chore: add npm run fallow:ci script with --changed-since scoping#48
Merged
chore: add npm run fallow:ci script with --changed-since scoping#48
Conversation
CI's codebase-health job runs fallow with `--changed-since <PR-base-sha>`, which scopes findings to the diff. The plain `npx fallow` command runs project-wide, which sometimes behaves differently than the CI invocation and lets dupes through that CI later catches. Add `scripts/fallow-ci.sh` (wired up as `npm run fallow:ci`) that fetches origin/main, computes the merge-base with HEAD, and runs fallow with the same `--changed-since` scoping CI uses. Honest documentation in CONTRIBUTING.md: the script catches most issues locally, but there's an empirically observed platform gap where fallow's clone detector returns different results on Linux x64 (CI) vs macOS arm64 (local). When CI flags something you can't reproduce locally, dedupe by intent and re-push.
…eam/main Two issues codex flagged on PR #48: 1. The unreachable-fallback bug. `BASE_SHA=$(git merge-base ...)` runs under set -e, so a non-zero exit from git merge-base would terminate the script before the empty-string fallback ran. Added `|| true` to the command substitution so the fallback path is reachable. 2. Fork-aware base resolution. CONTRIBUTING.md describes a fork-and-PR workflow where `origin` is the contributor's fork. CI compares against atomicmemory/main, but `git merge-base origin/main HEAD` on a fork would compare against the fork's main, which can drift from canonical. The script now prefers `upstream/main` when an `upstream` remote exists, falls back to `origin/main` otherwise. Documented the `git remote add upstream ...` setup step in CONTRIBUTING.md.
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
Adds
npm run fallow:ci(backed byscripts/fallow-ci.sh) that runsfallowwith the same--changed-since <PR-base-sha>scoping the GitHub Action uses, so contributors can catch most CI fallow findings before pushing.```bash
npm run fallow:ci
→ fetches origin/main, computes merge-base, runs:
npx fallow --root . --format human --changed-since
```
Why
Over the last batch of PRs (#44/#45/#47) we hit four rounds of fallow CI failures that local `npx fallow` ran clean for. Investigation: CI passes `--changed-since ` (auto-detected by `fallow-rs/fallow@v2`), and that scoping matters for which clones get reported. Local invocations without it analyze the whole tree at slightly different sensitivity.
Honest caveat (documented in CONTRIBUTING.md)
Even with this script, there's a residual parity gap: empirically, fallow 2.42.0's clone detector sometimes returns different results across platforms (CI Linux x64 vs developer macOS arm64) on the same commit, same flags, same fallow version, fresh `npm ci`, clean cache. I couldn't fully reverse-engineer it. The script catches most of what CI flags; when CI flags a clone you can't reproduce locally, dedupe by intent and re-push.
Test plan