fix(homepage): boot-seed HomepageShelves; retire seed CSV + manual seed:thirdparty - #2079
Merged
Merged
Conversation
…ed:thirdparty HomepageShelves kept losing its curated/third-party rows (Prior Labs, Dremio, Reltio, n8n, …) on deploy. Root cause: while the seed CSV lived in db/data it compiled to an .hdbtabledata with include_filter:[] that HDI full-replaced the table from on every deploy whose CSV hash changed, wiping runtime-seeded rows and admin edits. Commit 1404c4c moved the CSV to test/data (stopping the wipe on PROD) but never re-seeded the lost rows, and the manual `npm run seed:thirdparty` promotion was DEV/PROD-ambiguous (it followed the CDS binding, so it could silently target the wrong environment). Replace both mechanisms with an idempotent, non-destructive boot seed: - srv/lib/homepage/homepage-shelves-defaults.js — single inline canonical baseline (SAP entries + third-party links); ships with the srv bundle, no runtime file-read / packaging risk. - srv/lib/homepage/seed-homepage-shelves.js — insert-if-missing on (verb,url), called from cds.on('served'). Never overwrites admin edits, self-heals a deleted baseline row on next restart, non-fatal, runs in every profile (cds watch, unit tests, hybrid, production). - Retire test/data seed CSV, db/data/staging/homepage-thirdparty.json, scripts/seed-thirdparty.js + its two tests, and the seed:thirdparty npm script (now a helpful error stub pointing at the new path). - admin-managed-seed-csvs guard test asserts the CSV is gone from BOTH data dirs. - Docs: new "HomepageShelves seeding" section in homepage.md. Tests: new defaults-validation + seed-behavior unit tests added; homepage-seed, homepage-shelves-crud, homepage-link-health still green (9078 unit tests pass).
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.
Why
HomepageShelveskept losing its curated/third-party shelf links (Prior Labs, Dremio, Reltio, n8n, Iceberg, Kaggle, Vercel, Hugging Face…) — the recurring "shelf links disappeared" incidents.Root cause (verified): while the seed CSV lived in
db/data,cds build --productioncompiled it to an.hdbtabledatawithinclude_filter: [], so HDI treated the table as fully tabledata-managed and full-replaced it on every deploy whose CSV hash changed — deleting runtime-seeded rows and admin edits. Commit1404c4c4moved the CSV totest/data(which stopped the wipe on PROD, since--productionthen emits no tabledata) but it never re-seeded the already-lost rows, and the manualnpm run seed:thirdpartypromotion was DEV/PROD-ambiguous (it followed the CDS binding, so it could silently target the wrong environment).What
Replace both fragile mechanisms with an idempotent, non-destructive boot seed:
srv/lib/homepage/homepage-shelves-defaults.js— single inline canonical baseline (74 SAP entries + 23 third-party links = 97 rows across all 7 verbs). Ships with the srv bundle; no runtime file-read / packaging risk.srv/lib/homepage/seed-homepage-shelves.js— insert-if-missing on(verb,url), called fromcds.on('served')(srv/server.js, mirroring the existingui-event-saved-queries/ai-gradingseed precedents). Never overwrites admin edits, self-heals a deleted baseline row on next restart, fully non-fatal, runs in every profile (cds watch, unit tests, hybrid, production).test/data/…-HomepageShelves.csv,db/data/staging/homepage-thirdparty.json,scripts/seed-thirdparty.js+ its two tests, and theseed:thirdpartynpm script (now a helpful error stub pointing at the new path). This also removes the DEV/PROD-ambiguous manual-seed footgun.admin-managed-seed-csvsguard test now asserts the CSV is gone from both data dirs.docs/developers/architecture/homepage.md.Guarantees
.hdbtabledata).(verb,url)rows.Testing
test/unit/homepage/homepage-shelves-defaults.test.js(schema/enum/unique/persona-tag validation of the baseline) andtest/unit/homepage/seed-homepage-shelves.test.js(boot-populates third-party, idempotent, non-destructive, self-heals).homepage-seed,homepage-shelves-crud,homepage-link-healthand the guard test stay green.npm run setup, and the generatedsrv-qa/lib/parsers.bundle.mjs— none related to this change.)Ops note
PROD
HomepageShelveswas manually re-seeded and a PROD content rebuild run to restore the links immediately (out of band). Once this ships, the baseline is self-healing on every boot; DEV — which still lacked the rows — will be seeded automatically on next deploy.