fix: ignore Anchor's .anchor/ generated directory (closes #67)#68
Open
tomazzi14 wants to merge 1 commit into
Open
fix: ignore Anchor's .anchor/ generated directory (closes #67)#68tomazzi14 wants to merge 1 commit into
.anchor/ generated directory (closes #67)#68tomazzi14 wants to merge 1 commit into
Conversation
`packages/diff-filter` already filtered Cargo's `target/` but missed
`.anchor/` — the directory the Anchor framework writes during
`anchor build` / `anchor test` (test-ledger state, program-test
snapshots, IDL caches).
This repo uses Anchor at `contracts/solana/`, so PRs touching the
escrow program were leaking regenerated ledger artifacts into the
diff Sonnet scored. The fix is a one-line addition to
`GENERATED_DIR_PREFIXES`; the existing nested-prefix check (`includes("/" + prefix)`)
covers the realistic path `contracts/solana/.anchor/...` for free.
Tests added in `classify.test.ts`:
- `.anchor/test-ledger/genesis.bin` (top-level)
- `contracts/solana/.anchor/test-ledger/...` (nested, the actual repo path)
- `contracts/solana/.anchor/program-logs/...`
71/71 in @ghbounty/diff-filter pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
Adds
.anchor/toGENERATED_DIR_PREFIXESinpackages/diff-filterso Anchor framework artifacts (test-ledger state, program-test snapshots, IDL caches) don't leak into PR diffs scored by Sonnet.Closes #67.
Why
target/(Cargo) was already in the list, but.anchor/is regenerated separately byanchor build/anchor testand lives next to it. Since this repo uses Anchor atcontracts/solana/, every PR touching the escrow program was sending regenerated ledger artifacts to the AI scorer.Changes
packages/diff-filter/src/patterns.ts— one-line addition (.anchor/) toGENERATED_DIR_PREFIXESwith a doc comment explaining the relationship to Cargo'starget/.packages/diff-filter/tests/classify.test.ts— three new test cases:.anchor/test-ledger/genesis.bin(top-level)contracts/solana/.anchor/test-ledger/rocksdb/CURRENT(nested, mirrors the real repo path)contracts/solana/.anchor/program-logs/escrow.log(nested log dir)The existing nested-prefix matcher in
classifyPath(normalized.includes("/" + prefix)) handles the realisticcontracts/solana/.anchor/...path for free — no behavior changes there, the new entry just plugs into the existing logic.Test plan
pnpm --filter @ghbounty/diff-filter test→ 71/71 pass (3 new + 68 existing)pnpm typecheckclean across the workspacepnpm testno regressionsclassifyPath("contracts/solana/.anchor/test-ledger/genesis.bin")returns{ ignore: true, reason: "generated_dir" }Out of scope
.solana/,solana-test-validator-*ledgers created outside the workspace). Open separate issues if those show up in real PRs.target/idl/*.json(already covered by the existingtarget/prefix).🤖 Generated with Claude Code