Removes all 353 em dashes across the task, the quiz prefixes becoming
"Correct:" and "Not quite:". Also untracks the study documents a git add -A
swept into main, and adds the script that built this commit.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
init_db is idempotent, logs loudly on failure and re-raises, and /health now
reports db_error. Infrastructure, shared by both arms.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Deploy: counterbalance the side within a block, fix the feedback capital
Each block now puts the pair's first letter on the left for exactly half its
trials and its second for the other half, shuffled, matching the 20-trial
PsychoPy scheme. Applies to the dyad arm and the SONA arm. The quiz feedback
sentence is recapitalised after its prefix is stripped.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Deploy: record the trial landmarks, the quiz feedback and the clicks
stim_onset/outcome_onset plus the two interval columns, from stamps nicewebrl
was already writing; the quiz feedback text; partner_relation; and the screen
recorder fix that was losing every click count and the timing file's rt.
Also deals the partner code and avatar from the pool instead of per session.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Deploy: stop a parent and child meeting the same stranger
partner_id_for and partner_avatar_for now seed off rando, so a parent playing
under their first child's pid no longer gets that child's partner. The match
reveal records the partner it showed and export_csv prefers it, keeping the
three sessions already collected readable. Also carries the per-child bearid
fix to the BEAR sheet tooling.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
30 days ago
Deploy: name a quiz retry after the question it re-asks
Both found in the first BEAR pilot session.
- screens.watch wrote nothing, because its `from web_app import log_event`
built a second copy of a module that runs as __main__ in this container,
and a bare `except: pass` hid it. web_app registers the logger by name now,
and a screen that cannot be written is logged as a warning.
- bear_randomization_log.csv upserted on pid, which a dyad shares, so the
parent replaced the child. It keys on (pid, role) now, and houses_done
never goes down, so a reopened tab cannot erase a finished run.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Deploy: BEAR dyad mode, the design pool, screen timing, and the ID-code removal
Brings the Space up to main. What changes for a running session:
- ?rando=<n> picks the design from the predetermined pool (randos.py), so a
dyad can share one pid and still get two different tasks.
- dyad_mode sessions write to bear/<pid>/ and bear_randomization_log.csv,
leaving data/ and randomization_log.csv to the SONA sample.
- every screen is timed into a per-participant CSV with PsychoPy's column
names, including the quiz answer and whether it was right.
- savequeue_fix.py no longer carries two real participant ID codes, which
this repository has been serving publicly.
The two .docx files on main are left out; HF rejects loose binaries.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Stop a reload from stranding a participant at the end of the hunt
SONA 64408 finished all 192 trials and all 12 ratings, and then the page
never advanced. 64450 hit the same wall the night before and gave up without
writing in. Both sessions are complete in the data and neither one ended.
Reloading mid-game sends EnvStage.activate down its "load stage state from
memory" branch, where flax restores every array as numpy. custom_data_fn then
indexes those arrays and gets numpy scalars back, which make_serializable does
not convert because np.generic is not np.ndarray, so msgpack refuses the
record. That raise lands inside _process_save_queue ahead of its task_done(),
the queue keeps an unfinished task forever, and the queue.join() that ends the
stage can never return. Every later reload blocks at the same await.
Three guards, because the last step turns a lost record into a lost two-hour
session and that should not be possible however a record goes bad:
- get_latest_stage_state runs the restored state through match_types, so a
reload hands back…
The TriPM and demographics pages centred the instruction, the statements
and the Continue button. A statement therefore sat over the middle of its
own scale, and a short statement could wrap onto the line above its own
options, so the list read as a different layout for every statement
length. Both pages now put the whole list in one left-aligned column:
statement, its scale on the next line pulled flush by the radio's own
10px of inner padding, then the next statement.
Same change as task_pe-cu-nicewebrl's copy of these two pages, which is
the one a participant sees when this task runs first.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Take the real credit token back out of the public repo
This Space is public. A tracked file is served to anyone at /raw/main/,
and test_health.py held a working SONA credential: the token that grants
study credit for experiment 457. I put it there earlier tonight while
fixing the opposite problem, a token that was wrong.
The tests now use a fabricated token of the same shape. Which value the
live Space actually holds is checked through the fingerprint /health
reports, which is a hash and reveals nothing, so no test ever needs the
real one. test_no_real_credit_token_is_committed_anywhere walks every
tracked file and fails on any 32-hex credit_token that is not the
documented fake.
The token in this repo's history has to be treated as exposed. Rotating
it in SONA is the fix; removing it from the tip is not.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Let /health say which completion URL a Space is holding
The token was wrong for two days and nothing could see it. Both Spaces
reported SONA_RETURN_URL present and true, the URL was built, signed,
handed across the tasks and substituted exactly as designed, and the only
thing that could tell the right token from the wrong one was a real
participant reaching the final screen. This Space happened to hold the
right token and handed it to the other task whenever a participant
started here, so the study credited half its sample and not the other
half.
/health now reports the experiment id, which is public, a sha256 prefix
of the whole value, which is not reversible, its length, and whether a
survey-code placeholder is still in it. The fields match
task_pe-cu-nicewebrl's copy exactly, because comparing the two Spaces is
the point.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
In the combined study the second task skips consent on a genuine handoff,
so a participant reads one form and which one depends on their task order.
These two copies had drifted in two places.
This line adopts the other task's "at any time. It will not be held
against you.", which is an RA's correction of a run-on and is pinned by a
test over there. The other difference was a missing verb in their copy,
fixed on their side from this one. The two files are byte-identical now,
and task_pe-cu-nicewebrl's test_handoff_contract.py fails with a diff if
they separate again.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The session working in this repository ended before any of it landed, so the
record goes here: what was committed off the working tree, the push fix that
was losing every session's final write, the wording and framing fixes, and
the two facts about this checkout and its Space remote that are not obvious
from looking at either.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Frame this task's own partner too, not just the one it serves out
The belief and liking screen shows the farmer and the explorer on one
page. The picture served to the other app went through the frame; the one
rendered locally for this app's own screen did not, so on this side the
farmer filled its slot and the explorer sat at about a third of it.
The framing moved to sprites.draw_partner_avatar_framed and all three
callers use it: the /static/partner_face route, the deferred end-of-study
screen, and the standalone session's own row. The matching reveal keeps
the raw render, since it shows this task's partner alone with nothing
beside it to be mismatched against.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Scale the explorer to the frame the asking page reserves
The belief and liking page shows the farmer and the explorer side by side
in slots of one size. The farmer is a head-and-shoulders portrait that
fills its own render; the explorer is a whole standing figure occupying
54 of 144 pixels across, so in the same slot it came out about a third the
farmer's size, reading as a child beside an adult rather than as two
people the participant met. Cropping to what is drawn and scaling into a
144x176 frame puts both at the same presence. NEAREST on the way up,
since the art is pixel art.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Serve this task's partner faces, and stop dropping the final push
Four fixes that were written but never committed, so none of them reached
the Space.
The end-of-study belief and liking screen names every partner from both
tasks and shows each one's picture. Neither app can draw the other's
people, so each serves pictures of its own at /static/partner_face_<idx>.png
and the screen links to whichever app owns that avatar. This task served
nothing there, so its explorers showed a blank indent on both tasks'
copies of the screen. The route renders the same drawing the matching
reveal uses, and the handoff row now carries the avatar index so the other
app can ask for the right face. A missing index reads as None, never as
avatar 0.
The screen also named the game as "that game" for every row, which leaves
the participant guessing which of three or four people belonged to which
game, and asked the night-harvest partner whether they would "receive the
credits you earned for them" when that partner could only ever lose
credits. Both now match the wording t…
Request fullscreen on the first real click, not silently on load
A requestFullscreen() call made on page load has no user gesture behind
it (the click that navigated here happened on a different document),
so it was a rejected promise every time, silently swallowed by the
except clause. Queues the request instead and fires it from the
welcome page's Next button handler -- a real gesture, which browsers
honor. Mirrors task_pe-cu-nicewebrl's identical fix, found after they
asked their user whether the second leg was actually windowed.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Skip the fullscreen/device-check screen on a genuine handoff arrival
desktop_gate() ran unconditionally at the top of run_intro(), so even
after fixing the pid-screen gate, a second-task participant still hit
a click-through "make sure you're on a computer" screen before the
title screen. Skipped entirely on a verified handoff, attempting
fullscreen silently instead. Also checked three other defect shapes
task_pe-cu-nicewebrl found on their own side (canvas-drawn-late, id
capitalization, markdown-in-flex-row, nested bold) -- none exist here.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Restructure belief/liking into one per-partner check, plus 3 smaller fixes
Belief and liking now run once, covering every partner across both
tasks (not just this task's own), before TriPM/demographics, on
whichever task finishes second. Adds a kind field to the handoff's
partner-row format so the belief question's wording (receive vs. lose)
matches each partner's actual mechanic; backward compatible with the
3-field format.
Also: fixed a real bug where the experimenter ID-entry screen was
showing on every non-dyad session (role was never set outside dyad
mode, but was required to skip it); added partner numbering to the
match-reveal screen; quiz feedback now states the correct answer
outright instead of only explaining it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Send a bare partner id instead of a sentence in the handoff row
task_pe-cu-nicewebrl caught this: "your partner (#12345)" survives
_ROW_ID_OK's filtering as "your partner 12345", then their screen wraps
its own label around that, doubling up. Send str(partner) bare instead,
matching their own id format, and add the wording on the receiving side
for either direction's bare id.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Name each partner on the final screen instead of a combined total
A total can't say what any one partner walked away with, which is what
the participant actually decided. Ports task_pe-cu-nicewebrl's
encode_partner_rows/partner_list_signature/verify_partner_rows into
order_link.py (verified byte-identical against their actual file) and
carries them as pparts1=/ppsig= alongside the existing pbonus1=/plost1=
total, not instead of it. The final screen now lists one line per
partner, in the order met, falling back to the combined-total sentence
if no itemised list arrives.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The retry loop had no exit besides answering correctly, and its attempt
counter was global across every wrong item rather than per item. A
participant who could not pass a given item for any reason had no way
through it. Matches task_pe-cu-nicewebrl's day-quiz cap; a still-wrong
item at the cap is let through flagged forced=True.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Apply the user's pilot review list: ordering, headings, and partner totals
Drops the "a couple more things" interstitial, swaps TriPM/demographics
order, shuffles the future-outlook items, moves the belief/suspicion
check to the very end (after TriPM/demographics, not before), reworks
post-task page headings into TriPM's instruction-line register, carries
a signed partner-bonus total across the handoff so whichever task runs
second can report every partner across both tasks, runs the front matter
on a genuine handoff even under ?dev=1, and discloses a new character/
partner when this task runs second. Mirrors several equivalent fixes
already made and shared by task_pe-cu-nicewebrl.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Shuffle the TriPM per participant and stop forcing all 58 answers
Mirrors two fixes already made on task_pe-cu-nicewebrl: the TriPM was
shown in fixed file order, unevenly weighting attention cost across its
three scales, and the submit handler blocked Continue entirely while any
item was blank, contradicting consent's "you can skip any question" line.
Also ports back a dialog-persistence fix to _confirm_skip, which their
side found in their copy of a helper that originated here.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Fix three consent-text errors found on task_pe-cu-nicewebrl's served form
Venmo was never set up but the form offered it as a payment option; the
task-order sentence was hardcoded and wrong for half the sample depending
on which task resolves first; the payment-ask wording omitted the
reference code that actually identifies which session to pay. Mirrors the
same three fixes already made and approved on the sibling task.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Add a dev one-house override and carry dev/trials across the handoff
?houses=N shortens a dev run to the first N houses, matching the existing
?trials=N (per-house). The cross-task handoff was also missing the
dev=/trials= passthrough task_pe-cu-nicewebrl already had, so a shortened
session here handed over to a full-length one there; mirrored their fix.
The entry-order redirect now skips itself under ?dev=1 for the same reason
their equivalent redirect does.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Trust a verified handoff for general-measures deferral too, not just sona_url
task_pe-cu-nicewebrl found and fixed a gap in their own consent-skip logic:
it depended on sona_url reaching the second task's session, which does not
happen when the first task supplies its own sona_url from a Space secret
and does not carry it into the handoff. Checked whether this task's handoff
has the same gap: it does not. other_task_url() carries sona= whenever
app.storage.user["sona_url"] is already resolved, and that resolution
(including the SONA_RETURN_URL fallback) runs before finish_experiment()
can build the handoff, confirmed by reading the code and by calling
other_task_url() directly.
This task's consent gate also does not share their failure shape (it
defaults to not showing consent unless the combined study is confirmed
active, the opposite default from theirs).
The general-measures (demographics/TriPM) deferral does share the same
dependency on _in_combined_study(), so it's hardened the same way: trusts
a directly verified handoff (task_order_source == "handoff" a…
Fix: trust a verified cross-task handoff even when task_first was cached
Real bug, found via an actual live two-task playthrough (the first one run
since the reference-code redesign): a participant whose first task is "pe"
touches THIS task's session twice -- once on arrival (resolves and caches
task_first="pe", redirects away before experiment_started) and once on
return, via the OTHER task's genuine signed handoff, in the same browser
session. The old "resolve once" guard ("task_first" not in app.storage.user)
saw it already cached from the first visit and skipped verifying the
handoff entirely on the second, leaving task_order_source stuck at its
stale pre-redirect value -- which then re-triggered the entry-redirect
check, bouncing the participant straight back to the other task instead of
ever letting them play this one.
Fix: a genuinely verified handoff is now checked and trusted on every
request that carries one, not gated behind "nothing cached yet" -- a
cryptographically verified handoff is always more authoritative than an
earlier self-resolved gu…
Matches task_pe-cu-nicewebrl's phrasing (they matched the consent form's own
wording; mine still said "email you separately", a holdover from before the
consent fix). Cosmetic -- a participant only ever sees one of the two
screens -- but keeps the promise consistent with what consent.md actually
says.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Bake the bonus amount into the signed reference code; fix consent wording
order_link.signed_reference_code()/verify_reference_code(): the participant's
final-screen code is now "<pseudonym>-<cents>-<sig>", HMAC-signing the
pseudonym and the combined bonus total together (SONA_PID_HASH_KEY). An RA
reads the dollar amount straight off a reported code with no lookup, and a
participant editing the digits before reporting it back breaks the
signature. Falls back to the bare pseudonym if the key is unset. 6 new
tests (21 total).
Also fixes a wrong assumption surfaced while building this: the combined
screen does NOT always land on this task -- the entry-redirect logic means
whichever task finishes second shows it, which alternates with task_first.
That only held for the old write-based design (item 44, withdrawn), where
only this task had GitLab write credentials. task_pe-cu-nicewebrl needs the
matching screen for when they end up second.
content/consent.md: "we will ask for your name and an email address at the
end of the study" -> "the research team will conta…
Show reference code on final screen for the SONA bulk-email payment workflow
Resolves item 45's two open payment-design questions, after the user
confirmed directly in SONA admin that Contact Participants is bulk/templated
(not 1:1), settling on: an RA periodically emails everyone granted credit
asking them to reply with name + payment method, matched back to their saved
bonus data via a reference code shown on this final screen.
The code is the participant's existing research pseudonym (app.storage.user
["pid"]) -- already the literal GitLab data-folder name, so no new scheme,
secret, or stored mapping is needed for an RA to look up the real amount
(money_self/money_partner, already saved, never taken on the participant's
word). gitlab_save.submit_payment()/questionnaires.payment_screen() remain
unused -- this design doesn't need them.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Update consent to match approved protocol; withdraw non-compliant payment store
Consent (content/consent.md, applied by task_pe-cu-nicewebrl at the user's
instruction, byte-identical to their copy): now says name + email are
collected for payment, stored in a password-protected payment spreadsheet
kept separate from study data -- matching the BEAR protocol's 09-22 revision,
which added exactly this and removed the prior "no identifiable information
will be collected" promise.
Withdraw item 44's payment store: task_pe-cu-nicewebrl found the approved
protocol commits to a password-protected spreadsheet separate from study
data (the lab's existing Box-based arrangement), not a GitLab-hosted CSV
written via a Space API token, and not email alone without a name.
payment_log.csv/payment_screen()/submit_payment()/SONA_PAYMENT_HASH_KEY are
pulled from finish_experiment() -- confirmed via /health this was live and
would have actually written to the non-compliant store, though no real
participant had reached it. Replaced with a display-only bonus total; no
collection, noth…
Add SONA payment-collection screen + store, fix raw-code leak in task-order log
Payment: whichever task a participant finishes second now sums both tasks'
self bonus and collects email + Venmo/Amazon Gift Card/PayPal choice, saved
to a separate payment store keyed by its own pseudonym (SONA_PAYMENT_HASH_KEY,
distinct from the research pid's key) so email can never be joined to research
data with only one secret. Nothing here executes a real payment -- disbursement
stays a human-worked queue by design.
Privacy fix: the shared task-order log was keyed on the raw SONA code, which
(combined with SONA_PID_HASH_KEY) could re-identify participants -- found by
task_pe-cu-nicewebrl while checking what the new payment log would sit next to.
first_task() now takes the raw code and the research pseudonym separately: the
raw code still feeds only the (unpersisted) local hash fallback, while the
pseudonym is what actually gets written as the log's row key.
15 new tests in test_payment.py; one new test_health.py test.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Add SONA_RETURN_URL fallback so the credit-granting URL never has to fit in SONA's Study URL
Squashed deploy snapshot of main (item 32 in PROJECT_LOG.md), same
docx-free pattern as the previous deploy commits.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Squashed deploy snapshot of main (item 31 in PROJECT_LOG.md), same
docx-free pattern as the previous deploy commit -- see that commit's
message for why the doc is excluded.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Deploy: 16-trial redesign, chest/counterbalancing fixes, pilot bug fixes
Squashed deploy snapshot of main (items 23-30 in PROJECT_LOG.md), built
without the tracked reviewer-instructions .docx: Hugging Face's git
endpoint rejects pushes containing binary files (Git LFS/Xet only), and
this history carried two .docx blobs. The doc isn't needed by the running
app -- it stays tracked on `main` and backed up via `origin`, just left
out of what's pushed here. See PROJECT_LOG.md on `main` for the full,
unsquashed commit history and rationale.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>