Skip to content

frontend: validate the pipeline editor autosave entry with a zod schema - #2655

Merged
SpicyPete merged 1 commit into
masterfrom
improvement/rpcn-draft-simplify
Sep 21, 2026
Merged

SpicyPete merged 1 commit into
masterfrom
improvement/rpcn-draft-simplify

Conversation

@SpicyPete

@SpicyPete SpicyPete commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #2624. The editor's crash-recovery buffer in localStorage was gated by a hand-written type guard that re-listed every field of EditorAutosaveEntry, so the type and the check had to be kept in step by hand. This replaces the guard with a zod schema and derives the type from it, so there is one definition of what a valid entry looks like.

  • editorAutosaveEntrySchema pins version to AUTOSAVE_ENTRY_VERSION and keeps basedOnUpdateTime nullish, as before.
  • readAll runs safeParse per entry and drops the ones that fail, so a stale or corrupt shape still can't reach form.reset.
  • The only observable difference is that unknown keys on a stored entry are now stripped rather than carried along. Nothing reads them.

Testing

  • rpcn-editor-autosave.test.tsx passes under the integration config.
  • bun run type:check and Biome are clean on the changed file.

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

✅ Clean — no registry drift, off-token colours, or ad-hoc classes

App: frontend · Scope: diff vs origin/master · Files: 1

Count
⚠️ Outdated registry components 0
🛠 Locally-modified components 0
❓ Unknown to registry 0
🎨 Off-token palette colours 0
🔢 Ad-hoc utility classes 0

Generated by lookout audit-changes.

@SpicyPete
SpicyPete requested review from a team and removed request for a team September 21, 2026 14:46
@SpicyPete SpicyPete self-assigned this Sep 21, 2026
@SpicyPete
SpicyPete merged commit cc6d331 into master Sep 21, 2026
18 checks passed
@SpicyPete
SpicyPete deleted the improvement/rpcn-draft-simplify branch September 21, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants