Skip to content

Thin Fork: auto-archive queries move into their own module - #45

Merged
ziyadakl merged 3 commits into
spec107/integrationfrom
spec107/auto-archive
Nov 3, 2026
Merged

ziyadakl merged 3 commits into
spec107/integrationfrom
spec107/auto-archive

Conversation

@ziyadakl

@ziyadakl ziyadakl commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Part of ziyadakl/tokenmaxxing#117 (spec pingdotgg#107).

Summary

Auto-archive's database queries leave Upstream's ProjectionStore.ts; its settings UI leaves the Upstream settings files. Behaviour is unchanged.

apps/server/src/orchestration-v2/
├── ProjectionStore.ts          # -134 lines: no archive code left (also drops a stray Upstream doc comment absent at MB and upstream/main)
├── ThreadArchiveQueries.ts     # NEW: ThreadArchiveQueries service + layer (SQL moved verbatim, read-only)
├── ThreadArchiveService.ts     # reads ThreadArchiveQueries; new layerWorker (moved from server.ts)
└── ThreadArchiveQueries.test.ts# NEW: candidate SQL tests, moved from ProjectionSettlement.test.ts
apps/web/src/components/settings/
├── AutoArchiveSettingsRows.tsx # NEW: the two rows, own days input, restore label/defaults
├── autoArchiveSettingsSearch.ts# NEW: the two search entries (own file, so no runtime import cycle)
└── SettingsPanels.tsx          # 1 import + 3 seam lines; Upstream's AutoSettleDaysInput restored
apps/mobile/src/features/settings/
├── autoArchiveSettings.ts      # NEW: supportsAutoArchive, plan wrapper over Upstream's planAutoSettleSettingsSync, banner text
├── AutoArchiveSection.tsx      # NEW: the section (own file; the logic file stays free of react-native)
└── autoSettleSettingsSync.ts   # back to Upstream exactly
-const layerThreadArchiveWorker = Layer.effectDiscard(...).pipe(Layer.provide(ProjectionStoreV2.layer), ...)   // server.ts
+ThreadArchiveService.layerWorker,                                                                              // server.ts, one entry

Also: stray worktreeSettledAfterDays: null in contracts/settings.test.ts reverted to Upstream's text; default 7 inlined in contracts/settings.ts; SettingInheritance.tsx shrunk to two inline comparisons; ProjectionSettlement.test.ts, ProviderTurnControlService.test.ts, autoSettleSettingsSync(.test).ts, SettingInheritance.test.ts, sharedSettings.test.ts are back to Upstream. Their auto-archive tests moved to fork test files, assertions unchanged.

Test wiring changes (fork-owned tests, assertions unchanged): ThreadArchiveService.test.ts mocks ThreadArchiveQueries instead of ProjectionStoreV2; ThreadArchive.integration.test.ts provides ThreadArchiveQueries.layer on the in-memory database. ThreadArchiveService.layer keeps needing ThreadArchiveQueries (so tests can mock it); layerWorker provides it.

Evidence

  • Footprint (Upstream files the Fork edits, git diff --no-renames --numstat --diff-filter=MD $MB HEAD):
    Before: 181 files, +13889 -2908 After: 175 files, +13347 -2896
  • This feature alone (21 shared files, lines matching archive identifiers): 22 files / 206 lines before, 14 files / 58 lines after. Six files leave the footprint outright: ProjectionSettlement.test.ts, ProviderTurnControlService.test.ts, autoSettleSettingsSync.ts, autoSettleSettingsSync.test.ts, SettingInheritance.test.ts, sharedSettings.test.ts. ProjectionStore.ts stays in it for rewind and /compact.
  • Tests (Node 24 locally): server ThreadArchiveService, ThreadArchive.integration, ThreadArchiveQueries, ProjectionSettlement, ProviderTurnControlService: 17 passed before the move, 17 after. contracts settings + customSettings: 41 passed. client-runtime src/state/: 775 passed. web settingsSearch, SettingInheritance, autoArchiveSettingsSearch, autoArchiveSettingInheritance: 33 passed. mobile src/features/settings/: 68 passed.
  • Checks run: pnpm run typecheck (all packages), vp check (0 errors), pnpm run knip:check: clean.
  • Not run: full CI, mobile native static analysis, a running server (the worker wiring is covered by typecheck and the integration test's layer, not by booting server.ts).

Merge Danger

Door: two-way. No schema, migration or stored-data change; revert restores the old layout.

Blast Radius: auto-archive sweep and cascade, the Settings > Threads rows, mobile Thread settings. The SQL is moved verbatim and still runs read-only. ThreadArchiveService.make and ThreadArchiveQueries.make are no longer exported (knip). Slice 2 (sidebar groups) edits the same settings files, and slice 5 (rewind) the other region of ProjectionStore.ts; the hunks do not overlap.

🤖 Generated with Claude Code

…wn files

ThreadArchiveQueries.ts takes the candidate and subagent-child SQL out of
ProjectionStore.ts. The web rows, search entries and mobile section move into
fork files; Upstream files keep seam lines. Behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XL labels Nov 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ziyadakl
ziyadakl merged commit 32de2f6 into spec107/integration Nov 3, 2026
5 checks passed
@ziyadakl
ziyadakl deleted the spec107/auto-archive branch November 3, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants