Context
PR #12638 delivered #9906 by adding durable TEST FILE -> VALIDATES -> CLASS edges in the Native Edge Graph. The cross-family review approved the PR and treated the precision concern as non-blocking because #9906 needed the relation contract first, but the concern becomes load-bearing before any reward / gap-downgrade consumer treats VALIDATES as stronger than token-heuristic evidence.
Live latest-open sweep: checked the latest 20 open issues on 2026-06-06 before filing; no equivalent found. Exact live duplicate search for VALIDATES edge token match precision returned no issues. Local issue/discussion sweep found related historical anchors (#9906, #9889, #10035, #9904) but no ticket for this post-#12638 precision bound. Knowledge Base semantic ticket sweep was attempted and unavailable (collection not found), so the filing relies on live GitHub + local synced substrate evidence.
The Problem
Current GapInferenceEngine.inferTestGapsFromSession() uses the same broad node-token regex predicate for two different claims:
- no token match -> emit
[TEST_GAP]
- any token match -> suppress
[TEST_GAP] and create a VALIDATES edge
That predicate is false-negative-tolerant for gap detection, but the inverse is false-positive-sensitive for graph evidence. Example risk from the review: a structural node named ButtonFeature tokenizes to button + feature; a path such as test/.../ButtonStore.spec.mjs can match button and receive a VALIDATES edge even though it does not validate ButtonFeature.
This matters because VALIDATES is now a structural relation. Once downstream RLAIF / reward / gap-downgrade consumers read it, a broad token match can become overconfident evidence.
The Architectural Reality
Current origin/dev after #12638:
ai/services/graph/GapInferenceEngine.mjs tokenizes structural node names and matches any token against test/ file paths before calling linkTestEvidenceToStructuralNode().
linkTestEvidenceToStructuralNode() writes VALIDATES edges with metadata: evidenceKind, evidencePath, inferredBy, validatedNodeName, and validatedNodeType.
test/playwright/unit/ai/daemons/orchestrator/services/DreamService.spec.mjs covers the positive exact-match case (ButtonFeature -> ButtonFeature.spec.mjs) but not the sibling-token false-positive class.
learn/agentos/DreamPipeline.md and learn/benefits/ArchitectureOverview.md document the current behavior as token match -> VALIDATES edge.
The Fix
Tighten the VALIDATES creation predicate or explicitly classify its confidence so downstream consumers cannot mistake broad token evidence for direct validation.
Preferred implementation shape:
- Extract the test-file matching predicate into a small helper on
GapInferenceEngine so the same logic is named, documented, and unit-tested.
- Require stronger evidence for
VALIDATES than a single shared token when the structural node has multiple significant tokens. For example: exact normalized basename match, all significant tokens present in the basename/path segment, or an equivalent source-grounded predicate.
- Preserve
[TEST_GAP] behavior for genuinely uncovered nodes.
- Add a negative fixture where two structural nodes share one token and only one test file exists; verify only the actually-covered node receives
VALIDATES.
- Update Dream Pipeline / Architecture Overview wording so consumers understand the evidence contract.
Contract Ledger Matrix
| Target Surface |
Source of Authority |
Proposed Behavior |
Fallback |
Docs |
Evidence |
GapInferenceEngine test-file match predicate |
#9906 delivered relation contract + PR #12638 review follow-up |
VALIDATES creation requires stronger evidence than one shared token for multi-token structural names |
If only broad token evidence exists, keep or emit [TEST_GAP] rather than creating overconfident VALIDATES |
JSDoc on helper |
Unit fixture with sibling-token false-positive candidate |
VALIDATES edge metadata |
Current linkTestEvidenceToStructuralNode() metadata |
Metadata remains durable and may add confidence/match-kind only if needed by the chosen predicate |
Existing metadata remains sufficient if predicate is made precise |
DreamPipeline.md, ArchitectureOverview.md |
Unit assertions on edge metadata |
| Downstream graph consumers |
RLAIF / Dream Pipeline graph evidence flow |
Consumers may treat VALIDATES as durable evidence only after the precision bound lands |
Before this ticket lands, treat VALIDATES as token-heuristic evidence |
Docs wording |
Post-merge docs + tests |
Decision Record impact
Aligned with the Native Edge Graph / Dream Pipeline architecture. No ADR amendment required.
Acceptance Criteria
Out of Scope
- Replacing all test-discovery heuristics with a full parser or coverage engine.
- Changing
GraphService.linkNodes semantics.
- Adding reward / gap-downgrade consumers for
VALIDATES.
- Reopening #9906; #9906 delivered the first relation contract and remains complete.
Avoided Traps
- Treating all token matches as equal evidence. Good enough for a gap heuristic is not automatically good enough for a structural validation edge.
- Deleting the heuristic entirely. The Dream Pipeline still needs lightweight test discovery; the goal is a precision bound, not a full coverage rewrite.
- A tiny docs-only clarification. The graph predicate and unit fixture must move together; docs alone would leave the overconfident edge path intact.
Related
- #12638 — delivered #9906 and surfaced this follow-up in review.
- #9906 — original
TEST -> VALIDATES -> CLASS relation contract.
- #9904 — parent RLAIF / Dream topology context.
- #10035 — prior GapInferenceEngine move away from fragile regex concept matching.
Origin Session ID
dbb1a88c-987f-4519-9645-8f13e9d71000
Handoff Retrieval Hints
query_raw_memories(query="VALIDATES edge token match precision GapInferenceEngine false positive")
query_summaries(query="PR 12638 VALIDATES precision follow-up")
- Source anchors:
GapInferenceEngine.inferTestGapsFromSession, linkTestEvidenceToStructuralNode, DreamService.spec.mjs inferTestGapsFromSession links matching test files via VALIDATES edges (#9906).
Context
PR #12638 delivered #9906 by adding durable
TEST FILE -> VALIDATES -> CLASSedges in the Native Edge Graph. The cross-family review approved the PR and treated the precision concern as non-blocking because #9906 needed the relation contract first, but the concern becomes load-bearing before any reward / gap-downgrade consumer treatsVALIDATESas stronger than token-heuristic evidence.Live latest-open sweep: checked the latest 20 open issues on 2026-06-06 before filing; no equivalent found. Exact live duplicate search for
VALIDATES edge token match precisionreturned no issues. Local issue/discussion sweep found related historical anchors (#9906, #9889, #10035, #9904) but no ticket for this post-#12638 precision bound. Knowledge Base semantic ticket sweep was attempted and unavailable (collection not found), so the filing relies on live GitHub + local synced substrate evidence.The Problem
Current
GapInferenceEngine.inferTestGapsFromSession()uses the same broad node-token regex predicate for two different claims:[TEST_GAP][TEST_GAP]and create aVALIDATESedgeThat predicate is false-negative-tolerant for gap detection, but the inverse is false-positive-sensitive for graph evidence. Example risk from the review: a structural node named
ButtonFeaturetokenizes tobutton+feature; a path such astest/.../ButtonStore.spec.mjscan matchbuttonand receive aVALIDATESedge even though it does not validateButtonFeature.This matters because
VALIDATESis now a structural relation. Once downstream RLAIF / reward / gap-downgrade consumers read it, a broad token match can become overconfident evidence.The Architectural Reality
Current
origin/devafter #12638:ai/services/graph/GapInferenceEngine.mjstokenizes structural node names and matches any token againsttest/file paths before callinglinkTestEvidenceToStructuralNode().linkTestEvidenceToStructuralNode()writesVALIDATESedges with metadata:evidenceKind,evidencePath,inferredBy,validatedNodeName, andvalidatedNodeType.test/playwright/unit/ai/daemons/orchestrator/services/DreamService.spec.mjscovers the positive exact-match case (ButtonFeature->ButtonFeature.spec.mjs) but not the sibling-token false-positive class.learn/agentos/DreamPipeline.mdandlearn/benefits/ArchitectureOverview.mddocument the current behavior as token match ->VALIDATESedge.The Fix
Tighten the
VALIDATEScreation predicate or explicitly classify its confidence so downstream consumers cannot mistake broad token evidence for direct validation.Preferred implementation shape:
GapInferenceEngineso the same logic is named, documented, and unit-tested.VALIDATESthan a single shared token when the structural node has multiple significant tokens. For example: exact normalized basename match, all significant tokens present in the basename/path segment, or an equivalent source-grounded predicate.[TEST_GAP]behavior for genuinely uncovered nodes.VALIDATES.Contract Ledger Matrix
GapInferenceEnginetest-file match predicateVALIDATEScreation requires stronger evidence than one shared token for multi-token structural names[TEST_GAP]rather than creating overconfidentVALIDATESVALIDATESedge metadatalinkTestEvidenceToStructuralNode()metadataDreamPipeline.md,ArchitectureOverview.mdVALIDATESas durable evidence only after the precision bound landsVALIDATESas token-heuristic evidenceDecision Record impact
Aligned with the Native Edge Graph / Dream Pipeline architecture. No ADR amendment required.
Acceptance Criteria
GapInferenceEnginehas a named, documented predicate for test-file evidence matching.ButtonFeaturedoes not receiveVALIDATESfrom aButtonStore-style test path.VALIDATESfixture from #12638 still passes.[TEST_GAP]still emits for uncovered structural nodes.learn/agentos/DreamPipeline.mdandlearn/benefits/ArchitectureOverview.mddescribe the tightened evidence contract or confidence semantics.Out of Scope
GraphService.linkNodessemantics.VALIDATES.Avoided Traps
Related
TEST -> VALIDATES -> CLASSrelation contract.Origin Session ID
dbb1a88c-987f-4519-9645-8f13e9d71000Handoff Retrieval Hints
query_raw_memories(query="VALIDATES edge token match precision GapInferenceEngine false positive")query_summaries(query="PR 12638 VALIDATES precision follow-up")GapInferenceEngine.inferTestGapsFromSession,linkTestEvidenceToStructuralNode,DreamService.spec.mjsinferTestGapsFromSession links matching test files via VALIDATES edges (#9906).