You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(links): a link for a place opens its recorder, names the draft and offers the way back - #290
Protocol side: mieweb/pulsevault#98 (PROTOCOL.md §3, §3.1, §5.4, §5.6; protocol 2.7). The links come from TimeHuddle: mieweb/timehuddle#861. 27 commits on main: squash on merge.
What
An upload link is still one upload: v=1, artifactId, server, token, exactly as released. New in protocol 2.7: when the link's token carries a ref claim (the operator's opaque key for the place the upload goes to — a ticket, a team's update), the link is "for a place", and Pulse:
opens the recorder on that place's unsent draft if there is one, else on a new draft named with the link's name (the draft is created on its first clip);
keeps one destination row per (server, ref) until a draft uses it — a newer link for the place, once its server has accepted it, replaces the older one's upload id and token;
preselects the place on the upload screen, and never falls back to another destination by itself;
offers "Back to · " once the upload is in, when the link carried a return URL;
titles an unnamed draft with the place's label on Home while the place's row exists.
Optional, unsigned display hints on the link: label (≤ 60), name (≤ 80, cut to a draft name's limit), app (≤ 30), return (≤ 512, https or http to a private/dev address, no username or password). There is no ref URL parameter: the place is read from the token, as exp already is.
A link whose token has no readable ref is a plain link and takes the path it always did, with the differences listed under "Behaviour changes for plain links".
Why
The operator's app (TimeHuddle) mints upload links for "Record with Pulse" on a ticket or a huddle. Before this, each link was an anonymous destination in a pool: the person had to find the right draft and pick the right server by host name. With the place in the token, a second link for the same ticket finds the recording already started for it.
How a link for a place is handled
Parse. Parameters are decoded by the platform's URLSearchParams (form-urlencoded, §3; the first value of a name counts). server and return are read by the platform's URL. Hints are cleaned to one line of plain text: control characters and U+2028/2029 become one space, bidirectional-formatting characters are dropped, a hint with nothing to see is absent, lengths are Unicode code points and a cut never falls inside an emoji sequence or between a letter and its marks (§3.1).
Read the token as §5.6 says: the part before the first ., base64url without padding, the UTF-8 text of one JSON object with artifactId, iat, exp, kid and issuer. exp must be a whole number; ref is 1–200 code points with no unpaired surrogate, else it reads as none. Only exp and ref leave the decoder.
Screen, before anyone is asked anything:
a link whose exp has passed on this device is refused with its own toast and opens no recorder;
a link the place already holds (the same upload id and the same token) has nothing to pair: its recorder opens at once, with no sheet and no request, offline included;
on Android, the link the app was launched with is checked against the links Pulse already dealt with (see "Known limitations").
Confirm the server on the pairing sheet, unless it is trusted. The sheet shows only the host, never the link's own words.
Ask the server two things at once: whether it speaks this app's protocol (/capabilities), and whether it accepts the link's token (the status request, §6.5, token in the Authorization header only). Each gives up after 8 s; the recorder waits for the slower of the two, and a toast says "Checking with …" meanwhile. As §5.6 defines it: 200 is accepted, 401/403 is refused, anything else — no status route, a server error, a redirect, no answer — is unknown and is never treated as accepted.
Store. A refused link is dropped, and the place keeps what it has. An accepted link replaces the place's unclaimed link when it is the newer: its token expires later, or in the same second (the link received last wins a tie). A link whose answer was unknown never replaces a link the place holds; it becomes the link of a place that holds none (no row, a row without a token, or a token whose exp has passed). The old token is cleared before the row changes and the new token is written last, so a stop in between leaves a row with no token (not offered) instead of a new upload id under the old token.
Open the recorder for the place, whichever link it now holds. A take in progress is saved first (a save that hasn't settled after 10 s fails this link's recorder and leaves the screen as it is); the place is handed to the recorder in memory, never through route params. A recorder already on the place's draft is left as it is.
With no connection, step 5 fails: the toast says the server couldn't be reached, nothing is stored, no recorder opens, and the link can be opened again. Recording from Home is unaffected.
A link is used up when its upload starts
Exactly as in the released app:
the row is claimed and removed at the Upload tap, for a place's link as for any other;
a failed or cancelled upload unpairs the draft, and a new link is the retry;
the upload manager is main's, with one fix: a cancel that lands while a claim is being written now unpairs the draft instead of leaving it locked until the next launch.
What the place adds on top:
the draft keeps its place and its name after a failed or cancelled upload;
its upload screen says "Open a new link for <draft's name> to upload." (else by the place's label while its expired row is still there, else "from ") — the one sentence used wherever a place needs a new link;
the place's next link comes back to that same draft with a fresh upload;
a link opened while the place's earlier upload is still running is simply a new row, for the next draft.
After the claim an unnamed place draft is "Untitled" on Home, as an unnamed draft always has been.
Security and trust
Nothing unsigned decides where a video goes. label, name, app and return are display text; the place comes from the token and the destination from server + the row.
A ref is what the link says until the server has accepted the link's token: an unconfirmed ref never replaces the link a place holds, and nothing Pulse shows says the server vouches for the place.
Wherever a label names a destination on a path with no confirmation sheet, the server's host is shown or spoken with it: the pairing toasts, the chips, the Upload button's accessibility label, the destinations sheet. The Home pill shows the host.
"Back to · " always ends on the host it opens, shortened in the middle so the registrable domain stays; a look-alike host (non-ASCII or punycode) gets the pairing sheet's warning. It opens only on a tap, and nothing is added to the URL.
The status request sends the link's token to the link's server only, in a header, and never follows a redirect.
No tokens or links are logged.
Hosts are read by the platform's URL, as on main. In this app that is Expo's WHATWG parser (whatwg-url-minimum, installed over the global by expo/src/winter), not React Native's regex-based URL. An earlier revision of this branch replaced it with a hand-written parser, on the belief that the released app read the host of https://evil.example/x@good.example.org as good.example.org, and that URLSearchParams threw on a stray %. Neither is true of the released app: its URL reads that host as evil.example, and its URLSearchParams never throws. That claim is withdrawn, the hand-written parser and decoder are removed, and no vulnerability in the released app is fixed or reported here.
What this branch does add to main's check of server (and applies to return):
a URL with whitespace, a control character or a backslash is refused. The parser strips or rewrites these before reading the host (tabs, line breaks, spaces at the ends; \ read as /), but Pulse keeps, and builds its requests from, the string the link carried — so the host that was checked and shown could differ from what the system's own parser makes of that string;
the same characters decoded into the host from an escape (https://%7fgood.example.org) are refused: Expo's parser accepts them, and they can't be seen on the sheet;
plain http takes a private address only as the parser writes one (four parts, 0–255, no leading zero). http://10.0.0.08 is a name that resembles an address, which Expo's parser lets through.
link-urls.test.ts holds this to main's rule over 647 hostile server shapes, under both Node's URL (the oracle) and whatwg-url-minimum (the app's): nothing main refuses is accepted, the host shown is the host the parser reads, and every extra refusal is one of the three above. Hosts trusted on the released app still match (new URL(server).host, unchanged).
Migration
One migration, drizzle/0019_link_places.sql: six nullable columns and a unique index on (server, ref). Existing rows have NULL refs, which SQLite treats as distinct. Unchanged since the first version of this branch. A link paired as a plain row by the released app and opened again after the upgrade becomes its place's row; the plain row for the same upload id is removed.
Behaviour changes for plain links
Plain links take the same path as on main, with these differences:
Delivery. Links arrive through expo-linking's getInitialURL and url event instead of its useLinkingURL hook, so the same URL opened twice is seen twice. The same URL reported twice within two seconds is one opening.
Opening again. A link that couldn't connect (the capabilities check failed) can be opened again at once. On main it stayed ignored until another link came between or the app restarted. (A cancelled link could already be reopened.)
server. Refused, as a damaged link, when it has whitespace, a control character or a backslash, when an escape decodes one into its host, or when it is plain http to a name that only resembles a private address. On main these paired (and then failed to connect, or connected to whatever the system's parser made of the string).
token. A link whose token is empty, or has a space, a control character or a letter outside ASCII, is refused as a damaged link. On main it paired, an empty one as if it had no token.
Token reading. A token's expiry is read only when its first part is base64url without padding and the UTF-8 text of a JSON object whose exp is a whole number. Main also read the +// alphabet, bytes that aren't UTF-8 and a fractional exp; such a token now reads as "No expiry". A token whose claims are the JSON null used to throw in the decoder and no longer does.
Upload screen. The default selection follows the newest destination until the person picks one; on main the first default stuck. There is no default until the draft has loaded. The Upload tap reads the destination's row again: one removed a moment before does nothing, where on main the claim started and undid itself.
Cancel during a claim unpairs the draft (the fix above).
Copy. The upload manager's messages say "open a new link" where they said "scan a new link" (six messages: upload failed, link expired, didn't finish, server too old, server too new, video missing). Every other toast string for plain links is unchanged.
Nothing else differs for a plain link: it is never screened, its server is never sent a status request, its row is found by upload id as before, and hosts are shown and trusted exactly as on main.
Known limitations
Android can't tell a tap from a replay. After the process dies, Android hands the app the intent that first started it; that looks the same as the person tapping the same link again while the app isn't running. So for a launch link Pulse already paired, both get one answer:
the place still holds it: its recorder opens (also on a relaunch from Recents);
it has expired, or its server refused it: the message says so (also on every such relaunch);
otherwise — its upload was used, a newer link replaced it, or the person removed it — nothing happens and nothing is said. A genuine tap on such a link is silent. It is never paired a second time, which is what the guard is for.
Telling the two apart needs the intent's FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY, which expo-linking doesn't expose. iOS never hands a launch link back. Plain links are not guarded, as on main.
A server without the status route (or one that answers it with an error) never confirms a link. A place then keeps the link it holds until that link is used or expires; a newer link opened meanwhile opens the place as it is and is not stored.
The token check is header-only. A server that reads a token on GET only from the query string would answer 401 and the link would be refused. PulseVault reads the header.
The recorder waits for the server (up to 8 s on a bad connection) the first time a link is opened, and doesn't open offline. A link the place already holds is not subject to this.
Look-alike hosts. Expo's URL does no IDNA: a host with letters outside ASCII is shown as written and flagged on the sheet, as on main. What the system connects to for such a host, and for a server with a username containing @, is the system's parser's reading (see the device matrix).
Blank labels. A label of spaces, format characters, lone marks, Hangul fillers or the blank Braille pattern falls back to the host. That is not every character that shows as nothing.
An expired row is kept, with its token, while a draft recorded for its place is unsent (for the Home title); the sweep re-reads its token every 15 s while a destinations list is on screen. A duplicate of an unnamed place draft is named "Untitled copy".
Tests
npx jest: 449 tests, 443 passed, 6 skipped (the integration suite, which needs PULSE_INTEGRATION=1). npx tsc --noEmit is clean. ESLint is clean on every tracked file (npm run lint also reports on three git-excluded bench screens that aren't in the repo); Prettier is clean on every source file this branch touches.
Suites cover: the URL differential described above; parameter decoding under both URLSearchParams implementations; text cleaning and grapheme cuts (checked against Intl.Segmenter, Thai and Lao included); token decoding; one test per §5.6 rule (same place, newer and the tie, accepted / refused / unknown, an unconfirmed ref and a place that holds none); the link gate, screening and pairing; the token check; the handled-links store; the place handoff with a key containing %, : and /; the recorder opener and its save timeout; the upload choice; place labels; the Back button; and the pool and draft queries against real SQLite.
Not covered by a test: the provider's React glue and the screens themselves (the repo's Jest setup runs pure logic only), and a ref token against a real server (see "Before merging").
Device test matrix
Nothing here was run on a device. To check on iOS and Android:
Area
Check
Parser
In the running app, new URL('https://evil.example/x@good.org').host is evil.example (Expo's URL is the global)
Delivery
Cold and warm start, for both link forms (pulsecam:// and the https link), plain and for a place
Checking
A place link on a slow connection: "Checking with …" shows until the recorder opens or the failure toast replaces it. Offline: "Couldn't connect", no recorder
Held link
Open a place link, close the recorder, open the same link again (also offline, also with the server untrusted): the recorder opens at once, no sheet
Android
Cold-start from a place link, kill the process, relaunch from Recents: recorder reopens while the link is unused; after uploading, nothing happens; after expiry, the expired toast
Android
Tap the same unused link again with the app killed: the recorder opens
Recorder
Link opened from Home, from the editor, from the upload screen, and with a recorder already open on another draft: one recorder, one camera, Back goes Home
Recorder
Link opened twice for the place already on screen: the recorder isn't torn down
Recorder
Link arriving mid-take: the take is saved into its own draft
Recorder
Link opened while another sheet (destinations) is closing: no stacked or lost screen
Welcome
Fresh install: pair a place link during the welcome screen, Continue — the first recording has the place, its name and the Back button
Upload
Preselect; upload; "Back to …" shown, also after leaving the screen during the upload and returning
Failure
Cancel and fail an upload: the draft keeps its name, the screen says to open a new link, a new link reopens the same draft
Newer link
Two links for a place: the later-expiring one replaces the other; an older one opened late doesn't. With the status route answering 404 or 500: the place keeps the link it holds
Refused
A link with a changed token: "Couldn't use this link", the place's row untouched
Concurrent
Open a link for the place while its earlier upload runs: a new draft, and the running upload finishes
Expiry
Open an expired link: its own toast, no recorder. Let a paired link expire with an unsent draft: the Home title stays, the upload screen asks for a new link
Hosts
What the system connects to for a server with a non-ASCII host, a percent-encoded host (https://%65xample.org), and a username containing @ (https://a@b@host/): the host on the sheet, or no connection
Text
Labels with emoji, RTL text, Thai, and long names; + and %20 as spaces
Accessibility
VoiceOver and TalkBack on the toasts, the chips, the Upload button and the Back button: the host is spoken
Upgrade
Install over the released app with destinations, trusted servers, drafts and an upload in flight: trusted hosts still pair without the sheet; a plain destination reopened as a place link is one row
Before merging
Merge PulseVault 2.7 first, then bump the pulsevault-mieweb submodule (pinned at 55621cf, which has no §3.1 or ref) and regenerate protocol.gen.ts. Until then neither CI integration target can exercise a ref token.
Add an integration case for a ref token and the status request once the submodule is bumped.
Confirm no other open branch also claims migration 0019.
No version bump here: releases are separate chore(release) commits.
Squash on merge: the branch's history includes designs that were dropped (a row kept until its upload succeeded, the hand-written URL parser), and their commit titles describe them.
…ing hints
A v1 link is still one upload. When its token has a signed `ref` claim
(1–200 chars), the link is for that place: the parser returns `place` with
the ref and the link's optional hints (label ≤ 60, name ≤ 80, app ≤ 30,
return: https or a private http origin). The ref is never read from the
URL. Without a readable claim the link parses exactly as before.
Migration 0019 adds ref/label/app/return_url to upload_destinations (unique
on server + ref) and context_server/context_ref to drafts; existing rows
are untouched.
A link for a place upserts that place's one row with its upload, token and
hints (never while an upload is running on the link the row holds). The row
stays through a failed or cancelled upload, so Upload is the retry, and is
removed once the upload succeeds; a second draft can't claim it meanwhile.
Expired, it stays while an unsent draft was recorded for it, so that draft
keeps the place's name. Plain links behave as before.
The upload screen puts the draft's own destination first and preselects it,
names chips by label and app, says "Open the link from <place> again" when
its destination is gone, and after an upload to the draft's own place
offers "Back to <app> · <host>".
Also: a cancel that lands before the claim's pairing is written no longer
leaves the draft `uploading`.
…ow the place's label
After pairing, a link whose token names a place opens the recorder on that
place's newest unsent draft, or a new one named with the link's `name` and
recorded for the place. A running recorder saves its take first, and only
then is the open draft looked up; the old recorder is dismissed and gone
before the new one mounts, so recorders never stack. The same link opened
again reopens it. Home shows an unnamed draft as its place's label while
that destination exists, then "Untitled"; uploads send only the draft's own
name.
A link may name a new draft with up to 80 characters, but a draft's name
takes 40: a longer one could be shown and uploaded, yet only shortened in
the rename field. The limit now lives in one place, and a link's name is
cut to it.
…t at whole characters
A label, name and app name are shown as one line of plain text: control
characters and line breaks become a space, text-direction characters are
dropped, and what is left blank is absent (PROTOCOL.md §3.1). Lengths are
Unicode code points, and a cut never falls inside an emoji sequence or between
a letter and its accent. A return URL with a username or password, longer than
512 characters, or whose host two parsers could read differently is ignored.
…exp and ref
The part before the first dot, base64url without padding, the UTF-8 text of one
JSON object (PROTOCOL.md §5.6); anything else is a credential Pulse can't read,
never an error. A ref is 1 to 200 code points. Nothing but exp and ref leaves
the decoder.
…ew upload with the old token
A link for a place replaces the one its row holds only when it expires later:
an older link opened late (a stale tab, a replayed launch) is ignored. The
order is read from exp, the one claim besides ref a client may act on
(PROTOCOL.md §5.6).
The row and its token are in two stores. The old token is now cleared before
the row takes the new upload and the new token is written last, so a stop in
between leaves a row with no token, which isn't offered and is completed by
opening the link again, instead of a new upload id the server refuses under
the old token. A row's names and return URL are cleaned again when read.
Each as its own module, so it can be tested without the app around it:
- the gate that decides which deliveries of a link are acted on (the same one
reported twice at once is one; a failure or a cancel lets it be opened again
straight away);
- a screen that refuses a link whose token has already expired, and drops a
launch link that was dealt with before: Android hands a relaunch from Recents
the link the app was first started with. Handled upload ids are kept in the
settings table;
- the pairing itself, which asks the server to accept a place link's token (the
status request) before the link takes over what the place has: a client can't
verify the ref it reads from a token (PROTOCOL.md §5.6);
- the sentences these say, the one for opening a link again among them.
Nothing uses them yet.
…link is turned away
The place went to the recorder through route params, which the router decodes
twice: a key with a percent sign in it arrived as another key, and the draft
never matched its destination. It is now handed over in memory, exactly as the
token gave it.
The provider runs a link through the new checks: an expired link for a place
is refused with its own toast and opens no recorder, one its server doesn't
accept never touches the place's row, and an old launch link isn't replayed.
A link paired during the welcome screen leaves its place for the first
recording made after it. A recorder already on the place's draft is left as
it is instead of being torn down and pushed again, a recorder that couldn't be
opened says so, and a link that came to nothing can be opened again at once.
The toast for a place always names the server its video goes to.
…ny other
A place's destination row was kept until its upload succeeded, so a failed or
cancelled upload could be tried again under the same upload id. The server
treats an id as one attempt: the retry met a 409 until the first attempt had
been idle for minutes, and for good when the video had landed. The row is now
claimed and removed at the tap, exactly as a plain link's is, and the upload
manager is main's again (but for a cancel that lands while a claim is being
written, which now unpairs the draft instead of leaving it locked).
After a failed or cancelled upload the draft keeps its place and its name. Its
upload screen says to open the link again (by the draft's name, else the
place's label while its row is there, else the host), and the place's next
link comes back to that draft with a fresh upload. A link opened while the
place's earlier upload is still running is a new row, for the next draft.
The way back to the host rides the upload from the claim to its announcement,
so it is still offered after the upload screen was left and opened again, and
for ten minutes after the upload finished. The button always ends on the host
it opens, shortened in the middle, and warns of a look-alike host.
A draft's place label on Home, and the label in the upload screen, are read
live from the pool's rows rather than in a subquery the live query didn't
follow. Nothing says to open a link again before the pool has loaded.
…a video goes
A place's label is the link's own word for it, unsigned. The Home pill shows
the server's host again, and a destination chip and the Upload button say the
host to a screen reader along with the label.
… a stray percent sign is no error
React Native's URLSearchParams cuts a value at its first equals sign and throws
on a malformed escape, so a link anyone can write could throw inside the link
handler. The parameters are now decoded here: form-urlencoded UTF-8, a plus
for a space (PROTOCOL.md §3); a pair that can't be decoded is no parameter.
…really go to
React Native's URL is a set of regular expressions: it accepts any string and
takes what follows the first @ for the host, even an @ in the path. So
https://evil.example/x@good.example.org was shown on the pairing sheet, and
matched against the trusted servers, as good.example.org, while every request
went to evil.example; and http://evil.example/a@192.168.1.1 passed for a
private address. The host is now read by hand, as the part between :// and the
first slash, for the server a link names, its return URL, and everywhere a
host is shown. A URL with whitespace, control characters or a backslash, which
parsers split differently, is refused.
Android hands a relaunch from Recents the intent that first started the app;
iOS never hands a launch link back, so there a launch link is the person's own
tap and is acted on like any other.
The app's global URL is Expo's WHATWG parser (whatwg-url-minimum, installed by
expo/src/winter), not React Native's: it reads the host of
https://evil.example/x@good.example.org as evil.example, as main always did.
The hand-written host parser added on this branch fixed nothing, and accepted
hosts the platform parser refuses (escaped delimiters, bad ports, out-of-range
addresses). It is removed; server, return and every shown host go through
new URL() as on main, so hosts trusted on the released app still match.
Kept beyond main's checks, for server and return alike:
- whitespace, control characters and a backslash are refused: the parser
drops or rewrites them before reading the host, but requests are built from
the string the link carried;
- the same characters decoded into the host from an escape (%7f) are refused:
they can't be seen there;
- plain http takes a private address only as the parser writes one, so a name
that resembles one (10.0.0.08, which Expo's parser lets through) is none.
link-urls.test.ts runs a 650-shape corpus under both Node's URL and the app's
parser and holds this branch to main's rule: nothing main refuses is accepted,
and the host shown is the host the parser reads.
The hand-written decoder dropped a parameter with a malformed escape, so a
token with a stray percent sign vanished and the link paired as if it had
none, and a later duplicate could count in place of an unusable first value.
The platform's URLSearchParams (Expo's WHATWG one) never threw on a link and
keeps a value's equals signs; it decodes the parameters again, as on main.
A token that can't be forwarded in a header (empty, or with a space, a
control character or a letter outside ASCII) now makes the link invalid
rather than a tokenless pairing.
…paired surrogate
PROTOCOL.md §5.6 (protocol 2.7, final): a ref with an unpaired surrogate reads
as none, and so does a ref in a token without a numeric exp. An exp that isn't
a whole number of seconds (1e400 is infinity in JSON) now leaves the token
unreadable: no known expiry, no place.
…ce holds
PROTOCOL.md §5.6 (protocol 2.7, final):
- accepted is a 200 from the status route for the link's upload; 401 or 403
is refused; anything else, no answer included, is unknown and is never
treated as accepted;
- an unconfirmed ref never replaces the link a place holds. It becomes the
link of a place that holds none: no token, or one whose exp has passed;
- of two links for a place the newer expires later, and a tie goes to the one
received last.
Before, a 404 or a 5xx from the status route let a link with a later exp
replace the place's row, and a link that tied did not.
The status request carries the token in the Authorization header only, no
longer in the URL as well, and goes out together with the capabilities
request, so a place's recorder waits for the slower of the two.
…unch link says what it came to
A link the place already holds (the same upload, the same token) has nothing
to pair: its recorder opens at once, with no sheet and no request, offline
included, on either platform.
On Android the app can't tell the system handing the launch link back after
the process died from the person tapping the same link again while the app
isn't running. Before, every launch link already dealt with was dropped
silently, a genuine tap with it. Now both get the same answer: the recorder
when the place still holds the link, the expired or refused message when it
is dead, and silence only for a paired link whose upload was used, which is
still never paired a second time. Refusals are remembered as such.
While a place's link is checked with its server a toast says so and names the
server; the recorder waits for that.
…er, not every link after it
A link's recorder opens once the take in progress is saved. A save that never
settled held the opener's queue for good; now it gives up after ten seconds,
leaves whatever is on screen as it is, and says the recorder couldn't open.
A place's messages said "open the link again" while the upload manager said
"scan a new link" of the same situation. A link is one upload, so the one
opened before won't do: a place's messages now say "Open a new link for …",
and the manager's say "open a new link" where they said "scan" (links are
tapped as often as scanned). The unused openLinkAgainClause is removed.
The README says what the recorder waits for, and what a link needs a
connection for.
A link paired by the released app is a plain row. Opened again after the
upgrade, its token names a place: the place got a second row for the same
upload id, and the pool offered one upload twice. The place's row now takes
the plain one's place.
…ys with its consonant
A label of a lone variation selector, accents with no letter, Hangul fillers
or the blank Braille pattern passed for text and showed as an empty title;
it now falls back like a label that was never given, as PulseVault's builder
leaves the client to decide. The Thai and Lao vowel sign AM is a spacing
mark to a grapheme cluster though a letter by category, so a cut could fall
before it.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unsynchronized destination reads and claims can consume fresh links without successful uploads, while plain-link collisions can overwrite held-place tokens with unverified credentials.
Adds place-aware upload links to Pulse’s recording workflow: links reopen an unsent draft or name a new one, preselect its destination, and offer a return to the originating app after upload.
Changes:
Adds place-token parsing, server validation, replacement rules, and replay handling.
Connects place context to recorder navigation, draft names, destination selection, and post-upload actions.
Adds database migration 0019 and regression coverage for parsing, storage, navigation, and upload behavior.
File
Description
src/utils/presence.ts
Tracks mounted screens and waits for dismissal.
src/utils/presence.test.ts
Tests presence tracking and timeouts.
src/utils/draft-name.ts
Shares draft-name limits and surrogate cleanup.
src/utils/display-text.ts
Cleans hints and truncates whole character clusters.
src/utils/display-text.test.ts
Tests Unicode cleaning and truncation.
src/features/upload/use-upload.ts
Selects place destinations and carries return metadata.
src/features/upload/use-destinations.ts
Tracks pool readiness and live place labels.
src/features/upload/upload-manager.ts
Carries return targets and fixes claim cancellation.
src/features/upload/upload-manager.test.ts
Tests cancellation and return-target lifecycle.
src/features/upload/upload-choice.ts
Defines place-aware selection and return eligibility.
src/features/upload/upload-choice.test.ts
Tests selection defaults and return eligibility.
src/features/upload/types.ts
Adds upload return-target types.
src/features/upload/token-check.ts
Checks token acceptance through the status endpoint.
src/features/upload/token-check.test.ts
Tests status responses and request construction.
src/features/upload/pairing-sheet.tsx
Registers sheet presence for navigation coordination.
src/features/upload/pair-link.ts
Implements link screening and pairing decisions.
src/features/upload/pair-link.test.ts
Tests delivery, screening, and pairing outcomes.
src/features/upload/open-recorder.ts
Coordinates saving and opening a place’s recorder.
src/features/upload/open-recorder.test.ts
Tests recorder navigation and save timeouts.
src/features/upload/link-urls.test.ts
Compares URL validation across platform parsers.
src/features/upload/link-messages.ts
Defines place messages and return-button labels.
src/features/upload/link-messages.test.ts
Tests messages, host visibility, and return labels.
src/features/upload/handled-links.ts
Persists handled-link outcomes for replay screening.
src/features/upload/handled-links.test.ts
Tests outcome persistence and bounded history.
src/features/upload/destinations-sheet.tsx
Displays place hints and accessible destination names.
…as it is
A plain link (a token Pulse can't read a place from) was matched to a place's row by its upload
id alone and rewrote the row's token, without the server's acceptance or the newer-link check.
… only the link it read
The upload screen's read of a destination could land between a re-pair's writes (the old upload
id with the new token), and its claim could remove a row a newer link had replaced since the read.
The read now runs in turn with pairing, and the claim removes the row only while it still holds
the link the upload read.
The upload screen read the link again before claiming it, but took the return URL and app name
from the list's copy: a place whose link was replaced a moment before could offer the old link's
Back button. The way back is now read with the link, and cleaned as the pool cleans it.
…again
Open screens loaded tokens only when the pool's row ids changed or a pairing succeeded. A place's
replacement keeps its row id, so one whose new token was never written left the screen offering
the row with the old link's cached token, and Upload did nothing. Tokens now reload whenever a row
takes a newer link in place.
Of two links for a place that expire in the same second, the one received last is the newer
(PROTOCOL.md §5.6). Pairings run at once, each waiting on its own server, so the tie went to the
link whose server answered last. Each link's save now waits for the links received before it.
… upload's
An upload waiting for its view link when the draft was uploaded again still wrote its
announcement once the link came, bringing back its Back button after the newer upload started,
failed or finished. It still says it landed, but leaves the announcement to the newer upload.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved recorder-opening and destination-removal races can associate drafts with the wrong destination or leave them without one, while plain-link history blocks valid re-pairing.
Reset plain-link history when admitting a place link
src/features/upload/pair-link.ts:26
An intervening place link leaves handledPlain unchanged: opening plain link A, then place link B, then A again (more than two seconds apart) still rejects A. Previously any intervening link allowed a plain link to be reopened, so a removed plain destination now cannot be paired again after opening a place link. Clear the plain-link history when admitting a place link to preserve that behavior.
…ol types
pulsevault-mieweb moves from 55621cf to v0.9.0 (15514db), the release
with the link hints this branch reads: the token's ref claim and the
link's name, label, app and return. protocol.gen.ts is regenerated from
its schemas; tsc and the tests pass unchanged.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved queue and handoff races can let older links overwrite newer ones, report pairing success for deleted destinations, and open recorders with the wrong place.
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
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.
Protocol side: mieweb/pulsevault#98 (PROTOCOL.md §3, §3.1, §5.4, §5.6; protocol 2.7). The links come from TimeHuddle: mieweb/timehuddle#861. 27 commits on
main: squash on merge.What
An upload link is still one upload:
v=1,artifactId,server,token, exactly as released. New in protocol 2.7: when the link's token carries arefclaim (the operator's opaque key for the place the upload goes to — a ticket, a team's update), the link is "for a place", and Pulse:name(the draft is created on its first clip);(server, ref)until a draft uses it — a newer link for the place, once its server has accepted it, replaces the older one's upload id and token;returnURL;labelon Home while the place's row exists.Optional, unsigned display hints on the link:
label(≤ 60),name(≤ 80, cut to a draft name's limit),app(≤ 30),return(≤ 512, https or http to a private/dev address, no username or password). There is norefURL parameter: the place is read from the token, asexpalready is.A link whose token has no readable
refis a plain link and takes the path it always did, with the differences listed under "Behaviour changes for plain links".Why
The operator's app (TimeHuddle) mints upload links for "Record with Pulse" on a ticket or a huddle. Before this, each link was an anonymous destination in a pool: the person had to find the right draft and pick the right server by host name. With the place in the token, a second link for the same ticket finds the recording already started for it.
How a link for a place is handled
URLSearchParams(form-urlencoded, §3; the first value of a name counts).serverandreturnare read by the platform'sURL. Hints are cleaned to one line of plain text: control characters and U+2028/2029 become one space, bidirectional-formatting characters are dropped, a hint with nothing to see is absent, lengths are Unicode code points and a cut never falls inside an emoji sequence or between a letter and its marks (§3.1).., base64url without padding, the UTF-8 text of one JSON object withartifactId,iat,exp,kidandissuer.expmust be a whole number;refis 1–200 code points with no unpaired surrogate, else it reads as none. Onlyexpandrefleave the decoder.exphas passed on this device is refused with its own toast and opens no recorder;/capabilities), and whether it accepts the link's token (the status request, §6.5, token in theAuthorizationheader only). Each gives up after 8 s; the recorder waits for the slower of the two, and a toast says "Checking with …" meanwhile. As §5.6 defines it:200is accepted,401/403is refused, anything else — no status route, a server error, a redirect, no answer — is unknown and is never treated as accepted.exphas passed). The old token is cleared before the row changes and the new token is written last, so a stop in between leaves a row with no token (not offered) instead of a new upload id under the old token.With no connection, step 5 fails: the toast says the server couldn't be reached, nothing is stored, no recorder opens, and the link can be opened again. Recording from Home is unaffected.
A link is used up when its upload starts
Exactly as in the released app:
What the place adds on top:
After the claim an unnamed place draft is "Untitled" on Home, as an unnamed draft always has been.
Security and trust
label,name,appandreturnare display text; the place comes from the token and the destination fromserver+ the row.refis what the link says until the server has accepted the link's token: an unconfirmedrefnever replaces the link a place holds, and nothing Pulse shows says the server vouches for the place.serveronly, in a header, and never follows a redirect.Hosts are read by the platform's
URL, as on main. In this app that is Expo's WHATWG parser (whatwg-url-minimum, installed over the global byexpo/src/winter), not React Native's regex-basedURL. An earlier revision of this branch replaced it with a hand-written parser, on the belief that the released app read the host ofhttps://evil.example/x@good.example.orgasgood.example.org, and thatURLSearchParamsthrew on a stray%. Neither is true of the released app: itsURLreads that host asevil.example, and itsURLSearchParamsnever throws. That claim is withdrawn, the hand-written parser and decoder are removed, and no vulnerability in the released app is fixed or reported here.What this branch does add to main's check of
server(and applies toreturn):\read as/), but Pulse keeps, and builds its requests from, the string the link carried — so the host that was checked and shown could differ from what the system's own parser makes of that string;https://%7fgood.example.org) are refused: Expo's parser accepts them, and they can't be seen on the sheet;http://10.0.0.08is a name that resembles an address, which Expo's parser lets through.link-urls.test.tsholds this to main's rule over 647 hostileservershapes, under both Node'sURL(the oracle) andwhatwg-url-minimum(the app's): nothing main refuses is accepted, the host shown is the host the parser reads, and every extra refusal is one of the three above. Hosts trusted on the released app still match (new URL(server).host, unchanged).Migration
One migration,
drizzle/0019_link_places.sql: six nullable columns and a unique index on(server, ref). Existing rows have NULL refs, which SQLite treats as distinct. Unchanged since the first version of this branch. A link paired as a plain row by the released app and opened again after the upgrade becomes its place's row; the plain row for the same upload id is removed.Behaviour changes for plain links
Plain links take the same path as on main, with these differences:
expo-linking'sgetInitialURLandurlevent instead of itsuseLinkingURLhook, so the same URL opened twice is seen twice. The same URL reported twice within two seconds is one opening.server. Refused, as a damaged link, when it has whitespace, a control character or a backslash, when an escape decodes one into its host, or when it is plain http to a name that only resembles a private address. On main these paired (and then failed to connect, or connected to whatever the system's parser made of the string).token. A link whose token is empty, or has a space, a control character or a letter outside ASCII, is refused as a damaged link. On main it paired, an empty one as if it had no token.expis a whole number. Main also read the+//alphabet, bytes that aren't UTF-8 and a fractionalexp; such a token now reads as "No expiry". A token whose claims are the JSONnullused to throw in the decoder and no longer does.Nothing else differs for a plain link: it is never screened, its server is never sent a status request, its row is found by upload id as before, and hosts are shown and trusted exactly as on main.
Known limitations
Telling the two apart needs the intent's
FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY, whichexpo-linkingdoesn't expose. iOS never hands a launch link back. Plain links are not guarded, as on main.GETonly from the query string would answer 401 and the link would be refused. PulseVault reads the header.URLdoes no IDNA: a host with letters outside ASCII is shown as written and flagged on the sheet, as on main. What the system connects to for such a host, and for aserverwith a username containing@, is the system's parser's reading (see the device matrix).Tests
npx jest: 449 tests, 443 passed, 6 skipped (the integration suite, which needsPULSE_INTEGRATION=1).npx tsc --noEmitis clean. ESLint is clean on every tracked file (npm run lintalso reports on three git-excluded bench screens that aren't in the repo); Prettier is clean on every source file this branch touches.Suites cover: the URL differential described above; parameter decoding under both
URLSearchParamsimplementations; text cleaning and grapheme cuts (checked againstIntl.Segmenter, Thai and Lao included); token decoding; one test per §5.6 rule (same place, newer and the tie, accepted / refused / unknown, an unconfirmedrefand a place that holds none); the link gate, screening and pairing; the token check; the handled-links store; the place handoff with a key containing%,:and/; the recorder opener and its save timeout; the upload choice; place labels; the Back button; and the pool and draft queries against real SQLite.Not covered by a test: the provider's React glue and the screens themselves (the repo's Jest setup runs pure logic only), and a
reftoken against a real server (see "Before merging").Device test matrix
Nothing here was run on a device. To check on iOS and Android:
new URL('https://evil.example/x@good.org').hostisevil.example(Expo'sURLis the global)pulsecam://and the https link), plain and for a placeserverwith a non-ASCII host, a percent-encoded host (https://%65xample.org), and a username containing@(https://a@b@host/): the host on the sheet, or no connection+and%20as spacesBefore merging
pulsevault-miewebsubmodule (pinned at 55621cf, which has no §3.1 orref) and regenerateprotocol.gen.ts. Until then neither CI integration target can exercise areftoken.reftoken and the status request once the submodule is bumped.chore(release)commits.