One --target parser: ArgvOption leaves unknown options in place; TargetFlag and LintWorklist.parse_target retire #790
Labels
No labels
P0
P1
P2
P3
bug
category/code-change
category/cross-repo
category/eval-run
category/investigation
category/no-test-target
category/owner-ruling
category/prose-artifact
category/recurring-chore
category/structure
category/umbrella
crc-refactor
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
rule-proposal
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#790
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
There are three
--targetparsers:CLI::TargetFlag(parser/cli/target_flag.rb),LintWorklist.parse_target(controller/lint_worklist.rb:59), andArgvOption.take!(controller/argv_option.rb, used by controller/implementation/scripts.rb:13).ArgvOption.take!cannot replace the other two yet: it callsOptionParser#parse!on the whole argv, and that raisesOptionParser::InvalidOptionon any other flag.bin/os-sdlc project-config demo --path lib --target xandbin/lint-worklist --target x --newboth carry other flags.Reproduce
Failing test:
ArgvOption.take!(%w[project-config demo --path lib --target os-sdlc], "--target NAME")returns"os-sdlc"and leaves argv%w[project-config demo --path lib]. Today it raises InvalidOption.Approach
Files (7): controller/argv_option.rb, controller/project/setup_cli.rb, bin/os-sdlc, controller/lint_worklist.rb, parser/cli/target_flag.rb (delete), tests/controller/project/cli_target_flag_env_test.rb (retire), tests/controller/argv_option_test.rb (new).
ADRs cited: ADR-0213 (target only from
--targetorimplementation.target), ADR-0236 (controller/ owns argv), ADR-0123 (Thor). No ADR to supersede. The parser location is a heuristic (ADR-0224).Required work:
ArgvOption.take!removes only the named option and its value, in the--target xand--target=xforms. It leaves every other token in argv, in order. It still raises on a missing value. — check:ruby plugins/os-sdlc/tests/controller/argv_option_test.rbProject::SetupCLI#project_configtakes the target withArgvOption.take!(args, "--target NAME"). Delete theSetupCLI.targetaccessor,SetupCLI.extract_target!, and theSetupCLI.target =line inbin/os-sdlc. — check:! grep -rn "extract_target!\|SetupCLI.target" plugins/os-sdlcLintWorklist.runtakes the target withArgvOption.take!(argv, "--target NAME"). DeleteLintWorklist.parse_target. — check:! grep -rn "parse_target" plugins/os-sdlc/libparser/cli/target_flag.rb. — check:! grep -rn "TargetFlag" plugins/os-sdlcruby plugins/os-sdlc/tests/all.rbRejected: Thor
method_option :targeton SetupCLI. LintWorklist and the implementation scripts do not use Thor, so there would still be two parsers.Rejected: keep
TargetFlagand deleteArgvOption.ArgvOptionis the general option reader already in controller/;TargetFlagknows only one flag.Acceptance criteria
project-config demo --path lib --target os-sdlc, when the target is taken, then the value isos-sdlcand argv isproject-config demo --path lib.--target=os-sdlc --new, when the target is taken, then the value isos-sdlcand argv is--new.--target, when the target is taken, then the value is nil and argv is unchanged.bin/os-sdlc project-config demo --target os-backlogin a targets-shaped project, when it runs, then it fails with the same TargetSelectionError text as today (the write is refused).bin/lint-worklist --target os-sdlcin cc-os, when it runs, then it lists the os-sdlc target's offenses as before.Owner sketch
Non-goals
Thor option declarations for other subcommands.
CLI::OptionParserBuilder(project-config's own flags).Retired tests
plugins/os-sdlc/tests/controller/project/cli_target_flag_env_test.rb
Origin
--targetparser, in controller/)OptionParser#parse!over the whole argv (DESIGN: controller/argv_option.rb)Project concept batch, run in order: T1 #790, T2 #791, T3 #792, T4 #793, T5 #794, T6 held for a lint-paths ruling, T7 #795, T8 #796. Write the ADR before T3.
Work started on branch ticket-790 via /os-sdlc:implement (session bb36e383).
Resolution
Done: ArgvOption.take! consumes only its own flag and leaves other argv entries in place; SetupCLI#project_config and LintWorklist use it; CLI::TargetFlag, SetupCLI.extract_target!, the class-level target accessor, and LintWorklist.parse_target are deleted.
Evidence: os-sdlc implementation 54 on branch ticket-790: 11 dispatches, 1 suite-check retry repaired; final suite-check pass; contract-auditor pass; commit
b9c8862cFollow-ups: none