Repository navigation
cli(feat): add crash-safe demo seeding - #147
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Retargeted to |
af3b6f5 to
0eda9b1
Compare
0eda9b1 to
e462cd4
Compare
e462cd4 to
199cbea
Compare
Summary: - Add strict seed and add --demo orchestration that generates a reviewable Payload script only after a complete component install. - Fail closed on partial installs, path escapes, symlinks, unowned output, ownership conflicts, drafts-disabled Pages, and mutation failures. - Make Page and media reruns idempotent, atomic, marker-scoped, and safe across interrupted writes, with complete CLI and consumer documentation. Rationale: - Give contributors useful demo content without adding database access or runtime dependencies to the distribution CLI. - Keep elevated Local API access explicit and operator-run while preventing implicit publication or unrelated content and file mutations. Tests: - lint, source build, TypeScript, registry and integration checks - 111 integration tests passed; 1 skipped - packed CLI contract passed with add --demo - 14 focused browser tests and 275-page production build passed - fresh Payload 3.85.2 hero-basic seed smoke passed end to end - CodeQL security-and-quality found no diff-scoped findings - full fresh smoke reached all 31 installs, then hit an unchanged existing pricing-enterprise identifier-length limit
199cbea to
fd2a7db
Compare
# Conflicts: # tests/int/fresh-payload-smoke.int.spec.ts # tests/int/payload-components-pack.int.spec.ts # tools/payload-components/smoke/fresh-payload-repo.ts
Summary: - require healthy install state, dependencies, files, and wiring - bind generated Page and Media writes to local tokenized state - preserve the real Payload smoke harness and exercise demo seeding - document collision, rerun, and filesystem safety guarantees Rationale: - database-visible slugs, titles, and alt text are forgeable - exact locally recorded IDs prevent unintended elevated mutations - media deletion is unsafe without independent ownership proof Tests: - pnpm lint - pnpm source:build - pnpm exec tsc --noEmit - pnpm run test:int (160 passed, 1 skipped)
Summary: - journal unique Page and Media operation tokens before database creates - reconcile exact interrupted creates and persist their ownership IDs - cover create failures, restart recovery, and collision refusal - document the crash-safe demo seeding contract Rationale: - prevent successful database writes from becoming untracked when local state persistence is interrupted - preserve fail-closed ownership checks without duplicating or deleting content Tests: - pnpm lint - pnpm source:build - pnpm exec tsc --noEmit - pnpm run test:int
Summary: - add a 20-second timeout to generated demo seed runtime subprocesses Rationale: - prevent a hung generated script from stalling the integration suite forever Tests: - pnpm exec vitest run tests/int/payload-components-seed-runtime.int.spec.ts - pnpm exec eslint tests/int/payload-components-seed-runtime.int.spec.ts
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
payload-components seed <component> [--cwd <path>]andpayload-components add <component> [--cwd <path>] [--demo]interfaces..payload-components/demo-state/and atomically replace only version-marked owned scripts.Page.layout, validate it before mutation, and fill missing upload relationships at block roots and in nested arrays.Why
Demo content is useful only if it cannot silently publish, overwrite consumer files, or mutate unrelated Payload documents. The generated script keeps elevated Local API access explicit and reviewable while the private ownership record and write-ahead operation tokens make reruns and interruption recovery fail closed.
Security contract
--demoruns only after all five install stages and installed-state recording succeed.overrideLock: false.overrideAccess: trueexists only in the explicit operator-run script.Verification
VITEST_MAX_WORKERS=2 E2E_PORT=3211 pnpm test:releasehero-basicgenerated types, TypeScript, seed execution, build, and browser renderhero-videogenerated script TypeScript and seed executionScope note
The original incomplete admin-field-hints sweep was removed. This PR contains demo seeding, its tests, smoke-harness reuse, and documentation only.