Repository navigation
v2 CLI: --target as a closed choice over rostered TargetModels (Rust, C, Swift); usage refusals exit 2 - #12266
Conversation
… refusals exit 2 v2.cli.compile_cli gains CliEmitTarget = Rust | C | Swift, each arm naming one rostered TargetModel. The plan's declared default (cli_default_emit_target) is Rust, the argv every existing caller spawns. An unknown or dangling --target is a typed parse refusal (cli_unknown_target / cli_target_missing_value). Plan refusals are now CliUsageRefused and exit exit_code_misuse (2); emit refusals stay exit_code_general_error (1), the split native_driver_plan_exit already makes. The seed's native-CLI harness follows the declared usage line and the no-entry control's new status. Also records the v2-native route's 7 GB remote-runner OOM as a recurring failure mode, with its receipts. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ain, also OOM on the 7 GB runner Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…g seed-emittable The first emit-build carrying v2.extdeps.languages.swift in the CLI closure failed rustc (E0308 at swift_bool_grounding, plus two truncated errors; CI run 36078559948). A rostered target's model is in the door's closure, so Swift joins the roster when that module emits cleanly, the trigger stated beside CliEmitTarget. The unknown-target claim now uses 'swift' as its discriminating input. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…2270) The trigger stated beside CliEmitTarget is met: #12270 made v2.extdeps.languages.swift and .c emit to Rust cleanly, so the door's closure builds with both rostered. The unknown-target claim's discriminating input moves to 'kotlin', a real target with a model that is not rostered. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
briansrls
left a comment
There was a problem hiding this comment.
APPROVE-MERGE at exact head 12c70113f3d39a6d7e438b876a57a2ad8b243409.
The target selection is correctly modeled as plan data rather than a free emitter string. CliEmitTarget is closed over Rust/C/Swift; each arm has an exhaustive spelling projection and TargetModel projection; cli_default_emit_target records the existing caller behavior as Rust; and v2_cli_run consumes only the target carried by the parsed plan. An unknown or dangling --target therefore refuses before source walking or emission.
The exit split is also correctly placed. Parse/plan failures become CliUsageRefused and map to GNU misuse status 2, while an admitted plan whose ingest or emission refuses remains CliRunRefused and maps to general error status 1. The seed door's no-entry control and usage string move with that contract; direct plan constructors are updated explicitly rather than relying on a hidden default.
The claims discriminate all three spellings, the no-option default, unknown and dangling target forms, and the exact 2-versus-1 statuses. Their execution on the required floor closes the PR body's earlier local OOM gap. emit-build additionally establishes that the native CLI door still emits and builds with the C and Swift target modules in its closure after #12270.
The scope boundary is honest: this lands target planning and routing, not successful member-body emission for a real C or Swift closure. That remains gated on #12239 and is not treated here as executing end-to-end evidence.
Run 36110505850 passes compiler, clippy, emit-build, floor and witnesses at this exact SHA. GitHub reports CLEAN and mergeable.
No source condition remains unless the head moves. The merge queue remains authoritative for the composed revision.
…door Resolved: the door emits through cli_emit_target_model(t: target); the imports are unioned; CliUsageRefused sits beside CliEmitted in the CLI and its witness; the generated main keeps the single text write before the status dispatch. native_lane_runner 36/36, v2_native_cli 26/26, closure_emission 5/5. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…CensusRefused beside CliUsageRefused Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Slice-1 prerequisite for generating the approve-ios Swift from .dag (dashboard node adhoc-1a935b07-173). The design is approved by the parent lane: emit goes through the v2 route, which is rows only, with no v1 growth.
What changes
v2.cli.compile_cliaddsCliEmitTarget = CliTargetRust | CliTargetC | CliTargetSwift. Each arm names one rosteredTargetModelthroughcli_emit_target_model, andv2_cli_runreads its target only from the plan. Previouslyrust_target_model()was hardwired.cli_default_emit_target = CliTargetRustis the argv every existing caller (the instruments) already spawns.--targetrefuses at the parse withcli_unknown_targetorcli_target_missing_value, and the detail names the roster. The target is never a free string.CliUsageRefusedand exitexit_code_misuse(2). Emit refusals stayexit_code_general_error(1). This is the splitv2.compiler.compilenative_driver_plan_exitalready makes.native_lane_runner.rsgets the declared usage line, and its no-entry control now expects exit 2.--targetplans the default, unknown and dangling targets refuse, and there are exact exit codes for a usage refusal and for an emit refusal.v2_native_route_exceeds_the_default_remote_runner_memory. It records the measured OOM receipts.History
Swift and C were first held back because their target modules did not emit to Rust. #12270 fixed that (merged), so all three are rostered. The RFM row moved to #12268.
Evidence, stated honestly
cargo check -p v1-compileris green.gunbc run --claim-runofsrc/v2/test/claim/cli/v2_native_cli_test.dagwas OOM-killed (137,oom_kill 4) on the 7 GB BuildBuddy runner, the same class the new RFM row records. So the required floor on this PR is the first execution of these claims.--target cor--target swifton a real closure. The v2 closure-emit route still refuses member bodies for every target (CLI_DOOR_EMIT_BODY_REFUSAL). That capability is Gen-two #4: the door renders a module and its members' bodies through Rust's rows; a module reaching type projection refuses #12239, and the Swift protocol slice is stacked on it.🤖 Generated with Claude Code