Repository navigation
fix(content): skip Option-B delta flag boot-seed under vitest - #2068
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-BContentCurrentdomain:test/lib/content-store.test.js(8) — nav/hashes/catalog return empty, hashesundefinedtest/integration/content-pipeline-lifecycle.test.js(3) —count0, hash registry emptytest/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) addedensureContentDeltaDefaults()to thecds.on('served')boot hook to seedcontent.delta.write/read/skipCarryForward = 'true'so the fast path defaults ON in production. But that hook also runs in thecds.test('serve')unit harness, seeding all three flags ON in the in-memoryImsConfig. The 21 pre-existing tests were written against the resolver's fail-safe-OFF (legacyContentFiles) default — so their nav/hashes/catalog aggregate reads now hit the emptyContentCurrent, and rollback replaysContentHistoryinstead of clearing.Fix
Gate the seed call behind
!process.env.VITEST.VITESTis set only by the test runner (unit + hybrid), never in CF orcds 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
vitest run --project unit: exit 0; the only stragglers are known shared-load concurrency flakes (e.g.run-job-by-name-optspasses in isolation), unrelated to this one-line boot gate.🤖 Generated with Claude Code