Skip to content

fix(csv): validate the shape of saved datasets (02-2.4) - #5

Merged
daggerok merged 1 commit into
masterfrom
fix/validate-saved-datasets
Oct 13, 2026
Merged

daggerok merged 1 commit into
masterfrom
fix/validate-saved-datasets

Conversation

@daggerok

Copy link
Copy Markdown
Owner

Plan 02 item 2.4 (csv part), with the check fixed to the real DataSet type

What

loadPersistedDataSets restores only an array of { fileName: string, data: string[][] }; anything else returns null (the existing "nothing stored" path) and logs a warning

Why

The plan's check (d.rows, d.headers) does not match interface DataSet { fileName: string; data: string[][]; } and would have rejected every valid saved set; its find block also occurs twice (NEEDS_BOOT_RESTORE only checks the length, so it was left as is)

Checks run

  • bun install -E, bun run build, git diff --check
  • the patched function on 11 stored values (valid one and two files, the plan's {"dataSets":"x"}, rows/headers shape, data not an array, a row not an array, [null], [], null, broken JSON, nothing stored): valid ones restore, the rest return null
  • headless Chromium, Remember Data on, built site: valid record restores its rows; {fileName, data:"x"} crashed the old build (blank page, TypeError: ec.rows.map is not a function) and loads cleanly with this change; no console errors

loadPersistedDataSets returned any non-empty JSON array from
localStorage, so a damaged or foreign record reached the table code and
failed there (.map is not a function). It now restores only an array of
{ fileName: string, data: string[][] } and otherwise starts empty, the
path an empty store already takes
@daggerok
daggerok merged commit a4dd09b into master Oct 13, 2026
3 checks passed
@daggerok
daggerok deleted the fix/validate-saved-datasets branch October 13, 2026 00:39

This branch was successfully deployed

2 active deployments
ci — c447abfd Deployed Oct 13, 2026 by daggerok via npm-check-updates #41
github-pages — c447abfd Deployed Oct 13, 2026 by daggerok via deploy #37
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.

1 participant