Skip to content

world-view-contract-guard-meta-test-retirement#788

Open
AndreasAbdi wants to merge 6 commits into
mainfrom
ralph/world-view-contract-guard-meta-test-retirement
Open

world-view-contract-guard-meta-test-retirement#788
AndreasAbdi wants to merge 6 commits into
mainfrom
ralph/world-view-contract-guard-meta-test-retirement

Conversation

@AndreasAbdi

Copy link
Copy Markdown
Contributor

{
"project": "infinite-you",
"branchName": "ralph/world-view-contract-guard-meta-test-retirement",
"description": "Retire redundant reflection inventory coverage from the world-view contract guard while preserving observable WorkDispatch JSON behavior and BuildFactoryWorldView projection behavior from canonical events.",
"context": {
"customerAsk": "Remove pkg/interfaces/world_view_contract_guard_test.go or reduce it to only behavior that is not already covered elsewhere. Delete reflection inventory tests for approved field lists and absent fields, confirm pkg/interfaces/work_runtime_test.go still covers WorkDispatch public JSON behavior, confirm pkg/factory/projections/projectiontests/world_view_support_test.go covers world-view shape through BuildFactoryWorldView output from canonical events, and add only small behavioral assertions if a real customer-visible gap remains. Do not touch current dirty factory-graph save/layout files, preserve public runtime/API behavior, keep the change narrow, and prefer observable JSON/projection behavior over source layout or struct field inventory assertions.",
"problem": "The backend still has a meta-test surface that freezes WorkDispatch, FactoryWorldTopologyView, and FactoryWorldRuntimeView structure through reflection and approved field inventories. This duplicates behavior-focused runtime and projection tests, increasing maintenance cost without improving confidence in observable API, CLI, UI, or emitted-event behavior.",
"solution": "Use existing runtime and projection tests as the contract authority. Remove or reduce the redundant reflection guard, add only narrowly scoped behavioral JSON/projection assertions if a genuine gap is found, and verify with go test ./pkg/interfaces plus go test ./pkg/factory/projections/...."
},
"acceptanceCriteria": [
"WorkDispatch public JSON behavior remains covered by behavior-focused tests, including dispatch-owned values, omission of worker-owned fields, and clone behavior.",
"BuildFactoryWorldView projection behavior remains covered from canonical events, including the topology/runtime output shape consumed by downstream surfaces.",
"Redundant reflection field-inventory assertions for WorkDispatch, FactoryWorldTopologyView, and FactoryWorldRuntimeView are removed or reduced to only non-duplicated behavioral coverage.",
"No public runtime, API, CLI, UI, OpenAPI, or emitted-event behavior changes unless an existing redundant legacy shim is proven safe by behavioral tests.",
"The change does not touch dirty factory-graph save/layout work or unrelated frontend files.",
"Any added coverage asserts observable JSON/projection outcomes, not source layout, route inventories, struct field inventories, docs topology, or asset-bundle internals.",
"Quality gate: Go typecheck, lint for touched files, go test ./pkg/interfaces, and go test ./pkg/factory/projections/... pass."
],
"userStories": [
{
"id": "world-view-contract-guard-meta-test-retirement-001",
"title": "Confirm WorkDispatch JSON behavior before guard retirement",
"description": "As a backend maintainer, I want WorkDispatch behavior protected by runtime JSON tests so removing reflection inventories does not weaken the public dispatch contract.",
"acceptanceCriteria": [
"Existing or minimally adjusted pkg/interfaces/work_runtime_test.go coverage verifies that marshalled WorkDispatch output includes the dispatch-owned values expected by runtime consumers.",
"Existing or minimally adjusted pkg/interfaces/work_runtime_test.go coverage verifies that worker-owned fields remain omitted from public WorkDispatch JSON output.",
"Existing or minimally adjusted pkg/interfaces/work_runtime_test.go coverage verifies WorkDispatch clone behavior for mutable content that would otherwise leak state.",
"No new WorkDispatch coverage is implemented as an approved struct-field list or absent-field reflection inventory.",
"Typecheck passes",
"Tests pass"
],
"priority": 1,
"passes": true,
"notes": ""
},
{
"id": "world-view-contract-guard-meta-test-retirement-002",
"title": "Confirm world-view projection output before guard retirement",
"description": "As a backend maintainer, I want world-view contract confidence to come from BuildFactoryWorldView projection output so downstream surfaces are protected by event-to-view behavior.",
"acceptanceCriteria": [
"Existing or minimally adjusted projection tests build a factory world view from canonical events and verify the resulting topology data needed by downstream consumers.",
"Existing or minimally adjusted projection tests build a factory world view from canonical events and verify the resulting runtime data needed by downstream consumers.",
"If a missing customer-visible world-view case is found, the added assertion checks BuildFactoryWorldView output for a concrete event scenario rather than reflecting over Go struct fields.",
"No projection coverage is added as a source-layout, route-registration, or struct-field inventory assertion.",
"Typecheck passes",
"Tests pass"
],
"priority": 2,
"passes": true,
"notes": ""
},
{
"id": "world-view-contract-guard-meta-test-retirement-003",
"title": "Retire redundant reflection guard coverage",
"description": "As a backend maintainer, I want the redundant world-view reflection guard removed so the test suite enforces observable contracts instead of freezing implementation shape.",
"acceptanceCriteria": [
"Redundant reflection inventory checks for approved field lists on WorkDispatch, FactoryWorldTopologyView, and FactoryWorldRuntimeView are removed from pkg/interfaces/world_view_contract_guard_test.go.",
"Redundant absent-field reflection checks are removed when the same public behavior is covered by runtime JSON or projection-output tests.",
"If the guard file has no remaining unique behavioral assertion after cleanup, it is deleted rather than kept as an empty shell.",
"Public runtime/API behavior remains unchanged; implementation does not introduce broad interface refactors or OpenAPI changes for this cleanup.",
"Typecheck passes",
"Tests pass"
],
"priority": 3,
"passes": true,
"notes": ""
},
{
"id": "world-view-contract-guard-meta-test-retirement-004",
"title": "Verify focused backend test evidence",
"description": "As a reviewer, I want focused package test results proving the guard retirement preserved runtime and projection behavior.",
"acceptanceCriteria": [
"go test ./pkg/interfaces passes after the guard retirement.",
"go test ./pkg/factory/projections/... passes after the guard retirement.",
"Any test changed or added in this cleanup has at least one assertion about observable JSON or projection output.",
"No dirty factory-graph save/layout files are modified by the implementation.",
"Typecheck passes",
"Tests pass"
],
"priority": 4,
"passes": true,
"notes": ""
}
]
}

