test: dispatch every command, pin catalog/parser/dispatch agreement (WI-P8)#98
Merged
Conversation
The 0.2.3 file-split refactor dropped three imports referenced only inside command paths: institutional dispatch (50169cf), constitutional disposition (41bcd43), and the unwrap failure path — the last of which had been shipping a NameError traceback since 0.2.4 and was found only while fixing something else. All three passed CI. The suite imported the modules and exercised the SDK, but never ran a subcommand end to end, and a name looked up only when a branch executes stays invisible until that branch executes. So walk the whole surface. Almost nothing is asserted about the answers — the claim is that every command survives its own dispatch path and emits a well-formed envelope rather than an interpreter traceback. Argv is derived from the parser, so a command added later is covered the day it is added. Three fake-source modes, because the failures hide at different depths. The third one, `unrecognized`, was added after the first two sailed past a removed `ParseFailureError` import: neither reached the error branch, so the smoke was green for exactly the reason the old suite was. It now fails across 14 command paths when that import is missing. Also pins catalog/parser/dispatch three-way agreement: nothing advertised that cannot be parsed, nothing parsable that is undocumented, nothing parsable that is never dispatched, no dispatch branch the parser cannot reach. Spot-checked by re-applying both regressions: removing 50169cf's import fails 2 cases, removing the unwrap import fails 14. ci.yml needs no change — it already runs `pytest -m "not live"`, which collects these. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The 0.2.3 file-split refactor dropped three imports that are only referenced inside command paths:
_statute_args)ParseFailureError)All three passed CI. The suite imported the modules and exercised the SDK, but nothing ran a subcommand end to end — and a name that is only looked up when a branch executes stays invisible until that branch executes.
What
Whole-surface dispatch smoke. Every subcommand runs through
main()against a fake source. Almost nothing is asserted about the answers; the claim is that each command survives its own dispatch path and emits a well-formed envelope rather than an interpreter traceback. Argv is derived from the parser, not hand-listed, so a command added later is covered the day it is added rather than the day someone remembers this file.Three source modes, because the failures hide at different depths:
empty→{}, what law.go.kr actually returns for a bad identifiershallow→{target: {}}, unwraps cleanly and reaches normalizationunrecognized→ a populated payload matching no known shape — the only mode that reaches theParseFailureErrorbranchThe third mode was added after the first two were found to sail past a removed
ParseFailureErrorimport. A smoke that never enters the error branch is green for the same reason the old suite was.Catalog / parser / dispatch agreement. Nothing advertised that cannot be parsed, nothing parsable that is undocumented, nothing parsable that is never dispatched, no dispatch branch the parser cannot reach.
Verification (acceptance spot-check)
Both regressions re-applied, then reverted:
from .data import _statute_args→ 2 failures (load-institutional-system, both modes)ParseFailureErrorfromunwrap.py→ 14 failures across command paths441 deterministic tests pass with the code restored.
ci.ymlneeds no change — it already runspytest -m "not live", which collects these.🤖 Generated with Claude Code