Repository navigation
fix(test): stop CDS singleton leak reddening anonymize unit tests in CI - #3160
Merged
Thomas Jung (jung-thomas) merged 1 commit intoNov 21, 2026
Merged
Conversation
…ss-file CDS singleton leak The test deployed a hand-picked subset omitting db/schema.cds to the shared sqlite::memory: DB. cds.deploy().to() mutates the process-wide cds.db/cds.model singleton for the whole vitest fork worker, so on CI (maxWorkers:4, dense file-to-worker packing) a later file in the same worker inherited a schema missing DeveloperEnvironmentTabs. #977 made the GDPR anonymize cascade's nested-subject resolution issue a SELECT ID FROM DeveloperEnvironmentTabs, which then hard-failed with 'no such table', reddening admin-service.test.js and anonymize-dsr-request-number.test.js in the full suite (green in isolation). Deploying all of db/ restores every table + @personaldata annotation into the singleton; the job under test only needs an empty DB.
Thomas Jung (jung-thomas)
deleted the
worktree-fix-unit-test-pollution-977
branch
November 21, 2026 16:03
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
unit testshas been red on DEV since 2026-11-16. Two files fail only in the full CI suite (both pass in isolation):test/admin-service.test.js→ anonymizeUser blanks PII and deletes metadatatest/unit/anonymize-dsr-request-number.test.js(2 tests)All fail with the same error:
Root cause
test/unit/srv/kg-featured-topics-job.test.jsdeployed a hand-picked subset (knowledge-graph/homepage-featured/tutorials/missions) — omittingdb/schema.cds— tosqlite::memory:.cds.deploy().to()mutates the process-widecds.db/cds.modelsingleton for the whole vitest fork worker.On CI (
maxWorkers: 4, dense file→worker packing) a later file in the same worker inherits that partial schema, which has noDeveloperEnvironmentTabstable. PR #3139 (#977) rewrote the GDPR anonymize cascade to resolve nested data subjects via an explicitSELECT ID FROM DeveloperEnvironmentTabs— which then hard-fails on the missing table. (Pre-#977 the cascade issued only a bare DELETE, so the leak was latent.)Locally (unbounded workers) the files land in separate fresh workers, so it's green — matching passes in isolation, red in full suite and CI-only.
Fix
Deploy all of
db/in the job test'sbeforeAllinstead of a subset, restoring every table +@PersonalDataannotation into the shared singleton. The job under test only needs an empty DB, so the full model is harmless.Verification
kg-featured-topics-job.test.jspasses standalone and alongside both anonymize files (1+39+2 green locally).🤖 Generated with Claude Code