Made with Cursor

AndreasAbdi and others added 4 commits June 10, 2026 17:07
…rkDispatch JSON behavior before guard retirement

Co-authored-by: Cursor <cursoragent@cursor.com>
…rld-view projection output before guard retirement

Co-authored-by: Cursor <cursoragent@cursor.com>
…undant reflection guard coverage

Co-authored-by: Cursor <cursoragent@cursor.com>
…used backend test evidence

Co-authored-by: Cursor <cursoragent@cursor.com>
@AndreasAbdi

Copy link
Copy Markdown
Contributor Author

Mergeability follow-up (story 004)

CI Build, Lint, and API failed on make backend-size with three violations. Addressed with test-only splits (no runtime/API behavior changes):

  1. Function limit (100 lines): Split TestBuildFactoryWorldView_MarshaledDashboardSurfacesExposeCanonicalTopologyAndRuntime into four top-level tests in world_view_support_test.go.
  2. File limit (1000 lines): Moved FirstRuntime*Lookup tests and stubs from interfaces_contract_test.go to new runtime_lookup_test.go.
  3. File limit (1000 lines): Moved TestCloneFactoryWorldProviderSessionRecord_ClonesCanonicalSafeContracts from work_runtime_test.go to new work_runtime_clone_test.go.

Local verification: go test ./pkg/interfaces, go test ./pkg/factory/projections/..., and make backend-size all pass.

…used backend test evidence

Co-authored-by: Cursor <cursoragent@cursor.com>
@AndreasAbdi

Copy link
Copy Markdown
Contributor Author

Additional mergeability follow-up

make pkg-maint failed on cyclomatic complexity for TestWorkDispatch_StoresDispatchOwnedFields (20 > 15 limit) after story 001 JSON assertions were added inline.

Extracted assertWorkDispatchJSONScalarFields, assertWorkDispatchJSONExecutionSection, and assertWorkDispatchJSONInputTokens helpers so the test stays behavioral while satisfying the complexity gate. Local make pkg-maint, make backend-size, and targeted test pass.

…used backend test evidence

Co-authored-by: Cursor <cursoragent@cursor.com>
@AndreasAbdi

Copy link
Copy Markdown
Contributor Author

Additional mergeability follow-up

make pkg-file-count failed because pkg/interfaces reached 16 files (limit 15) after splitting tests into runtime_lookup_test.go and work_runtime_clone_test.go.

Consolidated both into runtime_contract_test.go so the package stays at 15 files. Local make backend-size, make pkg-maint, make pkg-file-count, and targeted tests pass.

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.

1 participant