Files
t3code/scripts/lib/projection-tables.ts
T
Theo BrowneandClaude Opus 5 02594421d2 Simplify dev tooling after review
Four parallel cleanup reviews over the branch; the fixes that survived
verification:

- scripts/lib/dev-share.ts was a 216-line reimplementation of
  @t3tools/tailscale (the client the server's own --tailscale-serve
  uses). Now a thin wrapper adding only the dev-share semantics: the
  stale-mapping pre-clear and the cleared/not-cleared result. Picks up
  Windows tailscale.exe handling and command timeouts for free. The
  package's exit error gains a bounded stderrPreview so callers can
  recognize "handler does not exist" without a parallel spawner.
- The .git-is-a-file worktree check existed three times across two
  packages; now once in @t3tools/shared/devHome. dev-runner drops its
  duplicated T3CODE_HOME fallback so base-dir precedence lives in one
  function.
- The dev proxied-prefix list existed in apps/web's vite config and
  apps/server's http catch-all with nothing keeping them in sync; both
  now consume @t3tools/shared/devProxy. The vite proxy map is built
  from the list.
- PROJECTOR_NAMES and the projection-table delete order were pasted in
  both seeding scripts; now shared via scripts/lib/projection-tables.
- PairingGrantStore keyed the dev startup TTL by string-comparing the
  caller's subject; issueOneTimeToken takes an explicit
  purpose: "startup" instead, and the subject constant returns to
  EnvironmentAuth where its other uses live.
- dev-seed: iterate rows instead of materializing (unbounded copies
  held the whole table in memory and the spread had a ~128k-element
  ceiling); parameterized IN lists replace hand-rolled quoting.
- Smaller: cli/auth's layer stack deduped into environmentAuthLayer,
  Set-based dedupe, precomputed proxied prefixes, vite HOST parsed
  once, dead T3CODE_DEV_SHARE_URL removed, redundant tests dropped.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-07-25 21:45:24 -07:00

34 lines
1.1 KiB
TypeScript

/**
* The projection read-model surface that seeding scripts write to.
*
* Must match `ORCHESTRATION_PROJECTOR_NAMES` in
* apps/server/src/orchestration/Layers/ProjectionPipeline.ts — that package
* exposes no importable surface, so this is a maintained copy. If a projector
* is missing here, `computeSnapshotSequence` reports 0 and every shell
* snapshot advertises sequence 0.
*/
export const PROJECTOR_NAMES = [
"projection.projects",
"projection.threads",
"projection.thread-messages",
"projection.thread-proposed-plans",
"projection.thread-activities",
"projection.thread-sessions",
"projection.thread-turns",
"projection.checkpoints",
"projection.pending-approvals",
] as const;
/** Deleted in this order so a row never outlives what it points at. */
export const PROJECTION_TABLES_IN_DEPENDENCY_ORDER = [
"projection_pending_approvals",
"projection_thread_proposed_plans",
"projection_thread_activities",
"projection_thread_messages",
"projection_thread_sessions",
"projection_turns",
"projection_threads",
"projection_projects",
"projection_state",
] as const;