Skip to content

ssljson precision: duplicate scene/step IDs are silently deduped by map[string]bool — the spec's "unique IDs" Pass-4 rule is uni [Content truncated due to length] #39494

Closed as not planned

Description

@github-actions

Summary

ssljson's ValidateDoc (pkg/linters/ssljson/ssljson.go:93-149) builds its scene and step lookup tables as map[string]bool:

sceneIDs := make(map[string]bool, len(doc.Scenes))
for _, s := range doc.Scenes {
    sceneIDs[s.ID] = true        // ssljson.go:96-99
}
stepIDs := make(map[string]bool, len(doc.LogicSteps))
for _, ls := range doc.LogicSteps {
    stepIDs[ls.ID] = true        // ssljson.go:100-103
}

Because a map collapses repeated keys, two scenes (or two logic steps) that share an id produce no diagnostic — the second silently overwrites the first. Every downstream reference check (entry_scene, entry_logic_step, transition target, step next) then resolves against an ambiguous, deduped table, so a malformed document with colliding IDs is reported as valid.

The intent is the linter's own embedded spec

The repo's own .github/skills/ssl/ssl.json:150 (step_verify_validate) enumerates the Pass-4 rules the analyzer is meant to enforce:

"Run all Pass-4 validation rules against $draft_ssl: JSON syntax, required fields, enum membership, unique IDs, entry pointers, transition targets, graph integrity"

"unique IDs" is an explicit, named rule. It is currently unimplemented: there is no uniqueness check anywhere in ValidateDoc. The analyzer's Doc (ssljson.go:24) advertises "enum and graph rules", and uniqueness is a precondition for the graph to be well-defined.

Why it matters

If an SSL-authoring agent emits two scene_recover scenes with diverging next_scene_rules, or two step_reason_pass1 steps with different next pointers, the graph is non-deterministic — but ssljson waves it through. The 4 current production files happen to have unique IDs (verified: no scene or step id repeats), so this is a latent correctness gap, exactly the class of issue worth closing before the linter is enforced in CI.

Recommendation

Detect collisions while building the maps. Minimal form:

for _, s := range doc.Scenes {
    if sceneIDs[s.ID] {
        msgs = append(msgs, fmt.Sprintf("duplicate scene id %q", s.ID))
    }
    sceneIDs[s.ID] = true
}

...and the symmetric loop for stepIDs. Reuse the existing msgs accumulator; no new data structures needed.

Validation checklist
  • Add ValidateDoc cases: two scenes with the same id are flagged; two steps with the same id are flagged.
  • Single-occurrence ids stay unflagged (TestValidateDoc_Valid green).
  • All 4 production ssl.json files still validate clean (ids are unique today).
  • go test ./pkg/linters/ssljson/... passes.

Effort: small — a guard inside each of the two existing ID-collection loops plus two testdata cases. Pairs naturally with the scene_id graph-integrity gap (#39493); both complete the spec's Pass-4 rule set in the same function.

Generated by 🤖 Sergo - Serena Go Expert · 284.3 AIC · ⌖ 13.8 AIC · ⊞ 5.3K · ◷

  • expires on Jun 22, 2026, 9:39 PM UTC-08:00

Activity

  1. added
    cookie
    on Jun 16, 2026
  2. Copilot commented on Jun 16, 2026

    Copilot
    Contributor

    The agent encountered an error and was unable to start working on this issue: Please try again later, or contact support if the problem persists. (Request id: 12C0:375BA6:19A2825:6111E16:6A310B50)

  3. github-actions commented on Jun 16, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster selected this for Copilot

    I've identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster · 26.7 AIC · ⌖ 9.52 AIC · ⊞ 24.3K · ◷

  4. github-actions commented on Jun 23, 2026

    @github-actions
    ContributorAuthor

    This issue was automatically closed because it expired on 2026-06-23T05:39:54.943Z.

    Closed by Workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

cookiesergo

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions