Repository navigation
fix: tighten the windows session-trash removal - #31676
Conversation
621fde8 to
9de3bca
Compare
|
[operator: bolichen97] Backend Tests (Windows) (2) and Backend Tests (3.12, 2) fail on test/test_security_gate_liveness.py::test_the_package_stays_within_its_line_budget. It also fails on origin/main 8dbdf04 with this PR's change rebased on top, and this PR touches nothing in that package. Tracked in #31648; fix in #31625. This PR waits for that fix, then rebases. |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. One thing to subtract: the new trash sweep is a near-copy of the artifact store's pinned sweep. Notes
What this change shipsInventory (7 items) — 5 justifiedIntent: on Windows, emptying the session trash deletes only what is inside the trash. FIX (#7566).
[FIRST-PRINCIPLES-REVIEWED] 8c23512 Description read[DESCRIPTION-READ] fff43ad0df52cd895d6559db3d995aa69c29577d8e007077191d39af7dd72e10 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fix removes the path-based delete itself, using the pinned-directory sweep that main already ships, and Windows CI runs the new tests. Notes
[DESIGN-REVIEWED] 8c23512 Description read[DESCRIPTION-READ] d67e1dfdef42cc42deca7dd2e55c6c4479ffce6ba4d15082431b2207ade0a3b8 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
9de3bca to
a4ac5a0
Compare
|
[operator: bolichen97]
|
|
[operator: bolichen97] Backend Tests (3.12, 7) fails on test/test_pull_request_target_allowlist.py::test_only_the_allowed_workflows_use_pull_request_target (sensitive-change-review.yml). It fails on origin/main 39717a0 too, and this PR touches no workflow. Tracked in #31771. This PR waits for that fix, then rebases. |
a4ac5a0 to
0d40168
Compare
0d40168 to
a603bf9
Compare
|
[operator: bolichen97]
|
a603bf9 to
ed83327
Compare
|
[operator: bolichen97]
|
5243e95 to
21b7d26
Compare
21b7d26 to
dfe4439
Compare
|
[operator: bolichen97] Backend Tests (Windows) (2) and Backend Tests (3.12, 2) fail on test/test_security_gate_liveness.py::test_the_package_stays_within_its_line_budget (package grew to 34855 lines). This PR touches nothing in the security package; the budget is main's. Fix in #32183. This PR waits for it, then rebases. |
On Windows, emptying the session trash removes only what is in the trash. Closes #7566
|
Rebased: main moved in [operator: bolichen97] |
dfe4439 to
8c23512
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved: PR Readiness passed on 8c23512, and all five review lanes (Opus 5.5, GPT 6.1, Design, UX, First Principles) report no blocking finding on this head. No conflict and no open change request.
Problem / Motivation
Goal: On Windows, emptying the session trash removes only what is in the trash.
On Windows the session trash is removed with a path-based delete. That delete can be led out of the trash.
Why it matters
The trash holds the user's old sessions, and its folder is writable by the same user, agents included. A delete that leaves the trash can remove files the user never put there.
Not a goal
What changed (motivation → approach → change)
Windows session storage now removes a trash batch with the pinned-directory sweep main already ships and Windows CI already runs. Each folder is held still while it is emptied, and a link inside the batch is removed as a link and never entered.
A cloud-files or dedup folder is still emptied as the folder it is: the pinned-directory helper in
src/kiro_crew/platform_compat_links.pycan carry its existinglinks_onlychoice down the whole tree, and the platform-compat spec says so.On Windows the helper's file delete checks that the file it opened really sits in the pinned folder, and deletes through that same handle. A folder that became a link in place therefore loses nothing outside.
src/kiro_crew/platform_compat.pyforwards the two new private helpers, as it does for the module's other names.A batch's manifest is removed last, only once everything else went, so a batch that will not go keeps its listing.
Everything else stays as it was: the batch is still renamed aside and its identity checked first, the freed bytes are still measured after the attempt, a batch that will not go is still put back and reported as kept. The session storage spec is updated to describe the sweep.
Backwards compatibility
Compatible: the same batches are removed and kept as before; only how the files inside are reached changes.
Removes nothing: the delete reaches the same entries; nothing a user or caller sees is taken away.
Tests
Proof: PROVEN test/test_platform_compat_refactor_facade.py::test_every_moved_name_is_defined_by_its_owner_and_read_through_the_facade[kiro_crew.platform_compat_links-_win_check_within], test/test_platform_compat_refactor_facade.py::test_every_moved_name_is_defined_by_its_owner_and_read_through_the_facade[kiro_crew.platform_compat_links-_win_final_path], test/test_platform_compat_refactor_facade.py::test_every_moved_name_is_defined_by_its_owner_and_read_through_the_facade[kiro_crew.platform_compat_links-_win_unlink_within], test/test_platform_compat_refactor_facade.py::test_every_moved_name_is_defined_by_its_owner_and_read_through_the_facade[kiro_crew.platform_compat_links-_WIN_FILE_READ_ATTRIBUTES], test/test_platform_compat_refactor_facade.py::test_every_moved_name_is_forwarded_unless_code_still_here_reads_it (head cb18d11f13b2)
prove.py reverts all production hunks at once, so it reports the first tests that fail. Each Windows test was also run by hand on Windows with its own production change reverted: the swapped-in link, the locked-file manifest, the non-link reparse folder and the in-place link conversion each fail, because a file outside the batch is deleted or the batch cannot go, and each passes with the change. Repeats: the touched files pass 3 runs in a row on Windows, in random order.
Manual verification
N/A — the Windows test drives the real delete against a real junction on NTFS.
Related Issues
Closes #7566
Sibling sweep
Swept: git grep -n "shutil.rmtree" -- src/kiro_crew/session_storage.py src/kiro_crew/session_storage_parts/
Sibling: src/kiro_crew/session_storage_parts/batch_removal.py -- changed here
Sibling: src/kiro_crew/session_storage_parts/pinned_delete.py -- changed here
Sibling: src/kiro_crew/session_storage_parts/crew_staging.py:360 -- tracked in #31901
Pattern harvest
Rule candidate: semgrep
Pattern: a path-based recursive delete of an agent-writable tree where the pinned-directory sweep exists
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)