InwardDependency cop: resolve LedgerPath against the config file, not the working directory #1143
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#1143
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
plugins/os-sdlc/.rubocop-sweep.yml sets
LedgerPath: ../../docs/crc/os-sdlc/ledger.tsv.ledger_pathin lib/os_sdlc/cops/inward_dependency.rb doesFile.expand_path(configured).That call resolves against Dir.pwd.
From the repo root,
plugins/os-sdlc/bin/lint-sweeppoints outside the tree.Ledger#role_by_constraisesSdlc/Structural/InwardDependency LedgerPath does not exist: ....Rubocop prints
An error occurred while Sdlc/Structural/InwardDependency cop was inspecting ...for every lib file (5628 lines onc7539a22) and exits 0.The gate passes with no inward check.
From plugins/os-sdlc/ it works (176 offenses, 125 unique file/constant/outer/inner edges on
c7539a22).Part 1 shipped in
5e3cd884(implementation 70):Lint::WorklistRubocopConfigwrites each relative*Pathparameter of an inherited config as an absolute path, sobin/lint-sweepreports the same InwardDependency offense set from the repo root and from plugins/os-sdlc/; a missing ledger gives one error line and exit 3 (tests/lint/lint_sweep_test.rb). The cop itself still resolves a relative LedgerPath against Dir.pwd, so a direct rubocop run with--config plugins/os-sdlc/.rubocop-sweep.ymlfrom the repo root still crashes on every file.Reproduce
The first run reports offenses. The second prints "An error occurred while Sdlc/Structural/InwardDependency".
Approach
The crc-tickets acceptance text needs no change:
BodyContext#acceptance_lines(lib/os_sdlc/crc/tickets/body_context.rb:26-31) takes the inward lint command from the caller and hard-codes no directory.Required work:
InwardDependency#ledger_pathexpands a relative LedgerPath against the directory ofconfig.loaded_path, never against Dir.pwd. An absolute LedgerPath (as part 1 writes) is unchanged.Acceptance criteria
LedgerPathrelative to that directory, when the cop inspects a file with the working directory elsewhere, then the cop reads that ledger and reports its offenses.Owner sketch
RuboCop::Cop::Sdlc::Structural::InwardDependency#ledger_path(lib/os_sdlc/cops/inward_dependency.rb:65-70): expands a relative LedgerPath againstFile.dirname(config.loaded_path).RuboCop::Configwith aloaded_pathand a relative LedgerPath).Origin
VERDICT: CREATE
Work started on branch ticket-1143 (worktree .claude/worktrees/ticket-1143), through /os-sdlc:implement. Same branch also carries: Exclude retirement for InwardDependency, the per-kind cop split, and #1072 ambiguous keep rows.
Implementation 70 failed at contract-auditor (verdict:error, dispatch 658): R2 and R3 were green (suite pass, behavior-verifier pass) and are committed as
5e3cd884; R1 (cop-side resolution against config.loaded_path) was missing and needed a new test, which contract-auditor cannot route back to test-writer. Cause: R1 had no acceptance criterion of its own. Body now scopes the remaining work to R1 with its own criterion; fresh implementation follows on branch ticket-1143.Follow-up dropped by ticket-skeptic: contract-auditor has no route for a test-needing WORK-MISSING item (implementation 70 ended verdict:error). The root is upstream: change-auditor accepted R1 with no criterion of its own; recovered by implementation 73.
Resolution
Done: Relative LedgerPath resolves against the directory of the config file that sets it: the cop expands it against config.loaded_path (
ccd16090), and lint-sweep's generated config carries inherited *Path parameters as absolute paths, refusing a missing one with one line and exit 3 (5e3cd884). crc-tickets acceptance text needed no change.Evidence: Merged to main
0cd8943e. Suite 2108 runs, 0 failures. bin/lint-sweep from plugins/os-sdlc/ and from the repo root: 176 InwardDependency offenses each (125 unique edges), identical sets, 0 InwardDependency crash lines (was 5628 from the root). Implementations 70 (failed at contract-auditor, green part kept) and 73 (complete).Follow-ups: contract-auditor route for test-needing WORK-MISSING: dropped by ticket-skeptic (root is upstream, see comment). Origin-check defect seen while filing: occurrence posted on #965. Cop split continues as #1153.