Render imported party rosters as canonical inputs
This commit is contained in:
@@ -35,11 +35,12 @@ func materializeCanonicalPartyInputs(
|
||||
if resolved.Canonical == nil {
|
||||
return nil, fmt.Errorf("canonical party data is required")
|
||||
}
|
||||
if len(resolved.Canonical.Raw) == 0 {
|
||||
return nil, fmt.Errorf("canonical party raw bytes are required")
|
||||
partyBytes, err := resolved.Canonical.YAML()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("render canonical party: %w", err)
|
||||
}
|
||||
partyPath := filepath.Join(inputsDir, party.Filename)
|
||||
partyChecksum, err := writeBytesIfChanged(store, partyPath, resolved.Canonical.Raw)
|
||||
partyChecksum, err := writeBytesIfChanged(store, partyPath, partyBytes)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("materialize canonical party: %w", err)
|
||||
}
|
||||
|
||||
@@ -132,15 +132,19 @@ func currentPreparePartySourceInputs(env *Env) ([]prepareExpectedInput, error) {
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("players prepared-input descriptor is unavailable")
|
||||
}
|
||||
if env.Config.Party.Canonical == nil || len(env.Config.Party.Canonical.Raw) == 0 {
|
||||
if env.Config.Party.Canonical == nil {
|
||||
return nil, fmt.Errorf("canonical party data is unavailable")
|
||||
}
|
||||
partyBytes, err := env.Config.Party.Canonical.YAML()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
playersBytes, err := env.Config.Party.Canonical.PlayersYAML()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return []prepareExpectedInput{
|
||||
{kind: party.ManifestKind, checksum: checksumPrepareBytes(env.Config.Party.Canonical.Raw)},
|
||||
{kind: party.ManifestKind, checksum: checksumPrepareBytes(partyBytes)},
|
||||
{kind: players.ManifestKind, checksum: checksumPrepareBytes(playersBytes)},
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -193,8 +193,12 @@ characters:
|
||||
paths := sessionPathsForEnv(env, m.SessionID)
|
||||
preparedParty := filepath.Join(paths.InputsDir, "party.yml")
|
||||
preparedPlayers := filepath.Join(paths.InputsDir, "players.yml")
|
||||
if got, err := os.ReadFile(preparedParty); err != nil || !bytes.Equal(got, partyBytes) {
|
||||
t.Fatalf("prepared party = %q, %v; want unchanged canonical bytes", got, err)
|
||||
wantParty, err := document.YAML()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got, err := os.ReadFile(preparedParty); err != nil || !bytes.Equal(got, wantParty) {
|
||||
t.Fatalf("prepared party = %q, %v; want rendered canonical bytes", got, err)
|
||||
}
|
||||
wantPlayers, err := document.PlayersYAML()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user