Files
claw/docs/superpowers/plans/2026-04-19-g3-real-sample-output-contract-verification-plan.md

174 lines
5.8 KiB
Markdown

# G3 Real Sample Output Contract Verification Plan
> Date: 2026-04-19
> Status: Draft
> Upstream Spec: [2026-04-19-g3-real-sample-output-contract-verification-design.md](D:/data/ideaSpace/rust/sgClaw/claw-new/docs/superpowers/specs/2026-04-19-g3-real-sample-output-contract-verification-design.md)
> Trigger Report: [2026-04-19-g3-real-sample-runtime-contract-correction-closure-report.md](D:/data/ideaSpace/rust/sgClaw/claw-new/docs/superpowers/reports/2026-04-19-g3-real-sample-runtime-contract-correction-closure-report.md)
## Plan Intent
This plan implements the next bounded mainline scope after `G3` runtime-scope correction:
`G3 real-sample output / contract verification`
Its purpose is to reduce the remaining real-sample mismatch from a generic verification gap to either:
1. a verified pass
2. or a smaller named output/contract mismatch
## Scope Guardrails
1. do not reopen the completed `G3` archetype-correction scope
2. do not reopen the completed `G3` runtime-scope correction scope
3. do not broaden this work into `G8` runtime implementation
4. do not reopen `G3` family expansion or add unrelated fixtures
5. do not open `G4 / G5`
6. do not update validation assets until output verification produces a narrower outcome
## Workstreams
1. `WS1` Real-Sample Output Contract Differential
2. `WS2` G3 Output Contract Narrowing
3. `WS3` Regression and Verification Integrity
4. `WS4` Real-Sample Verification Rerun and Closure
## Phase 0: Freeze the Verification Boundary
### Objective
Lock the scope to one remaining mismatch: `output_contract_not_verified`.
### Tasks
1. freeze `95598工单明细表` as the only verification anchor
2. freeze current remaining mismatch:
- `output_contract_not_verified`
3. freeze current `G3` routing and runtime-scope behavior as completed constraints that must not regress
### Deliverables
1. verification-boundary note
2. fixed output-gap statement
### Acceptance Criteria
1. no additional family or runtime scope is added under this plan
2. the correction target is explicitly `G3 output / contract verification`
## Phase 1: Build the Real-Sample Output Contract Differential
### Objective
Understand exactly what part of the generated real-sample contract is still unverified.
### Tasks
1. compare the real generated `SceneIr` against the intended `G3` business output contract
2. isolate which fields are structurally present but semantically too broad
3. isolate whether the dominant gap is:
- main request selection
- enrichment request partitioning
- join key correctness
- merge/dedupe correctness
- export contract correctness
4. write a minimum verification-gap summary before code changes begin
### Deliverables
1. output-contract differential note
2. minimum verification-gap summary
### Acceptance Criteria
1. the smallest remaining output mismatch is explicit
2. the next change target is narrower than the current generic verification label
## Phase 2: Narrow the G3 Output Contract Gap
### Objective
Reduce the real-sample mismatch from generic non-verified output to a specific verified contract state.
### Tasks
1. adjust the minimum `G3` output-contract logic only where the real sample proves it is too coarse
2. keep routing and runtime-scope logic unchanged unless required by output verification
3. preserve fail-closed behavior for scenes whose output contract is still unresolved
### Deliverables
1. bounded output-contract update
2. explicit verification rule in code or tests where needed
### Acceptance Criteria
1. the real-sample mismatch is narrower than `output_contract_not_verified`
2. no unrelated family is reclassified or broadened
3. the corrected result stays inside `G3`
## Phase 3: Lock Regression and Verification Integrity
### Objective
Prove the narrower contract logic does not create false positives.
### Tasks
1. add or update regression that names the corrected real-sample verification pattern
2. retain mixed-boundary, `G8`, and canonical regressions
3. verify unresolved `G3` cases still fail closed when the output contract is genuinely incomplete
### Deliverables
1. regression tests for `G3` output verification
2. updated assertions where needed
### Acceptance Criteria
1. no regression causes `G8` to disappear as a boundary archetype
2. no regression causes unrelated `single_request_table` or other families to drift
3. test coverage explicitly names the corrected output-verification pattern
## Phase 4: Rerun the Real Sample and Close the Loop
### Objective
Use the actual real sample to confirm the narrowed output-verification outcome and record the next state.
### Tasks
1. rerun `sg_scene_generate` on `95598工单明细表`
2. record whether:
- the sample becomes `executed-pass`
- or the remaining mismatch is narrower than `output_contract_not_verified`
3. update the real-sample validation record layer
4. write a formal closure report
### Deliverables
1. rerun output
2. updated real-sample validation assets
3. `G3` output-contract-verification closure report
### Acceptance Criteria
1. the rerun no longer leaves the generic `output_contract_not_verified` label unchanged
2. the validation layer records a narrower family outcome
3. the next scope recommendation can move from `G3` to the next mainline gap when appropriate
## Completion Criteria
This plan is complete when:
1. the `G3` real sample no longer ends at the generic `output_contract_not_verified` label
2. the narrowed result is covered by automated regression
3. real-sample validation assets are updated with the new outcome
4. `G8` and prior `G3` routing/runtime corrections remain intact
## Next Step
After this plan completes:
1. if `G3` becomes `executed-pass`, return to the next mainline mismatch in priority order, which is `G2` real-sample contract correction
2. if `G3` still has a smaller output-specific mismatch, move only to that narrower `G3` verification slice