Skip to content

Address all findings from the post-merge tooling review#9

Merged
maybebyte merged 10 commits into
masterfrom
005-review-fixes
Jun 12, 2026
Merged

Address all findings from the post-merge tooling review#9
maybebyte merged 10 commits into
masterfrom
005-review-fixes

Conversation

@maybebyte

Copy link
Copy Markdown
Owner

Summary

Fixes all 8 findings from the code review of the quality-tooling rollout (PRs #6#8): two coverage gaps in the hash-integrity check, push/commit latency reductions, drift guards for the duplicated exclude lists, broader editor protection for media assets, and two CI config cleanups.

Changes

  • Orphan detection (new check d) in check-hashes.sh: every tracked hashed asset must be referenced by a tracked text file. The four orphans it would have flagged (two unused webp variants, two unreferenced pngs — all shipping with the site) are removed first; recoverable from history.
  • Template agreement (check c) generalized: templates referencing hashed assets are discovered via git grep instead of hardcoding the _header.html/errdocs/err.html pair; both are asserted present so the check can't silently degrade. Note this requires any future hashed-asset-referencing template to agree exactly — loosen then if a legitimate subset-template appears.
  • gitleaks pre-push now scans only the pushed range (PRE_COMMIT_FROM_REF..PRE_COMMIT_TO_REF) via a wrapper script, falling back to full history when no range is provided — so CI's --hook-stage pre-push run keeps the exhaustive scan. Local push scan drops from ~1,100 commits to just the pushed ones.
  • Hash check trigger gated on relevant file types (md|html|css|webmanifest + hashed assets) instead of always_run; CI --all-files unaffected.
  • Exclude-list drift guard: the five copies of the vendored-tree list now cross-reference each other; the deliberate fonts/ omission in .gitleaks.toml is documented.
  • .editorconfig protects future media types (jpg/jpeg/gif/avif/mp4/webm) up front.
  • CI installs via uv instead of pipx (both preinstalled; ~1-3s vs 5-15s per tool, matches local tooling).
  • Dropped enable-beta-ecosystems from dependabot.yml (pre-commit ecosystem GA'd March 2026; docs mark the flag unused).

Testing

  • pre-commit run --all-files and --hook-stage pre-push: all hooks pass.
  • Check (d) negative-tested with a planted unreferenced hashed file; check (c) with a planted divergent third template — both fail as intended, clean tree passes.
  • gitleaks wrapper verified in both modes: range mode scanned 2.43 KB in 61ms (vs full history); fallback mode passed; the real push of this branch exercised it live.
  • Hash-check files: filter observed skipping on config-only commits and running on content commits during this branch's commit sequence.

Notes for reviewers

  • If pre-commit update jobs stop appearing under Insights → Dependency graph → Dependabot after the beta-flag removal, restore enable-beta-ecosystems: true (noted in the commit message).
  • The deleted orphan images may still sit in the rendered output dir until the next site rebuild/deploy sync.

maybebyte added 10 commits June 12, 2026 16:20
None of these are referenced by any tracked file or by the rendered
site output: two are webp variants whose articles embed the png
versions, and the other two belong to no current article. They were
still being copied into the published site. Recoverable from history
if ever needed again.
The hash check proved every referenced asset exists but never the
inverse, so unreferenced assets sat in the tree and shipped with the
site unnoticed — the stale-stylesheet failure mode again, and four
orphaned images were found this way. New check (d): every tracked
hashed asset's token must appear in at least one tracked text file
outside the vendored trees.
Check (c) hardcoded the {_header.html, errdocs/err.html} pair, so a
future template referencing hashed assets would escape the agreement
check and could serve stale tokens undetected. Templates are now
discovered with git grep like check (b)'s sources; the two known
templates are asserted present so the check cannot silently degrade.
Full-history scans (~1,100 commits) on every push re-checked commits
that are already public, adding latency without protection. The wrapper
uses the PRE_COMMIT_FROM_REF..PRE_COMMIT_TO_REF range pre-commit
provides at the pre-push stage and falls back to full history when no
range exists, so CI's --hook-stage pre-push run keeps the exhaustive
scan.
The {fonts, stagit, migration, pubkeys} list is necessarily repeated in
five files in five syntaxes (each tool's exclusion semantics differ), so
it cannot be driven from one source. Point each copy at the others so
adding or renaming a vendored tree cannot silently miss one.
always_run re-hashed every asset and re-grepped the tree on every
commit, including ones touching nothing the check looks at. Gate it on
the file types that participate: hashed assets themselves and the text
types that reference them. The check itself still scans the full tree
when triggered, and CI's --all-files run is unaffected.
The byte-preservation section enumerated only extensions present today,
so the first jpg/avif/video asset would start unprotected and an editor
save could break its content hash (caught at commit by check-hashes,
but better not corrupted at all).
Both are preinstalled on ubuntu-latest; uv installs the same pinned
versions in ~1-3s where pipx spends 5-15s per tool building a venv, and
it matches how pre-commit is installed locally.
The pre-commit ecosystem GA'd in March 2026 and GitHub's docs now mark
enable-beta-ecosystems as not in use. If pre-commit update jobs stop
appearing in the Dependabot tab, restoring this line is the first thing
to try.
uv is not preinstalled on the ubuntu-latest image after all; both jobs
failed with command-not-found. setup-uv is SHA-pinned like the other
actions.
@maybebyte maybebyte merged commit 2010550 into master Jun 12, 2026
2 checks passed
@maybebyte maybebyte deleted the 005-review-fixes branch June 12, 2026 22:31
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