doc-triggers.py resolves the repo root by depth, so it climbs out of every project that adopts it #17
Labels
No Label
P0
P1
P2
release-blocker
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: null/Project-Template#17
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
ROOTwaspathlib.Path(__file__).resolve().parents[3]— correct only while the script sits at its template home,docs/architecture/scripts/.The template's own adoption instructions tell a project to copy scripts into
scripts/, andTOOLS.mddocuments exactly that ("they are taken from the template one at a time, having been read"). From<project>/scripts/doc-triggers.py,parents[3]resolves to the parent of the project directory — outside the repository.What it costs
The failure is silent and reads as a pass.
main()opens with:So an adopting project gets exit 0 and a line naming a directory two levels above the project, and the check that enforces "update the triggered documents in the same commit as the code" has quietly stopped running. That is the failure mode
GUARDS.mdopens with — a guard that cannot fail is worse than no guard, because it is trusted — landing on the tool that polices the documents.Reproduced against a scratch repo at
<tmp>/thing/with the script atscripts/, adocs/THING.mdgoverningsrc/**, andsrc/a.pystaged:What to do
Find the root rather than assume its depth: walk up from
__file__for a directory holding bothdocs/and.git, then either alone, thengit rev-parse --show-toplevel, then give up to the script's own parent.Traps
docs/and.gitmust be tried beforedocs/alone, or a repo containing a vendoreddocs/in a subdirectory anchors on the wrong one.docs/case non-zero. Exit status is always 0 by design here — this is a prompt, not a gate — so the fix has to be in root resolution, not in the exit code.docs/architecture/scripts/itself.Verify: with
doc-triggers.pycopied toscripts/in a repo whosedocs/holds a document governingsrc/**,python3 scripts/doc-triggers.py --stagednames that document instead of printing "no docs/ directory"; run in place fromdocs/architecture/scripts/it still fires DOC_TRUST_MAP.md, TOOLS.md and architecture/README.md.