Skip to content

fix(lychee): derive the private-repo exclude inventory from repository visibility - #497

Merged
kyle-sexton merged 3 commits into
mainfrom
fix/lychee-private-inventory
Aug 28, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
fix/lychee-private-inventory

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Summary

Makes lychee.toml's private-repo exclude inventory a derived artifact with a check that fails on drift, instead of a hand-kept list that has now drifted twice, and records the managed-file seam decision the issue asked for.

Problem

claude-code-proxy (created 2026-07-30, private) was missing from both melodic-software/ alternations — the same class as #212, which closed ten days earlier and deferred exactly this class fix. A downstream repair in .github PR 46 was then silently reverted by sync PR 47. The list copied a queryable fact (repository visibility) by hand, and nothing compared the two.

Fix

  • components/lychee/private-repo-inventory.sh: generate --write rewrites both alternations from gh repo list --visibility private (sorted, regex-escaped, both entries identical); check fails on any disagreement with the visibility facts it is given and prints the regenerated entries. lychee.toml regenerated by it — claude-code-proxy added, medley/medley-archive now in sorted order.
  • ci.yml lychee-fixtures lane: runs the new offline contract test (34 cases) and the credential-free half of check (an excluded repo that went public; structural invariants) with github.token.
  • .github/workflows/lychee-private-inventory.yml (daily + dispatch): mints a metadata-read-only standards-sync App token over the installation (github-iac holds that set equal to the sync roster), so a new private sync target missing from the list is detected the next day. Drift files/refreshes one marker-keyed tracking issue and the first clean run closes it (no permanently red cron, per fix(ci): standards-sync-stuck alert fails hourly — App token minting 404s on /standards/installation #274). Private repos outside the roster are reported as unverified — the residual, documented in the README.
  • components/lychee/README.md: the "keep it in sync by hand" instruction replaced with the generated/checked contract.
  • ADR-0007: no additive layer on the managed-file seam (every locally-owned flip in the manifest is policy-level; none holds one line); facts a managed file copies are derived at the source; the downstream hand-edit signal is managed-files-guard, whose fleet rollout is filed as Roll managed-files-guard out to every sync target so a downstream hand-edit of a managed file fails its PR #496.
  • Rider: excludes for two bot-blocked cursor.com pages and one lib.rs crate page (403 to the checker, 200 to a browser, verified 2026-08-27) that produced the open link-check reports dotfiles#551 and claude-code-plugins#3340.

Verification

  • bash harness/shell/run-tests.sh components/lychee/private-repo-inventory.test.sh — 34/34 PASS.
  • private-repo-inventory.sh check against the live org lists (public via API, private via gh repo list) — OK, exit 0 after regeneration; exit 1 naming claude-code-proxy before it.
  • shellcheck (rcfile), actionlint, zizmor (one github-app finding explicitly ignored with rationale: whole-installation scope is the fact being read, metadata:read only), markdownlint, typos, editorconfig-checker — all clean locally; lefthook pre-commit green.

Related

…y visibility

The two melodic-software/ alternations in lychee.toml were hand-kept against a
queryable fact and drifted twice (#212, then claude-code-proxy created ten days
after that fix and never added). private-repo-inventory.sh now generates them
from `gh repo list --visibility private` and `check` fails on any disagreement:
the lychee-fixtures CI lane covers the credential-free direction (an excluded
repo that went public; sorted, identical alternations) and a daily
lychee-private-inventory workflow reads the standards-sync App installation's
repository set to catch a new private sync target, filing a rolling tracking
issue instead of a permanently red cron.

Also excludes two bot-blocked cursor.com pages and one lib.rs crate page that
answer 403 to the checker and 200 to a browser (dotfiles#551,
claude-code-plugins#3340), and records in ADR-0007 that the managed-file seam
stays binary with no additive layer, with the managed-files-guard rollout
tracked in #496 as the downstream hand-edit signal.

Closes #483

Co-Authored-By: Claude Fable 5 <[email protected]>
@claude

claude Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 4m 41s —— View job


Code review

  • Gather context (PR body, changed files, CLAUDE.md/REVIEW.md)
  • Review components/lychee/private-repo-inventory.sh
  • Review components/lychee/private-repo-inventory.test.sh
  • Review .github/workflows/lychee-private-inventory.yml
  • Review .github/workflows/ci.yml changes
  • Review lychee.toml, README, ADR-0007
  • Post findings

This repo has no claude-security-review.yml yet, so per REVIEW.md this lane also covers security — nothing security-relevant stood out (the App token is metadata-read-only, scoped and justified inline; the two-entry rewrite in private-repo-inventory.sh is atomic via mktemp + mv).

🔴 Important — posted inline on .github/workflows/lychee-private-inventory.yml#L88-98: the "Check the inventory against visibility" step sets set -uo pipefail but GitHub Actions' default bash shell already runs with -e, which that line doesn't clear. When private-repo-inventory.sh check exits nonzero (drift or query error), the step dies immediately at that command — rc=$? and everything after it (writing steps.check.outputs.rc, printing the captured check.out/check.err) never executes. Concretely, on drift the downstream "File or refresh the drift tracking issue" step's if: steps.check.outputs.rc == '1' never fires, so the workflow's core purpose — auto-filing/refreshing a tracking issue on drift — silently doesn't happen; the job just fails opaquely with no diagnostic output in the log. This repo already has the correct pattern for this (set +e / capture $? / set -e) in publish-packages.yml:72-75; the same shape fixes this step.

Everything else reviewed cleanly:

  • private-repo-inventory.sh's regex-escaping/unescaping round-trip (. ↔ \.), sorted-alternation invariant, and the check/generate set logic (public vs. private vs. installation-partial truth) all check out against the 34-case offline test suite and the actual lychee.toml shape.
  • The ci.yml lychee-fixtures addition is a plain single-command step (no $?-capture pattern), so it doesn't share the -e pitfall above — a drift there correctly fails the PR check.
  • ADR-0007's reasoning and README's updated contract description match what the script/workflows actually implement.

@github-actions

Copy link
Copy Markdown

Claude has reviewed this PR 1 time. The lane skips further automatic reviews after 5; deleting this comment resets the count.

kyle-sexton and others added 2 commits August 27, 2026 05:37
…list

lychee.test.sh carried its own copy of the private-repo alternation and the
Exclusions fixture another; both would have lagged the generated inventory
exactly the way lychee.toml lagged visibility. The test now compares the two
file entries against what private-repo-inventory.sh renders for the set read
back from the file, and requires the fixture to cite every inventoried repo.
read_list accepts a process substitution so the test needs no scratch file.

Co-Authored-By: Claude Fable 5 <[email protected]>
…e runner's -e

The default run shell already carries -e, so a bare call followed by rc=$?
aborted the step on drift before the findings were logged or the tracking
issue filed. The call now sits in an `if`, where a non-zero status is not
fatal, and the outcome routes to the file/close steps as intended.

Co-Authored-By: Claude Fable 5 <[email protected]>
@kyle-sexton
kyle-sexton merged commit 27b7a90 into main Aug 28, 2026
1 check passed
@kyle-sexton
kyle-sexton deleted the fix/lychee-private-inventory branch August 28, 2026 05:35
kyle-sexton added a commit that referenced this pull request Oct 30, 2026
Closes #779

## Summary

Justify verdict (`/overengineering:justify`, attended, inline) on the
App-token half of `maintenance-audit-link-check-excludes`: **RETIRE**.
With that half gone, the scheduled job only repeats the PR lane's
public-visibility check, so the whole workflow is consolidated onto that
lane.

- **Reason when built:** the private-repo inventory drifted twice by
hand ([#212](#212),
[#483](#483)).
[#497](#497)
(2026-08-28) made the inventory generated, added a PR-lane `check` for
"an excluded repo went public", and added this scheduled App-token read
for "a new private sync target is missing".
- **Catches since then:** none. `gh run list --workflow
maintenance-audit-link-check-excludes.yml` shows 27 runs from 2026-10-05
to 2026-10-30, all `success`, and no failed run under any path of this
workflow.
- **The one real gap it was built for was outside its reach.**
[#767](#767)
(2026-10-11) added agent-automations, architecture and azure-iac. Its
own body says this workflow "could not catch it: it reads only the
standards-sync App installation, and none of the three is a sync
target". A manual online run found the gap as a 404, which is the
control that actually catches this drift.
[standards#779](#779)
cites a 16-clone sweep that found one link into an uninventoried private
repository.
- **Carry cost:** a daily job that loads the standards-sync App private
key (an App that holds contents, pull_requests, issues and workflows
write elsewhere) to read repository names, plus a third input mode in
`private-repo-inventory.sh` with its tests. A miss costs one false 404
in a non-blocking online run that names the repository, fixed by
`private-repo-inventory.sh generate --write`.

Options considered: keep (no catch on record, and blind to non-sync
repos); simplify to the public half on a schedule (duplicates the
PR-lane `check`, which runs on every standards pull request and push to
main); retire (this PR).

## Fix

- Delete `.github/workflows/maintenance-audit-link-check-excludes.yml`.
- `components/lychee/private-repo-inventory.sh`: drop
`--installation-list` and the code that only it fed. Drop its two test
cases from `private-repo-inventory.test.sh`.
- `components/lychee/README.md`, `lychee.toml` (the generated-inventory
comment, outside the lines #915 touched), `pr-require-checks.yml`, root
`README.md`, `components/code-review-rules/README.md`, and the cron
comments of three maintenance workflows now say what covers each
direction, or stop naming the workflow.
- `vocabulary.json`: the `check-links` purpose no longer names the
workflow. The `audit-link-check-excludes` slot stays, because
`rename-map.json` still lists it as a rename target and
`naming-lint.test.mjs` requires every rename target to pass the
vocabulary.
- ADR 0007, which mentions the workflow under its old name, is left as
written.

## Verification

- `bash harness/shell/run-tests.sh
components/lychee/private-repo-inventory.test.sh`: passed.
`components/lychee/lychee.test.sh`: passed.
- `bash components/lychee/private-repo-inventory.sh check --config
lychee.toml`: OK.
- `npm run lint:github-actions-conventions`: 0 findings. `node --test
components/github-actions-conventions/naming-lint.test.mjs`: 14 pass.
`lint:concurrency-policy` and `lint:runner-policy`: passed.
- `actionlint` on every workflow: clean. `shellcheck` on both scripts:
clean. markdownlint on the three READMEs: clean.

## Related

- The `STANDARDS_SYNC_APP_*` secrets in the `standards-sync` environment
are still used by the sync workflow. Nothing to remove there.
- Separate from
[#923](#923) (#778 and
#780), which edits a different paragraph of
`components/lychee/README.md`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01VcupojYKhHyDni9LuAXBuX

Co-authored-by: Claude Opus 5.5 <[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.

lychee private-repo exclude inventory drifted again, and a downstream fix was silently reverted

1 participant