-
Notifications
You must be signed in to change notification settings - Fork 253
feat(fws): file-write safety series — trial build (all 15 component PRs) #1413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
easonLiangWorldedtech
wants to merge
62
commits into
Zoo-Code-Org:main
Choose a base branch
from
easonLiangWorldedtech:feat/fws-trial-all
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
e11ef14
fix(mcp): preserve concurrent MCP settings during initial creation (f…
easonliang28 4ab3bf4
perf(write-path): remove artificial write delays by default (part of …
easonliang28 352df16
fix(task): guard saveClineMessages against abandoned tasks (fixes #1021)
easonliang28 3f8db83
test(webview): cover writeDelayMs in getStateToPostToWebview
easonliang28 ce34d48
test(task): document double assertion in abandoned-guard test
easonliang28 332253a
test(mcp): cover getMcpSettingsFilePath fallback branches
easonliang28 44b6791
test(dv): assert default saveChanges delay via DEFAULT_WRITE_DELAY_MS
easonliang28 131d18d
feat(file-safety): add version token for the guarded-write path (A1, …
easonliang28 13188d2
docs(file-safety): correct ino precision bounds in version token (A1,…
easonliang28 2c1582b
fix(file-safety): derive the version token from exact BigInt stats (A…
easonliang28 a3c6f86
feat(experiments): make chat-diff the default approval path (L2, #1375)
easonliang28 165bff4
test(experiments): cover unset-experiment default routing in all writ…
easonliang28 c0ef476
test(experiments): add explicit enabled-state routing tests for chat-…
easonliang28 2965ad1
feat(task): per-task file observation registry (A2, #1375)
easonliang28 a37dd24
feat(file-safety): atomic text publish primitive + safeWriteJson refa…
easonliang28 991ab69
feat(editor): async post-save diagnostics on chat-diff save path (L1,…
easonliang28 3dd8700
feat(file-safety): add version token for the guarded-write path (A1, …
easonliang28 ba1332e
docs(file-safety): correct ino precision bounds in version token (A1,…
easonliang28 6813013
fix(file-safety): derive the version token from exact BigInt stats (A…
easonliang28 588b95f
feat(task): per-task file observation registry (A2, #1375)
easonliang28 7a25fc0
feat(tools): guarded write CAS core with per-path FIFO chain (S4a, #1…
easonliang28 68be264
feat(tools): wire guarded writes into the diff-view save paths (S4b, …
easonliang28 abfbe7f
feat(checkpoints): per-write checkpoints, task-start baseline, and pe…
easonliang28 93a8329
feat(checkpoints): per-task change journal with torn-tail repair (B2,…
easonliang28 2500ab3
feat(checkpoints): per-step change cards and changeCardDetail setting…
easonliang28 d0c60bf
feat(checkpoints): per-file and per-step rollback service (B3c, #1375)
easonliang28 4c16c00
feat(webview): change cards UI and rollback buttons (B3b, #1375)
easonliang28 c3f4484
merge: file-write-safety trial — include PR #1380
easonliang28 490f27f
merge: file-write-safety trial — include PR #1381
easonliang28 95f3023
merge: file-write-safety trial — include PR #1382
easonliang28 3afa66a
merge: file-write-safety trial — include PR #1383
easonliang28 558afa7
merge: file-write-safety trial — include PR #1395
easonliang28 71d3ab5
merge: file-write-safety trial — include PR #1394
easonliang28 d786497
merge: file-write-safety trial — include PR #1405
easonliang28 d8cf26d
merge: file-write-safety trial — include PR #1403
easonliang28 8fcf0a9
merge: file-write-safety trial — include PR #1384
easonliang28 02cad7e
merge: file-write-safety trial — include PR #1408 (S4b guarded-write …
easonliang28 201174a
merge: file-write-safety trial — include PR #1412 (B stack: B1+B2+B3a…
easonliang28 6a0feb1
test(trial): reconcile write-tool specs with the composed L2 default …
easonliang28 376e013
test(trial): compose the L2 default with the edit/write specs and rec…
easonliang28 178e6f4
fix(fws): address CodeRabbit findings on the trial aggregate
easonliang28 d2239ce
fix(fws): contain symlinked restoreFile targets (CodeRabbit security …
easonliang28 4fc14c4
fix(fws): address CodeRabbit round-4 findings (unknown guard + pre-hy…
easonliang28 0e021ef
fix(fws): change-card step resolution, Tailwind v4 grow, sibling sett…
easonliang28 9b0787a
fix(fws): test the pre-hydration change-card detail default
easonliang28 1f36d80
feat(fws): record per-write checkpoint and change card for apply_diff…
easonliang28 7f6d136
feat(fws): add per-file open-in-editor control to change cards (B3b, …
easonliang28 94fea2f
test(fws): keep the apply_diff change-card spec green on the trial st…
easonliang28 aa1a214
merge: file-write-safety trial — re-include updated PR #1411 (apply_d…
easonliang28 3c5dfa3
merge: file-write-safety trial — re-include updated PR #1412 (change-…
easonliang28 c48522c
fix(fws): use a native button for the compact-row open-file control (…
easonliang28 83d83a3
merge: file-write-safety trial — re-include updated PR #1412 (native-…
easonliang28 341a9c2
test(fws): assert the perWriteCheckpoints initializer default alongsi…
easonliang28 502f8ca
fix(fws): type VSCodeCheckbox change events and the settings test dou…
easonliang28 2bd79a4
merge: file-write-safety trial — re-include updated PR #1411 (perWrit…
easonliang28 eaabaa0
merge: file-write-safety trial — re-include updated PR #1412 (typed c…
easonliang28 67d8525
feat(fws): edit and search_replace writes now record the per-write ch…
easonliang28 d6d08e8
merge: file-write-safety trial — re-include updated PR #1411 (edit + …
easonliang28 f0f3313
fix(checkpoints): roll change-card files back to their pre-step state…
easonliang28 7591bc8
feat(webview): add per-file restore-latest to change cards and correc…
easonliang28 779cb4b
ci: retry mocked E2E (flaky 30s timeout in subtask approvals test, no…
easonliang28 22a3f33
merge: file-write-safety trial — addendum 10 (CodeRabbit review fixes…
easonliang28 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| import { describe, expect, it } from "vitest" | ||
|
|
||
| import type { ChangeCardData } from "@roo-code/types" | ||
|
|
||
| import { | ||
| buildChangeCard, | ||
| buildChangeCardPayload, | ||
| isAutoApprovedStep, | ||
| resolveChangeCardDetail, | ||
| type ChangeCardWrite, | ||
| } from "../changeCard" | ||
|
|
||
| describe("changeCard (B3a)", () => { | ||
| function write(overrides: Partial<ChangeCardWrite> = {}): ChangeCardWrite { | ||
| return { | ||
| path: "src/a.ts", | ||
| diffStats: { additions: 2, deletions: 1 }, | ||
| diff: "--- a/src/a.ts\n+++ b/src/a.ts\n@@ -1 +1,2 @@\n-old\n+new-1\n+new-2", | ||
| ...overrides, | ||
| } | ||
| } | ||
|
|
||
| describe("isAutoApprovedStep", () => { | ||
| it("returns false for an empty step", () => { | ||
| expect(isAutoApprovedStep([])).toBe(false) | ||
| }) | ||
|
|
||
| it("returns true only when every write was auto-approved", () => { | ||
| expect(isAutoApprovedStep([write({ autoApproved: true }), write({ autoApproved: true })])).toBe(true) | ||
| expect(isAutoApprovedStep([write({ autoApproved: true }), write()])).toBe(false) | ||
| expect(isAutoApprovedStep([write()])).toBe(false) | ||
| }) | ||
| }) | ||
|
|
||
| describe("resolveChangeCardDetail", () => { | ||
| it("forces summary for auto-approved steps even when the setting is full", () => { | ||
| const writes = [write({ autoApproved: true })] | ||
| expect(resolveChangeCardDetail(writes, "full")).toBe("summary") | ||
| expect(resolveChangeCardDetail(writes, undefined)).toBe("summary") | ||
| }) | ||
|
|
||
| it("follows the setting for interactive steps, defaulting to summary when unset", () => { | ||
| const writes = [write()] | ||
| expect(resolveChangeCardDetail(writes, "full")).toBe("full") | ||
| expect(resolveChangeCardDetail(writes, "summary")).toBe("summary") | ||
| expect(resolveChangeCardDetail(writes, undefined)).toBe("summary") | ||
| }) | ||
| }) | ||
|
|
||
| describe("buildChangeCard", () => { | ||
| it("carries the inline diff per file for full detail on a multi-file step", () => { | ||
| const card = buildChangeCard( | ||
| "sha-1", | ||
| [write(), write({ path: "src/b.ts", diffStats: { additions: 1, deletions: 0 }, diff: "+b" })], | ||
| "full", | ||
| ) | ||
|
|
||
| expect(card).toEqual({ | ||
| checkpointIds: ["sha-1"], | ||
| files: [ | ||
| { | ||
| path: "src/a.ts", | ||
| additions: 2, | ||
| deletions: 1, | ||
| diff: "--- a/src/a.ts\n+++ b/src/a.ts\n@@ -1 +1,2 @@\n-old\n+new-1\n+new-2", | ||
| }, | ||
| { path: "src/b.ts", additions: 1, deletions: 0, diff: "+b" }, | ||
| ], | ||
| totalFiles: 2, | ||
| detail: "full", | ||
| }) | ||
| }) | ||
|
|
||
| it("omits the diff per file for summary detail (lazy fetch is B3b)", () => { | ||
| const card = buildChangeCard("sha-1", [write()], "summary") | ||
|
|
||
| expect(card.files).toEqual([{ path: "src/a.ts", additions: 2, deletions: 1 }]) | ||
| expect(card.files[0]).not.toHaveProperty("diff") | ||
| expect(card.detail).toBe("summary") | ||
| expect(card.totalFiles).toBe(1) | ||
| }) | ||
|
|
||
| it("defaults missing diffStats to zero counts and keeps full detail without diff for a write without one", () => { | ||
| const card = buildChangeCard("sha-1", [write({ diffStats: undefined, diff: undefined })], "full") | ||
|
|
||
| expect(card.files[0]).toEqual({ path: "src/a.ts", additions: 0, deletions: 0 }) | ||
| }) | ||
| }) | ||
|
|
||
| describe("buildChangeCardPayload", () => { | ||
| it("resolves the detail level and builds the payload in one call", () => { | ||
| // The expectations are typed against the shared ChangeCardData | ||
| // contract in @roo-code/types, so the builder's output is checked | ||
| // against the same single source of truth the webview consumes. | ||
| // Interactive step with the full setting: diff inline. | ||
| const full: ChangeCardData = buildChangeCardPayload("sha-1", [write()], "full") | ||
| expect(full.detail).toBe("full") | ||
| expect(full.files[0].diff).toBe("--- a/src/a.ts\n+++ b/src/a.ts\n@@ -1 +1,2 @@\n-old\n+new-1\n+new-2") | ||
|
|
||
| // Auto-approved step with the full setting: compact summary, no diff. | ||
| const compact: ChangeCardData = buildChangeCardPayload("sha-1", [write({ autoApproved: true })], "full") | ||
| expect(compact.detail).toBe("summary") | ||
| expect(compact.files[0]).not.toHaveProperty("diff") | ||
| expect(compact.checkpointIds).toEqual(["sha-1"]) | ||
| expect(compact.totalFiles).toBe(1) | ||
| }) | ||
| }) | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.