fix(maintenance): export and import Experiments and Variants in starter (#36337)#36339
Conversation
…er (#36337) The starter export (_downloadStarter / _downloadStarterWithAssets) only dumped Hibernate-mapped tables plus a few hand-coded special tables. The experiment and variant tables are persisted via DotConnect (not Hibernate) and were in neither list, so experiment data was silently dropped from starters and never restored on import. Add both tables to the starter round-trip: - Export: write Experiment.json and Variant.json in ExportStarterUtil.getAdditionalDataAsJSON() (shared by both starter endpoints). - Import: register Variant.json (early) and Experiment.json (after contentlets) in StarterEntity, and handle them in ImportStarterUtil via the variant/experiment factories. Deserialize with the configured dotCMS mapper so Instant/Optional and JSONB fields round-trip correctly. Skip the DEFAULT variant and use the variant factory (not VariantAPI) so archived experiment variants restore. The pg_dump backup path (_downloadDb) already includes these tables and is left unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude finished @wezell's task in 1m 43s —— View job Rollback Safety Analysis
Result: ✅ Safe To RollbackAfter checking every category in the rollback-unsafe reference, this PR matches none of the unsafe categories. What the PR changes
Category-by-category verdict
SummaryRolling back to N-1 after this change is deployed is completely safe. The only behavioral delta is that starter ZIPs produced by N contain two additional JSON files ( |
|
Tick the box to add this pull request to the merge queue (same as
|
🤖 dotBot Review (Bedrock)Reviewed 3 file(s); 5 candidate(s) → 3 confirmed, 0 uncertain (unverified, kept for review). Confirmed findings
us.deepseek.r1-v1:0 · Run: #28271403691 · tokens: in: 24273 · out: 9586 · total: 33859 · calls: 9 · est. ~$0.085 |
Live run on dotCMS/core#36339 (via the new diagnostic) showed R1 emits stage-1 candidates with keys [sev, loc, desc] — it echoes the carry-forward dotcms-review-findings schema from the prompt instead of the requested severity/line/title/hypothesis. The prior alias map had "description" but not "desc", and didn't map sev/loc, so _usable() still dropped every candidate and the review reported "No issues found". Now: "desc" is a title/hypothesis alias, "sev" ("🔴 Critical") maps to severity, and "loc" ("path:597") maps to line. Verified the canonical schema is untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Proposed Changes
Fixes #36337.
The starter export endpoints (
/api/v1/maintenance/_downloadStarterand/_downloadStarterWithAssets) silently omitted Experiments and their Variants, and the import path never restored them.ExportStarterUtilonly dumps Hibernate-mapped tables plus a few hand-coded "special" tables; theexperimentandvarianttables are persisted viaDotConnect(not Hibernate) and were in neither list — so experiment data was lost in starter-based backups and migrations.Export (
ExportStarterUtil)getAdditionalDataAsJSON()(shared by both starter endpoints), emit:Variant.json— all rows including archived andDEFAULT, viaVariantTransformer.Experiment.json— all experiments viaExperimentsFactory.list(empty filter).Import (
StarterEntity+ImportStarterUtil)Variant.jsonearly (before contentlet version info / multi-tree, which referencevariant_id) andExperiment.jsonlast (experimentpage_idreferences a contentlet identifier).DEFAULT, and use the factory (notVariantAPI, which rejects archived variants) so archived experiment variants restore.ExperimentsFactory.save()upserts by id and binds JSONB columns viaaddJSONParam.ObjectMapper(JavaTime + Jdk8 modules) soInstant/Optionaland JSONB fields round-trip correctly —BundlerUtil's bare mapper cannot.Out of scope
pg_dumppath (_pgDumpAvailable/_downloadDb) already includesexperiment/variant(not in its--exclude-table-datadeny-list) and is left unchanged.Checklist
./mvnw compile -pl :dotcms-core)openapi.yamlregeneration needed)How to Test
experimentrow +dotexperiment-…variantrows).GET /api/v1/maintenance/_downloadStarterWithAssets(and_downloadStarter); unzip and confirmExperiment.jsonandVariant.jsonare present and populated.🤖 Generated with Claude Code
This PR fixes: #36337