Skip to content

fix(tools): scan the repository, not the disk under it - #37

Merged
frahlg merged 1 commit into
mainfrom
claude/wonderful-goldberg-f547aa
Jul 28, 2026
Merged

frahlg merged 1 commit into
mainfrom
claude/wonderful-goldberg-f547aa

Conversation

@frahlg

@frahlg frahlg commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

No hardware support or contract changes. This fixes the boundary check, which
made make check unrunnable on any machine with a git worktree.

tools/check_public_boundary.py
enumerated files with ROOT.rglob("*"), a filesystem walk that ignores git's
ignore rules. A git worktree under .claude/worktrees/ is a second full
checkout, so its copies of SOURCE_IMPORT.md,
baselines/ftw/drivers/pixii.lua and source-import-delta.json failed the
forbidden-private-reference rule:

FAIL .claude/worktrees/<name>/SOURCE_IMPORT.md: forbidden private reference ...
FAIL .claude/worktrees/<name>/baselines/ftw/drivers/pixii.lua: forbidden ...
FAIL .claude/worktrees/<name>/source-import-delta.json: forbidden private ...

Six errors, all naming paths the contributor never edited. CLAUDE.md tells
contributors to run make check before merge, and they could not. CI never saw
it, because CI has no worktree.

The check now asks git what the repository contains:

git ls-files -z --cached --others --exclude-standard

.claude/worktrees/ is already in .git/info/exclude, so git knows these files
are not ours.

What a reviewer should know

Why --others --exclude-standard and not --cached alone. The old walk
also read untracked files, so a private key in a new file was caught before
git add. Tracked-only enumeration would have dropped that. --exclude-standard
honours .gitignore, .git/info/exclude and global excludes, which is what
shuts out the worktrees.

Tracked files behave exactly as before. Comparing both enumerations over a
checkout holding two worktrees: 1198 files → 379, nothing added. Everything
dropped is a worktree copy (759), __pycache__ (53), .pytest_cache (5) or a
built lua55/luac55 (2). No source file lost coverage.

main() now takes a root. That is the seam the tests need; the default
stays ROOT, so the Makefile target is unchanged.

The new test file cannot name a forbidden string — writing one would make
tests/test_public_boundary.py fail the very check it tests. It reads one from
boundary.FORBIDDEN_TEXT instead.

Driver evidence

not applicable — no driver changes.

Safety

The first three do not apply: no driver or package changes.

  • No credentials, serial numbers, private addresses or site data are included.

Package or promotion evidence

not applicable — tooling only, no package version, target or control contract
changes.

Checks

  • Commits include Signed-off-by.
  • make test-driver ID=<id> — not applicable
  • make package-driver ID=<id> TARGET=<target> — not applicable
  • make check — exit 0 with two worktrees present, 2034 passed, 2251
    skipped. Before this change the same command failed at the first step.

🤖 Generated with Claude Code

frahlg commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

Reviewed as part of an automated pass over open PRs/issues.

This looks safe to merge on its own merits. It's tooling-only (no driver, package, or contract changes — correctly marked "not applicable" throughout the PR template), the fix itself is narrow and well-reasoned (git-ls-files instead of an rglob that doesn't respect gitignore), it ships its own regression test, and all 5 required checks (dco, history-secret-scan, public-boundary, packages, drivers) are green.

Could not merge automatically — the merge API keeps rejecting it:

405 5 of 5 required status checks are expected. []

despite get_check_runs showing all 5 as completed/success against the current head SHA, and the PR being based on the current main tip. Retried three times over ~2 minutes with no change. This looks like either a branch-protection/required-checks propagation issue or a naming/context mismatch between what's configured as required and what these jobs report as — not something I can diagnose further via the tools available here.

Flagging for a maintainer to merge directly (or re-trigger/investigate branch protection) — no code concerns on my end.


Generated by Claude Code

@frahlg
frahlg force-pushed the claude/wonderful-goldberg-f547aa branch from e302156 to fa0097b Compare July 28, 2026 18:27
check_public_boundary.py enumerated files with ROOT.rglob("*"), which
walks past git's ignore rules. A git worktree under .claude/worktrees/
is a second full checkout, so its copies of SOURCE_IMPORT.md,
baselines/ftw/drivers/pixii.lua and source-import-delta.json failed the
forbidden-private-reference rule. `make boundary`, and so `make check`,
reported six errors naming paths the contributor never edited. CLAUDE.md
tells contributors to run `make check` before merge; they could not
while a worktree existed. CI never saw it, because CI has no worktree.

Enumeration now asks git: `ls-files --cached --others
--exclude-standard`. Tracked files behave as before. In this checkout
the new file set is a strict subset of the old one, nothing added, and
everything dropped is a worktree copy, __pycache__, .pytest_cache or a
built lua55/luac55. Untracked files that are not ignored stay in scope,
so a secret is still caught before it is staged.

main() takes a root, which is the seam the tests need. Three tests
against a temporary repository hold that an ignored checkout is not
scanned, and that a tracked or an untracked file still fails.

Co-authored-by: Claude Opus 5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
@frahlg
frahlg force-pushed the claude/wonderful-goldberg-f547aa branch from dafb753 to a379423 Compare July 28, 2026 18:30
@frahlg
frahlg merged commit 172db05 into main Jul 28, 2026
5 checks passed
@frahlg
frahlg deleted the claude/wonderful-goldberg-f547aa branch July 28, 2026 18:31
frahlg added a commit that referenced this pull request Jul 28, 2026
#37 taught the boundary check to scan the repository rather than the
disk under it, so make check passes locally again with worktrees
present. #38 removed sigenergy's SoH read. #39 stopped sungrow
accepting a battery command on an inverter with no battery.

Two real conflicts, both in drivers this branch had also touched:

  sigenergy  main removed the SoH read at 30087 outright; this branch
             had bounded it. Removing a read whose result is discarded
             is strictly better than bounding it, so main's side stands
             and the bounded probe covers the remaining five reads.

  sungrow    merged cleanly in the Lua: main's control-path guard plus
             this branch's bounded reads through optional_read. Zero
             violations, and the string-inverter refusal is intact.

Both files now differ from main's bytes under main's version, so both
move again -- sigenergy 1.1.1 -> 1.1.2, sungrow 1.5.1 -> 1.5.2. This is
exactly what the signed channel refuses to publish otherwise, and what
the SemVer gate in ftw#709 checks across a pin move.

Swept the whole catalog afterwards: zero absent-register violations
across every driver. make check green, 3008 tests pass.

Co-Authored-By: Claude Opus 5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant