Skip to content

Minimal selection reads and matched origin checks

Discover now reads only id, creatorId, languageGroupId, and tags when choosing cards from its queue. Final delivery and committed retries still fetch full cards and recheck current eligibility. Selection previously computed the five sibling-wide counters and fetched presentation fields that only final delivery uses. This removes unused work without changing recall or ranking.

The optional hydration purpose preserves existing one-argument sources. Both projections use the same creator join, eligibility predicates, ID filter and tag normalization. The final response map is populated only by full delivery reads. No cursor format, Redis encoding, snapshot, CAS, family exclusion, backfill, ranking coefficient or pool-size change is included.

Local correctness

New tests failed before implementation for the missing purpose, missing minimal query, and missing connection to actual feed serving. After implementation, 35 focused tests passed with no skips and server typecheck passed. Independent review ran 31 relevant tests with no failures/skips and found no actionable issue.

Database-backed tests verify that selection omits all five aggregate expressions and presentation/vector fields, while final sibling counters and weighted ratings are exact. Full and minimal selection produce identical ordered pages, cursor state and snapshots through family deduplication and changed metadata. Actual feed retries remove a newly unpublished card without changing the committed request ID or continuation. Existing eligibility and personalization-continuation regressions were included.

The first red run also exposed an invalid test fixture: a non-array tag value violated the current schema constraint. That fixture was corrected before the intended failures above were recorded; no schema constraint was weakened.

Matched bounded Railway runs

The frozen before/after bundle manifests differ in exactly four application inputs: discovery-feed.ts, discovery-pagination.ts, discovery-session.ts, and recommendations.ts. The harness, guards, runner and schema are identical. Worker deadline changes being developed separately were absent from both bundles.

BeforeAfter
Application commit46facd017c54f3a178136d2ff59163c990403690279fbd2ed9336062dfcab1e8ff7b5586a7fcac05
Runc42798b83d2b2291028e1b13fb3ceddb3dc902f68594ec56d901ba8b1a4e01d6
Deployment3bc1cd6e-ce1e-499d-a9d5-35a5359906aeb45d93ee-ea88-4c67-a86b-2402682d56c4
HTTP checks96 passed96 passed
SQL calls / errors1,890 / 01,890 / 0
Eligible traversal713 families, 15 pages713 families, 15 pages
After two saved families711 families, 15 pages711 families, 15 pages
Missing / duplicate IDs or families0 / 00 / 0
Sampled Redis peak7,345,727 bytes7,345,727 bytes
Exact keys cleared and verified6969

Authentication, cross-actor cursor rejection, committed retry, save/link/receipt idempotency and translated-family exclusions passed in both arms. Parent cleanup independently verified the owned Redis namespace empty and removed each temporary service, database and restricted role, with no forced disconnects or production writes. Both resource records report cleanupComplete: true.

Actors (samples per page type)First-page p50 / p95 before→after (ms)Continuation p50 / p95 before→after (ms)
1 (2)430.29 / 445.49 → 381.26 / 389.05174.79 / 193.20 → 117.75 / 133.18
4 (8)723.13 / 742.71 → 522.39 / 674.80298.74 / 321.66 → 169.61 / 184.12
8 (16)1,398.83 / 1,592.54 → 862.72 / 1,007.95449.39 / 596.39 → 216.27 / 332.94

These are one sequential pair of small synthetic runs, not a causal speedup estimate or stable production p95 (the split p95 equals the maximum). Unchanged phases varied substantially: authentication took 148.34 ms before versus 69.63 ms after; startup and seed CPU also differed. At one actor, first-page catalog SQL union p50 increased from 248.06 to 259.71 ms despite lower HTTP latency. Therefore the broad latency reduction cannot be attributed solely to this patch. The established benefits are removal of unused query expressions/payload and preserved correctness; its production latency effect remains unproven.

SQL count remains unchanged: projection is narrower, not fewer round trips. Catalog timing combines multiple statements and does not isolate selection. Headers still have two unfinished spans per load request; final pending count is zero. Audit costs, loopback HTTP, synthetic English-only fixtures, testing PostgreSQL, disabled general Redis/PostHog/import jobs, and single-process topology retain the limitations of the profiling report. No full deployment, public proxy, multi-replica or Neon capacity claim follows.

Artifacts

Ignored controller artifacts preserve both contexts and results: full-origin-context-hydration-{before,after}, hydration-{before,after}-controller-{resource,result}.json, and hydration-comparison.json generated by hydration-compare.mjs.

  • Before report SHA-256: a672ed80cfaab5ec0a12e719052b0b32fccee4b1c2819e3b138bdfd12ea8f3b9.
  • After report SHA-256: df06c7a76a04354d826b7c7aa284b554b9eb9831056d558d22d881b34bb0d62f.

The change remains in draft PR183. Production flags and experimental ranking remain disabled; full deployment and real CDC/erasure gates are still open.