Remove legacy party configuration

This commit is contained in:
2026-09-02 12:04:35 +00:00
parent 61095e69ce
commit 82d75e7beb
35 changed files with 110 additions and 364 deletions

View File

@@ -20,35 +20,6 @@ const (
PlayersSchemaVersion = "narratio.players.v1"
)
// PartyMode records whether a source document uses the canonical party
// contract or the bounded compatibility path for older opaque files.
type PartyMode string
const (
PartyModeCanonical PartyMode = "canonical"
PartyModeLegacy PartyMode = "legacy"
)
// PartyDocument classifies a party input. Canonical is populated only for a
// versioned canonical document; legacy contents intentionally remain opaque.
type PartyDocument struct {
Mode PartyMode
Canonical *CanonicalParty
}
// IsCanonical reports whether the document has validated canonical data.
func (d *PartyDocument) IsCanonical() bool {
return d != nil && d.Mode == PartyModeCanonical && d.Canonical != nil
}
// PlayersYAML renders the derived players projection for a canonical document.
func (d *PartyDocument) PlayersYAML() ([]byte, error) {
if !d.IsCanonical() {
return nil, fmt.Errorf("canonical party is required")
}
return d.Canonical.PlayersYAML()
}
// CanonicalParty is the normalized domain value for narratio.party.v1. Raw is
// retained independently so later preparation can copy the authored party file
// byte-for-byte rather than serializing normalized values.
@@ -84,7 +55,7 @@ type PartyClass struct {
}
// ParseParty strictly parses one supported party document.
func ParseParty(data []byte) (*PartyDocument, error) {
func ParseParty(data []byte) (*CanonicalParty, error) {
root, decoder, err := parsePartyFirstDocument(data)
if err != nil {
return nil, err
@@ -96,7 +67,7 @@ func ParseParty(data []byte) (*PartyDocument, error) {
if err != nil {
return nil, err
}
return &PartyDocument{Mode: PartyModeCanonical, Canonical: party}, nil
return party, nil
}
func parsePartyFirstDocument(data []byte) (*yaml.Node, *yaml.Decoder, error) {