Skip to content

fix(core): treat export-seed --with-content=all as all collections (#1329)#1571

Open
marcusbellamyshaw-cell wants to merge 1 commit into
emdash-cms:mainfrom
Emdash-Bug-Testing:fix/1329-export-seed-with-content-all
Open

fix(core): treat export-seed --with-content=all as all collections (#1329)#1571
marcusbellamyshaw-cell wants to merge 1 commit into
emdash-cms:mainfrom
Emdash-Bug-Testing:fix/1329-export-seed-with-content-all

Conversation

@marcusbellamyshaw-cell

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes emdash export-seed --with-content=all exporting no content.

exportSeed treated the withContent value as a comma-separated allowlist of collection names. The documented all value matched no collection, so the seed's content came back empty. ("" and "true", produced by the bare --with-content flag, already meant "every collection".)

Fix: treat "", "true", and "all" as "all collections"; anything else stays a comma-separated allowlist.

Closes #1329.

Type of change

  • Bug fix

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset (if this PR changes a published package)

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Claude Opus 4.8 ultracode

Screenshots / test output

New test packages/core/tests/unit/seed/export-seed-with-content-all.test.ts: seeds posts + pages with content, calls exportSeed(db, "all"), asserts both collections' entries are exported.

…mdash-cms#1329)

`export-seed`'s `--with-content` help documents `all` as a valid value, but
only `""` and `"true"` were treated as the all-collections sentinel. Passing
`all` produced `["all"]`, an allowlist of one collection named "all"; since no
collection has that slug, every collection was skipped and nothing exported.

Add `"all"` to the sentinel so it behaves as documented. Comma-separated
collection names still work as an explicit allowlist.

Adds a regression test exporting two collections with `withContent: "all"`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jun 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ca11784

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/do-demo-site Patch
@emdash-cms/do-solo-demo-site Patch
@emdash-cms/admin Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
create-emdash Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve. This is the right change solving the right problem.

Approach. emdash export-seed --with-content=all exported no content because exportSeed treated withContent purely as a comma-separated allowlist of collection slugs, so the literal all matched no collection and seed.content came back empty. Both the CLI arg help ("Include content (all or comma-separated collection names)") and docs/src/content/docs/reference/cli.mdx document all as a valid value meaning "every collection". Adding all to the existing ""/"true" sentinel set is the correct, minimal, idiomatic fix — it matches the documented contract and is consistent with how the bare --with-content flag is already handled. Closes #1329.

Implementation. The diff is a single conditional addition (|| withContent === "all") in exportSeed, with an explanatory comment. Tracing exportContent: when collections is null every collection is exported; the allowlist branch is unchanged. No SQL interpolation, no route/auth/locale concerns — this is a CLI export path.

Test. The new export-seed-with-content-all.test.ts is a genuine regression test: it seeds posts + pages with content, calls exportSeed(db, "all"), and asserts both collections' entries appear. Without the fix, "all" falls into the split branch → ["all"] allowlist → both collections skipped → seed.content is {}seed.content?.posts?.map(...) is undefined → the toEqual(["hello"]) assertion fails. With the fix it passes. Setup mirrors the established seed-test pattern (setupTestDatabase + SchemaRegistry, setI18nConfig(null) to mirror the CLI), and the ContentRepository.create / createField calls match their signatures.

Changeset. .changeset/export-seed-with-content-all.md is well-formed: "emdash": patch (correct package name), leads with "Fixes", describes the observable effect for an upgrader.

Edge cases considered and dismissed. all is not in RESERVED_COLLECTION_SLUGS, so a collection literally named all would now be swept into an --with-content=all export rather than exported alone — but all is the documented sentinel, so this is correct behavior, and the collision is an extreme edge case. all,posts (mixed) exports only posts; undocumented and defensible. Case-sensitivity (ALL) is consistent with the existing exact-match sentinels and the lowercase docs.

Clean, well-scoped bug fix with a proper regression test and changeset. No findings.

@github-actions github-actions Bot added review/approved Approved; no new commits since and removed review/needs-review No maintainer or bot review yet labels Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

export-seed: --with-content=all exports nothing (treated as a collection named "all")

1 participant