Skip to content

fix(content): skip Option-B delta flag boot-seed under vitest - #2068

Merged
jung-thomas merged 1 commit into
DEVfrom
fix/content-delta-boot-seed-vitest
Aug 28, 2026
Merged

jung-thomas merged 1 commit into
DEVfrom
fix/content-delta-boot-seed-vitest

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Problem

CI unit tests on DEV (and the PR that introduced it, #2064) fail with 21 failures across 6 files, all in the content-publish / Option-B ContentCurrent domain:

  • test/lib/content-store.test.js (8) — nav/hashes/catalog return empty, hashes undefined
  • test/integration/content-pipeline-lifecycle.test.js (3) — count 0, hash registry empty
  • test/unit/content-delta-read.test.js (1) — rollback replays instead of clearing (expected 1 to be +0)
  • test/unit/content-publish-carryforward-memory.test.js (2)
  • test/unit/content-publish-guard.test.js (3)
  • test/unit/source-hashes-filter.test.js (1)

Root cause

#2064 (250d28f1) added ensureContentDeltaDefaults() to the cds.on('served') boot hook to seed content.delta.write/read/skipCarryForward = 'true' so the fast path defaults ON in production. But that hook also runs in the cds.test('serve') unit harness, seeding all three flags ON in the in-memory ImsConfig. The 21 pre-existing tests were written against the resolver's fail-safe-OFF (legacy ContentFiles) default — so their nav/hashes/catalog aggregate reads now hit the empty ContentCurrent, and rollback replays ContentHistory instead of clearing.

Fix

Gate the seed call behind !process.env.VITEST. VITEST is set only by the test runner (unit + hybrid), never in CF or cds watch — so production and local dev still default-ON (the intent of #2064 is preserved), while the test harness keeps the deterministic fail-safe-OFF default the suite expects. The seed function stays exported and directly callable, so the flag-aware tests (content-delta-flags.test.js, content-delta-read.test.js) that set state explicitly are unaffected.

Verification

  • The 6 previously-failing files: 94 passed / 5 skipped, 0 failed.
  • Full vitest run --project unit: exit 0; the only stragglers are known shared-load concurrency flakes (e.g. run-job-by-name-opts passes in isolation), unrelated to this one-line boot gate.

🤖 Generated with Claude Code

The default-ON boot seed (#2064) runs in the cds.test('serve') harness too,
inserting content.delta.write/read/skipCarryForward='true' into the in-memory
ImsConfig. That flipped the fast path ON for 21 pre-existing content-store /
content-pipeline / carryforward / publish-guard / source-hashes tests written
against the resolver's fail-safe-OFF (legacy ContentFiles) default:
nav/hashes/catalog reads hit the empty ContentCurrent and rollback replayed
ContentHistory instead of clearing.

Gate ensureContentDeltaDefaults() behind !process.env.VITEST. VITEST is set
only by the test runner (unit + hybrid), never in CF or 'cds watch', so
production and local dev still default-ON. The seed function stays exported and
directly callable, so content-delta-flags.test.js is unaffected.
@jung-thomas
jung-thomas merged commit 21a6186 into DEV Aug 28, 2026
3 of 4 checks passed
@jung-thomas
jung-thomas deleted the fix/content-delta-boot-seed-vitest branch August 28, 2026 12:46
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