Fix FastGate::ChangedFiles for a project root below the git top level #1689
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#1689
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
fast-gateand its new-offense report give wrong results when the project root is a subdirectory of the git top level.The Ruby class
FastGate::ChangedFilesmixes two path bases: paths from the git top level and paths from the project root.One form drops a tracked change without a message; the other form fails with
HarnessError: git show lib/a.rb failed.No test pins the subdirectory case.
Observed
The session ran both forms against a real temporary repository, with the project root in
sub/(transcript, piece 5 report, 2026-11-10):base_sourcetracked_from(git.found(root))sub/lib/a.rbis joined to the root and no such file existsproject.repofor bothlib/a.rbHarnessError: git show lib/a.rb failed, becauseref:pathresolves from the topUntracked files are reported in both forms.
The session wrote: "Both forms are defective for a subdirectory root, in different ways."
Both forms exist on
mainnow:plugins/os-sdlc/lib/os_sdlc/fast_gate/new_offense_report.rb:23:ChangedFiles.new(root, argv, options.base, git.at(root)).tracked_from(git.found(root))(the first form).plugins/os-sdlc/lib/os_sdlc/fast_gate/run.rb:29:ChangedFiles.new(root, target, base, @project.repo)(the second form;@topstaysrepo).plugins/os-sdlc/lib/os_sdlc/fast_gate/changed_files.rb:22-25(tracked_from),:33(base_sourcereads@repo.read_at(base_commit, change.old_path)),:45-48(trackedreads@top.changes(against: base_commit).tracked), and:29(File.join(@root, change.path)).The session wrote: "no fast-gate test pins that case. This was already true with the shim."
The pinning test on
mainistest_a_tracked_path_comes_from_the_repository_top_and_an_untracked_path_from_the_root; it covers only a root at the top.I read the code and the transcript table; I did not run the commands.
Reproduce
I did not run this command form. Use a
.sdlc/project.yamlundersub/so thatsubis the project root; the target name comes from that file.Approach
Pick one path base for
FastGate::ChangedFiles: convert every git path to a project-root-relative path intracked, and convert it back to a git-top-relative path inbase_source.Remove
tracked_fromso that both callers use one form.Required work:
tracked_frominplugins/os-sdlc/lib/os_sdlc/fast_gate/*.rbAcceptance criteria
lib/a.rb, whenfast-gatecollects changes, then the change is reported aslib/a.rb.fast-gatereads the base source of that change, then it returns the content ofsub/lib/a.rbat the base commit.fast-gatecollects changes, then the paths and base sources are unchanged.Owner sketch
Origin
ChangedFilesforms while it moved the git factory ontoProject(commit031244657).ChangedFilesuses git-top paths fortrackedand root paths for the rest (changed_files.rb:22-48) ← the shim formtracked_fromkept a second base; no test covers a subdirectory rootVERDICT: CREATE
REASON: The defect exists on main, was not caused by this session, and no test covers the case.