Fail loudly when system-model root has no Ruby files in lib #1515
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#1515
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
system-modelwith a root that does not exist, or that has no Ruby files underlib/, printsclasses: 0and exits 0.A mistyped path looks like a valid empty model.
Observed
The chain, with the line of each step:
plugins/os-sdlc/lib/os_sdlc/boot/inputs.rb:70expands the argument withFile.expand_path(argv.first, io.cwd). A relative path resolves against the cwd.plugins/os-sdlc/lib/os_sdlc/boot.rb:72callsinput.root_or(...). The given root wins, soProjectBind(boot/project_bind.rb:10-14) never looks up.sdlc/project.yaml.plugins/os-sdlc/lib/os_sdlc/system_model/extractor.rb:54globslib/**/*.rbunder the root and finds nothing.plugins/os-sdlc/lib/os_sdlc/system_model/report.rb:11printsclasses: 0.The no-argument form does not use
project.yamltoday:inputs.rb:68refuses it with the usage text and exit 2.Reproduce
Approach
Choice on relative roots: a relative root keeps resolving against the cwd, as
inputs.rb:70does now. Reason: a path typed in a shell means the cwd, and.sdlc/project.yamlmarks the outermost project root (Project::RootSearch.outermost), which differs from a plugin root such asplugins/os-backlog. A project-root rule would move the meaning of every existing call.The fix is a refusal, not a new lookup.
SystemModel::Run#call(system_model/run.rb:17) raisesBoot::RefusalError(status 1, the pattern ofrun.rb:55) when the subcommand isgenerate,build,coverageoropportunitiesand the resolved root has nolib/**/*.rbfile. The message names the resolved absolute path. A nonexistent root takes the same path: the glob is empty. The guard sits inRun, not inExtractor, becauseShape::Run(system_model/shape/run.rb:26) builds one Extractor per root with no per-root rescue, andshapesover plugins with nolib/(cc-architect, os-context, os-doc-hygiene, os-vault) must keep working. The guard countslib/**/*.rbonly, so a bin-only root is refused too, as the user asked.serve,stopandstatusdo not run the Extractor and keep their behavior.The no-argument form stays as it is (usage, exit 2). Binding the no-argument form to
.sdlc/project.yamlis a separate decision (Non-goals).Required work:
lib/glob inRun— check: presentRefusalErrorinplugins/os-sdlc/lib/os_sdlc/system_model/run.rbno Ruby filesinplugins/os-sdlc/tests/system_model_cli_test.rbOrchestrator work: run
bin/refresh-plugins; add one History row todocs/implementation-status/os-sdlc-system-model.md.Acceptance criteria
system-model generate <root>runs, then it exits nonzero and the error text contains the resolved absolute path.lib/directory, whensystem-model generate <root>runs, then it exits nonzero and the error text contains the resolved absolute path.lib/has no.rbfile, whensystem-model coverage <root>runs, then it exits nonzero and prints noclasses:line.system-model shapesover a plugin root with nolib/directory, when it runs, then its behavior is unchanged..rbfile underlib/, whensystem-model generate <root>runs, then the output and exit status are unchanged.system-modelruns, then it prints the usage text and exits 2, as before.Owner sketch
Non-goals
Binding the no-argument form to
.sdlc/project.yaml: the outermost project root is not a plugin root, so the user must rule on which root applies.system-model shapesroots (Shape::Run) and bin-only roots inshapes.Origin
cd /tmp && plugins/os-sdlc/bin/system-model generate plugins/os-backlogprintedclasses: 0and exited 0.classes: 0for a wrong path ← no check that the root has Ruby files ← DESIGN (plugins/os-sdlc/lib/os_sdlc/system_model/extractor.rb:54,plugins/os-sdlc/lib/os_sdlc/boot/inputs.rb:66-71)VERDICT: CREATE
Work started on branch
ticket-1515through /os-sdlc:implement.Resolution
Done: system-model refuses a root with no Ruby files under lib/: exit 1 and an error that names the resolved root. shapes still accepts a root without lib/. Extractor.sources is the one owner of the lib/**/*.rb glob.
Evidence: Commit
41cdf5feon ticket-1515 (implementation 222). Five new tests in plugins/os-sdlc/tests/system_model_cli_test.rb. Suite gate green twice (dispatches 2016, 2019). Contract audit pass (2020).Follow-ups: none