Skip to content

fix(ci): loc-gate.sh scans git-tracked files only, skip hidden folders - #236

Merged
getappz merged 1 commit into
masterfrom
fix/loc-gate-traversal-bug
Jul 18, 2026
Merged

fix(ci): loc-gate.sh scans git-tracked files only, skip hidden folders#236
getappz merged 1 commit into
masterfrom
fix/loc-gate-traversal-bug

Conversation

@getappz

@getappz getappz commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • scripts/loc-gate.sh's traversal only pruned the top-level ./target, so running it from repo root also walked .competitive-audit/ (a scratch clone of unrelated external repos) and nested target/ dirs inside other worktrees, both flagged as false positives
  • Switched to git ls-files -- '*.rs', which scans tracked files only and structurally can't include either; added a hidden-folder skip as defense in depth
  • Not wired into CI yet — src/mcp_server.rs is currently 7249 lines (3.6x over its own frozen 2000-line ceiling in the gate's allowlist), so turning the gate on today would fail on pre-existing debt rather than new violations. Tracked as item feat: asset MCP tool — attach/get/list/delete with storage, dedup, and tests #168 (split the file); CI wiring is a follow-up once that lands.

Test plan

  • Ran bash scripts/loc-gate.sh before and after the fix; false positives from .competitive-audit/nested worktree target dirs are gone, only the real src/mcp_server.rs violation remains

Summary by CodeRabbit

  • Bug Fixes
    • Updated Rust line-limit checks to scan only tracked, non-hidden files.
    • Prevented build artifacts, vendor content, untracked files, and worktree content from being checked.
    • Added clearer handling when the file-listing operation fails.
    • Preserved existing limits and allowlist validation behavior.

find . -path ./target -prune only excluded the top-level target/, so
running it from repo root also walked .competitive-audit/ (scratch
clone of unrelated external repos) and nested target/ dirs inside
other worktrees, both flagged as false positives. git ls-files scans
tracked files only, which structurally can't include either.
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 866d5a3b-4cea-49da-9b62-2710f7862154

📥 Commits

Reviewing files that changed from the base of the PR and between aa4ae5d and 24cb4a8.

📒 Files selected for processing (1)
  • scripts/loc-gate.sh

📝 Walkthrough

Walkthrough

The LOC gate now derives Rust files from Git’s tracked-file list, skips hidden paths, fails explicitly if discovery fails, and applies the existing limits and allowlist checks to the resulting files.

Changes

LOC gate file selection

Layer / File(s) Summary
Tracked Rust discovery and enforcement
scripts/loc-gate.sh
Uses git ls-files to enumerate tracked Rust files, skips hidden paths, reports discovery failures, and preserves existing LOC limit and allowlist enforcement.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: limiting loc-gate.sh to git-tracked Rust files and skipping hidden folders.
Description check ✅ Passed The PR includes Summary and Test plan, and covers why and how it was tested; only the Notes for reviewers section is missing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/loc-gate-traversal-bug

Comment @coderabbitai help to get the list of available commands.

@getappz
getappz merged commit 6ef921d into master Jul 18, 2026
16 checks passed
@getappz
getappz deleted the fix/loc-gate-traversal-bug branch July 18, 2026 04:26
getappz added a commit that referenced this pull request Jul 29, 2026
…icate-item reuse, assignee freeze (#365)

* feat(handoff): verified continuation commit, structured payload, duplicate-item reuse, assignee freeze

Item #236 (handoff hardening, QuorumGit adoption):

- HandoffRequest gains last_commit: verified via `git cat-file -e` and,
  when the item's task/<seq> branch already exists, `git merge-base
  --is-ancestor` -- a fabricated or unreachable OID is rejected, not
  trusted.
- HandoffRequest gains required completed/remaining and optional
  blockers fields, stored in the asset's metadata.
- A handoff without item_id now reuses an existing open item assigned
  to the recipient (matched by name or thread_id) instead of blindly
  creating a duplicate; genuinely new work still auto-creates.
- agentflare_backend::item::claim gains a BlockedByAssignee outcome:
  a freshly handed-off, never-claimed item can only be claimed by its
  assignee until accepted, excluding completed/cancelled items.

Deferred: shim-side branch-push denial for open handoffs (spec's own
review already downgraded this to defense-in-depth, covered in large
part by #234's scope enforcement and the opencode branch-guard plugin).

* fix(handoff): fmt, canonicalize claim owner, validate commit oid/payload off the DB lock (#366)

- cargo fmt (item.rs claim closure, types.rs schemars doc attr)
- item::claim: canonicalize both sides of the assignee/owner comparison so
  an alias owner (claude:1) isn't wrongly BlockedByAssignee against its own
  canonical handoff assignee (claude-code)
- verify_continuation_commit: resolve the target branch under the backend
  DB lock, then run all git subprocess checks after releasing it, matching
  the existing item_claim split; validate oid is a plain hex id and force
  commit-type resolution (oid^{commit}) so a non-hex/flag-like value or a
  blob/tree/tag can't pass as a continuation commit
- handoff_impl: reject empty completed/remaining instead of silently
  accepting an empty structured payload
- mcp_prompts: document completed/remaining as required handoff fields
  so generated requests don't fail deserialization

* fix(test): stop with_temp_home_clears_the_override_env_var_after_returning from racing concurrent with_temp_home callers

The assertion read AGENTFLARE_HOME_OVERRIDE outside GLOBAL_STATE_LOCK,
the lock that guards every set/remove of it. A concurrent thread's own
correctly-scoped with_temp_home call could be transiently holding the
var set at the exact moment this test read it, flaking the check on a
var this test was never entitled to observe in the first place. Fix:
acquire the same lock before reading.
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