Skip to content

chore(gitignore): match nested target/ for all crates, not just the repo root#296

Merged
hyperpolymath merged 1 commit into
mainfrom
gitignore-nested-target
May 20, 2026
Merged

chore(gitignore): match nested target/ for all crates, not just the repo root#296
hyperpolymath merged 1 commit into
mainfrom
gitignore-nested-target

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Summary

  • The repo has 7 Rust crates besides the workspace root (affinescriptiser/, runtime/, distributions/rattlescript/, tools/affine-doc/, tools/affine-pkg/, tools/affinescript-dap/, tools/affinescript-lsp/). Each builds to its own sibling target/.
  • The previous rule /target/ was anchored to the repo root and only caught one of the seven. git status was showing e.g. tools/affinescript-lsp/target/ as untracked across several sessions, one stray git add . away from committing ~100 MB of build output.
  • Drop the leading slash so target/ matches anywhere — the standard Rust convention.

Why not unanchor the others too

Only the Rust target/ has the nested-crate problem. /_build/ stays anchored: there's exactly one OCaml dune build dir at the root, and an unanchored _build/ could over-match user code that happens to live in a directory called _build. Same reasoning for the other anchored entries.

Verification

After the fix, git check-ignore confirms the nested dirs are now ignored:

$ git check-ignore tools/affinescript-lsp/target/ runtime/target/ affinescriptiser/target/
tools/affinescript-lsp/target/
runtime/target/
affinescriptiser/target/

Test plan

  • git check-ignore returns each nested target/ path
  • CI: no behavioural change expected (this only affects what git status shows and what git add . accidentally stages)

🤖 Generated with Claude Code

…epo root

The repo has 7 Rust crates besides the root:

  affinescriptiser/, runtime/, distributions/rattlescript/,
  tools/affine-doc/, tools/affine-pkg/, tools/affinescript-dap/,
  tools/affinescript-lsp/

Each builds to its own sibling `target/` directory.  The previous rule
`/target/` was anchored to the repo root and only caught one of the
seven — `git status` was showing e.g. `tools/affinescript-lsp/target/`
as untracked across several sessions, one stray `git add .` away from
committing ~100 MB of build output.

Drop the leading slash so the rule matches `target/` anywhere — the
standard Rust convention.  No other glob change; the OCaml `/_build/`
remains anchored (we only have one `_build/`, at the root, and a
non-anchored `_build/` would over-match user code).

Verified post-fix that all three checked nested target/ dirs are now
ignored (`git check-ignore` returns the path).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 40 issues detected

Severity Count
🔴 Critical 12
🟠 High 16
🟡 Medium 12

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Stray AI.a2ml in root -- use 0-AI-MANIFEST.a2ml only",
    "type": "banned",
    "file": "AI.a2ml",
    "action": "delete",
    "rule_module": "root_hygiene",
    "severity": "high"
  },
  {
    "reason": "Superseded by 0-AI-MANIFEST.a2ml",
    "type": "banned",
    "file": "AI.djot",
    "action": "delete",
    "rule_module": "root_hygiene",
    "severity": "high"
  },
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Action actions/checkout@v4 needs attention",
    "type": "unpinned_action",
    "file": "publish-jsr.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action denoland/setup-deno@v2 needs attention",
    "type": "unpinned_action",
    "file": "publish-jsr.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/example/smoke_driver.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/cli.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@hyperpolymath hyperpolymath merged commit 686adc1 into main May 20, 2026
15 checks passed
@hyperpolymath hyperpolymath deleted the gitignore-nested-target branch May 20, 2026 06:53
hyperpolymath added a commit that referenced this pull request May 20, 2026
`affinescript.install` (and any sibling `*.install` files for future
opam packages declared in `dune-project`) is regenerated by dune on
every `dune build`.  It was showing up as untracked across recent
sessions, one stray `git add .` away from being committed alongside
the regular source changes.

`*.install` is the standard pattern: dune emits one per `(package ...)`
declaration in `dune-project`, and they're consumed only by opam during
install — not durable repo content.  Same shape as the previous
`target/` glob fix (#296) — match anywhere, not just the repo root, so
any future nested opam package's `.install` file is covered too.

Verified post-fix: `git check-ignore affinescript.install` returns the
path; `git status` no longer lists it as untracked.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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