Phase 7: the client link
CI / secret scan (push) Successful in 6s
CI / fmt, clippy, tests (push) Successful in 59s
CI / release (push) Skipped

Staff make a link for a person (or "+ New client": a record with only the
name they know, and its link); the client fills in their own record from
their phone without a login, and presses Send.

- Links (src/links.rs, migrations/0006): the table keeps the SHA-256 of
  the token only, as sessions do; the link is shown once, to copy, to email
  (mailto with the person's address) or as a QR code (qrcode crate, inline
  SVG). It is open 14 days, until Send, or until staff close it; a new
  link closes the earlier one. States open, opened, sent, closed, expired.
- The client's pages at /c/<token> (src/web/client.rs, client_*.html in a
  frame of their own, phone first): About you, Passport (the photo reader;
  a zone fills in the personal details still empty), Address in Thailand,
  Contact, Documents, Send. Each part is saved on its own, straight into
  the record. Forms carry the link's own token plus the same-site check.
  A passport with the same number is changed; an address unlike the
  current one is added beside it, so the current one and its TM.30 receipt
  stay; a second save changes what the link added. Uploads (passport page,
  photo, visa, arrival stamp, TDAC, work permit, other) go through the
  same checks and encrypted store as staff uploads, tied to the person's
  newest record of their kind.
- Audit: the client's views and changes carry the actor `link <id>`;
  actions send and close and entity link are new. The person's page shows
  the newest links, when they were opened and sent, and each record the
  client changed, with the fields, to check.
- Demo data: Erika sent her link an hour ago (phone and email changed),
  Jane opened hers.
- documents::read_upload returns why it refused, so the client's pages
  answer in their own words.

Checks: fmt, clippy; 101 unit and 54 integration tests (tests/client.rs:
the link shown once and kept as a hash, a new client, the whole client
flow with the login on, forged, closed, expired and made-up links);
layout check light/dark desk/phone on the client pages, the person page
and the new client form: no problems; the camera reader on the client's
passport page with a fake camera filled the form and Send closed the link.
This commit is contained in:
grabowski committed 2026-11-20 19:48:34 +07:00
1 parent a6ebdfc89c
commit 43ed75d81b
32 files changed
+2706 -40

No files matched your search

+32 -19
View File
@@ -5,8 +5,10 @@
> of the documents from a directory on cnx01 into a bucket of cnx01's Garage
> was built (task 4.8) and checked in the fleet (task 4.9, cnx-network-clan
> PR #150); the documents move once that PR is deployed. Phase 6, the Non-B
> extension pack, was built on November 20, 2026. **Resume here: phase 7, the
> client link.**
> extension pack, and phase 7, the client link, were built on November 20,
> 2026, the same day every push to main became a signed release that cnx01
> installs by itself. **Resume here: phase 8, reminders; task 7.6, the
> client's signed agreement, waits for B4L's text.**
visa.buildfor.life keeps the immigration records of the foreigners that B4L
looks after: their passports, addresses in Thailand, arrivals with the Thailand
@@ -228,7 +230,7 @@ dark at desktop and phone width, a commit and a push.
| 4 | Documents: encrypted uploads (passport pages, TDAC, receipts, photo) in a bucket of cnx01's Garage (first on the dataset `zroot/visa`) with a key var, viewing and download, all audited; the office's GPS position and photo | live Nov 18, 2026; Garage built Nov 19, 2026 |
| 5 | Filled-in forms: TM.7, STM.2, the overstay acknowledgment (STM.9), STM.11, STM.1, TM.47 and TM.8 as PDF | built Nov 18, 2026 |
| 6 | The Non-B extension pack: B4L's company documents, the checklist, one PDF to print | built Nov 20, 2026 |
| 7 | The client link: a client fills in their own record on a phone, the MRZ read from a photo; later the signed agreement | planned Nov 20, 2026 |
| 7 | The client link: a client fills in their own record on a phone, the MRZ read from a photo; later the signed agreement | built Nov 20, 2026; 7.6 waits for the text |
| 8 | Reminders by Matrix room message and by email | |
| later | Thai user interface, agency cases and fees, other visa categories' packs | |
@@ -436,18 +438,26 @@ one `Kind`.
Planned on November 20, 2026, from Alex's answers (decisions table).
- [ ] 7.1 Links: staff make a link on a person's page, and "+ New client" in
the people list makes an empty record with its link. The app keeps only
the SHA-256 of the link's token, as with sessions: it shows the link
once, to copy or as a QR code to show on a phone, and a new link closes
the person's earlier one. The person's page lists the links with their
state (open, used, sent, closed, expired), and staff close one.
- [ ] 7.2 The client's pages at `/c/<token>`, the one part of the app open
- [x] 7.1 Links: staff make a link on a person's page, and "+ New client" in
the people list makes a record with only the name staff know (and an
email address, if any) with its link. The app keeps only the SHA-256 of
the link's token, as with sessions: it shows the link once, to copy, to
email or as a QR code to show on a phone, and a new link closes the
person's earlier one. The person's page lists the newest three links
with their state (open, opened, sent, closed, expired), and staff close
one (`src/links.rs`, `src/web/links.rs`, `migrations/0006`).
- [x] 7.2 The client's pages at `/c/<token>`, the one part of the app open
without a login: about you, the passport, the address in Thailand,
contact, the documents, and Send. Plain English, phone first, each part
saved on its own; the link's own form token and the same-site check;
nothing about anyone else. After Send, or 14 days, or once staff close
it, the link shows only that it is closed.
nothing about anyone else (`src/web/client.rs`, `templates/client*.html`
in a frame of their own). The parts show what the record holds, so the
client corrects rather than retypes. A passport from a zone fills in
the personal details still empty. A passport with the same number is
changed; an address unlike the current one is added beside it, so the
current one and its TM.30 receipt stay until staff check; a second
save changes what the link added. After Send, or 14 days, or once staff
close it, the link shows only that it is closed.
- [x] 7.3 The passport from a photo, built ahead on November 20, 2026 on
the staff's new person and new passport forms (the client's pages
reuse `templates/_mrz_photo.html`). "Take a photo" opens a camera view:
@@ -472,13 +482,16 @@ Planned on November 20, 2026, from Alex's answers (decisions table).
specimen pages: every readable zone read, except under a hard shadow
across the lines; the specimens that failed have their zone blanked
out.
- [ ] 7.4 Uploads from the client into the encrypted store: the passport's
photo page, the photo, the TDAC and other scans, each tied to its record
where there is one.
- [ ] 7.5 Audit: every view and change through a link is logged with the
actor `link <id>` and the names of the fields; making, using, sending
and closing a link too. The person's page says when the client sent the
form and links to what changed.
- [x] 7.4 Uploads from the client into the encrypted store: the passport's
photo page, the photo, the visa, the arrival stamp, the TDAC, the work
permit and other scans, each tied to the person's newest record of its
kind where there is one. The client sees the names of what they
uploaded through the link, never the files.
- [x] 7.5 Audit: every view and change through a link is logged with the
actor `link <id>` and the names of the fields; making, sending and
closing a link too (actions `send` and `close`, entity `link`). The
person's page says when the client opened and sent the form and links
to each record changed, with the fields.
- [ ] 7.6 Later: the agreement. A box where the client signs, drawn on the
screen, the agreement with B4L to keep and work with their data; the
signed agreement is kept as an encrypted document (a PDF with the