Skip to content

Refactor projection pipeline side effects#1512

Merged
juliusmarminge merged 3 commits intomainfrom
t3code/projection-pipeline-refactor
Mar 29, 2026
Merged

Refactor projection pipeline side effects#1512
juliusmarminge merged 3 commits intomainfrom
t3code/projection-pipeline-refactor

Conversation

@juliusmarminge
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge commented Mar 29, 2026

Summary

  • Refactored ProjectionPipeline to use named Effect.fn helpers for projector application and attachment side effects.
  • Reduced repeated attachment-root reads by factoring cleanup/prune flows into shared helpers.
  • Added a regression test covering unsafe thread IDs during incremental attachment cleanup.
  • Marked the projection pipeline cleanup work complete in docs/effect-fn-checklist.md.

Testing

  • Added apps/server/src/orchestration/Layers/ProjectionPipeline.test.ts coverage for unsafe thread-id attachment cleanup.
  • Not run: bun fmt
  • Not run: bun lint
  • Not run: bun typecheck
  • Not run: bun run test

Note

Medium Risk
Touches the orchestration projection pipeline’s transaction + filesystem cleanup paths; while mostly a refactor, mistakes could cause missed or overly-broad attachment deletions during thread delete/revert flows.

Overview
Refactors ProjectionPipeline to wrap projector apply functions and internal helpers in named Effect.fn blocks, improving traceability while keeping projector behavior the same.

Reworks attachment cleanup/prune side effects into shared helpers (including reusing a single attachments-root directory read per side-effect run) and ensures unsafe thread IDs are skipped in both delete and prune flows.

Adds a regression test that directly calls projectEvent for a thread.deleted event with an unsafe thread id (..) to confirm attachment/state directories aren’t removed, and marks the projection pipeline refactor as complete in docs/effect-fn-checklist.md.

Written by Cursor Bugbot for commit 9aa023c. This will update automatically on new commits. Configure here.

Note

Refactor projection pipeline side effects with named Effect.fn helpers

  • Wraps projection pipeline handlers and utilities in named Effect.fn(...) calls to improve traceability in Effect traces.
  • Extracts removeDeletedThreadAttachmentEntry, deleteThreadAttachments, pruneThreadAttachmentEntry, and pruneThreadAttachments as named helpers from inline code in runAttachmentSideEffects.
  • Behavioral Change: the attachments root directory is now listed once per runAttachmentSideEffects invocation and the result is reused across all deletions and prunes, rather than re-reading the directory for each thread operation.

Macroscope summarized 684160a.

- Wrap projection helpers with named `Effect.fn`
- Share attachment directory reads and harden unsafe thread cleanup
- Mark the projection pipeline checklist item complete
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 29, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d2883de0-270b-49c9-aaba-65c219920a92

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/projection-pipeline-refactor

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Mar 29, 2026
@juliusmarminge juliusmarminge merged commit a1c428b into main Mar 29, 2026
11 checks passed
@juliusmarminge juliusmarminge deleted the t3code/projection-pipeline-refactor branch March 29, 2026 05:54
sfncore pushed a commit to sfncore/t3code that referenced this pull request Mar 29, 2026
Upstream changes (v0.0.15):
- Refactor projection pipeline side effects (pingdotgg#1512)
- Inline sqlite error classification (pingdotgg#1515)
- DrainableWorker drain off outstanding count (pingdotgg#1514)
- Thread archiving with archivedAt (pingdotgg#1505-related migrations)
- Auto-generate first-turn thread titles (pingdotgg#1375)
- Keyboard shortcuts for sidebar threads (pingdotgg#1456)
- Various UI fixes (sidebar, settings, markdown links)

Conflict resolution:
- ProjectionPipeline.ts: took upstream (our REINDEX workaround
  no longer needed with doltlite canDefer=0 fix)
- Migrations.ts: renumbered our 016-018 to 019-021, keeping
  upstream's 016-018 (CanonicalizeModelSelections, ArchivedAt)
- ProjectionThreads.ts, orchestration.ts: took upstream (archiving)
- Sidebar files: took upstream (new features)

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
AustinKelsay pushed a commit to AustinKelsay/t3code-custom that referenced this pull request Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). 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.

1 participant