oficina / fichas Public

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

Plain git — no account needed to clone.

Download

Download this file

1# πŸ€– fichas
2
3The Oficina suite's card cabinet. One instance per team.
4
5A *ficha* is an index card; a *fichero* is the cabinet it sits in.
6
7**Nothing is built.** This repo is a design document and this README.
8There is no module, no binary and no schema yet.
9
10## What it is meant to be
11
12Typed records β€” *cards* β€” with append-only *entries* attached to them, and
13references out to items in Docs, Sheets and Calendar. The first stack is a
14CRM: a Customer card, a Call Log entry, and a summary on the card that is
15derived from its entries and cites them.
16
17The ancestor is DabbleDB, not Microsoft Access. What is worth stealing is
18schema-by-refinement, entity promotion and views-as-first-class-objects β€”
19not the generic-database-builder positioning, whose best execution still
20found no market. The part that could not have been built in 2008 is that
21the model replaces HyperTalk: you reshape a card type in a sentence rather
22than in a dialog.
23
24## Why it is not part of memoria
25
26memoria is not an app of record and its decision 7 keeps it that way β€” it
27serves nobody to ask, so it cannot own content that needs an owner, a
28deletion story and a per-item visibility answer. Fichas owns its content
29and answers for it; memoria indexes it, cites it and reaches into it like
30any other sibling.
31
32Fichas would also be **the first app to serve the suite contract's server
33half** β€” `suite/README.md` says that half "arrives with the first app that
34serves one, and the fixtures get corrected by the second". memoria is the
35waiting consumer.
36
37## The design
38
39`docs/superpowers/specs/2026-09-19-fichas-design.md`.
40
41Read Β§1 first: half of its decisions table is marked **Proposed** and has
42not been ruled on. A proposal read as a ruling is the failure this suite's
43specs work hardest to prevent.
44
45Two things block slice 1, both in Β§10 β€” the seal-tier list (which card
46fields leave the seal, and therefore what can be filtered, sorted and
47grouped), and the reach credential ruling.
48
49## Building it
50
51A [rastrillo](https://github.com/rastrilloorg/rastrillo) app. `make ci` is
52the gate β€” vet, gofmt, tests, migration check β€” one definition for CI and
53for you. AGENTS.md carries the working conventions.
54
55`internal/fichastest/browser_test.go` walks the app in a real Chromium and
56is loud on any console error, failed request, or JS value that leaked to the
57screen:
58
59```sh
60go test -tags browser ./...
61```
62
63It needs a Chromium on PATH, via `RASTRILLO_CHROME`, or in a Playwright
64cache. **A skip is not a pass:** with no browser it fails unless
65`RASTRILLO_BROWSER_OPTIONAL=1` makes the skip a deliberate, visible choice.
66`make ci` runs the plain suite only.
67
68## Deploying, and the DEK
69
70The app is claimed on CARLOS as `fichas` in account `bds`
71(`https://console.carloku.com/a/bds/apps/fichas`). It is **not deployed**,
72and it should not be until sign-in lands β€” see the warning at the end.
73
74### 1. Mint the DEK
75
76The DEK is 32 random bytes, base64. It is not `carlos secrets genkey`,
77which mints the *secrets* keypair that seals config β€” a different thing at
78a different layer.
79
80```sh
81head -c 32 /dev/urandom | base64
82```
83
84**Keep a copy somewhere you will still have it in a year.** Everything in
85fichas β€” every card value, every call logged, every label β€” is sealed
86under this key and under nothing else. Lose it and the database is
87unreadable: there is no recovery path, by design, and no fallback key is
88generated because a fallback would seal this boot's cards under a key the
89next boot cannot derive and lose the data quietly instead of refusing
90loudly. memoria keeps its copy at `memoriadrive/DEK-production.txt`
91alongside `carlos secrets`; do the same here, or better.
92
93### 2. Set it, with the origin
94
95```sh
96carlos secrets set --app fichas --account bds FICHAS_DEK='<the base64>'
97carlos env set --app fichas --account bds FICHAS_ORIGIN='https://fichas.oficina.works'
98```
99
100`FICHAS_ORIGIN` is the CSRF yardstick and the base of every link the app
101emits, so it must be the host the browser is actually on. Unset, the app
102warns and falls back to loopback.
103
104### 3. Ship it
105
106```sh
107make release # refuses a dirty tree; stamps the version from git describe
108carlos deploy --app fichas --account bds --channel edge --timeout 5m \
109 releases/fichas-linux-arm64
110```
111
112**Mail submission.** Ship every build with `--mail submit`: it declares
113that the build sends through CARLOS mail submission (`mail.FromCarlos`,
114`internal/fichas/mailer.go`). Until `carlos email submission on --app
115fichas` runs, fichas keeps sending over `CARLOS_SMTP_*`; after it the
116agent sets `CARLOS_MAIL=submit`, fichas holds no SMTP credential, and
117every instance must run a build shipped with the flag. `carlos deploy`
118has no `--mail` flag yet (carlos main 9eec0236), so until it does ship
119and promote instead:
120
121```sh
122carlos ship --app fichas --account bds --mail submit releases/fichas-linux-arm64
123carlos promote --app fichas --account bds <version> edge
124```
125
126### Sign-in
127
128Magic link through rastrillo's `auth`, with the owners list as the
129admission gate β€” the **lone** shape of suite ruling 5. `FICHAS_SHAPE=suite`
130is the intended default and **refuses to boot**: it needs the home's
131identity bridge and roster pull, and booting into it before those exist
132would mean an admission gate that is really the owners list while the
133operator believes it is the home's roster.
134
135```sh
136carlos secrets set --app fichas --account bds \
137 FICHAS_DEK='<32 random bytes, base64>' \
138 FICHAS_INSTANCE_KEY='<any long random string>'
139carlos env set --app fichas --account bds \
140 FICHAS_ORIGIN='https://fichas.oficina.works' \
141 FICHAS_OWNERS='paul@keymail.dev'
142```
143
144`FICHAS_INSTANCE_KEY` seals the pending sign-in blob; `auth.New` refuses an
145empty one, because an empty input hashes to a fixed value identical across
146every deployment. `FICHAS_OWNERS` has no default: an empty admission gate
147on a public hostname admits anyone who can receive mail, so the app refuses
148to start without one.
149
150Mail goes through the platform's sender:
151
152```sh
153carlos email enable --app fichas --account bds --from noreply@fichas.bds.oncarlos.com
154```
155
156**The app refuses to boot without it.** `mail.FromEnv` falls back to
157`mail.Logged` on missing SMTP with nothing but a warning, and `mail.Logged`
158writes the magic link β€” a live credential β€” into platform log storage we
159cannot grep and cannot retract. The first deploy of this app ran in exactly
160that state and nothing failed; a WARN scrolled past. `LoadConfig` now
161refuses, and `FICHAS_ALLOW_LOGGED_MAIL=1` accepts it only on a loopback
162origin.
163
164## Live
165
166**https://fichas.oficina.works** β€” account `bds`, channel `edge`. Sign in
167with an address in `FICHAS_OWNERS`.
168
169`fichas.bds.oncarlos.com` still answers. It is the platform route the
170custom hostname sits in front of, not a second deployment, and signing in
171there still *starts* β€” but `FICHAS_ORIGIN` is the base of every sign-in
172link and the `client_id` keymail validates against, so the flow lands you
173on `oficina.works` and the session is set for that host. Use the canonical
174name. memoria made the same move, and its README says why being precise
175about it matters.
176
177The hostname was attached on 2026-09-27 and the certificate took about 45
178minutes to issue, with `carlos domains list` reporting `issuing-cert` and
179no guidance throughout. **Do not switch `FICHAS_ORIGIN` until HTTPS
180actually answers on the new name**: until then every emailed link points at
181a host that fails the TLS handshake. The list's STATE column also lags β€”
182it still said `issuing-cert` after HTTPS was serving β€” so check with curl,
183not with the list.
184