Repository navigation
chore(seeds): retire the one-shot importers and the atlas sync - #1171
Conversation
The content migrations are complete — the legacy We Meditate database, Storyblok, the meditation library, Cloudinary tags — and the Atlas sync's final run went to production on 2026-11-13. Their importers can only re-run a migration that has already happened, so they are deleted rather than left to rot against a schema they no longer match. Retired: storyblok, wemeditate, meditations, meditation-transcripts, tags, atlas, atlas-reset, and `pnpm atlas:sync`. Also `scripts/etl-d1-to-postgres.ts` (the finished D1 → Postgres cutover) and `seeds/extract-to-json.ts`, which only regenerated the two data dumps. `wm-app-translations` goes too, as a strict subset of `translations`, which writes the same global plus the other two. Its directory stays, holding the seed data and the converter `translations` reads — the shape `wm-web-translations/` and `sy-atlas-translations/` already have. Kept: `translations`, the only way to publish an atlas locale (`availableLocales` refuses an unpublished one), and `file-transcripts`, the bulk re-request for any recording the target holds without a transcript — which has to run on the target's own server, with its own vendor key, so the seed route is what runs it. `preview-fixture` stays until #1168 replaces it. `seeds/lib` loses the five modules whose last consumer was a retired importer, and `EXPECTED_COUNTS` loses the from-data floors, whose only declarer was the Atlas manifest. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWiybcQknBjbkLzcBU
`seeds/AGENTS.md` and `seeds/lib/AGENTS.md` documented the migrations in full — the Atlas sync pipeline, the transcript corpus's provenance, the Rails and Storyblok dumps — none of which has a reader any more. Every pointer elsewhere that named a deleted path is re-stated without it, keeping the rule each one carried: the trash-aware existence check, the `availableLocales` partial-write rule, the D1 history footnote, the smoke spec's warning about where a Vimeo id comes from. `refuseDuplicateClass`'s `skipDuplicateClassCheck` bypass goes with them. The Atlas importer was its only writer, so what is left is an unreachable way past a duplicate-class refusal. `.claude/commands/reset-db.md` still names a retired script in an example. It is a Protected Path, so it needs an attended edit. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWiybcQknBjbkLzcBU
Five review passes over the branch. What they caught: Residue the first two commits missed — the seed route's own `Scripts:` header, `src/AGENTS.md`'s and `src/types/AGENTS.md`'s examples, the `.railwayignore` rule for two deleted dumps, the `slugify` JSDoc clause this PR falsified, and eight comments citing the deleted `seeds/lib/lexicalConverter.ts`. Each now states the substance it was pointing at, so it stands with its link cut. Code whose last consumer this PR deleted: `safeBufferFromUint8Array`, `stripPreviewPrefix`, `cliParser.printUsage`, four unread Cloudflare keys in `seeds/env.ts`, and three of the four names on `eventQuality`'s heuristics barrel line. Three holes in the rewritten `seed-pagination` spec, each proved by reintroducing the defect and watching the case fail: nothing pinned the `offset` term of `min(offset + limit, floor)`; the registration floor's filter was compared against the registry it came from, so flipping `pending` to `accepted` stayed green; and a dependency naming no step passed, because `indexOf` answers -1 and -1 precedes every index. `seeds/lib` keeps a media and retry surface nothing calls — its fate is the seed CLI's, under #1169 §C. Both guides now say so instead of presenting it as the way to do things. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWiybcQknBjbkLzcBU
|
🚅 Deployed to the SahajCloud-pr-1171 environment in sahajcloud
1 service not affected by this PR
|
sydevs-bot
left a comment
There was a problem hiding this comment.
1 question for the reviewer, one per thread.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The shape is right: 69k deletions against 387 insertions, with no new abstraction. §C correctly does not fire, the §B departure on sy-atlas-translations/ is argued from §A, and skipDuplicateClassCheck is genuinely joined — its only writer was the deleted importer.
One thing is left standing. src/lib/mapbox/geocoder.ts is now half dead: geocodeRegion, resolveRegionLocation, geocodeVenue and MANUAL_LOCATION are reachable only from their own 558-line spec. The body flags it and asks. Delete it here. It is the migration artifact the ticket retires, git history is the archive, a later region geocoder would be written against whatever replaces Atlas, and MANUAL_LOCATION only re-spells the live MANUAL_PREFIX.
Findings
should-fix—src/lib/mapbox/geocoder.ts:56,225,269,483: ~250 of 496 lines orphaned. No inline thread; the file is outside the diff.consider—.env.example:214: stale R2 block.consider—tests/unit/seed-pagination.spec.ts:17: header contradicts two of its own cases.consider—src/app/(payload)/api/seed/[script]/route.ts:47: breadcrumb names nothing.
What was checked
- Every removed export grepped across the branch —
stripPreviewPrefix,safeBufferFromUint8Array,cliParser.printUsage,skipDuplicateClassCheck,isFromData,atlasDataFile— no consumer left. seeds/env.ts's four Cloudflare keys were already owned bysrc/lib/env/server.ts:156andrequireEnv./api/healthanswers 200 at commit71e4245, so Railway boots without the deleted modules. The seed links 302 to the Access-gated host, which this session cannot pass.- Ladder: the new pieces are
scriptLines(), twoKNOWN_SINGLE_CONSUMERentries and ashortcut:marker. The allowlist grew against its own header, but each entry names why its move is a separate reshuffle.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
…ire-seed-importers # Conflicts: # seeds/AGENTS.md # seeds/lib/AGENTS.md
The block named reset-storage, `pnpm reset:prod` and `pnpm reset:all`, none of which exist, and two variables nothing reads: the cleanup script derives its R2 pair from CLOUDFLARE_API_KEY (docs/rules/storage.md). The same two names leave seeds/env.ts four lines above in this PR, so the file otherwise gave two answers to one question. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWWJrnYTcLqWtGNwjJ
Two cases pin a literal on purpose — the users batch at line 150 and the user-submissions filter — because reading the value back from the registry it came from passes against the mutation each case exists to catch. The header claimed every case reads the registry, so a fresh reader met the rule first and the exceptions later. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWWJrnYTcLqWtGNwjJ
`the way one of them first was` pointed at atlas-reset, which this PR deletes, so a fresh reader has nothing left to check it against. The first clause already carries the why. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWWJrnYTcLqWtGNwjJ
|
Three review threads adopted, base merged, pushed as
The geocoder Lean gate green on the merged tree, plus the seed preload int spec. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
…ire-seed-importers
`geocodeRegion`, `resolveRegionLocation`, `geocodeVenue` and `MANUAL_LOCATION` were reachable only from their own spec once the Atlas importer went. With them go the internals nothing else read — `TYPES_BY_LEVEL`, `FALLBACK_TYPES`, the two default radii, `forwardUrl`, `forwardFeature` and the region/venue argument types — and the spec cases that only covered them. What the running app imports stays: `geocodeLocation`, `addressFeatureMapboxId` and their types, read by the event CSV import. #893's permanent-v6 guard is still pinned, by the `geocodeLocation` case that asserts the endpoint and the flag together. The file header, `ForwardAnswer`, `baseParams` and `GeocodedLocation` each described the deleted half, as did the `searchTypesByValue` comment in `Regions.ts`, which named `TYPES_BY_LEVEL` and `geocodeVenue` as its twin. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXkqkZx36mfKN94ptW
|
Geocoder dead code deleted, pushed as Gone with the four named functions: Kept, because the event CSV import reads them: Five comments described the deleted half: the file header,
PR body refreshed — it listed this finding as declined. Lean gate green: 270 files, 3697 tests. Plus 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
One conflict, in seeds/meditations/import.ts. #1176 rewrote its bare `seeds/env` specifier as relative, because TypeScript 6 dropped tsconfig baseUrl. This branch retires that importer, so the deletion stands: the rewrite has nothing left to apply to, and no bare `seeds/` specifier survives anywhere in the merged tree. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjViXHyBCzw9pvSLoQS
|
Merged Lean gate re-run on the merged tree: 271 files, 3704 tests green, on Payload 3.93 / Vitest 5 / TypeScript 6 as 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
#1181 landed #1168's half of the split: the app loads `src/fixture/` at boot, so the `preview-fixture` seed is retired on `main` while this branch retires the other eight. Every hunk takes the union of the two retirements. `ScriptName` is now `translations | file-transcripts`. §C of #1169 still does not fire — two scripts remain, so the seed CLI, the route and `seeds/lib` stay. `tests/unit/seed-pagination.spec.ts` loses its floor-arithmetic and dependency-ordering cases. They read `preview-fixture`'s registry, the last one declaring collections, and `verifyCountsForScript` takes its floors from `EXPECTED_COUNTS` by script name with no seam to inject a fixture. What is left are the registry-wide invariants, which hold over an empty registry. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWn29rtkBez9tWZGZe
|
Merged §C still does not fire: two scripts remain, so the seed CLI, the route and One resolution worth a look. ⚠ The PR body above still names Lean gate green on the merged tree, plus 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
translations,file-transcriptsandpreview-fixture.refuseDuplicateClass'sskipDuplicateClassCheckbypass, whose only writer was the Atlas importer — a joined finding, not listed on the ticket.slugifyout ofsrc/lib/utilities/and besidesrc/fields/slugField.ts, its one remaining consumer — the reviewer's answer on thelib-boundarythread.src/lib/mapbox/geocoder.ts, whose last caller was the Atlas importer — the reviewer's answer on the adversarial review'sshould-fix.Change outline
Files — what leaves
seeds/The three surviving scripts are what is still run. Everything else imported a migration that has already happened.
Contract —
ScriptName, and the five registries keyed on itScriptNameis the type every registry is total over, so narrowing it is what makes a missed entry a build error rather than a 500.seed-data-files.spec.tsis what holds the three non-total registries closed, readingrun.tsand the route as source text. It keeps doing so.Behaviour — a bypass with no writer left
refuseDuplicateClass({ data, operation, originalDoc, req }) src/collections/Events/hooks/ not a create or an update → pass - req.context.skipDuplicateClassCheck → pass # nothing sets this any more update that leaves the class identity alone → pass a twin exists → APIError 400Flow —
pnpm seedwith nothing namedFiles — exports whose last consumer was a retired importer
Each verified by grep before deleting; none had a remaining caller, in code or in a spec.
Behaviour — the geocoder's region half
Reachable only from its own spec once the Atlas importer went. What the event CSV import reads
stays.
MANUAL_LOCATIONre-spelledMANUAL_PREFIX, whichmanualLocation.tsstill owns and the adminpicker still reads. #893's permanent-v6 guard survives the cut: the
geocodeLocationcaseasserting the endpoint and the flag together is what
expectPermanentV6duplicated.Files — a module moved to its one consumer
src/AGENTS.mdrule 4: asrc/libmodule whose only consumer sits outsidesrc/libis thatconsumer's private helper in the commons.
slugifybecame one here.@/lib/lemonfox/normalizekeeps its entry: moving that folder makes@/lib/transcripts/cuesfail the same check, so it is a three-module reshuffle. #1177 holds it, blocked on this ticket.
The verdict on every script that was in
VALID_SCRIPTSstoryblokSTORYBLOK_ACCESS_TOKEN, now gone fromseeds/env.ts,.env.exampleanddocs/environment.mdwemeditatemeditationsmeditation-transcriptstagsatlasatlas-resetatlasre-sync, so it outlives nothingpnpm atlas:syncatlas's inputwm-app-translationstranslations, which writes that same global plus the other two, idempotently. Its directory stays:translationsreads itsdata.en.jsonand itslexicalConverter.ts, so it now has the data-only shape its two sibling directories already hadtranslationssy-atlas-config.availableLocalesrefuses a locale whose translations are unpublished (#705). It is also how new English copy reaches a target after a schema changefile-transcriptsseeds/scripts/would mean rebuilding that remote-execution path for no gain, while the route stays for the other two anywaypreview-fixtureAlso retired, as the ticket's §B asks:
scripts/etl-d1-to-postgres.ts, the finished D1 → Postgres cutover, andseeds/extract-to-json.ts, which only regenerated the two dumps.Preview
Nothing here is visible in the admin panel — the value of the preview is that it builds and boots at all, which is the one check that no deleted module is still imported (
next.config.tsdropsseeds/**from the production trace, so a dangling seed import surfaces at the Railway build, not in CI).GET /api/seed/translations— the surviving script's metadataGET /api/seed/atlas— now a 400 naming the three scripts that are leftA browser read of that host is sent on to
pr-<n>.cloud-preview.sydevelopers.com, behind Cloudflare Access — sign in with GitHub as asydevsmember. The seed routes need an admin session, which the preview's sign-in picker grants.Data: this repo sets no
previewUrl.seed, and no Access service token is present in this session, so the links were not opened and verified from here. CI's ownpreview-fixturefill is what puts content in the preview.Test results
.claude/skills/pr-prep/check.sh— lint, format:check, typecheck, typecheck:tests,pnpm test:unit(270 files, 3697 tests), re-run on the merged tree atac87eb3tests/int/event-imports.int.spec.ts, the live caller of whatgeocoder.tskeeps. Earlier commits' specs:tests/int/{seed-importer-preload,file-transcripts,meditation-transcripts,events}.int.spec.tsand bothseeds/tests/suitesManual verification
pnpm seed --helplists exactlytranslations,file-transcripts,preview-fixture, and says a barepnpm seedrunstranslations.GET /api/seed/translationsanswers with metadata andGET /api/seed/atlasanswers 400.file-transcriptskept rather than moved underscripts/— the ticket left that open, and the reason it stays is in the table above.Notes for reviewer
seeds/lib,ADMIN_TOKENhandling andisSeedScriptto go if nothing is left inVALID_SCRIPTS. Three scripts are left, so all of that stays. feat(preview): load a typed fixture at boot that covers every surface #1168 has no PR yet; whichever of the two lands second does §C.seeds/sy-atlas-translations/among "source dumps the retired scripts read". It is not one —translationsreads all ten of its locale files, and §A says to keeptranslationsif it is still run. §A's verdict governs, so the directory stays..gitignorelines are kept on purpose./seeds/atlas/data/and/seeds/atlas/local/still hold personal data on a maintainer's machine. Dropping the ignores would surface those files as untracked, onegit add .from being committed. The comment above them now says so..claude/commands/reset-db.mdstill names a retired script in an example (pnpm seed meditations)..claude/is a Protected Path, so an unattended session cannot write it; it needs a one-line attended edit.tests/unit/lib-boundary.spec.tsgained one allowlist entry,@/lib/lemonfox/normalize, which lost its second consumer here. That file's header calls the allowlist a backlog that should only shrink, so the entry is the exception and it names why: every module insrc/lib/lemonfox/is reached only fromsrc/jobs/TranscribeRecording/, so rule 4 says move the folder — but@/lib/transcripts/cuesis consumed only bylemonfox/normalize.tsand is exempt today solely because that consumer sits insidesrc/lib, so movinglemonfox/out makescuesfail the same check. refactor(transcripts): move the Lemonfox readers into their job folder #1177 carries that reshuffle, blocked on this ticket.@/lib/utilities/slugifywas the second entry and is gone: the reviewer chose to move the module instead, whichfe6487cdoes.should-fixis built, inac87eb3. The reviewer called it: git history is the archive, and a later region geocoder would be written against whatever replaces Atlas.VALID_SCRIPTSfromSCRIPT_DESCRIPTIONS, and makegetImporteraRecordrather than a switch. Both are real duplicate spellings, and both are pre-existing rather than introduced here. They edit the exact lines feat(preview): load a typed fixture at boot that covers every surface #1168 also edits, and the two source-text cases inseed-data-files.spec.tsare the only thing holding those registries closed today. They belong with §C.BaseImporter's pagination methods, and the unread halves ofdelays.ts/dataLoader.ts/fileUtils.ts. These are partial deletes of modules that still have live consumers, reaching into a class's members andlib.test.ts— a different operation from the five whole modules deleted here, which had no consumer at all.seeds/AGENTS.mdnow carries ashortcut:marker naming the surface and its trigger.CollectionMetadata.collectionrequired and dropgetCountTargets's skip branch.CollectionMetadatais the shape the route returns to the CLI, so narrowing a field is a contract change. Noted in its JSDoc instead, which no longer cites a deleted script's step.subtitlesZodSchema's parse half has no production caller. True, butSubtitlesandsubtitleCueare still imported bysrc/lib/transcripts/, so the module is not deletable as it stands. Its comment no longer claims a deleted importer reads it.tests/PERF.mdrows naming deleted specs. They are dated measurements with a machine recorded against them, so each row keeps its numbers and now says the file is gone.Detail
Pagination is kept, though no surviving script uses it.
preview-fixturedeclares six collections, allrequiresPagination: false, so nothing left sets the flag. The mechanism stays because it is the seed route's and the CLI's, not a per-script feature:POST /api/seed/<script>?collection=&offset=&limit=is still the request shape, andvalidatePaginationParamstill guards it. Removing it belongs with §C.What
tests/unit/seed-pagination.spec.tsstopped asserting. Its script-keyed cases now readpreview-fixture's registry instead oftags/wemeditate/meditations/storyblok/atlas. Two cases were dropped outright, because no surviving script has the property they asserted: "marks large collections as requiring pagination" and "identifies collections with file uploads". So wasgetCountTargets's "drops a step that lands in no collection of its own" — that branch existed for the Atlaspicturesstep, which uploaded intoimagesand so could claim no floor. The branch itself is kept; nothing in the registry exercises it any more.Four of its cases were watched failing against the real defect, by reintroducing each and running the file:
min(offset + limit, floor)→min(limit, floor)adjusts for an intermediate batch — the offset counts toocountWhere'spending→acceptedcarries the filter a floor is stated underdependenciesnaming no steplists every step after the steps it depends ongetCountTargetsreversing its stepskeeps the script metadata orderThe first three were holes the first draft of this spec had: it compared each value against the registry it came from, so all three mutations stayed green. They are now literals, or named before they are indexed.
No migration. Nothing under
src/changed shape: the route lost importer cases, one hook lost an early return, one storage helper and three barrel re-exports lost their last consumer, one module changed folder, and the rest is comments.pnpm db:migrations:createwas therefore not run.The security review found nothing. It read the three paths
securityReview.triggerPatternmatched — the seed route,refuseDuplicateClass,queueTranscription— plus the.envedits, and confirmed: the route's unknown-script rejection and admin gate are untouched, losingverifyCountsForScript's override removed an unreachable branch rather than a check, nothing setsskipDuplicateClassCheckany more, and no secret was ever committed to the three files whose Storyblok lines went. Theslugifymove and thegeocoder.tsdeletion touch no path that pattern matches.Closes #1169
🤖 Generated with Claude Code
https://claude.ai/code/session_01Mg9rjWiybcQknBjbkLzcBU