test(scripts): guard that dispatcher entrypoints are tracked executable#409
Merged
Merged
Conversation
Repo-wide CI guard: enumerates every git-tracked .pkit/**/scripts/*.py carrying the uv-script shebang and asserts each is tracked 100755, so a dispatcher entrypoint can never ship unrunnable again (the #402 defect class — a 100644 entrypoint raises PermissionError through subprocess.run). Keys on the shebang so _lib modules and other non-entrypoints are excluded; asserts the git-tracked mode (what ships to a fresh clone), not the local filesystem stat. Includes an enumeration-drift guard so the exec-bit check can't pass vacuously, plus unit coverage of the mode parser's failure path against synthetic input. Test-only addition; no surface change, no version bump, no migration. Closes #405 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
Author
|
Reviewer agent (local, reviewer): APPROVED
No warnings. No |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A repo-wide CI guard (
tests/test_entrypoint_exec_bit.py) that asserts every dispatcher entrypoint script is git-tracked executable (100755), so the #402 defect class can't recur: a100644entrypoint raisesPermissionErrorthrough the dispatcher'ssubprocess.run([script_path, ...])and the verb silently can't run..pkit/**/scripts/*.pycarrying the#!/usr/bin/env -S uv run --scriptshebang, reads its git-tracked mode viagit ls-files -s, and asserts100755. On failure it names every offender with the remedychmod +x <path> && git add <path>.check-doc-mapping.py,adopt-existing.py,set-field.py,create-issue.py) are discovered, so the exec-bit check can't pass vacuously on a broken scan.100755/ synthetic100644inputs and the shebang discriminant, exercising the failure path without mutating any real file.Design notes
scripts/_lib/module (nor any non-entrypointscripts/*.py) carries the uv-script shebang, so libs are excluded naturally and a new entrypoint anywhere under.pkit/**/scripts/is covered automatically.chmodcan't mask.Verification
100755; 30 non-entrypointscripts/*.pycorrectly excluded.100644(working tree untouched) makes the guard fail, name the offender, and print the remedy; restored, tree clean.ruff/pyrightclean;pkit migrations check-diff --include-working-tree --base main— no trigger (pure addition).Version / migration
Test-only addition — not a surface change per PRJ-002 (no new CLI command/flag/principle/schema/adopter-facing convention; tests project-kit's own tree). No version bump, no migration.
Doc impact
100755") is internal to project-kit's own scripts; the test module docstring documents the rule and rationale. Not an adopter-facing convention, so no COR/PRJ record.Test plan
100644.Closes #405
🤖 Generated with Claude Code