Skip to content

Commit 32a3538

Browse files
authored
fix(settings): clone save payloads (#1768)
* docs: add tape systems design * feat(tape): implement view manifest flow * fix: address tape view manifest review feedback * fix(tape): address view manifest review * fix(settings): clone save payloads Serialize renderer config payloads before IPC invokes and restore MCP auto-approve checkbox rendering. * fix(tape): address review feedback Preserve tape view metadata across truncation and resumes, make replay slice hashing deterministic, localize trace fallbacks, and tighten MCP/TraceDialog tests.
1 parent a19e5d6 commit 32a3538

51 files changed

Lines changed: 666 additions & 79 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# DeepChat Tape Baseline Plan
2+
3+
## Approach
4+
5+
Keep the Tape implementation baseline as a goal-scoped architecture document.
6+
Use it as the shared map for the active Tape SDD folders.
7+
8+
## Maintenance
9+
10+
- Keep references to active Tape SDD folders relative to this directory.
11+
- Update the baseline when ownership or runtime flow changes.
12+
- Keep compatibility notes aligned with the current Tape schema.

docs/architecture/deepchat_tape_spec_v1.md renamed to docs/architecture/deepchat-tape-baseline/spec.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# DeepChat Tape System - Implementation Baseline
22

33
Status: current implementation direction. Active SDD goals are
4-
[deepchat-tape-view-manifest](deepchat-tape-view-manifest/spec.md),
5-
[deepchat-tape-replay-contract](deepchat-tape-replay-contract/spec.md), and
6-
[deepchat-tape-view-assembler](deepchat-tape-view-assembler/spec.md), and
7-
[deepchat-tape-view-policy](deepchat-tape-view-policy/spec.md), and
8-
[deepchat-tape-policy-provenance](deepchat-tape-policy-provenance/spec.md), and
9-
[deepchat-tape-policy-selector](deepchat-tape-policy-selector/spec.md).
4+
[deepchat-tape-view-manifest](../deepchat-tape-view-manifest/spec.md),
5+
[deepchat-tape-replay-contract](../deepchat-tape-replay-contract/spec.md), and
6+
[deepchat-tape-view-assembler](../deepchat-tape-view-assembler/spec.md), and
7+
[deepchat-tape-view-policy](../deepchat-tape-view-policy/spec.md), and
8+
[deepchat-tape-policy-provenance](../deepchat-tape-policy-provenance/spec.md), and
9+
[deepchat-tape-policy-selector](../deepchat-tape-policy-selector/spec.md).
1010

1111
This document keeps the Tape vision aligned with the current DeepChat codebase. The implementation
1212
path is:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# DeepChat Tape Baseline Tasks
2+
3+
- [x] Move the baseline spec into a kebab-case architecture folder.
4+
- [x] Update relative links to active Tape SDD folders.
5+
- [x] Update references from the legacy flat architecture path.

docs/architecture/deepchat-tape-policy-selector/plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ TapeViewAssembler.buildTapeResumeView()
2727
| `src/main/presenter/agentRuntimePresenter/tapeViewAssembler.ts` | Resolve default policy through selector. |
2828
| `test/main/presenter/agentRuntimePresenter/tapeViewPolicy.test.ts` | Cover registry and selector behavior. |
2929
| `test/main/presenter/agentRuntimePresenter/tapeViewAssembler.test.ts` | Assert selection reason and injected policy behavior. |
30-
| `docs/architecture/deepchat_tape_spec_v1.md` | Record the selector boundary. |
30+
| `docs/architecture/deepchat-tape-baseline/spec.md` | Record the selector boundary. |
3131

3232
## Compatibility
3333

docs/architecture/deepchat-tape-view-assembler/plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ resumeAssistantMessage()
3636
| `src/main/presenter/agentRuntimePresenter/tapeViewPolicy.ts` | Selection policy boundary used by the assembler. |
3737
| `src/main/presenter/agentRuntimePresenter/index.ts` | Replace direct metadata builder calls with assembler calls. |
3838
| `test/main/presenter/agentRuntimePresenter/tapeViewAssembler.test.ts` | Add chat/resume parity tests. |
39-
| `docs/architecture/deepchat_tape_spec_v1.md` | Update current implementation path and owner table. |
39+
| `docs/architecture/deepchat-tape-baseline/spec.md` | Update current implementation path and owner table. |
4040

4141
## Compatibility
4242

docs/architecture/deepchat-tape-view-policy/plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ TapeViewAssembler.buildTapeResumeView()
2727
| `src/main/presenter/agentRuntimePresenter/tapeViewAssembler.ts` | Delegate selection to `TapeViewPolicy`. |
2828
| `test/main/presenter/agentRuntimePresenter/tapeViewPolicy.test.ts` | Prove legacy policy parity. |
2929
| `test/main/presenter/agentRuntimePresenter/tapeViewAssembler.test.ts` | Assert policy metadata and policy delegation. |
30-
| `docs/architecture/deepchat_tape_spec_v1.md` | Record the new policy boundary. |
30+
| `docs/architecture/deepchat-tape-baseline/spec.md` | Record the new policy boundary. |
3131

3232
## Compatibility
3333

docs/issues/deepchat-tape-view-manifest-pr-review/plan.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Apply the PR review fixes in place, keeping the existing Tape architecture and p
1515
| `TraceDialog.vue` | When a request sequence is selected, only show matching trace/manifest data. |
1616
| `routes.ts` | Replace broad route catalog annotation with `satisfies Record<string, RouteContract>`. |
1717
| i18n `traceDialog.json` | Translate new diagnostic keys for non-English locales and convert Traditional Chinese files. |
18+
| `contextBuilder.ts` | Preserve turn boundaries during emergency truncation. |
19+
| `tapeService.ts` | Exclude replay export timestamps from slice hash inputs. |
20+
| `tapeViewManifest.ts` | Copy included/excluded ref arrays into manifest snapshots. |
1821
| SDD docs | Keep this issue SDD current and address small doc nitpicks. |
1922

2023
## Compatibility
@@ -40,5 +43,7 @@ pnpm run typecheck
4043
pnpm vitest run test/main/presenter/agentRuntimePresenter/agentRuntimePresenter.test.ts
4144
pnpm vitest run test/main/presenter/agentRuntimePresenter/tapeViewAssembler.test.ts
4245
pnpm vitest run test/main/presenter/agentRuntimePresenter/tapeViewManifest.test.ts
46+
pnpm vitest run test/main/presenter/agentRuntimePresenter/tapeService.test.ts
47+
pnpm vitest run test/main/presenter/agentRuntimePresenter/contextBuilder.test.ts
4348
pnpm vitest run test/renderer/components/trace/TraceDialog.test.ts
4449
```

docs/issues/deepchat-tape-view-manifest-pr-review/spec.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Tape ViewManifest PR Review Fixes - Spec
22

3-
Status: active issue-fix SDD for PR #1767 review follow-up.
3+
Status: active issue-fix SDD for PR #1768 review follow-up.
44

55
## Problem
66

7-
PR review identified correctness and localization issues in the Tape ViewManifest flow. Some diagnostics can fail hard instead of degrading gracefully, request/manifest diagnostics can show mismatched request sequences, manifest provenance can record stale summary cursors after context-pressure recovery, resume view assembly can use stale tape history after compaction, route-contract typing loses literal key precision, and newly added TraceDialog labels are not properly localized.
7+
PR review identified correctness and localization issues in the Tape ViewManifest flow. Some diagnostics can fail hard instead of degrading gracefully, request/manifest diagnostics can show mismatched request sequences, manifest provenance can record stale summary cursors after context-pressure recovery, resume view assembly can use stale tape history after compaction, request sequence generation can repeat after resume, replay hashes can include wall-clock time, manifest snapshots can alias caller arrays, and newly added TraceDialog labels are not properly localized.
88

99
## Goals
1010

11-
1. Fix still-valid CodeRabbit review findings for PR #1767 with minimal changes.
11+
1. Fix still-valid CodeRabbit review findings for PR #1768 with minimal changes.
1212
2. Preserve Tape ViewManifest and replay-slice contracts while correcting provenance and diagnostics behavior.
1313
3. Ensure TraceDialog diagnostic strings are localized for every supported non-English locale touched by the PR.
1414
4. Keep route-contract literal key inference intact.
15-
5. Commit the fixes locally without pushing.
15+
5. Commit and push the fixes to the existing PR branch.
1616

1717
## Acceptance Criteria
1818

@@ -25,11 +25,13 @@ PR review identified correctness and localization issues in the Tape ViewManifes
2525
7. `DEEPCHAT_ROUTE_CATALOG` uses `satisfies Record<string, RouteContract>` so route names remain a literal union.
2626
8. TraceDialog diagnostic labels are translated in supported non-English locale files, including Traditional Chinese variants.
2727
9. Review nitpicks that are small and local are addressed without broad refactors.
28-
10. `pnpm run format`, `pnpm run i18n`, and `pnpm run lint` pass or any blocker is documented.
28+
10. Emergency history truncation preserves per-turn metadata associations.
29+
11. Replay slice hashes are deterministic across exports of the same manifest.
30+
12. Manifest included/excluded snapshots are detached from caller-owned arrays.
31+
13. `pnpm run format`, `pnpm run i18n`, and `pnpm run lint` pass or any blocker is documented.
2932

3033
## Constraints
3134

32-
- Do not push changes.
3335
- Do not weaken authentication, authorization, or validation.
3436
- Avoid unrelated refactors and preserve existing presenter boundaries.
3537
- Keep ViewManifest schema compatible.

docs/issues/deepchat-tape-view-manifest-pr-review/tasks.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@
88
- [x] T6: Address local documentation/nitpick comments.
99
- [x] T7: Run format, i18n, lint, and focused validation.
1010
- [x] T8: Stage intentional files and create a local commit without pushing.
11+
- [x] T9: Preserve turn metadata during emergency context truncation.
12+
- [x] T10: Make replay slice hashes deterministic across export times.
13+
- [x] T11: Detach manifest included/excluded snapshots from caller-owned arrays.
14+
- [x] T12: Localize TraceDialog fallback values and Traditional Chinese model labels.
15+
- [x] T13: Restore MCP checkbox test semantics and PascalCase component filename.
16+
- [x] T14: Run required checks, commit, and push the PR branch.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# MCP Server Form Auto Approve Controls Plan
2+
3+
## Approach
4+
5+
Restore the existing checkbox component binding for the MCP server form auto-approve options.
6+
Keep the submitted `MCPServerConfig.autoApprove` shape unchanged.
7+
8+
## Implementation
9+
10+
- Import the shared checkbox component used by the form template.
11+
- Verify edit-mode initial values and submit behavior for read/write permissions.
12+
13+
## Verification
14+
15+
- `pnpm vitest --config vitest.config.renderer.ts test/renderer/components/McpServerForm.test.ts`

0 commit comments

Comments
 (0)