One library on prod: the Drive and Sheet data now lives in the platform
14 import packages from five projects landed on QA and then prod, each in a reversible batch with a backup taken first. The library now holds Trousers, Shirts and T-shirts designs, 349 master DXFs and 160 linked adaptation pairs, with 0 Drive links. After the final merge, prod passed every contract check (21 of 21) and the V11b brand flow was walked again in a real browser.
The library on prod after the imports
Prod after the final merge (release #61, 4 Nov 13:47 UTC)
Before the fix (PR #60)
- Library API: 20 of 21 live answers conform to the contracts
- The sales builder's demo key got its reference without the file it must download
- Earlier V11b check: product photos unverified on prod (test setup blocked S3)
After (prod image promoted unchanged from QA)
- Library API: 21 of 21 live answers conform (OperationalLayer main schemas)
- /ops/coverage and all 17 import batches identical to 11:14 UTC; 0 Drive links
- V11b walked again in a real browser: photos load (49 of 49 in the Trousers grid)
- Walk's test projects removed after an RDS snapshot; 2 committed units given back
Files each package put into S3 on prod (SHA-256 checked)
The V11b brand scenario, walked again on prod after the merge (14:00 UTC)
- Sign-in, Home, Inventory, Smart Designs, Insights
All open; 1,187 active records incl. 523 Trousers with photos; 2 published designs.
- Pre-selection: Auto-match all
96 records with design options. It was 152 at 10:41: the Design Builder's chest-width windows for BZ00115 were imported at 10:44 (BZ00115 152 → 79; BZ00352 unchanged at 73).
- Collection plan
1 style · 1 unit, no 'over by' warning; images load.
- Approval and tech pack
Brand admin approved; the tech pack (19 MB PDF) was generated and its download answered 200.
- DXF pattern
Failed for a data reason: RM 292R has no pattern DXF in size 52 (1,080 of 1,193 RM records lack one).
Drive and Sheets in the platform code
Before (4 Nov morning)
- A script in the prod image downloaded SDA files from Drive
- The Drive importer sat in tools/ next to the app
- RM Trousers and five SDA tabs only in the Google Sheet
- Adapter pairs without RM patterns or masters in the library
After
- No runtime path reads Drive or a Sheet (script removed)
- One-time readers only under migration/, never built or tested
- Every source snapshot imported with sheet + row provenance
- Engines read pairs, references and coverage through the Library API
Pre-selection after the fix (QA)

Imported Trousers in the brand's inventory (prod)

The collection plan on prod after the merge

Production outputs on prod: tech pack ready, DXF blocked by data

Your decisions (open)
- Add categories Bermuda, Shorts and Skirts: 74 designs from the RM sheet are ready in a package and wait for them. Decide Tailcoats (26 rows).
- Lock the RM sheet tabs that are still edited (RM Trousers, SDA Trouser, SDA Shirts, SDA T-Shirts) and edit on the platform from now on; until then each change needs a new snapshot package.
- Approve an 'Adaptation pairs' screen so pattern makers record pairs in the platform instead of the blazer and trousers trackers (the two living trackers).
- Real adapted DXFs on prod: 1,080 of 1,193 RM records have no pattern DXF, and the 2 published SDAs are not in the adapter's rulebook. Pattern files, or an engine-known SDA published with Cost/RRP, or a pattern-maker review unblock it.
- Held package tech-builder-rm-height-splits: its corrections overwrite values another source wrote, which the importer refuses by design. Allow correction packages to overwrite (a platform rule), or decide row by row. It was not imported.
- Name the 0297-B 54/176 twin that was adapted (4 pairs), and give the missing 5233-T trouser row (colour, composition).
- Confirm the 11 adapter trouser designs against the sheet's SDA Trouser designs (possibly the same designs under two names).
- The V11b prototype in the repo hot-links 237 Drive images: archive it as a library reference without them, or keep it frozen.
What changed in the platform (PRs #45–#61)
- Migrations 0033–0034 (expand-only): reversible import batches with an undo log, reference files, adaptation-pair fields, height labels, retirement, extra measurements.
- Package importer (dry run, one batch per idempotency key, revert) following OperationalLayer's contract v1 additive; the spec is docs/library/packages.md.
- Library API: GET /examples (status filter), /references, /references/{id_or_slug}, /ops/coverage, /ops/imports; demo and ops keys see what the contract allows.
- Pre-selection: results of Auto-match all stay visible, the summary counts them, polling continues in a background tab, and allocation never exceeds a record's pieces.
- Released QA first, then prod: an RDS snapshot was taken before the prod imports, the QA image was promoted unchanged, and Amplify releases were run.
- After the final merge: PR #60 (a demo key's own references keep their file) and release #61, promoted to prod unchanged from QA (Amplify job 15).
Verification
- Typecheck clean; npm test 55 backend + 33 frontend test files; real-PostgreSQL tests 5 files incl. new package tests; all Library API answers validated against the contract schemas.
- Every package passed the contract checker, then on QA and prod: dry run, apply, and a second run that changed nothing.
- Prod after: 170 adaptation pairs with 0 duplicates, 7 retired as the owner ordered on 21 Oct, 0 external links.
- Real-browser checks with the local browser-use CLI on QA and prod using temporary brand accounts, deactivated afterwards.
- Validation before the final merge: up to date with origin/main; typecheck 0 errors; 55 + 33 unit test files and 5 real-PostgreSQL test files pass, the same as earlier in the day; OperationalLayer check.py 54 schemas, 73 examples, 0 problems.
- After the release: prod Library API 21 of 21 answers conform; /ops/coverage and the 17 import batches unchanged; V11b walk on prod passes up to the tech pack.
- Test data: the walks' projects (1 on QA, 2 on prod) removed with platform/ops/remove_test_project.js after an RDS snapshot; library data untouched (coverage identical before and after).
Kept on purpose
- The brand-facing photo-link import: brands may put a public photo link in their workbook; the platform fetches it once into S3 with SSRF guards. It is a product feature, not a library source.
- The 3 Nov bundle importer stays as library:import-bundle until the RM sheet is locked.