Repository navigation
Pin docs script tags and accept experiment_id in datapipe-client - #272
Merged
Merged
Conversation
An unpinned unpkg URL serves the newest release, so publishing one could change a study that is already collecting data. Every sample now takes its tag from components/dashboard/script-tags.js, pinned to extension-pipe 0.2.0 and datapipe-client 0.1.0, and the client README pins too. __tests__/script-tags.test.js fails when the client pin falls behind packages/client/package.json. Also say on the streaming and sending-data pages that the library takes experimentID while the extension's parameter is experiment_id. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The jsPsych extension and plugin call the experiment ID experiment_id, so the client now takes that name too. experimentID keeps working, because studies on an unpinned script tag pass it and so does the extension. If both are given and differ, the one-shot calls throw and a session starts inert with a warning. The wire format is unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The docs samples now read datapipe-client's version from its package.json, so the release PR's version bump moves their pin. That can't be done by a sync script: changesets/action (cwd: packages/client) commits only files under that directory, so an edit to components/ would never be committed. The README is inside the package, so `version-packages` now runs scripts/sync-readme-pin.mjs after `changeset version` to rewrite its pin. The script fails if the README has no unpkg URL to pin, rather than shipping one that points at the previous release. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The documented pattern was flush, read sessionId, submit. The flush was only there to wait for the session to start, but it also waited on the last staged write, which a backgrounded tab throttles hard, so the final submission could sit for most of a minute (#273). session.ready() waits for startup alone. saveData({ session }) awaits it and sends the id, so callers no longer read sessionId themselves. The sessionId option still works. The README, the dashboard sample and the streaming docs now show the new pattern. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The client accepts experiment_id as of this release, so the samples and README now use the same name as the jsPsych extension, and the notes explaining that the two names differ are gone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes three issues reported after launch, the third from #273.
Pin the script tags in the samples
The docs told researchers to load
https://unpkg.com/datapipe-clientandhttps://unpkg.com/@jspsych/extension-pipewith no version. unpkg serves the newest release for an unpinned URL, so publishing one could change a study that is already collecting data.components/dashboard/script-tags.js, pinned to extension-pipe0.2.0and datapipe-client0.1.0.script-tags.jsreads the version frompackages/client/package.json, so the release PR's version bump moves the pin.version-packagesnow runsscripts/sync-readme-pin.mjsafterchangeset versionto rewrite the pin. The script fails if the README has no unpkg URL to pin.changesets/action(withcwd: packages/client) commits only files under that directory, so a script edit tocomponents/would never reach the release PR.__tests__/script-tags.test.jscatches either pin coming unstuck.experiment_idin datapipe-clientThe extension and the plugin call the experiment ID
experiment_id. The client called itexperimentID, and the streaming page switched between the two without comment.experiment_id.experimentIDkeeps working, because studies on the old unpinned tag pass it and so does the extension.saveData,saveBase64DataandgetConditionthrow before sending anything, and a session starts inert with a console warning. TypeScript rejects passing both, or neither.The samples and README use
experiment_id, and the notes saying the two names differ are gone.Pass the session to
saveDataThe documented streaming pattern was flush, read
sessionId, submit. The flush was there only to wait for the session to start, but it also waited on the last staged write. A backgrounded tab throttles that write hard, so the final submission could sit for most of a minute (#273).session.ready()resolves once the session has started, or failed to start. It never rejects, and it waits only for the/api/sessionround trip.saveData({ session })awaitsready()and sends the session's id.sessionIdstill works for callers who build the request themselves.sessionId" warnings are gone.openSessions/{id}.Release order
The samples, the README and the dashboard now use
experiment_idandsession, which only 0.2.0 understands. The script tags take their version frompackages/client/package.json, which stays at 0.1.0 until the "Release datapipe-client" PR (opened by the test→main merge) bumps it. Merge that release PR right after test→main. Until it merges, prod serves 0.2.0 samples against a 0.1.0 tag.Testing
ready()resolving while a staged write never lands, andsaveDatawaiting on a session),tscpasses, and the build succeeds.script-tagssuite passes, as doextension-snippet,docs-navandlive-sessions-page. Lint is clean.next buildpasses, and the prerendered sending-data page loadsdatapipe-client@0.1.0.sync-readme-pin.mjsagainst a scratch copy with a bumped version. It pins an unpinned URL, leaves a pinned one alone, and exits 1 when there's no URL to pin.🤖 Generated with Claude Code