Skip to content

fix(item): split item.rs to satisfy the frozen 2000-line LOC gate - #464

Merged
getappz merged 1 commit into
masterfrom
task/95
Aug 12, 2026
Merged

fix(item): split item.rs to satisfy the frozen 2000-line LOC gate#464
getappz merged 1 commit into
masterfrom
task/95

Conversation

@getappz

@getappz getappz commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Splits crates/agentflare-backend/src/item.rs (2139 lines, over the frozen 2000-line LOC gate) into crates/agentflare-backend/src/item/ — a pure code-motion refactor following this repo's existing mod.rs + sibling-files pattern:

  • mod.rs (126 lines) — types + private DB helpers + module wiring + pub use re-exports (external call sites like agentflare_backend::item::create are unchanged)
  • crud.rs (312), relations.rs (144), search.rs (78), claim.rs (182), tests.rs (1329, moved verbatim)
  • Removes item.rs from scripts/loc-gate.sh's allowlist since every new file is well under even the ordinary 1500-line limit

Rescued from item #95: the dispatched agent's own work was fully done and verified but got stranded by a sandbox regression (.git and the item SQLite DB were read-only in that run, blocking item done/commit/vent). Re-verified locally before opening this PR: cargo fmt --check clean, cargo test -p agentflare-backend — 99 passed, 0 failed, cargo clippy -p agentflare-backend --all-targets -D warnings clean, and scripts/loc-gate.sh no longer flags item.rs (the one pre-existing unrelated item_tests.rs LOC-gate failure is untouched by this diff).

…e blocker completing the handoff — every write path in this sandbox is closed off:

**What I did:** Split `crates/agentflare-backend/src/item.rs` (2139 lines, over the frozen 2000-line LOC gate) into `crates/agentflare-backend/src/item/` — a pure code-motion refactor following this repo's existing `mod.rs` + sibling-files pattern:
- `mod.rs` (126 lines) — types + private DB helpers + module wiring + `pub use` re-exports (external call sites like `agentflare_backend::item::create` are unchanged)
- `crud.rs` (310), `relations.rs` (144), `search.rs` (78), `claim.rs` (182), `tests.rs` (1329, moved verbatim)
- Removed `item.rs` from `scripts/loc-gate.sh`'s allowlist since every new file is well under even the ordinary 1500-line limit

**Verification:** all 99 `agentflare-backend` tests pass (including all 43+ `item` tests), workspace builds clean, clippy clean, `loc-gate.sh` passes on the staged files. The only two failures in a full workspace test run are pre-existing and unrelated (a `ripgrep`-dependent test — `rg` isn't installed here — and a skill-content test in `mcp_prompts.rs`).

**The blocker:** I cannot commit or hand this off. Both `.git` (confirmed via `mount`: bind-mounted read-only inside this worktree) and the agentflare backend's own SQLite item database are read-only in this sandbox:
- `git add`/`git rm` fail: `Unable to create '.../index.lock': Read-only file system`
- `mcp__flare__item action=done` and `action=heartbeat` both fail: `attempt to write a readonly database`
- Even `mcp__flare__vent` (meant for exactly this situation) failed the same way trying to log the report

Every persistence channel available to me is blocked — this looks like a regression from the recent bwrap-sandboxing change (#445 in the log), now over-restricting the coding-agent subprocess to the point it can't fulfill its own commit/done contract. The finished, verified code is sitting uncommitted in `/home/avihs/projects/agentflare/.worktrees/task/95/crates/agentflare-backend/src/item/` and `scripts/loc-gate.sh` — someone with write access to that worktree's `.git` (or a fixed sandbox config) needs to commit it. I did not attempt the `#30`/`#93` rebase-coordination comments since posting comments requires the same blocked write path.

Agentflare-Branch: task/95
Agentflare-Item: 95
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 21 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3d18ffd2-e4ae-4d42-9303-1e5ee4154293

📥 Commits

Reviewing files that changed from the base of the PR and between 058c045 and 77ab08c.

📒 Files selected for processing (8)
  • crates/agentflare-backend/src/item.rs
  • crates/agentflare-backend/src/item/claim.rs
  • crates/agentflare-backend/src/item/crud.rs
  • crates/agentflare-backend/src/item/mod.rs
  • crates/agentflare-backend/src/item/relations.rs
  • crates/agentflare-backend/src/item/search.rs
  • crates/agentflare-backend/src/item/tests.rs
  • scripts/loc-gate.sh

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

@getappz
getappz merged commit 8aa2da2 into master Aug 12, 2026
17 checks passed
@getappz
getappz deleted the task/95 branch August 12, 2026 13:00
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