Skip to content

Cut runParse over to resolve-then-convert - #579

Merged
Smaug123 merged 1 commit into
mainfrom
argparser-resolve-before-convert
Jul 25, 2026
Merged

Cut runParse over to resolve-then-convert#579
Smaug123 merged 1 commit into
mainfrom
argparser-resolve-before-convert

Conversation

@Smaug123

Copy link
Copy Markdown
Owner

Stage 5b of the positional-args-with-unions stack (6/8). Stacked on #578.

Rewires runParse around the Stage 5a resolver, making the phase separation literal in the control flow: scan → resolve (structural) → convert in argv order → validate → defaults.

  • Help requests and fatal scan errors abort first, in argv order, before any resolution.
  • resolve fixes the case selection and the active positional sink; only then does the conversion pass replay events in argv order, so error messages still cite arguments in the order the user typed them.
  • Positional conversion runs only when resolution fully succeeded and the event's candidate set contains the active sink — a failed resolution never invokes a positional converter (previously conversion was eager).
  • TypedCallbacks.StorePositional gains the sink id, so generated code dispatches to the right per-sink accumulator.

No generated-code changes yet (the generator still emits one sink); the oracle is that the entire existing test suite — including the pinned error-message-ordering tests — passes unchanged, plus new pipeline tests covering resolution failure short-circuiting conversion.

🤖 Generated with Claude Code

@Smaug123
Smaug123 force-pushed the argparser-resolver branch from e6f154f to 9bdb4ab Compare July 25, 2026 10:26
@Smaug123
Smaug123 force-pushed the argparser-resolve-before-convert branch from c5fe1dd to 4dc9677 Compare July 25, 2026 10:26
@Smaug123
Smaug123 force-pushed the argparser-resolver branch from 9bdb4ab to 7695eba Compare July 25, 2026 10:33
@Smaug123
Smaug123 force-pushed the argparser-resolve-before-convert branch from 4dc9677 to 26e61b4 Compare July 25, 2026 10:33
@Smaug123
Smaug123 force-pushed the argparser-resolver branch from 7695eba to 36f624b Compare July 25, 2026 10:52
@Smaug123
Smaug123 force-pushed the argparser-resolve-before-convert branch from 26e61b4 to 23f5c42 Compare July 25, 2026 10:52
Base automatically changed from argparser-resolver to main July 25, 2026 11:13
Structural resolution (case selection and positional routing) now
happens before any conversion, making the phase-separation guarantee
literal: by the time a converter runs, every union case is chosen and
the positional stream routed, so a conversion failure can never change
either. When resolution fails, positional converters are not tried at
all — bare tokens that select nothing report only the selection error.

The conversion pass still replays the event log in argv order with the
same stored-slot bookkeeping, so conversion, duplicate and trailing-key
diagnostics keep their historical interleaving; help and fatal scan
errors still abort first, in argv order.

StorePositional gains the routed sink's id (dispatched in generated
code like storeOccurrence's leaf id), and the new routing errors are
rendered: unroutable positionals name the offending token, ambiguous
routing names the competing sinks' forms.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Smaug123
Smaug123 force-pushed the argparser-resolve-before-convert branch from 23f5c42 to 3273cdf Compare July 25, 2026 11:21
@Smaug123
Smaug123 enabled auto-merge (squash) July 25, 2026 11:31
@Smaug123 Smaug123 closed this Jul 25, 2026
auto-merge was automatically disabled July 25, 2026 12:16

Pull request was closed

@Smaug123 Smaug123 reopened this Jul 25, 2026
@Smaug123
Smaug123 enabled auto-merge (squash) July 25, 2026 12:20
@Smaug123 Smaug123 closed this Jul 25, 2026
auto-merge was automatically disabled July 25, 2026 12:32

Pull request was closed

@Smaug123 Smaug123 reopened this Jul 25, 2026
@Smaug123 Smaug123 closed this Jul 25, 2026
@Smaug123 Smaug123 reopened this Jul 25, 2026
@Smaug123
Smaug123 enabled auto-merge (squash) July 25, 2026 13:20
@Smaug123
Smaug123 merged commit 5fc2409 into main Jul 25, 2026
56 of 70 checks passed
@Smaug123
Smaug123 deleted the argparser-resolve-before-convert branch July 25, 2026 13:24
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