Repository navigation
fix(project): project_dirs honours soft-delete and archive; expose project archive/unarchive (#768) - #943
Merged
getappz merged 1 commit intoOct 21, 2026
Conversation
…oject archive/unarchive (#768) `project_dir::list` was a bare SELECT, so a soft-deleted project's folder row (only a hard delete cascades) and an archived project's (nothing read `archived_at`) were swept every discovery tick. 29 stale Temp\.tmp* registrations flooded `agentflare daemon logs` with "folder does not exist" every tick. - `project_dir::list` joins `projects` and skips deleted/archived ones; `list_all` keeps the raw table for folder/item -> project lookups (`flare doctor`, item controls). - `project::delete` also removes the `project_dirs` row, in one transaction. - `project::archive` / `unarchive`, exposed as `agentflare project archive|unarchive <name|id>` and MCP `project action=archive|unarchive` (`project` = name or UUID, default: this repo's project). Unarchive needs no re-registration. - The missing-folder line is logged once per project per daemon session, and again only after the folder has come back and gone missing again. Agentflare-Agent: claude-code Agentflare-Branch: task/768-project-dirs-survives-project-soft-delet Agentflare-Item: 768 Agentflare-Session: e4957d62-33fe-4989-9971-ea9f52c41af2
Owner
Author
|
Tracking this PR for automated review ( |
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
agentflare daemon logswas flooded (3,100+ lines) withproject <id> is registered at Temp\.tmpXXXX but that folder does not exist— 29 soft-deleted trial projects × every discovery tick.project_dir::listwas a bareSELECToverproject_dirs: soft-delete never removed the row (only a hard delete cascades) andprojects.archived_atwas never read anywhere, so archiving had no effect on dispatch.project_dir::listjoinsprojectsand skipsdeleted_at/archived_atrows (used by the discovery tick and review sweep).list_allkeeps the raw table for folder/item → project lookups (flare doctor, item controls), which must keep working inside an archived checkout.project::deletealso removes theproject_dirsrow, in the same transaction.project::archive/unarchivein the backend, exposed asagentflare project archive|unarchive <name|id>and MCPproject action=archive|unarchive(project= name or UUID, default: this repo's project). Archive is idempotent and keeps the original stamp. Unarchive needs no re-registration since the dir row is left in place.agentflare project listnow includesarchived_at.Test plan
cargo fmt --all --check— cleancargo clippy --locked --workspace --all-targets --all-features -- -D warnings -A unsafe_code -A clippy::pedantic— cleancargo test -p agentflare-backend project— 22 passed (new:listhides archived + soft-deleted rows whilelist_allkeeps them; soft-delete removes the dir row; archive idempotent / unarchive clears / archive on deleted → NotFound)cargo test --bin agentflare -- project_tests project_rejects multi_project_sweep project_resolution— passed (new: discovery tick skips archived and soft-deleted projects; missing-folder note fires once until the folder is back; MCP archive by name hides the folder from the sweep list, project stays listed, unarchive by UUID restores it, unknown project → invalid_params)cargo test --workspaceran there; locally it exceeded the 10-minute foreground budget on Windows)Notes for reviewers
project_dir::listnow sees only active projects. The two callers that map a folder or item back to its project (cli/git.rsrepo-root lookup,job_controls::mcp_for_item) were switched tolist_allso an archived project's checkout and item controls keep resolving.archived_atalready existed). Existing staleproject_dirsrows of soft-deleted projects are filtered out by the join; the 29 from the incident were already removed by hand. TheprojectMCP request gains an optionalprojectfield with#[serde(default)], so existinginfo/listcalls are unaffected.collect_review_batches) relies on the samelistfilter but has no dedicated archived-project test; the discovery-tick test covers the shared path.Agentflare item #768.