oficina / meet Public

Clone
git clone https://amadan.net/oficina/meet

Plain git — no account needed to clone.

Download

Download this file

1# calls
2
3A [rastrillo](https://github.com/rastrilloorg/rastrillo) app. Read the
4framework's own SKILL.md (repo root, or in the module cache) before
5writing app code — it is the whole app story in ~15KB. The conventions
6below are load-bearing; the framework enforces most of them
7mechanically.
8
9## Layout
10
11- `internal/<app>/` — the app: `models.go` (plain GORM structs
12 + Models), `migrations.go` + `migrations/` (Schema, BootSchema),
13 `app.go` (migrate.Apply + chi router), `handlers.go`,
14 `render.go` + `templates/`. This is SKILL.md's five-file shape.
15- `manifest/` — the declarative path, optional and equal: TOML or .go
16 Resource manifests, each generating a full screen set under `gen/`
17 (see manifest/README.md for the mounting recipe). A hand-written
18 action file at a generated path (carrying `//go:build rastrillo_actions`)
19 takes that one screen over, by existence.
20- `gen/` — generated when manifests are used; never edit. Regenerate
21 with `rastrillo generate`.
22- `internal/calls/seal/` — the app's only encryption surface. A title
23 is sealed by the store and opened by the store; no handler holds a
24 plaintext title it did not get from `store.title`. `pending_joins` is
25 the fingerprinted table: an outsider's address is stored there only as
26 a keyed fingerprint, while `persons.email` holds a verified address in
27 plaintext, the suite's current shape for a person (spec §2.1, as in
28 Docs, Slides and Calendar).
29 Meeting invitation tokens are looked up by hash and sealed for repeat sharing
30 by members. Legacy hash-only invitations remain valid; first sharing creates
31 a sealed invitation alongside them. Replacing a link revokes all current ones.
32- `internal/calls/store.go` — every database access. `standing.go` is
33 the entry authority (spec §2.3), computed per request, never stored.
34- Sign-in: the smart door (Home spec `2026-11-19-smart-door.md`, step 6;
35 home/connect `MIGRATING.md`). `signin.go` draws rastrillo's sign-in
36 screen (`SigninScreen` + `SigninOneWay`) inside estilo's door
37 (`estilo-signin-screen`), in rastrillo's approved words; only the
38 refusal and the removal are Calls'. With Home, `/signin` is connect's
39 `SigninDoor` (Continue with Oficina ID), `/signin/local` the email-only
40 door and `/signin/oficina` the exchange, all three behind
41 `signin_admission.go`'s probe of `requirePerson` (a 5xx is undecided,
42 never a refusal). Guests are not the door's business: joining by name at
43 `/j/{token}` is untouched, a guest session is never judged, refused or
44 ended at the door. While a join cookie is live the door opens on the
45 email way, with Oficina ID under Other ways (Paul's ruling, 2026-11-22,
46 oficina/meet #46), and an Oficina ID sign-in from there lands on
47 `/continue`, which follows the cookie's own invitation
48 (`continueInvitation`), as an emailed link does. A native app's
49 session is its own row and never
50 reaches the door. Oficina ID is remembered in `MintHomeSession`, for an
51 admitted session only. `POST /signin` is Begin behind `gateBegin` and
52 `beginSignin`, which keeps `return_to` in Calls' own return memory
53 (`signin_return.go`) so `/continue` (a pending meeting join first) is
54 never skipped. Keymail or an emailed link is chosen by the address's
55 domain alone, never by membership (Paul, 2026-10-06), and the link is
56 mailed after the response by `signin_mail.go`'s worker, only if this
57 request may have one, so neither the answer nor its timing says who is
58 a member; Begin's own answers (Sent, a bad address, the rate budget)
59 are passed on as they are, the same for any address. A refusal after
60 verification is the door, rendered in the refusal's own 403 by auth's
61 `Refused` hook (never a query anyone could type). An emailed link
62 opens the confirm door (`RenderConfirm`): `GET /auth/verify` spends
63 nothing, so a mail scanner cannot burn it, and the door's one Sign in
64 button POSTs the token back to `/auth/verify`, mounted for both methods
65 in both modes. `mayRequestLink` does the same database work for a
66 member and an outsider and logs nothing on the response path.
67- rastrillo upgrades: `go tool rastrillo doctor --probe` exits 0. The
68 files Calls carries its own way (estilo's busy shim and theme, and the
69 library files no layout links) are named in `vendoredIsMine`
70 (`internal/callstest/vendored_test.go`); the templates are on the
71 localizer-first syntax (`rastrillo migrate-templates`), and `gen/` and
72 `api/` are `rastrillo generate`'s stubs with the English pack. After a
73 bump: `doctor --fix`, `go run ./scripts/writeestilo`, `make credits`.
74
75## Rules the family holds hard
76
77- Every query touching user-owned rows goes through `scope.Owned` —
78 reads AND writes, transactions included. A row that isn't yours 404s,
79 never 403s.
80- Never bind a request body onto a GORM model: explicit
81 `map[string]any` + `.Select` allowlist.
82- Migrations apply at boot, once each, and are never re-run or reversed.
83- Schema changes: edit models.go, then run `rastrillo migration generate`
84 and read the SQL it writes — it may be a full table rebuild, not just
85 an `ADD COLUMN`. Never edit a migration that has shipped.
86 Renames are hand-written (`rastrillo migration new rename_x`) because
87 a rename is indistinguishable from a drop plus an add.
88- Money is integer cents. A float never touches a value a person will
89 be held to.
90- Screens work with JavaScript disabled, with two exceptions: browser
91 media participation (the holding screen's camera preview and join
92 button, and the call itself in the room), and, once a call exists,
93 the room's chat panel and its admission queue's Admit controls; both
94 pages still render their title, standing, floor notice and
95 navigation without script. Destructive actions get their own
96 confirm-page URL.
97- The gate is `make ci` (vet + gofmt + tests) — the same definition
98 CI runs. Run it before every push. `CGO_ENABLED=0` throughout: the
99 stack is cgo-free by design.
100- Native Apple bindings under `native/` use cgo to bridge Go to Objective-C.
101 Their toolchain is isolated in `native/go.mod`; server releases remain
102 `CGO_ENABLED=0`. Build with `make native-mac`.
103- `make race` is the test exception to that rule, and the third gate:
104 `-race` refuses to build without cgo, so it sets `CGO_ENABLED=1`. It
105 builds a test binary and never a release, so nothing that ships gains
106 a C dependency. Run it for any change to `internal/calls/hub` or the
107 stream — a hub behind a mutex, a tick goroutine and one goroutine per
108 stream is more concurrency than `make ci` can see.
109- **Spacing is on the scale, and a stack spaces the page** (Paul,
110 2026-11-22; Fiesta's DESIGN.md, "The stack"). `<main>` is `rst-stack`
111 (layout.html), and so is any region holding blocks of its own (a
112 section, the holding screen's device panel and its audio test);
113 `rst-section` opens a section and `rst-actions` is a row of buttons.
114 No hand margins between a page's blocks; every other margin, padding
115 and gap is a `var(--rst-sp-N)`, or carries `/* spacing-allow: why */`
116 for real geometry. The call window (room.html: tiles, bar, PiP,
117 popovers, chat) is that geometry, pinned to the Mac app's, and its
118 allowances say so. `make spacing` (in `make ci`) reads static/;
119 `TestEveryPageKeepsTheRhythm` (`make browser`) runs Fiesta's rhythm
120 audit over the pages in its list, in the states that change their
121 blocks, with script and without. A new page or state goes in that
122 list. Write a hidden input first in a stack (a hidden child between
123 two blocks costs the next one its spacing), and give a positioned
124 child of a stack back its own margins (`dialog.calls-report:modal`).
125- `make browser` is the second gate, for any change to a page or to the
126 client: a real call in real Chromium. It needs the Claude Code bash
127 sandbox **off** — the sandbox blocks UDP, so Chromium gathers no ICE
128 candidates and every call fails with `frames` stuck at 0, which reads
129 exactly like a client bug and is not one.
130
131## Team mode (roster, `CALLS_TEAM_*`)
132
133Spec §16 "Roster team mode" is the whole of it; Home
134`implementation/teammode-package.md` §7.4 and `team-members.md` Part B
135are its design. With the five `CALLS_TEAM_*` variables set (all or none,
136only beside `CALLS_HOME_*`), Home's roster decides standing on every
137request and `CALLS_ALLOWED_ADDRESSES` only admits local sign-in (empty
138admits nobody, in every Env). Without them nothing in `team_*.go` runs,
139every rule above stands, and the one difference is `GET /api/team`
140answering `{"team_mode":false}`. Paul's calls.oficina.works and the Mac
141and iPhone apps run with team mode off.
142
143- **Configuration, marker, runtime and probe are `home/teammode`'s**
144 (`team_config.go`). The marker is read before anything migrates; a team
145 database stays one. Never "fix" a refused boot by deleting the marker.
146- **Standing is the roster's, never the allowlist's or a stored role's**
147 (`team_access.go`): one `Access` per request, carried on the context.
148 A removed Home identity is signed out; a guest, and a local account
149 with no Oficina link, are the non-members they always were.
150- **A meeting stands on its host** (`team_host.go`): its creator, or an
151 agent's operator. A host the roster removes ends the meeting (a system
152 write) and the call in it; a host it cannot decide refuses new entries
153 with a retryable 503 and holds the call. Any new path that lets
154 somebody into a meeting asks `meetingStands` first.
155- **Every write that rests on standing runs inside `store.guard`**
156 (`team_guard.go`), on the Access the caller put on the context: the
157 member's own, an agent's operator's, or — for a guest's grant — the
158 host's. `TestTeamEveryWriteRouteRefusesALapseBeforeCommit` lists every
159 write route; add yours.
160- **The call stream re-decides before every delivery and at the lease's
161 end** (`team_stream.go`), on fresh Accesses (`freshStanding`), and
162 holds under Unknown: open, heartbeats only, nothing delivered. Its
163 re-decision timer is set when a decision is made and never by a
164 heartbeat. Run `make race` for any change to it.
165- **Unknown is never "not found"**: lists are the empty partial list with
166 the notice; items, forms, writes, the native API and the signalling
167 endpoints are retryable no-store 503s.
168
169## Serving
170
171`rastrillo.Resolve` + `Serve` speak the CARLOS activation contract
172(socket/addr/db argv, LISTEN_FDS, $STATE_DIRECTORY, `sidecar run`) —
173the golden deployment target, not a requirement: `./app -addr :8080`
174serves anywhere. `GET /healthz` and `GET /api/version` are answered
175by the framework, outside app middleware.
176
177## Deploying
178
179`make release VERSION=<sha>` builds and stamps the artifact; `carlos
180deploy --app calls --account oficina --channel edge --version <sha>
181--target linux-arm64 releases/calls-linux-arm64` ships and promotes it,
182waiting until `/api/version` serves it — but only once `carlos apps
183build-probe --app calls --account oficina /api/version` has been run
184for the app (set on the flagship app since 2026-09-09); a new app or
185account needs that first, or the wait watches `X-Carlos-Version`
186instead, which can report the version adopted before the process has
187actually changed. A migration applied under an earlier filename fails
188at boot; otherwise migrations never re-run. Every deploy, and every
189relay config change, restarts the instance and drops live calls — no
190drain exists. The wait can time out before
191hand-over — check `/api/version` before retrying. See the README's
192Deploying section for the canary recipe.
193
194## UX conventions (seeded from profile: considered)
195
196Accessible by construction, progressively enhanced, and never dependent on JavaScript to be usable, with the exceptions named above: browser media participation, on the holding screen and in the room, and, once a call exists, the room's chat panel and admission controls.
197
198These are rastrillo's own conventions, and the profile is named for what it does rather than after anyone else's work. For wider reading on interface quality, impeccable.style, the WAI-ARIA Authoring Practices and Inclusive Components are all worth your time — none of them is endorsed by, or authoritative for, this framework.
199
200- [x] Icons — lucide, inline — `internal/<app>/icons`
201- [x] Fields — label, hint, help and error in one envelope, wired with aria-describedby — `ui/field, ui/field-select, ui/field-text`
202- [x] Destructive actions — their own confirm-page URL, never a modal — `ui/confirm-form`
203- [x] State — never colour alone — always a text label too — `ui/status-pill, ui/badge`
204- [ ] Dates — relative, with the absolute date in a title attribute
205- [ ] Errors — server-rendered beside the field, in plain language
206- [x] Empty states — say what the screen is for, not just that it is empty — `ui/empty-state`
207
208`[x]` is enforced by a vendored component: use it, do not hand-roll an
209equivalent. `[ ]` is guidance to apply by hand. A convention absent from
210this list is one rastrillo has no opinion about.
211
212Edit any line. **This file is the source of truth, not the profile name.**
213The profile only seeded this list at scaffold time; nothing re-reads it, so
214changing a line here changes what the app does. A convention deleted from
215this file is not a convention to reinstate.
216
217## Work in a worktree, and catch main up first
218
219Take a worktree for the work. Do not work in the shared checkout.
220
221 git -C <repo> fetch origin
222 git -C <repo> worktree add ../<repo>-<task> -b <branch> origin/main
223
224Both halves matter, for different reasons.
225
226**The worktree**, because several sessions share this machine and some
227share this repository, and a checkout has one HEAD, one index and one
228working tree between all of them. A branch switch under somebody else's
229uncommitted work destroys it with nothing on screen to say so, and two
230sessions editing the same paths disagree quietly instead of conflicting
231loudly. A worktree gives the work its own HEAD and its own files, and
232costs a directory.
233
234**From `origin/main`, after a fetch** — not from whatever the checkout
235happens to be sitting on. A branch cut from a stale main is a merge
236conflict scheduled for later, against files somebody else has renamed in
237the meantime. A branch cut from another task's branch is worse: it
238carries that task's commits into yours, where they are reviewed as
239though you wrote them, and the two can only be separated by hand.
240
241Remove it when the work has landed — `git worktree remove` — so that
242`git worktree list` keeps saying something true.
243
244Written down because of 2026-09-17, in this repository, while it was
245still called `meet`. The shared checkout was
246sitting on one task's branch while holding a *different* task's feature
247uncommitted on disk — some four hundred lines, a new migration among
248them — put there by a session nobody else knew was working in that tree.
249Two other sessions were meanwhile coordinating over the same checkout by
250asking each other not to touch it, which is the arrangement a worktree
251makes unnecessary. Nothing was lost. Nothing about the arrangement would
252have said so if it had been, and by then the same feature existed twice,
253once on each side of a rename, because the two sessions had branched
254from different starting points.
255