Skip to content

test: add nested-data & filename-normalization stress guards to CI#104

Merged
jodeleeuw merged 3 commits into
mainfrom
test/stress-tests-in-ci
Jun 18, 2026
Merged

test: add nested-data & filename-normalization stress guards to CI#104
jodeleeuw merged 3 commits into
mainfrom
test/stress-tests-in-ci

Conversation

@Mandyx22

Copy link
Copy Markdown
Contributor

Why

We had standalone stress harnesses (stress-tests/run-nested.mjs, run-rename.mjs) that caught real issues in nested-data generation and Psych-DS filename normalization, but they only ran manually. If a later change broke something we already fixed, nothing would tell us. This wires them into the automated suite so npm test (and CI) guard that behavior.

What

Four Jest suites, ported from the harnesses so they run under plain npm test with no build step (they import from src, matching the existing tests; the CI test job does not build):

@jspsych/metadata

  • nested-generation.stress.test.tsgenerate() over a fixture exercising every nested-data shape (deep objects, arrays of objects/arrays, mixed-type columns, a trial_type-less row, unicode, empties); asserts each variable's stored type/levels/range stays coherent. Documented findings F1a/F1b/F2 are pinned as current behavior so the suite stays green and a new deviation is caught.
  • rename-normalization.stress.test.ts — battery for toPsychDSValue / isValidPsychDSDataFilename / deriveArrayFilename / disambiguateArrayFilename, including the invariant that every derived+disambiguated name is Psych-DS-compliant.

@jspsych/metadata-cli

  • nested-cli.stress.test.tsprocessDirectory end-to-end: compliant main CSV from the source name, original JSON preserved under data/raw/, two-way variableMeasured ↔ CSV-column cross-check, and a best-effort Psych-DS validation pass (asserts 0 errors when the validator can reach the network, skipped offline — the structural checks are the source of truth).
  • rename-reject.stress.test.ts — the non-interactive path refuses a non-compliant filename (writes nothing, reports the failure) rather than inventing a keyword.

Shared fixture: dev/stress/nested-all-cases/subject-nested.json.

Notes

  • Test-only — no library or CLI behavior changes.
  • Full suite: 339 passed. The unrelated interactive-rename.e2e.test.ts fails to load locally because node-pty isn't installed; it installs in CI via npm ci.

🤖 Generated with Claude Code

Port the standalone stress-tests/ harnesses into the automated Jest suite so
regressions in already-fixed behavior are caught by plain `npm test` (and CI).
The tests import from source (the CI test job runs no build) and add no library
or CLI behavior.

- metadata: nested-generation coherence over a comprehensive fixture, and the
  Psych-DS filename-normalization helper invariants.
- cli: processDirectory end-to-end (compliant main CSV, data/raw/ preservation,
  variableMeasured <-> CSV-column cross-check, best-effort Psych-DS validation),
  and refusal to write a non-compliant filename non-interactively.

Shared fixture lives at dev/stress/.

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

changeset-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 19b31e0

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

This PR includes changesets to release 3 packages
Name Type
@jspsych/metadata Patch
@jspsych/metadata-cli Patch
frontend 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

jodeleeuw and others added 2 commits June 18, 2026 18:19
The F1a/F1b/F2 findings this fixture documented as "current behavior" were fixed
in #102 (now on main). Update the assertions to verify the corrected behavior:
- F1a: a numeric value in a trial_type-less row is counted in min/max (rt max = 9999)
- F1b: a column only in a trial_type-less row is typed string with levels, not "unknown"
- F2: a boolean column absorbs string "true"/"false" with no levels
Also tighten the coherence check so any boolean-with-levels is now flagged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jodeleeuw jodeleeuw merged commit fa17a9e into main Jun 18, 2026
2 checks passed
jodeleeuw added a commit that referenced this pull request Jun 18, 2026
)

* test: add nested-data & filename-normalization stress guards to CI

Port the standalone stress-tests/ harnesses into the automated Jest suite so
regressions in already-fixed behavior are caught by plain `npm test` (and CI).
The tests import from source (the CI test job runs no build) and add no library
or CLI behavior.

- metadata: nested-generation coherence over a comprehensive fixture, and the
  Psych-DS filename-normalization helper invariants.
- cli: processDirectory end-to-end (compliant main CSV, data/raw/ preservation,
  variableMeasured <-> CSV-column cross-check, best-effort Psych-DS validation),
  and refusal to write a non-compliant filename non-interactively.

Shared fixture lives at dev/stress/.

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

* test: add CSV-ingestion, scale, and cross-file-collision stress guards

Stacked on the nested-data/filename stress suites (PR #104). Three more
Jest suites, all test-only (no library/CLI behavior change):

- metadata csv-input.stress: type re-inference from CSV string cells
  (numeric coercion, Infinity/NaN rejection, mixed-column downgrade,
  RFC-4180 quoting, unicode, empty/literal-null, 50-char level cap,
  JSON-in-cell extraction) + CSV/JSON parity.
- metadata scale.stress: 5,000-row exact extremes, dedup, high-cardinality
  levels, boolean handling, throughput ceiling.
- cli array-collision.stress: two same-stem files in different subdirs
  sharing a nested array column; asserts main CSV, sidecar, and raw
  originals each disambiguate without overwrite, staying Psych-DS valid.

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

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Josh de Leeuw <josh.deleeuw@gmail.com>
jodeleeuw added a commit that referenced this pull request Jun 18, 2026
…ayer overlap

- Rename dataProcessingStress.test.ts -> dataProcessing.stress.test.ts to match the
  repo's *.stress.test.ts convention (#104/#106).
- Add a header note explaining the intentional overlap with packages/metadata's stress
  suites: these guard generate() through the frontend bundle's own resolution path, plus
  frontend-only coverage (multi-file CSV+JSON accumulation, validator partitioning).

No changeset: the frontend package is private and unversioned, so changesets ignores it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants