Repository navigation
operad: reject repeated colour-section keys; scope the frozen 98f2ccc test oracle (Refs #76) - #84
Conversation
…test oracle (t342, Copilot #80 (4)/(5)) Copilot's review of #80, findings (4) and (5). Sam's split, relayed on #76: fix these two now; (1), (2), (3) and (6) stay follow-ups. - (4) json.Unmarshal keeps the last of two equal map keys and merges or drops a repeated struct key, so a repeated port_color_map port or matrix row or column loaded silently. LoadRegistry now runs checkColorSectionKeys right after the decode: a token-level pass (encoding/json Decoder.Token) over port_color_compatibility only: the section key itself; its port_colors, matrix and port_color_map keys (case-insensitive, as json.Unmarshal matches struct fields); every port_color_map port; every matrix row and every column of each row (exact, after unescaping). A repeat is a load error naming the section and the key. Nothing else is read, so doc-only keys keep loading, among them declared_pairs_by_wf, whose array lists the WF06 and WF08 pairs twice in 4.0.7. A colour listed twice inside port_colors stays declaredPortColors' "listed twice" error. - (5) The env-gated MOOS_INTEGRATION / MOOS_T342_* checks compare with the frozen 98f2ccc ValidateLINK only for a legacy-merge ontology or a pinned version (4.0.7, 4.0.8, mtdc-2.0.0, mtdc-2.1.0; the set never grows). Any other self-coloured ontology gets a production-only check: every declared pair admitted by ValidateLINK, colour source the ontology, served colours exactly its own port_color_map. The identity-matrix assertion applies to a pinned version or a shipped matrix; an unpinned shadow replay is counted, not compared; MOOS_T342_LOG_EXPECT still applies. Tests: loader_dupkeys_t342_test.go (11 rejected repeats, among them an escaped spelling, a case variant, a later "matrix": null and a repeated section; repeats outside the checked keys still load; shipped shapes pass) and integration_oracle_t342_test.go (a self-coloured ontology adding WF12 cites/cited-by passes with and without a matrix, while the frozen gate rejects every pair once the matrix is gone; the production-only check still reports a rejected pair and a recoloured port; pinned and legacy-merge ontologies keep the oracle). Each fails under the matching mutation. Neutral: all 64 known ontology inputs (57 ffs0 ontology.json blobs, 4.0.7, 4.0.8, mtdc-1.0.0 to 2.2.0) load; 36865fb and this change give byte-identical registries and ValidateLINK verdicts over every WF x contract x 137^2 port names (40.8M probes per build); none repeats a JSON key anywhere. Shadow replays unchanged (695/622/73 on 4.0.7; 430/412/18 on 4.0.8; 430/424/6 on mtdc-2.0.0 and 2.1.0); lab kernels serve identical routes. No rollout implied; the operad rollout stays Sam's ruling. Refs #76 (findings (1), (2), (3) and (6) are follow-ups; #76 stays open). authored-by: urn:moos:agent:claude-code.hp-laptop / urn:moos:session:sam.claude-code-hp-laptop / t342-colour-gate-copilot Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The implementation matches the stated scope and includes focused coverage for the new validation paths.
0 open findings
What changed in this PR
Rejects duplicate JSON keys in loaded colour sections and limits the frozen validation oracle to applicable ontology versions.
Changes:
- Adds token-level duplicate-key validation for colour configuration.
- Adds duplicate-key and oracle-scope tests.
- Uses production-only validation for newer self-coloured ontologies.
| File | Description |
|---|---|
internal/operad/loader.go |
Rejects duplicate colour-section keys. |
internal/operad/loader_dupkeys_t342_test.go |
Tests duplicate-key handling. |
internal/operad/t342_integration_test.go |
Selects frozen or production-only validation. |
internal/operad/integration_oracle_t342_test.go |
Tests oracle scoping and failure detection. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
t342 · Z440 seat · review of #84 ( Three lenses (spec, neutrality on real data, code with mutation tests), every finding re-checked by a skeptic. Both trees were exported by explicit SHA to C:, deleted afterwards. VerifiedCopilot (4) and (5) on #80 are resolved as worded. Only Neutral on real data
Key matching mirrors
It also holds under Oracle scoping
Mutations killed (12):
Low: test additions (each lets a mutant survive today)
Notes (not defects)
Merge-ready from the Z440 side, with or without the three tests. #76 stays open. — Z440 seat ( |
…e oracle (review of #84) From the Z440 seat's review of #84: three plausible wrong versions of the code still passed the suite. Each new test fails on exactly one of them (checked on a scratch copy, then discarded): - OracleBranchHasTeeth: under the frozen 98f2ccc oracle, 4.0.7 without its matrix must report 34 of its 35 declared pairs (the frozen gate rejects every pair with coloured ends; production admits them). Killed mutant: an oracle branch that never reports. - A repeated section key in a Unicode case fold ("port_colorſ" after "port_colors"): json.Unmarshal reads both as port_colors, so the check must reject it. Killed mutant: an ASCII-only case fold. - PortNamesAreExact: "hosts" and "Hosts" are two ports and must load. Killed mutant: comparing ports case-insensitively. gofmt clean; go vet and go test ./... pass. Refs #76 authored-by: urn:moos:agent:claude-code.hp-laptop / urn:moos:session:sam.claude-code-hp-laptop / t342-colour-gate-copilot Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review (6084840483). Your three optional tests are in, as
Mutation check (on a scratch copy of the full tree, then discarded; the baseline passes):
Then gofmt (on LF bytes), Body: "Nothing else is read" now reads "no other key is compared". The pass tokenizes the whole document once. harness-session 5daba391 |
|
t342 · Z440 seat · re-checked
Run on an export by explicit SHA, on C:: |
Copilot's review of #80, findings (4) and (5). Sam's split, relayed on #76: these two are fixed now, and (1), (2), (3) and (6) stay follow-ups (listed below). Refs #76 (it stays open).
#80 merged before these fixes (merge
23ba9ce), so this is a new PR from mastere04839f, which also carries #81, #82 and #83. The change applies cleanly on top of them.What changes
json.Unmarshalkeeps the last of two equal map keys, and merges or drops a repeated struct key. So a repeatedport_color_mapport, or a repeated matrix row or column, loaded silently.LoadRegistrynow runscheckColorSectionKeysright after the decode. It is a token-level pass (encoding/jsonDecoder.Token) overport_color_compatibilityonly. It checks:port_colors,matrixandport_color_mapkeys, case-insensitively, the wayjson.Unmarshalmatches struct fields;operad: port_color_compatibility.matrix["storage"]: duplicate column "storage".declared_pairs_by_wf, whose array lists the WF06 and WF08 pairs twice in 4.0.7.MOOS_INTEGRATION/MOOS_T342_*checks compare with the frozenValidateLINKonly for a legacy-merge ontology or a pinned version: 4.0.7, 4.0.8, mtdc-2.0.0 and mtdc-2.1.0, a set that never grows.color_source=ontology;matrix(step 3 of operad: colour-gate consolidation: close the colour set at load, strict colour equality,bound-toas topology, ontology as the single source of port colours #76's safe order) is no longer failed by a frozen gate.Tests
loader_dupkeys_t342_test.go:"matrix": nulland a repeated section;integration_oracle_t342_test.go:cites/cited-bypasses with and without a matrix, while the frozen gate rejects every pair once the matrix is gone;Mutation checks: each test fails under the matching mutation:
Review round (Z440 seat, comment 6084840483), commit
fb99086: three more tests, each catching one plausible wrong version:"port_colorſ"(ſ) repeatsport_colorsforjson.Unmarshal;hostsandHostsmust both load.Each fails on its mutant, on a scratch copy.
Gates on
e04839f+ this change (hp-laptop, verbatim summary)gofmt -lon the 4 changed files: no output.go build ./...andgo vet ./...: exit 0.go test -count=1 ./...: 9 packages ok.MOOS_INTEGRATION=1, all 9 packages ok on each of:-skip TestIntegration_EveryNodeTypeStratumParses;TestIntegration_EveryNodeTypeStratumParsesfails on 4.0.7, 4.0.8, mtdc-2.0.0 and mtdc-2.1.0 with5 node type(s) have no S0-S4 stratum: [event_notice= governance_proposal=S0-S2 message_packet= tool_call= tool_result=]. It passes on mtdc-2.2.0.ontology-integrationCI job is green only because it skips the real ontology (FFS0_READ_TOKENis not configured).Neutrality (two independent runs before this PR, and once more against master)
ontology.jsonblobs across all refs, 4.0.7, 4.0.8, and mtdc-1.0.0 to 2.2.0. All of them load.ValidateLINKverdicts over every WF × contract on/off × 137² port names, 40.8 M probes per build.23ba9ceand is Sam's ruling. This change enters the fleet only in a later restart.Follow-ups — Copilot review of #80 (not in this change; Sam's split, relayed on #76, which stays open)
#76 safe order: step 1 = ontology bump carrying full κ (self-coloured),
matrixkept · step 2 = kernel (#80 + this) · step 3 = second bump removingmatrix.port_colors= exactly the eight (Copilot 4228908910). Today an absent key means the eight; 13 historical ffs0 revisions (v2.0768e8c3, v3.037d07ce, 11 older.agent/copies) have no key and would stop loading; the other 51 known inputs already list exactly the eight. Trigger: step 1 — a missing key, a missing colour or an extra name becomes a load error.legacyPortColors(98f2ccc, sha256-pinned) still colours 60 of 4.0.7's 66 declared ports; without it 31 of 35 declared pairs would be rejected. Trigger: every fleet kernel loads a self-coloured ontology (step 1 rolled out) — delete the table, its pin and the legacy-merge branch; an absentport_color_mapthen means no colours.reportColorGatewarning. Neutral on every known input (51 ship a complete 8×8; no declared pair disagrees). Trigger: step 1 — interim load errors whilematrixstill ships; after step 3 a presentmatrixis itself the load error.matrixfromGET /operad/port-colors(Copilot 4228909129). Display-only since ruling 1; the pilot never reads it, and the workbench's live import treats it as optional. Trigger: step 3 (the bump that removesmatrix) — remove the key and update the route test and README.authored-by: urn:moos:agent:claude-code.hp-laptop / urn:moos:session:sam.claude-code-hp-laptop / t342-colour-gate-copilot
🤖 Generated with Claude Code