os-adr: three copies of path and file-name knowledge (A12) #948
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#948
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
Three places in os-adr copy path and file-name knowledge that another object already owns. This is heuristic A12 (one rule, one owner). A change to the rule must then change several files.
Observed
plugins/os-adr/bin/adr-migrate:23builds the report path:File.join('docs', 'adr', Adr::Migration::Report::FILENAME).Report#path(lib/adr/migration/report.rb:15) owns the file name, andRepository#dir(lib/adr/repository.rb:15) owns'docs', 'adr'.plugins/os-adr/lib/adr/migration/inventory.rb:7holdsGENERATED_BASENAMES = %w[README.md migration-report.md].freeze.Repository::INDEX_FILENAME(repository.rb:5) andReport::FILENAME(report.rb:6) already define both names.plugins/os-adr/lib/adr/record/creation.rb:36buildsFile.join(repo.dir, "#{id}-#{Adr.slugify(title)}.md").Repository#write(repository.rb:44) has the same rule.Reproduce
n/a: design defect. No command fails. The three copies are visible in the cited lines.
Approach
Each caller asks the owner. Show the code first.
Required work:
bin/adr-migratetakes the report path from the owner (MigrationorReport#path) and does not nameReport::FILENAMEor'docs', 'adr'. — check: absentAdr::Migration::Report::FILENAMEinplugins/os-adr/bin/adr-migrateInventorybuildsGENERATED_BASENAMESfromRepository::INDEX_FILENAMEandReport::FILENAME. — check: absentmigration-report.mdinplugins/os-adr/lib/adr/migration/inventory.rbRecord::CreationasksRepositoryfor the file path, andRepository#writeuses the same method. — check: absent#{id}-#{Adr.slugify(title)}.mdinplugins/os-adr/lib/adr/record/creation.rbAcceptance criteria
Repository#path_for(id, title)answers the path andRepository#writewrites the record, then the record file is at the path thatpath_foranswered.Owner sketch
Repositoryowns the ADR file path.Migration::Reportowns its file name and path.Inventoryowns only its candidate list.Adr::Repository#writecallspath_for(record.id, record.title).Adr::Record::Creation#write_adrcallsrepo.path_for(id, title).bin/adr-migrateprints the report path fromReport#path(throughMigration), not from literals.Adr::Migration::InventorysetsGENERATED_BASENAMES = [Repository::INDEX_FILENAME, Report::FILENAME].freeze.Non-goals
Moving
Record::CreationtoRepository::Creation(G4, a separate ruling).No new test for the report path printed by bin/adr-migrate; Required-work check R1 proves it, and the output must stay the relative path
docs/adr/migration-report.md(Report#path is absolute, so Migration answers the relative path).No new test for Inventory's generated-file skip list; Required-work check R2 proves it, and the existing inventory tests cover the skip.
Origin
4b8a1730) found thebin/adr-migrate:23copy and listed the other two. Lens challenge G1 (same commit) gave the same view ofbin/scripts.Work started on branch crc-os-adr-2026-10-04 (persistent worktree) via /os-sdlc:implement.
Implementation 30 failed (verdict:error after an orchestrator reroute into test-reviewer with no red_tests evidence). AC1 and AC2 moved to Non-goals: they already hold and are proven by Required-work checks R1/R2. Reopening on a fresh implementation.
Draft dropped (symptom, not root): map-router offers test-reviewer as a reroute entry node with empty red_tests (impl 30, dispatch 282). Same root as the no-map-for-refactor ticket; a red_tests precondition would only move the problem. Note this entry-node case on that ticket.
Draft dropped (symptom, not root): test-reviewer FAIL with CORRECTION NONE routes back to test-writer and burns the bound (dispatches 276, 278, 280). It stems from running a refactor through a red-tests map. #951 covers escalation recovery.
Resolution
Done: Repository#path_for owns the ADR file path; Repository#write and Record::Creation call it. Inventory::GENERATED_BASENAMES is built from Repository::INDEX_FILENAME and Migration::Report::FILENAME. bin/adr-migrate takes the report path from Report#path and prints it relative to the root.
Evidence: Commit on branch crc-os-adr-2026-10-04 (implementation 31, 8 dispatches, 0 retries, after failed implementation 30: map misfit for a behavior-preserving refactor). Required-work checks R1-R3 pass at suite-check; os-adr suite 52 runs, 0 failures; new test repository_test.rb covers path_for/write agreement.
Follow-ups: #952 no map for behavior-preserving refactors; #953 diff-test vs test-reviewer red rule mismatch; reroute-into-test-reviewer and reviewer no-correction loop DROPPED by skeptic as symptoms of #952/#951. Dropped: AC1/AC2 preservation pins (kept only in session scratchpad, not committed; R1/R2 text checks cover them). Branch not yet merged to main: waits for the user's decision on the whole crc-os-adr branch.