Skip to content

build_dist.py: four staleness and write-path gaps found by #1441's review passes #1444

Closed

Description

@ptr727

Found by adversarial passes during #1441 (2026-09-08), each measured rather than reasoned about. All four are pre-existing or latent, none blocked that pull request, and they are grouped because they share one surface.

1. is_stale() never checks the plugin tree's own root entries

is_stale() calls has_exact_entries() for DIST_PLUGIN/skills, GITHUB_SKILLS and DIGEST_DIR, and nothing checks the entries of .claude-plugin/fleet-skills/ itself. A stray or hand-added file at that tree's root, beside skills/, .claude-plugin/ and .source-digests/, differs from what a regenerate produces and --check still exits 0.

The same class of stray file in .github/skills/ is caught, so the asymmetry is the defect rather than the absolute coverage.

2. A symlinked plugin.json is invisible, and the generated-tree symlink cases are undocumented

Measured across the four shapes:

Shape Exit
Symlink at a generated skill directory (.claude-plugin/fleet-skills/skills/<n> or .github/skills/<n>) 1, stale, via has_exact_entries
Symlink at a digest stamp under .source-digests/ 1, stale, same
Generated plugin.json replaced by a symlink 0, clean, nothing reads it
Symlink strictly deeper inside a generated skill directory 2, via tree_digest -> reject_symlinks

The third row is the one worth a decision: a symlinked plugin.json passes --check entirely.

3. The resolve()-then-write window

include_source() proves a path is not a symlink via path.resolve(), and fill_includes() then writes to the unresolved INCLUDE_ROOT / rel. A path swapped to a symlink between the check and the write is followed, putting generated text outside the repository.

Pre-existing in shape for skill documents, which reject_symlinks() walks. It widens to declared destinations, which no such walk covers. Unreachable while INCLUDE_DESTINATIONS is empty, which it is.

4. The exit-2 causes added on #1441 have no test asserting main() returns 2

include_destinations()'s three refusals (a stale entry, a carried entry, an unreadable or wrong-shape manifest) are covered by tests calling include_destinations() and regenerate() directly. The one exit-code test, test_build_dist.py's --check case, covers only a broken include key. I verified all three reach exit 2 by hand, so the documented contract is correct and simply unguarded.

Activity

  1. added
    skills
    script
    on Sep 8, 2026
  2. ptr727 commented on Oct 23, 2026

    @ptr727
    OwnerAuthor

    Closed under the maintainer's decision (ptr727, 2026-10-23) on #3391: the backlog keeps real bugs with a stated failure, features the maintainer wants, and open decisions. A finding the review loop filed on code or text a change did not touch, a refactor or consolidation chore, a tracker, a wording item, or a guard shape no session has produced is closed rather than worked. Reopen with the input and the wrong result if this issue states one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scriptskills

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions