From 8a24d011bf88b3c185c002e05a0d5ee13e2c34cc Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sat, 25 Jul 2026 11:08:20 -0400 Subject: [PATCH 1/2] docs(website,frontend): rewrite docs and wizard copy for researchers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rewrite the six documentation pages and the wizard's interface text for readers who run jsPsych experiments but are not developers. The `data/raw/` rule and the join-key concept were each restated in several places, every time in different words and heavy with terms like "byte-for-byte, same-named copy" and "re-serialised". Each now has one plain-English explanation, reused where it is needed and linked to from the rest. Wizard labels match what the docs call them, field hints drop SPDX/canonical-URL jargon, `@type` becomes "Author type" and "Privacy policy" becomes "Sharing restrictions" (both still naming the underlying JSON key), and error messages say what to do next instead of dumping exception text into the file list. The processing summary now reports outcomes rather than counting skipped and failed files as processed, and destructive confirmations state that files on disk are untouched. Two factual fixes fell out of the pass: Validation now covers the dataset the user actually downloads. The zip has always shipped placeholder README.md and CHANGES.md, but the validator never saw them, so every run raised MISSING_README_DOC and MISSING_CHANGES_DOC against documents the download does contain — and the Review step carried a note explaining the false alarm away. Both Psych-DS rules are presence-only (stem plus extension at the dataset root), so handing the validator the same bytes the zip carries is an honest check rather than a suppression, verified against psychds-validator directly. Their content now lives once in datasetLayout.ts, shared with the zip builder so the two cannot drift. The project name is passed only when a zip is on offer: saving the bare dataset_description.json produces no such files, and the warnings are then real advice about the user's own folder. Review also pointed at `npx @jspsych/cli validate` — a package that does not exist on npm, with a subcommand the metadata CLI never had. Since validation now covers the whole downloaded project, the re-validation block was removed rather than corrected, along with its dead styles. Co-Authored-By: Claude Opus 5 --- .../docs-clarity-and-validated-readme.md | 9 ++ docs/dev/frontend-architecture.md | 2 +- packages/frontend/README.md | 2 +- .../frontend/src/components/PreviewDrawer.tsx | 2 +- packages/frontend/src/components/Sidebar.tsx | 3 +- packages/frontend/src/datasetLayout.ts | 25 +++++ packages/frontend/src/pages/Authors.tsx | 15 +-- packages/frontend/src/pages/DataUpload.tsx | 96 +++++++++++-------- packages/frontend/src/pages/Landing.tsx | 4 +- packages/frontend/src/pages/ProjectInfo.tsx | 42 ++++---- packages/frontend/src/pages/Review.module.css | 33 ------- packages/frontend/src/pages/Review.tsx | 47 ++++----- packages/frontend/src/pages/Variables.tsx | 5 +- packages/frontend/src/staging/datasetZip.ts | 13 +-- .../src/validation/validatePsychDS.ts | 31 ++++-- .../tests/AppShellIntegration.test.tsx | 6 +- packages/frontend/tests/Authors.test.tsx | 6 +- packages/frontend/tests/DataUpload.test.tsx | 48 +++++----- .../frontend/tests/PreviewDrawer.test.tsx | 2 +- packages/frontend/tests/ProjectInfo.test.tsx | 20 ++-- packages/frontend/tests/Review.test.tsx | 35 ++----- packages/frontend/tests/Variables.test.tsx | 4 +- .../frontend/tests/validatePsychDS.test.ts | 22 +++++ website/docs/guides/customizing-output.md | 40 ++++---- website/docs/guides/troubleshooting.md | 32 ++++--- website/docs/guides/using-the-cli.mdx | 8 +- website/docs/guides/using-the-wizard.mdx | 41 ++++---- website/docs/introduction.md | 16 ++-- website/docs/reference/cli-reference.md | 64 ++++++++----- 29 files changed, 363 insertions(+), 310 deletions(-) create mode 100644 .changeset/docs-clarity-and-validated-readme.md diff --git a/.changeset/docs-clarity-and-validated-readme.md b/.changeset/docs-clarity-and-validated-readme.md new file mode 100644 index 0000000..f88baa2 --- /dev/null +++ b/.changeset/docs-clarity-and-validated-readme.md @@ -0,0 +1,9 @@ +--- +"frontend": patch +--- + +In-browser validation now checks the dataset the user actually downloads. The zip has always shipped placeholder `README.md` and `CHANGES.md`, but the validator never saw them, so every run reported `MISSING_README_DOC` / `MISSING_CHANGES_DOC` for documents the download does contain — and the Review step carried a note explaining the false alarm away. The validator is now handed the same two files (both Psych-DS rules are presence-only, so this is an honest check, not a suppression), the warnings no longer appear, and the note is gone. Their content lives once in `datasetLayout.ts`, shared with the zip builder so the two can't drift. Saving only `dataset_description.json` produces no such files, so those warnings correctly still appear there. + +Review also no longer points at `npx @jspsych/cli validate` — a package that does not exist on npm, with a subcommand the metadata CLI never had. Since validation now covers the whole downloaded project, the re-validation block was removed rather than corrected. + +Wizard copy was rewritten throughout for researchers rather than developers: plainer field hints (`URL or SPDX identifier` → `A standard license name like CC-BY-4.0, or a link to the license text`), `@type` relabelled **Author type** and `Privacy policy` **Sharing restrictions** (both still naming the underlying JSON key), errors that say what to do next, no raw exception text in the file list, and a processing summary that reports outcomes (`Finished. 3 files read, 1 skipped.`) instead of counting skipped and failed files as processed. Destructive confirmations now state that files on disk are untouched. diff --git a/docs/dev/frontend-architecture.md b/docs/dev/frontend-architecture.md index b0dc0d5..06f63c9 100644 --- a/docs/dev/frontend-architecture.md +++ b/docs/dev/frontend-architecture.md @@ -148,7 +148,7 @@ The result is a `convertedFiles` map (dataset-relative path → contents) carrie **Network is required** — the validator fetches the Psych-DS schema and schema.org context at runtime. If it can't run, `validatePsychDS` throws `ValidationUnavailableError` with a connectivity-first message (underlying error appended), which Review surfaces as an `unavailable` banner rather than a false "invalid" result. -**Zip-resolved warnings:** the in-browser validator only sees the metadata + data files, so it reports `MISSING_README_DOC` / `MISSING_CHANGES_DOC`. The downloaded zip ships `README.md` and `CHANGES.md`, so Review (`ZIP_RESOLVED_WARNINGS`) shows a reassurance note explaining these clear once the downloaded dataset is validated. A `
` block also documents the CLI equivalent (`npx @jspsych/cli validate`). +**Validate what gets downloaded:** the zip ships placeholder `README.md` / `CHANGES.md`, so the validator is handed the same two files and `MISSING_README_DOC` / `MISSING_CHANGES_DOC` never fire against a project that will contain them. Both Psych-DS rules are presence-only (stem + extension at the dataset root), so this is an honest check rather than a suppression. Content lives in `datasetLayout.ts` (`datasetDocs()`), shared by `datasetZip.ts` and `validatePsychDS.ts` so the two cannot drift. Review passes the project name only when `hasDataFiles` — with no data there is no zip, so those warnings are real advice about the user's own folder and must still surface. > The core `@jspsych/metadata` library does **not** validate — validation is a consuming concern owned by the frontend (here) and the CLI (`packages/cli/src/validatefunctions.ts`). Unit tests for these helpers are tracked in issue #94. diff --git a/packages/frontend/README.md b/packages/frontend/README.md index 471fa49..6f36f66 100644 --- a/packages/frontend/README.md +++ b/packages/frontend/README.md @@ -99,7 +99,7 @@ Inspect the generated `dataset_description.json` and download your project: ``` - If no data files were uploaded, a **Save `dataset_description.json`** button is shown instead. - **Validate dataset** runs the Psych-DS validator entirely in your browser and lists any errors and warnings inline, each with the underlying rule key and the specific files/columns at fault. An internet connection is required — the validator fetches the Psych-DS schema and schema.org context at runtime. - - Because in-browser validation only sees your metadata and data files, it may report missing `README` / `CHANGES` warnings. These are expected: the downloaded zip already includes `README.md` and `CHANGES.md`, so they clear when you validate the downloaded dataset (e.g. with `npx @jspsych/cli validate`). + - The check covers exactly what the zip will contain, including its placeholder `README.md` and `CHANGES.md`, so there is no need to re-validate after downloading. Saving only `dataset_description.json` produces no such files, and missing `README` / `CHANGES` warnings then correctly appear. The **{} Preview** pill button (visible on all steps except Review) opens a live JSON snapshot in a slide-in drawer so you can check the output at any point without leaving the current step. diff --git a/packages/frontend/src/components/PreviewDrawer.tsx b/packages/frontend/src/components/PreviewDrawer.tsx index ebeba00..79784f9 100644 --- a/packages/frontend/src/components/PreviewDrawer.tsx +++ b/packages/frontend/src/components/PreviewDrawer.tsx @@ -37,7 +37,7 @@ const PreviewDrawer: React.FC = ({ jsPsychMetadata, onClose onClick={handleClick} >
- JSON Preview + JSON preview
diff --git a/packages/frontend/src/components/Sidebar.tsx b/packages/frontend/src/components/Sidebar.tsx index 5aad092..b77ddbb 100644 --- a/packages/frontend/src/components/Sidebar.tsx +++ b/packages/frontend/src/components/Sidebar.tsx @@ -110,7 +110,8 @@ const Sidebar: React.FC = ({ >

Start over?

- All progress will be lost and you'll return to the welcome screen. + This clears the data you uploaded and everything you've entered, and takes you back to + the start screen. Your own files on disk are not touched.