Skip to content

fix(e2e): stabilize ObsessionDB live e2e flakes on main - #220

Closed
vesperships wants to merge 1 commit into
mainfrom
fix/obsessiondb-live-e2e-flakes
Closed

vesperships wants to merge 1 commit into
mainfrom
fix/obsessiondb-live-e2e-flakes

Conversation

@vesperships

Copy link
Copy Markdown
Collaborator

Summary

Unblocks the red obsessiondb job on main HEAD 7fe44e5 (CI run 36370187217, job obsessiondb).

Turbo only reported @chkit/plugin-ingest#test as Failed; the same job log also shows failures in plugin-backfill mv-replay, migrate-dictionary, and text-index (suite continues after turbo’s first failure).

Not a #219 regression. Prior main obsessiondb fails on fedbf56 / 3cc768d / 256ec62 already hit ingest timeouts and the text-index 15s timeout; mv_replay passed on those SHAs and failed once here with partial visibility. #219 only retargeted systemTableSource / async polling away from hardcoded clusterAllReplicas('cluster', …).

Failures → root cause → fix

Failure Root cause Fix Confidence not flake
plugin-ingest live: UNKNOWN_TABLE …_journal (code 60); BigInt in same file passed createClickHouseJournal.ensure() CREATE TABLE without waiting for SharedMergeTree visibility; next append/read can hit another replica waitForTable after CREATE in ensure() High — matches error (“Maybe you meant …_raw?” which was waitForTable’d in beforeAll); prior runs failed the same suite with TimeoutError / UNKNOWN_TABLE variants
mv-replay-plan.e2e: actual missing buckets 0–1 after completed === 4 Assert immediately after QueryFinish; partial target visibility on managed CH waitForRows until BUCKETS rows, then toEqual(expected) Med–High — first miss after several green prior runs; harness wait matches existing waitForRows pattern; if data is permanently missing this will time out instead of masking a planner bug
migrate-dictionary.e2e: dictGet Expected "Alice" Received "" HTTP dictionary initial load races empty source vs post-migrate INSERT SYSTEM RELOAD DICTIONARY + waitForRows until Alice (after seed and after replace) High — deterministic race; prior runs sometimes passed (load after insert) sometimes would fail
text-index.e2e: two tests timeout at exactly 15000ms Package bun test … --timeout 15000; siblings use 60–120s and often take 20–30s on ObsessionDB Per-test timeouts: 120s (escape loop), 60s (quoted literals) High — exact 15.000s timeout; open #218 also batches the escape checks (complementary)

Files changed

  • packages/plugin-ingest/src/journal.ts — product: wait for journal table visibility after ensure
  • packages/cli/src/test/migrate-dictionary.e2e.test.ts — harness: reload + poll dictGet
  • packages/plugin-backfill/src/mv-replay-plan.e2e.test.ts — harness: poll target buckets
  • packages/cli/src/test/text-index.e2e.test.ts — harness: raise specific timeouts

How tested

  • bunx turbo run typecheck lint --filter=@chkit/plugin-ingest --filter=@chkit/plugin-backfill --filter=chkit --filter=@chkit/clickhouse — pass
  • bun test unit (no live CH): plugin-ingest executor/api/retry (54 pass); plugin-backfill async-backfill/planner/options (47 pass); sample cli unit (7 pass)
  • Live ObsessionDB e2e not run locally (no CI secrets / Doppler). PR CI obsessiondb job is the verification.

Out of scope / needs-human

  • Did not merge; did not touch release publish.
  • Did not freestyle product UX. Journal ensure() wait is a real correctness fix for managed CH, not a sleep paper-over.
  • If mv_replay still fails after wait with permanently empty partitions 0–1 → escalate as possible chunk SQL / visibility product bug (needs-human).
  • Complementary: #218 batches text-index escape queries (can land independently).

Unblock the obsessiondb CI job (run 36370187217 on 7fe44e5) which failed:
- plugin-ingest: journal UNKNOWN_TABLE after CREATE (SharedMergeTree lag)
- plugin-backfill mv_replay: target missing early buckets after QueryFinish
- cli migrate-dictionary: dictGet empty after seed (stale initial load)
- cli text-index: suite 15s timeout vs 20–30s sibling ObsessionDB latency

Root causes (recurring across prior main runs; not introduced by #219):
1. createClickHouseJournal.ensure() did not wait for table visibility
2. Dictionary HTTP source races initial load vs post-create INSERT
3. mv_replay assert did not poll for SharedMergeTree insert visibility
4. Two text-index tests inherited 15s suite timeout without overrides

Fixes: waitForTable after journal CREATE; SYSTEM RELOAD DICTIONARY +
waitForRows after seed/replace; waitForRows for mv_replay buckets;
120s/60s timeouts on the two text-index tests.

Cannot verify live ObsessionDB here (no secrets). Unit/typecheck/lint OK.
Related: #218 batches the escape-check queries (complementary).
vesperships pushed a commit that referenced this pull request Sep 28, 2026
…220) (#221)

* test(clickhouse): add pollUntil e2e helper that preserves assertion diffs

Co-authored-by: Marc Höffl <marc.hoeffl@gmail.com>

* fix(plugin-ingest): tolerate replica lag and slow terminal journal writes

- ensure() waits for the journal table after CREATE
- run_started/run_finished get the same bounded retry as stream facts
- terminal facts are bounded by the live run's deadline, with the fixed
  5s grace only after interruption; a slow run_finished insert no longer
  turns a successful run into a TimeoutError

Co-authored-by: Marc Höffl <marc.hoeffl@gmail.com>

* test(plugin-ingest): create the live journal during setup and bound hooks

Co-authored-by: Marc Höffl <marc.hoeffl@gmail.com>

* test(cli): reload the dictionary on every poll and read its source consistently

Co-authored-by: Marc Höffl <marc.hoeffl@gmail.com>

* test(plugin-backfill): consistent mv_replay chunk reads and polled target check

Co-authored-by: Marc Höffl <marc.hoeffl@gmail.com>

* test(cli): batch text-index remote checks into single queries

Co-authored-by: Marc Höffl <marc.hoeffl@gmail.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
@vesperships

Copy link
Copy Markdown
Collaborator Author

Superseded by #221 (merged). Closing unmerged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant