Skip to content

Latest commit

 

History

History
638 lines (582 loc) · 40.2 KB

coder-identity.md

File metadata and controls

638 lines (582 loc) · 40.2 KB

Coder sessions, identity and login

The study's coders (§2), coder sessions without login (§4), coder login (§5), researcher login (§7), quitting and deleting data (§8), closing sessions (§9) and response times (§10). Complements architecture.md.

1. Principles

  • The login provider proves who someone is; the server decides whether they get in (study roles, the who codes). No passwords on the server.
  • Only authentication unlocks earlier work from another device. An id from a link (a participant id in a panel URL, or an expert coder's own link) is a label, not a credential: anyone with the link could use it.
  • Unauthenticated work stays on its device, unless the coder moves it with a one-time transfer link.

2. Terms

Term What Where
Coder session (sessionId) One coder's run through a study: answers, progress. Everything is keyed by it coder_sessions
Device id A random secret the server gives a browser once, for all studies, in the httpOnly cookie annotinder_device. Never stored by the server the browser
Device key SHA-256 of device id, deployment and the crowd's participant id from the URL (if any): the device's key to its session in one study. Only this is stored, so a device's sessions in different studies can't be linked. One per device of a session session_devices
Coder Someone who codes in a study: an expert coder (made by the researchers, with their own units) or a crowd's coder (made when they start) coders
Coder id (coder) Who the coder is: $session.coder, the results' coder column, the values of the units' coder_set. Random, 8 characters, per study, never changed, and saying nothing about the person. Not personal data, except in studies from before 0.10.0 (below) coders.coder, coder_sessions.coder
Pseudonym A readable id ("fast blue heron"), made with the coder; the researchers can change it. Unique per study. Not personal data, but see below coders.pseudonym
Name An expert coder's name, given by the researchers, who can change it. Personal data coders.name
Coder's email address The address an expert coder signs in with, where the study has them sign in. Given by the researchers, who can change it. Personal data coders.email
Confirmed address When the expert coder first signed in with that address where the study requires sign-in (§5); none until then, and again after the researchers change it coders.email_verified_at
Participant id A crowd's id from the link's URL parameter (participantParam, e.g. PROLIFIC_PID): how a returning coder is found and how the panel pays. Personal data; never changes. A label, never a credential coders.participant_id
Linked email A verified address from a login (§5), linked to the session once, to continue on other devices coder_sessions.email
Transfer link A one-time link (15 minutes) that adds another device to the session transfers (token hash only)

The system never merges sessions. Researchers who want to merge sessions of one person group them by coder id in analysis.

Studies from before 0.10.0 keep readable coder ids. The migration that brought random ids (0002_release_0_10) kept every existing coder's id, so results from before and after the update match: an expert coder's id is what it was, their name or email address, and a crowd's coder's id is their participant id (the migration also copied it to name or participant_id). Such an id is personal data, and it shows wherever coder ids show: the results' coder column (also in coders.csv and deleted_coders.csv, whatever is chosen for the details), the API without details, the units' coder_set, $session.coder, the MCP endpoint's list_coders and deploy issues, and the deletion log. Only coders made since have random ids. Crowd sessions without a coder got a random id.

The study's coders

A study has expert coders or a crowd. The design's invitation chooses (the editor's Who codes), freely until the study's first deploy, which records the kind (studies.coder_kind, the study's coderKind; NULL before it) and fixes it (architecture.md §6.1). The Coders page shows the coders of that kind: before the first deploy the kind the draft (latest) design invites, after it the fixed one.

Expert coders a design doesn't use are never hidden. While the draft invites a crowd (or hasn't chosen) and the study has expert coders, the Coders page says "N expert coders (with email addresses) aren't used by this design", with Delete them (deleteCoders, after confirming); the editor's Who codes says the same when it is switched to a crowd. A first deploy as a crowd deletes them in the deploy's transaction (their rows with their names and email addresses, and their units in coder_set; they can have no sessions yet), and the Deploy page says so beforehand ("3 expert coders aren't used and will be deleted"). A crowd's coders only appear after a crowd is deployed, so the reverse doesn't arise.

A study's coders are rows of coders:

Column What Personal data Changes
coder The random id (below); the key is study and id no never
kind expert or crowd no never
pseudonym Made by the server (below), changeable. Unique per study, ignoring case no (but see below) yes
name Expert coders: required, unique per study ignoring case, 1 to 64 characters, no ; or # (a CSV's coder_set cells name coders, and use them as separators), no control characters, no spaces at its ends. Crowd: none yes yes
email Expert coders: the address they sign in with, unique per study ignoring case, or none. Crowd: none yes yes
email_verified_at When the coder first signed in with email where the study requires sign-in (§5): the address is right. None until then; cleared when the researchers change or remove the address yes (with the address) yes
participant_id Crowd: the participant id from the link, unique per study ignoring case; none without participantParam. Expert coders: none yes never
created When the coder was made no never

The database checks that an expert coder has a name and no participant id, and a crowd's coder no name and no email address. Lists are in the order the coders were made: created, then coder (an index on study, created, coder; created alone isn't unique: coders made in one request share it), and a page goes on after a coder id (after). A session's coder is one of them (coder_sessions.coder, never empty; it goes when the coder is deleted). Code: shared/studyCoders.ts, shared/pseudonyms.ts; the researcher API is in api/researcher.md (listCoders, createCoders, updateCoder, deleteCoders), the researcher UI on the Coders page (client.md §7).

  • Random ids: 8 characters from an alphabet without look-alikes (lower case letters and digits without 0 1 l o), e.g. k7m2q9xt, unique per study. Made by the server when a coder is made, distinct within a batch, and inserted with ON CONFLICT DO NOTHING: a coder that didn't go in because its id or pseudonym was taken gets new ones and is tried again, a few times, then the request fails; one whose name, email address or participant id another coder has (made meanwhile) refuses the request with 409 coder_exists (a crowd's session then continues the coder of that participant id). Coders made in one request are made a microsecond apart in the order given (created), so lists show them in that order.
  • Pseudonyms: an adjective, a colour and an animal, e.g. "fast blue heron", "old red fox": lists of short, common, neutral words (no words that read as a judgement of the person, such as "slow"), 40 × 15 × 60, so 36,000 combinations per study. Drawn at random, without reading the study's pseudonyms: the unique index refuses one that is taken, and the coder is tried again with another; after 3 taken ones, with a number ("fast blue heron 2", from a range that grows with each try), as in a study that uses most combinations. (The migration that gave existing coders pseudonyms, 0002_release_0_10.sql, numbered them in order.) The researchers can change a pseudonym, and the Coders page can make it from the name or the email address: the first and last characters (1 and 1 by default) with *** between, and whether an address's domain stays (k***s@uni.nl). Whatever is in it goes where pseudonyms go (downloads, AI assistants): the page says so when it is made from a name or an address, because it then holds a hint of who the coder is.
  • Expert coders are made by the researchers (the Coders page's "Add coders", POST /study/:studyId/coders), by name, before or after there are units; each gets an id and a pseudonym. A name or email address that another coder of the study has is refused (ignoring case), with the list. With "these are email addresses", Add coders takes an address per line: the address becomes the email address, and a shortened form of it the name (k***@uni.nl; a number where two collide), which the researchers can change.
  • The units' coder_set holds expert coders' ids. A coder set that names anyone else is refused, listing the unknown ids (400 unknown_coders). People write names: a CSV's coder_set value is looked up as an email address (coders.email), else a name (both ignoring case), else an exact coder id (so a downloaded file can be uploaded again), and uploaded by id. What isn't found is offered as new coders ("Add these coders": by name, or with "these are email addresses" as addresses). A recipe names its coders and its coder_set by name; the study gets ids. The server never makes coders on the way.
  • A crowd's session always has a coder. With a participant id in the link (participantParam), the coder with that participant id (ignoring case; kept as first written), made the first time it starts a session; without one, a new coder of its own, without a participant id. A returning coder on the same device still finds their session by the device key (§4). A crowd's coder goes with their last session: when the researchers delete it (§8), and when it is removed unused (§5).
  • The id never changes; the name, email address and pseudonym can. PATCH /study/:studyId/coders/:coder { name?, email?, pseudonym? } (a crowd's coder: only the pseudonym). Signing in uses the address as it is now (§5); a session keeps the address it was started with.
  • A confirmed address. The researchers can type an address wrong, and a study needn't have its coders sign in, so an address is unconfirmed until the coder signs in with it where the study requires sign-in (expert coders, link: "login", §5): then email_verified_at is when they first did (confirmCoderEmail, called from findOrCreateCoder, runtime/startSession.ts); later sign-ins keep it. Optional sign-in confirms nothing, also with the same address. Changing or removing the address (updateCoder) clears it. The Coders page shows "confirmed" (when: on hover) or "not confirmed" next to an address. Coders from before 0.10.0 had it set by the migration (0002_release_0_10.sql): the first session of the coder that signed in with that address (ignoring case), where the study's deployed design requires sign-in.
  • What researchers see: [id] [name | email | participant id | pseudonym]: next to the id, the first of name, email address and participant id that the coder has and the researcher may see, else the pseudonym. The client fetches the coders once (one cached query) and joins them to the ids where it shows coders (the Coders, Units, Links, Results and Preview pages, the coder set dialog, the editor's conditions). Links per coder hold only the link's secret (and the coder's id in their values); the link list shows the coder's name next to it.
  • Who may see personal data: listCoders gives ids, kinds, pseudonyms and units; with details=true also names, email addresses (with emailVerifiedAt) and participant ids, only for who may see personal data: a role in the study, through an API key only with the scope coders:details, and never through the MCP endpoint (AI assistants), else 403 (maySeeCoderDetails, researcher/coders.ts: the one place to decide). Through the MCP endpoint even the ids and pseudonyms (list_coders) only in a study whose ADMIN allowed AI access to its data (security.md "Keys"). The results export holds them likewise. The names and email addresses are stored before a coder ever signs in, which the privacy statement says (legal/privacy-statement.md).
  • $session: $session.coder is the coder's id; $session.coder_name (an expert coder's name), $session.participant_id, $session.email (the session's verified address, where it has one) and $session.pseudonym are read from the coder for their own session (GET /session), never stored with the session (coder_sessions.session keeps only the id): the researchers' session list has the id only. A design of format 1 (AnnoTinder 0.9, contracts design/upgrade.ts) is upgraded when it comes in: its $session.coder was the participant id in a crowd's design and the researcher-given id (a name) in expert coders', so it becomes $session.participant_id or $session.coder_name.

Results and downloads

  • Every file names coders by coder (the id); coders.csv has their pseudonym and kind.
  • Coders' details are chosen one by one, with no default: for each detail the study's coders have, the download asks: name (include / leave out), email address (include / leave out; with it email_verified_at, when it was confirmed, empty if not), participant id (include / hash / leave out). Download works once each is chosen; the browser remembers the last choice per study. Only who may see personal data gets these choices; others get the pseudonyms only (the server makes a raw export without the details for them).
  • participant_id_hash: the SHA-256 of the participant id exactly as stored (the panel's spelling), as hexadecimal, so researchers can still match with the panel. The download's README says how it is made, with a line of R and of Python, and that it is pseudonymised, not anonymous (an id that can be guessed can be found).
  • No hash for names or email addresses: they are easy to guess, so a hash of them would only look safe.

Study export and import

The coders go along as they are (ids, pseudonyms, names, the email addresses the researchers gave and when they were confirmed, participant ids), so results from before and after an import match by coder; so does the deletion log, with what was chosen at each deletion (participant ids or their hashes). Only the address a session signed in with (coder_sessions.email) goes along just where the deployed design requires sign-in: elsewhere it is a coder's own login, for their own sessions and settings, and not the researchers' data (shared/studyExport.ts).

3. Links

Links are made by deploying: one, or one per coder for expert coders with a link each (architecture.md §7). A link no longer part of the design is retired (403 link_inactive for new sessions; started sessions go on). A revoked link (403 link_revoked) can be reopened. The invitation (architecture.md §6.1), which says who codes (after the first deploy: the study's kind of coders), decides how a session starts:

Invitation Sign-in The coder ($session.coder)
expert coders, per_coder the coder's choice the link's coder
expert coders, pick_name the coder's choice the coder with the picked name (found by name, ignoring case; nameDevices: "first": the first device's; "any": picking it continues its session)
expert coders, login required (401 auth_required); only the email addresses of coders in the coder set (403 email_not_allowed) the coder with the login's address (coders.email)
one link (crowd) never required; the coder's choice only where the study's owner's plan has crowd sign-in on (§5) the coder with the participant id of participantParam (?<param>=…, required unless optional: true), else a new coder

Where the coder chooses to sign in, researchers don't see the email (contracts loginRequired). One link's maxCoders caps its sessions (403 link_used_up; the link's maxUses).

A coder can have several sessions: a coder who can't reach their first session (§4) starts another, as can anyone holding a link with that participant id (or the coder's own link). Each is its own session with the same coder (so panel redirects carry the participant id either way); researchers handle duplicates in analysis. What is guarded is privacy: no session is opened by a label. There is a most: a coder has at most 5 sessions in a study (§4).

4. Sessions without login

  • The device id. A browser gets one random device id the first time a link accepts it: cookie annotinder_device, HttpOnly, SameSite=Lax, Secure over https, Path=/api/d, 400 days. One cookie for all studies.

  • The session in a study. Per request the server derives the device key (SHA-256 of device id, deployment and the crowd's participant id from x-url-params, never the coder id) and finds the session with one indexed query. Including the participant id keeps coders apart on a shared lab computer. Only the key is stored; the id is long and random, so no server secret is involved (rotating ANNOTINDER_SECRET logs no coder out). Everything the study needs from the link and URL is stored when the session starts.

  • Device details. When a device joins, its type (phone, tablet, desktop), browser and OS are stored (shared/devices.ts), not the user agent. Each answer records its device (annotation_values.device_id); researchers get them via GET /study/:studyId/devices and devices.csv.

  • Session values. The design declares URL parameters (urlParams, architecture.md §7) and a crowd's participant id parameter (participantParam). A new session without a required value, or with one that doesn't fit (a list, or a pattern matched in full; at most 256 characters) is refused with 400 url_param_missing / url_param_invalid, so a broken panel link shows at once (runtime/sessionValues.ts). With the coder's id and the optional ?source= they are stored in coder_sessions.session and are $session.coder, $session.source and $session.<name>; who the coder is ($session.coder_name, .participant_id, .email, .pseudonym) is read from the coder (§2).

  • Same device later. The cookie resumes the session whatever link (or none) the coder comes back with, as long as the URL carries the same participant id.

  • CSRF. Every coder API request needs x-annotinder: 1, and the coder API sends no CORS headers. This relies on client and server sharing an origin.

  • Another device. "Continue on another device":

    1. POST /d/:deployment/transfer returns a one-time token (15 minutes), shown as a link and a QR code.
    2. On the new device, POST /d/:deployment/transfer/redeem adds it to the session (keys without and with the coder's participant id). Both devices can continue.

    Tokens are stored as hashes and deleted when used.

  • A link of a known coder on a new device (no cookie, and that coder already has a session: a crowd's participant id, or an expert coder's own link):

    1. The server refuses to create a second session silently: 409 { code: "coder_has_session" }.
    2. The client says: continue on the original device, or make a transfer link there. A coder who logged in there can Log in here: the notice has the button where the 409 says canLogIn (the server has a login, and the study's coders may sign in: §5), and the page they come back to continues the account's session.
    3. Only for a coder who can't get back (lost device, cleared browser): I can't get back to my earlier session… asks to confirm, then Start a new session retries with x-new-session: 1 (first request only). The new session can't see the earlier answers.

    New sessions of a known coder don't count toward the link's maximum. This tells someone holding the link that the participant id was used before, nothing else.

    At most 5 sessions per coder per study (MAX_SESSIONS_PER_CODER, runtime/startSession.ts): since they don't use up the link, one participant could otherwise fill a study with sessions. When the coder has 5, a request for another (x-new-session: 1) gets 403 coder_session_limit; the coding screen says "You can't start another session" and sends the coder back to the device where they started. The count runs under a database lock per study and coder (and a new crowd coder is made under a lock per participant id), so requests at the same time can't pass it together. A link without a participant id makes a new coder per session, so no such cap applies: those are bounded by the link's maxCoders and the limit on new sessions per address (security.md §3).

  • Links without a participant id on a new device simply start a new session (and coder). A coder who then logs in to continue their account's session leaves it; unused, it is removed (§5).

  • The coder home (/code) lists this browser's studies: the browser remembers the studies it opened (deployment and URL parameters, never a link secret) and asks each (GET /d/<id>/summary), since the server can't list a device's sessions. A logged-in coder also sees sessions linked to their email (GET /coder/sessions); one that isn't on this device opens with ?login=1, so the login counts there (§5). Without a login, the home offers one (Log in, where the server has a login) and comes back to the home. It shows each study's public title, never the (private) study name.

  • Not built: offering a longer-lived "continue later" link at the start of long studies (no PINs or passwords: easily forgotten, little gain).

5. Coder login

The researcher login (§7), with the same login cookie (annotinder_session). A login doesn't replace the session: it links an email to the session, once. After that the device key is the session as for anyone, and logging out doesn't affect coding. Code: runtime/requestCoder.ts, DeploymentRuntime.resolveCoder, runtime/dbStore.ts (resolveCoder), runtime/startSession.ts; client pages/CodePage.tsx, session/coderSession.ts.

  • Who must, and who may. Sign-in is required only for expert coders with link: "login"; only there do researchers see the email a session signed in with (Coders › Sessions, export). Everywhere else it is the coder's choice (optional sign-in), and not every coder has it:
    • expert coders always may;
    • a crowd's coders only where the study's owner's limits have crowdSignIn on (accounts.md §3): a plan's setting, off unless set, so off on a fresh server's default plan. It is read from the owner (studies.owner_id; a study without one: off) when a session asks (crowdSignInAllowed, shared/limits.ts), so a change of plan applies at once. Where it is off, the server ignores a crowd coder's choice (x-use-login): no login is read, linked or looked up.
  • What a session says (GET /session): signIn, how signing in stands in the study (required; optional: the server has a login and the study's coders may sign in; none, also in previews), and canLogIn: optional, the request has this study's link, and the session has no email yet.
  • Expert coders who sign in are the coder whose email address (coders.email) the login has, ignoring case; $session.coder is that coder's id, never the address. The coder must be in the deployed coder set; any other login gets 403 email_not_allowed, and the coding screen offers Sign in with another account: it logs out, also at the login provider (so the provider doesn't sign the same account in again), and logs in again. The provider's logout comes back to the start page, which goes on to that login and so back to the study (the way is kept in the tab's sessionStorage). They have one session each, found by the coder (not by the address): after the researchers change a coder's address, the new address continues that coder's session and the old one has no access. Such a sign-in confirms the coder's address, the first time (coders.email_verified_at, §2). Deploying checks that every coder with units has an address (architecture.md §8.4).
  • When a login counts: only where the deployed design requires sign-in, or the coder chose to code with their account (the request has x-use-login: 1), and only with an address the provider confirms (withVerifiedEmail, runtime/requestCoder.ts; or AUTH_INSECURE_DISABLE_EMAIL_VERIFICATION): a login whose address the session check found no longer confirmed signs in as no one, and Your studies lists nothing for it. A login that is just there in the browser is left out: a researcher who opens a coder link, or a coder who logged in for another study, gets a session without an email, and a second link in that browser (another panel id) starts its own session.
  • How a coder chooses. Three places send the browser to the study's page with login=1 in the address: Log in under "Continue on another device" (shown with canLogIn: "Sign in to continue from any device. The researchers don't see your email address.") and on the notice "You already started on another device" (the login's return address, logInWithAccount: coderLoginUrl({ useLogin: true })), and a study of the login on another device in the coder home's list (continueUrl). The page reads login=1 once, takes it out of the address (a copied link never carries the choice to someone else), and sends x-use-login: 1 while it stays open. After that the session has its email and the device its session, so nothing needs the header. login is one of the link's own query names, with link and transfer: a design can't use them as the key of a URL parameter or as participantParam (contracts RESERVED_URL_KEYS; "'login' is part of every study link (link, transfer, login): use another key").
  • When a login is read, where it counts: only while the session has no email and the request has a link of this study, or on a device without a session in this study. Never while coding, never in previews. Another study's link doesn't link a session here.
  • Required: without a login 401 auth_required; the client offers the login and comes back to the same page. An address that isn't a coder's in the coder set gets 403 email_not_allowed. "Continue on another device" says to sign in on the other device, with the session's address.
  • Optional: logging in from the offer (canLogIn) links the email.
  • A device that joined by a transfer link has no link of the study, so its login can't be linked to the session; what logging in there brings is the coder's own settings (theme, keys: GET /coder/settings). While its browser isn't logged in, and signing in is possible in the study (signIn not none), the coding screen shows one line: "Sign in here too to use your saved settings", with Log in (a plain login that comes back to the page; SignInHereLine).
  • Another device: on a device without a session in this study, a login that counts finds the email's session and adds the device, also without the link. A login whose email has a session in the study is also enough for the server to load the study for the request (Deployments.admit, api/coder.md), e.g. after a restart; so is a login whose address is now that of an expert coder who has a session (the researchers changed the coder's address since the session started, which keeps the old one).
  • One session per email per study: a device that started its own session and then logs in continues the email's session instead. Nobody can get back to the session it left (no device, no email). If the coder answered nothing in it (what a second device starts on an anonymous link, before the coder can log in) it is removed, and its link gets its place back (maxCoders); with answers it stays, for the researcher (removeIfUnused, runtime/startSession.ts). A crowd's coder whose only session that was is removed with it (forgetCrowdCoders).
  • When the login ends (§7: after 30 minutes without activity, 24 hours after the login), the coder goes on coding on the device: the session has its email, and the device key is the session. Logging in again is needed only for what reads the login: another device, the coder home's studies on other devices, and their own settings. Where the login is read (loginReader, runtime/requestCoder.ts), a request that changes something is activity for it, as for researchers, and the login is checked with the provider (§7, the session check).
  • Accounts: logging in creates a user with account role user (accounts.md).

Possible later: a system with its own login (e.g. AmCAT) vouches for a coder with a short signed assertion, so coders don't log in twice.

6. Open points

  • Removing a device from a session (e.g. a lost phone): possible, since devices have their own keys; not built.
  • A long-lived "continue later" link (§4): one per session, revocable; single use or not?
  • Duplicate work: shared queues count per session, so two sessions of one person can code the same unit. Possibly treat sessions with the same coder as one person.

7. Researcher login

Code: server/src/oidc.ts, researcher/login.ts, shared/sessions.ts, shared/sessionTokens.ts; client components/admin/account/. Endpoints: docs/api/researcher.md.

  • The provider proves who someone is; the session is ours. Any OpenID Connect provider, by issuer URL. The server runs the authorization code flow with PKCE itself (/auth/login, /api/auth/callback), so tokens never reach the browser; it checks the ID token and starts its own session: a random key in an httpOnly cookie, its hash in sessions. It ends after AUTH_SESSION_IDLE without activity (default 30 minutes) and AUTH_SESSION_MAX after the login (default 24 hours): activity is a request that changes something, or the client reporting that the user is at work (POST /auth/activity), written at most once a minute. The cookie is sent once, at login, for AUTH_SESSION_MAX (security.md §1, "The session"). Requests need x-annotinder: 1 (CSRF). The session keeps the provider's ID token (for logout) and refresh token (offline_access), encrypted. While the session is used, the server refreshes the token every 5 minutes (OIDC_SESSION_CHECK_INTERVAL): a session ended at the provider ends here too, and the user's address and name are updated (security.md §1, "The session check"). Logging out (POST /auth/logout) ends our session, revokes its refresh token and, when the provider has an end_session_endpoint, ends the provider's session (security.md, "Logout").
  • A new login ends the one it replaces. Coming back from the provider (/api/auth/callback, also for a step-up login), the server deletes the session of the login cookie the browser had, so it stops working at once. At every login it also deletes all sessions that have ended (deleteExpiredSessions, shared/sessions.ts), and the server does so every hour (sweepExpiredSessions, started in index.ts), so an ended session's row stays an hour at most. Each ended session's refresh token is revoked at the provider.
  • Identity is the login, not the email (accounts.md §1). A login without email_verified: true is refused. The user is iss + sub; the email (and the name, for display) is updated at each login and session check; the session check takes a new address only when the provider confirms it (security.md §1). Roles given to an address before its owner logged in are claimed at first login (within 3 months).
  • Reassigned addresses: a later owner of an address doesn't get the previous owner's account, and the safeguards keep them from old invitations.
  • Second factor: required for managing the server and for sensitive actions (recent, and renewed by each sensitive action: step-up); researchers and coders work without (security.md §1).
  • Account roles and limits: accounts.md.
  • Setting up a provider (e.g. Authentik): redirect URI <ANNOTINDER_PUBLIC_URL>/api/auth/callback, scopes openid email profile offline_access (openid email profile with OIDC_SESSION_CHECK=false), a confidential client. email_verified must reflect a real check; social logins may only be linked to existing users by email if that source verifies addresses; a lost second factor must not be recoverable by email alone.
  • The user's sessions: the Sessions and API keys page (account menu) lists the browsers a user is logged in on, and ends any of them or all others at once (GET /me/sessions, DELETE /me/sessions/:id, POST /me/sessions/end-others).

8. Quitting, and deleting a coder's data

Coders can always leave and have their data deleted; nothing is deleted by accident or to undo paid work.

Coder side (the door icon, QuitMenu.tsx):

  • Stop for now: nothing changes; the dialog explains how to continue (same link, same device and browser, or a transfer link first).
  • Quit this study: POST /quit ends the session (ended: { outcome: "quit", at }); answers are kept.
  • Quit and ask to delete my answers: POST /quit { requestDeletion: true } also records coder_sessions.deletion_request. The coder types a word to confirm. Also offered on the end screen; not in previews.

It is a request, not a deletion: AnnoTinder can't know whether the researcher holds the data elsewhere, and immediate deletion would let a paid coder withdraw the work after payment. It needs no proof of identity: it comes from the session itself.

Researcher side (Coders › Sessions): open requests come first, with Delete now or Delete later (POST /study/:studyId/sessions/:id/deletion-request/postpone sets postponedAt; the request stays until the data is deleted), and Delete all requests for all open requests at once, through the same dialog. Declining isn't a button: that is for the researcher's protocol. Any coder's data can be deleted (POST /study/:studyId/coders/delete { sessionIds?, coders?, participantIds? }, ADMIN; coders by id; "Delete a coder's data…" finds them by name, email address, participant id, pseudonym or id): the sessions (device keys, coder id, the request) and all their answers, also retired ones, and the study's stored results downloads (a file made before holds the answers; a download link for it stops working). Unit versions stay. It is a sensitive action (security.md §1). A deleted coder's browser later starts a new session from its link.

Deleting a coder (the Coders page's row action; the same request by coder id; the Sessions panel sends an expert coder's sessions this way too, and "Delete a coder's data…" every coder it finds, with all their sessions, also expert coders without a session) removes more than the sessions (removeCoders, shared/coderDeletion.ts):

  • the coder's row, with their name, email address and participant id;
  • every session of theirs and its answers, as above;
  • their set in the units' coder_set, in the draft and as deployed: the units have no coder from that moment (the runtimes read the sets again). The Coders, Units and Deploy pages say how many units have none; the researcher divides them again (Make coder set) and deploys the units;
  • their own link (expert coders with a link each), which is deleted (its sessions are gone): 404 link_not_found for anyone who has it.

The name can be given again afterwards: a new coder (a new id), without the earlier one's units, sessions or address, who gets a new link (another secret) when the units are deployed with them in the coder set. By session id an expert coder stays, with their units. A crowd's coder goes with their last session, so nothing of them is left.

Every deletion is logged (session_deletions: session id, coder id, requested, deleted, by whom, answer count), so the researcher can also delete the coder from earlier downloads by coder id (GET /study/:studyId/coders/deletions, Coders › Sessions, deleted_coders.csv). It lists no units, no name and no email address (neither the session's nor the coder's). Of a crowd coder's participant id it keeps what the researcher chose:

  • The dialog asks, and needs an answer to go on (where a crowd's coder is deleted; the API: participantIds, else 400 participant_ids_choice): keep the participant ids in the log, or only their hash: the SHA-256 of the id exactly as stored, in hex (participantIdHash, the same hash as the download's participant_id_hash). The dialog lists the participant ids with a copy button, to pass on to the panel.
  • Search in the deletion log: paste participant ids (POST /study/:studyId/coders/deletions/search); the server hashes them and says which were deleted, and when (found by the id kept, ignoring case, or by its hash).
  • Deletions logged before 0.10.0: a crowd's coder id was its participant id, so the migration copied it to participant_id (the search finds it). One that looked like an email address was kept as sha256:<hash of the address in lower case>, and stays so (no participant id).

deletedBy is the researcher's address. The export's sessions.csv also has ended = quit and a deletion_requested column.

9. Closing finished sessions

A session that ended (an end item, finishing the study, or quitting) is closed unless the study keeps sessions open (studies.reopen_minutes null; the first deploy suggests this for coder links, and a day for one link). So finished data won't change, and someone who later gets into a coder's login or device doesn't see their answers.

  • A closed session gets only what its end screen shows: GET /session returns endValues (the answers and unit fields the end message and redirect mention) and no other variables; getLoopUnit answers 409 session_closed.
  • Finishing without an end item also ends the session (POST /end without an item, outcome complete).
  • Going back: after completing (not after a screen-out, quitting or a deletion request) the coder can go back within the study's reopen time (reopen_minutes, counted from when they last finished; always if the study keeps sessions open): POST /reopen. Going back opens the session again; nothing counts down while it is open. reopen in POST /end's response and in GET /session says until when.
  • New units: when a coder got units since they last loaded the session (the researcher added units or moved units to them, and deployed), GET /session says how many (newUnits, with the deployment's newUnitsMessage), once. A finished session that can still be reopened is opened again for them, so they code the new units.

Not done on purpose: limiting how far back coders can go during a session. Coder-level answers are in the browser anyway (conditions use them).

10. Response times

Always on: how long coders take per question, for analysis (reading time) and for spotting clicking-through. In the download (timings.csv, and per unit in annotations.csv); mentioned on the privacy help page.

  • The browser measures per question (client/src/lib/studyManager/timing.ts, AnswerTimingSchema): time to first answer (firstMs), time on screen over all visits (totalMs), time with the page hidden (hiddenMs), and how often the answer changed (edits). Waiting for the server isn't counted. Sent with the answers (timings) and stored on the answer row (annotation_values.timing).
  • The server's bound, since a browser can be tampered with: when the server first handed out the unit (unit_serves, servedAt in listAnnotations) to the last answer bounds the time on its questions; coder-level answers are bounded by the previous post. The download flags browsers claiming more time than the server saw (exceeds_server, 2 s leeway). Too-fast answers show in the server's times themselves.
  • Later: inspecting times, distributions, fraud flags.