Skip to content

test(operad): regression coverage for the 4.0.4 member-of pair + port_color_map first use - #65

Merged
MSD21091969 merged 2 commits into
masterfrom
t264-operad-coverage
Jul 25, 2026
Merged

test(operad): regression coverage for the 4.0.4 member-of pair + port_color_map first use#65
MSD21091969 merged 2 commits into
masterfrom
t264-operad-coverage

Conversation

@MSD21091969

Copy link
Copy Markdown
Collaborator

Closes #64. No behavior change — regression coverage only, pinning the enforcement that ffs0#172 (ontology 4.0.4) now depends on.

Why

member-of/has-member are absent from DefaultPortColors, so their color comes only from the port_color_map override — the first load-bearing use of that path. If the override merge, the WF02 pair loading, or the fail-closed color gate regresses, the 4.0.4 member-of LINKs would be silently rejected (or worse, silently weakened). Nothing tested that until now.

What (all four #64 asks, one new test file)

  1. WF02 member-of pair — loader captures member-of/has-member (v4.0.4) alongside delegates-to (v3.13); ValidateLINK accepts both WF02 additional pairs and the primary governs, and rejects an undeclared variant with the declared set named.
  2. port_color_map first use — the override merges onto DefaultPortColors (defaults survive), an ontology color wins over a built-in default, and an unknown color name or JSON null is a load error (a typo or None-emitting script must not alias onto the exempt ""). Empty string stays a documented exemption.
  3. MOOS_INTEGRATION readback as a test — against the real sibling ontology, every port of every declared pair (primary + additional, all WFs) carries a color, and member-of is present + auth. The loader only warns on uncovered ports; this makes it a hard failure for the shipped ontology.
  4. Interim manual check recorded in the file header (diff /operad/rewrite-categories + /operad/port-colors vs ontology.json at Doctor time) until (3) runs in CI.

Verification

  • go test ./internal/operad/ — green (full hermetic suite)
  • MOOS_INTEGRATION=1 go test ./internal/operad/ -run DeclaredPairsAllColoredPASS against ffs0 4.0.4
  • go vet ./internal/operad/ clean · go build ./... ok

Reuses the shared writeOntology helper from loader_test.go (no duplicate).

🤖 Generated with Claude Code

…_color_map first use (#64)

No behavior change — pins the enforcement ffs0#172 (ontology 4.0.4) now depends
on so a regression fails loudly instead of silently weakening the fail-closed
color gate. One new test file, all four #64 asks:

1. WF02 member-of/has-member additional pair is captured by the loader, and
   ValidateLINK accepts member-of AND delegates-to (both 4.0.x WF02 pairs) while
   rejecting an undeclared variant with the declared set named.
2. port_color_map first-use coverage: the override merges onto DefaultPortColors
   (member-of/has-member are absent from the built-ins, so the override is what
   makes the pair loadable), an ontology color wins over a default, and an
   unknown color name or JSON null is a LOAD ERROR — a typo or a None-emitting
   script must not alias onto the exempt "" color. Empty string stays a
   documented exemption.
3. MOOS_INTEGRATION readback as a test: against the real sibling ontology, every
   port of every declared pair (primary + additional, all WFs) carries a color,
   and member-of is present + auth. The loader only WARNS on uncovered ports;
   this makes it a hard failure for the shipped ontology.
4. the interim manual Doctor-time check recorded in the file header until (3)
   runs in CI.

Verified: `go test ./internal/operad/` green; `MOOS_INTEGRATION=1 go test -run
DeclaredPairsAllColored` PASS against ffs0 4.0.4; go vet clean; go build ./...
ok. Reuses the shared writeOntology helper from loader_test.go.

Closes #64.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 23, 2026 21:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds regression tests to the internal/operad ontology loader/validator surface to pin behavior required by the ffs0 ontology 4.0.4 upgrade (notably WF02’s member-of/has-member additional port pair and reliance on port_color_compatibility.port_color_map).

Changes:

  • Adds a hermetic ontology fixture test ensuring WF02’s member-of additional pair is loaded into AdditionalPortPairs.
  • Adds ValidateLINK coverage ensuring WF02 accepts member-of/has-member, delegates-to/delegated-by, and the primary governs pair, while rejecting an undeclared variant with a helpful error.
  • Adds tests around port_color_map behavior (merge-over-defaults, override wins, unknown/null errors, empty-string exemption) plus a MOOS_INTEGRATION=1 check against the sibling real ontology.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +158 to +162
// TestLoadRegistry_PortColorMap_OverrideMergesOntoDefaults — the override adds
// member-of/has-member (absent from DefaultPortColors) WITHOUT dropping the
// built-in defaults. Merge, not replace.
func TestLoadRegistry_PortColorMap_OverrideMergesOntoDefaults(t *testing.T) {
reg, err := LoadRegistry(writeOntology(t, wf02Ontology))

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed — removed the duplicated port_color_map unit tests. loader_test.go already covers override-wins / new-port / "" exemption / unknown / null (with synthetic ports). Kept only what was actually missing: the WF02 member-of + delegates-to pair (load + validate) and the real-ontology declared-vs-loaded readback that pins member-of's color specifically. File renamed to member_of_pair_test.go.

…coverage (Copilot #65)

loader_test.go already covers the port_color_map merge/unknown/null/exemption
surface (with synthetic ports). Removed the redundant unit tests; kept what was
genuinely missing: the WF02 member-of/delegates-to pair (load + validate) and
the real-ontology declared-vs-loaded readback that pins member-of + every
declared pair's color. Renamed the file to match (member_of_pair_test.go).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@MSD21091969
MSD21091969 merged commit bc133cf into master Jul 25, 2026
2 checks passed
@MSD21091969
MSD21091969 deleted the t264-operad-coverage branch July 25, 2026 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

operad: additional_port_pairs enforcement — regression coverage + declared-vs-loaded readback (G5 close-out; member-of + delegates-to)

2 participants