Fichas level-up spec, revision 3: Fable APPROVE on revision 2, its mediums and lows folded in
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+108
−56
docs/superpowers/specs/2026-11-17-fichas-level-up.md+108 −56
CI passed — run details
CI log
=== vet === go vet ./... go vet -tags browser ./internal/fichastest/ === fmt === === test === go test ./... ? amadan.net/oficina/fichas/cmd/fichas [no test files] ok amadan.net/oficina/fichas/internal/fichas 2.008s ? amadan.net/oficina/fichas/internal/fichas/icons [no test files] ok amadan.net/oficina/fichas/internal/fichas/seal 0.011s ok amadan.net/oficina/fichas/internal/fichastest 1.211s ? amadan.net/oficina/fichas/scripts/mockups [no test files] ? amadan.net/oficina/fichas/scripts/preview [no test files] ? amadan.net/oficina/fichas/scripts/writeestilo [no test files] === migration-check === go tool rastrillo migration check rastrillo migration check: models and migrations agree
diff --git a/docs/superpowers/specs/2026-11-17-fichas-level-up.md b/docs/superpowers/specs/2026-11-17-fichas-level-up.md| index aafd585..109a33e 100644 |
| --- a/docs/superpowers/specs/2026-11-17-fichas-level-up.md |
| +++ b/docs/superpowers/specs/2026-11-17-fichas-level-up.md |
| @@ -1,7 +1,7 @@ |
| # Fichas level-up: Escritorio, with Expediente's sentence and Rejilla's cell keys |
| -**Status:** revision 2, 2026-11-17. For review. Nothing is built. |
| -- Fable reviewed revision 1 (`00e3ad3`) and found CHANGES REQUIRED: 3 high, 15 medium and 12 low findings. This revision answers all of them. |
| +**Status:** revision 3, 2026-11-17. **APPROVED** by Fable on revision 2 (`0cb3b09`), with 8 medium and 13 low text fixes, which this revision folds in. Nothing is built. |
| +- Fable reviewed revision 1 (`00e3ad3`) and found CHANGES REQUIRED: 3 high, 15 medium and 12 low findings. Revision 2 answered all of them. |
| - §18 records each review round and what changed. |
| - §13's questions to Paul are open. The design is built on the proposed answers, each marked "Proposed, awaiting Paul". |
| @@ -145,9 +145,9 @@ A saved view is one card type's: |
| **Density is not part of a view.** It stays one reader's cookie (`fichas-density`), because it is about the reader's screen, not the records. |
| **Each type always has at least one team view.** |
| -- **Where the first one comes from:** a view's name and payload are sealed, so no SQL migration can write one. The `views` table comes from a migration; its rows come from a **boot-time reconcile**, `SeedViews`, beside `Seed`. For each card type with no team view, it writes "All <plural>" from today's defaults (table, every column but long text, no filter, **last edited first**, which is today's `SortUpdated` descending) in one transaction, logged as `AppBecause(0, "default view")`. |
| +- **Where the first one comes from:** a view's name and payload are sealed, so no SQL migration can write one. The `views` table comes from a migration; its rows come from a **boot-time reconcile**, `SeedViews`, beside `Seed`. For each card type of scope `card` (never an entry type such as Call log) with no team view, it writes "All <plural>" from today's defaults (table, every column but long text, no filter, **last edited first**, which is today's `SortUpdated` descending) in one transaction, logged as `AppBecause(0, "default view")`. |
| - **New types** get theirs inside `CreateType` and the designer's Create (§8.2), in the same transaction as the type. |
| -- **The last team view of a type** cannot be deleted or made personal. Any other team view, "All <plural>" included, can be. |
| +- **The last team view of a type** cannot be deleted. Any other team view, "All <plural>" included, can be. |
| **Which view opens:** |
| - **At `/t/{type}` with no `v`:** the last view this person used for the type (the `fichas-views` cookie, §3.2), or else the first team view. A cookie key that no longer resolves for this reader falls back without a word. |
| @@ -160,7 +160,8 @@ A saved view is one card type's: |
| - **At most 12 conditions** per view. |
| - **Relative values** are kept as tokens and resolved when the list is drawn, in the team's zone (Europe/Dublin by default, 2026-11-13 ruling): today, tomorrow, yesterday, this week, last week, next week, this month, the next or last N days. **"Me"** is a token for the person reading, so a team view "Owner is me" shows each person their own. |
| - **Conditions name options by their opaque ids** (§6.2), so renaming an option never touches a view or a bookmark. |
| -- **A condition that no longer makes sense** (its field is gone, or every option it names was removed) is never silently dropped, because dropping it would widen the view. Under "Match all" the view shows no cards; under "Match any" the condition matches nothing. Either way the caption and the panel say "1 condition refers to something that was removed", with Remove it. |
| +- **A retired option** (§6.2) still matches: the cards holding it are still there. The caption and the panel show it as "Lost (retired)". |
| +- **A condition that no longer makes sense** (its field is gone, or an option id it names is unknown to the field) is never silently dropped, because dropping it would widen the view. Under "Match all" the view shows no cards; under "Match any" the condition matches nothing. Either way the caption and the panel say "1 condition refers to something that was removed", with Remove it. |
| - **Search** (the Find box, `q`) still applies on top of the filter, over every value that shows as text (§6.4). |
| The seal tiers do not limit any of this. The list runs on the in-memory index, which holds every live card unsealed (base §4.1). §10 says what the tiers still decide. |
| @@ -175,7 +176,7 @@ The seal tiers do not limit any of this. The list runs on the in-memory index, w |
| - **The structure is one table,** so column widths, frozen columns, the sticky header and the grid's one tab stop hold across groups. Each group is a `<tbody>` whose first row is a heading row: one cell spanning the columns, with the group's name and count. |
| - **With script,** the heading holds a toggle button (`aria-expanded`) that hides the group's other rows. Which groups are closed is kept in the tab only. **Without script,** every group is open. |
| - **Paging stays 100 rows a page,** counting each appearance of a card in a group. A group that crosses a page boundary repeats its heading, marked "continued". |
| -- **Boards and calendars do not page.** A board column shows its first 100 cards and a "Show all 140" link (a URL parameter for that column's option id). A calendar shows its whole month. |
| +- **Boards and calendars do not page.** A board column shows its first 100 cards and a "Show all 140" link (`all=<option id>`, a navigation parameter, §4.9). A calendar shows its whole month. |
| ### 4.6 Columns |
| @@ -207,6 +208,7 @@ The seal tiers do not limit any of this. The list runs on the in-memory index, w |
| - **Saving a team view checks its revision.** If someone else saved it since this person loaded it, Save is refused: "Niamh changed this view a moment ago." The choices are **Save as new** and **Replace theirs**, which is an explicit second POST. |
| - **Moving between scopes:** |
| - **Personal to team:** the owner's choice, from Manage views, logged. **The view's history, as anyone else sees it, starts at that event.** Its personal era's payloads are never shown to anyone but its owner, and Restore cannot reach past that event. |
| + - **The scope move cannot be undone** or restored past, by anyone: undoing it would be team to personal by another name. Its event is marked not undoable. |
| - **Team to personal is not offered.** It would let one person take a view away from everyone, with nobody else able to see where it went. "Save as new, only you" covers the need. |
| - **One accessor decides who sees a view:** `viewFor(reader, key)`. A personal view resolves only for its owner; a team view for anyone admitted. Personal views and type drafts are read and written through `scope.Owned` (`AGENTS.md`); team views through the `scope = 'team'` predicate inside the same accessor. Every view route (open, save, rename, reorder, delete, history, restore, undo, the scope move) goes through it. |
| - **Limits:** 50 team views per type, and 50 personal views per person per type. |
| @@ -217,16 +219,19 @@ The seal tiers do not limit any of this. The list runs on the in-memory index, w |
| ``` |
| /t/{type}?v=<view key>&layout=board |
| - &m=any&f0=<field key>&o0=any&x0=Lead&x0=Contacted |
| + &m=any&f0=<field key>&o0=any&x0=<option id>&x0=<option id> |
| &s=<field key>&s=-<field key>&g=<field key>&gb=week |
| &cols=<key>:228,<key>:124&hide=<key>&frz=1 |
| - &bf=<field key>&be=1&cf=<field key>&month=2026-11 |
| + &bf=<field key>&be=1&cf=<field key> |
| + &month=2026-11&all=<option id> |
| &q=<search>&card=<card id>&page=2 |
| ``` |
| - **Keys are opaque** (`f_` and hex, `v_` and hex, `o_` and hex for options). Operators and layouts are this app's words. **Filter values and the search are the team's words, in the clear** (Q4), as `?q=` already is. |
| - **A saved view's own URL is clean:** `/t/{type}?v=<key>`. Values appear only for unsaved changes. Saving moves them into the sealed payload and the URL drops them. |
| -- **Parameters override by section, never by delta.** The sections are: layout; filter (`m`, `fN`, `oN`, `xN`); sort (`s`); group (`g`, `gb`); columns (`cols`, `hide`, `frz`); board (`bf`, `be`); calendar (`cf`, `month`). If any parameter of a section is present, that whole section comes from the URL and the view's saved section is ignored. `f=none` and `s=none` say "no filter" and "no sort" explicitly. So a removed condition is expressible, and a teammate saving the view never changes what an unsaved URL shows. `v` only names the base for "Changed" and for Save. |
| +- **Parameters override by section, never by delta.** The sections are: layout; filter (`m`, `fN`, `oN`, `xN`); sort (`s`); group (`g`, `gb`); columns (`cols`, `hide`, `frz`); board (`bf`, `be`); calendar (`cf`, `month`). If any parameter of a section is present, that whole section comes from the URL and the view's saved section is ignored. `f=none`, `s=none`, `g=none` and `hide=none` say "no filter", "no sort", "no group" and "nothing hidden" explicitly. So a removed condition is expressible, and a teammate saving the view never changes **the sections present in** an unsaved URL; sections it leaves out follow the saved view. `v` only names the base for "Changed" and for Save. |
| +- **`href` writes only the sections that differ from the saved view,** so a saved view's own URL stays clean and "Changed" means a section is present. |
| +- **Navigation is not part of a view:** `q`, `card`, `page`, `panel`, `month` (the calendar's month) and `all` (a board column shown in full). They never make the view "Changed" and are never saved. |
| - **Values, by kind:** |
| | Kind | `xN` holds | |
| @@ -246,7 +251,7 @@ The seal tiers do not limit any of this. The list runs on the in-memory index, w |
| - **Only known keys are read.** An unknown field key, an operator that does not suit the kind, or a value that is not an option is dropped, never honoured (today's rule for filters, `parseList`). |
| - **A state longer than 4,000 bytes** is never written as a URL. |
| - **With script,** the panel keeps the state in the page, stops rewriting the address, and says "This view is too long to keep in the address. Save it as a view to keep it." Save and Save as new post the state in the body. |
| - - **Without script,** the panel's form switches from GET to POST at that size (the server counts while rendering), to `POST /t/{type}/preview`, which renders the list for the posted state and writes nothing, with the same sentence. That route is listed with the GETs in LU5. |
| + - **Without script,** the panel's form switches from GET to POST at that size (the server counts while rendering), to `POST /t/{type}/preview`, which renders the list for the posted state and writes nothing, with the same sentence. On that page the panel's form posts to the same route and Save posts the state; the caption's words, paging and the card links are not offered, so nothing on it needs the state in a URL. That route is listed with the GETs in LU5. |
| - **Where the values go:** the browser's history and address bar, and any link a person copies. Cross-origin requests carry only the origin (rastrillo's `Referrer-Policy: strict-origin-when-cross-origin`). The app's own log never records a query string (gate LU7). If CARLOS' edge logs query strings, it holds them too, as it holds `?q=` today. §10.2 lists this. |
| ### 4.10 The caption |
| @@ -303,8 +308,8 @@ Expediente's sentence, as the caption over the table, the board and the calendar |
| - **Undo reverses one event,** by a new event. `POST /cards/{id}/undo` with the event id. |
| - **What can be undone:** only an `updated` event on that card, by the person asking, whose payload is still held, and which was written by a person's edit (`SetField`, the edit form, a board or calendar move, a file added or taken off). Its payload marks it `undoable`. Anything else is refused with the app's 404: a `created` event (undoing it would blank the title), an entry, a migration's or reconcile's change, an Undo's own event (that is Redo, below). |
| - Each field the event changed goes back to its before value **only if it still holds the event's after value**. A field changed again since is left, and the toast says so: "Stage was changed again by Niamh, so it was left." |
| - - A before value that can no longer be written is left and named: an option since removed, a file since removed or swept (§7.4), a link to a card since deleted. |
| - - The new event is `updated`, by the person, with `trigger_id` naming the undone event. **Redo** undoes that event, by the same rule. |
| + - A before value that can no longer be written is left and named: an option id the field no longer knows, a file since removed or swept (§7.4), a link to a card since deleted. A retired option is still known, so Undo can put it back. |
| + - The new event is `updated`, by the person, with `trigger_id` naming the undone event and `redo` false. **Redo** is `POST /cards/{id}/undo` naming that Undo's event, by the same person, by the same rules; its event carries `redo` true. An Undo's own event is otherwise not undoable. |
| - Only the person who made a change can undo it from the toast. Anyone can restore an earlier value from the card's History (§5.5), as a new change. |
| - **⌘Z and ⌘⇧Z** in the table and on the card undo and redo this tab's own changes, newest first, through the same route. Inside a text input, ⌘Z is the browser's own until the field is saved. |
| - **With scripts off,** after the edit form saves, the card shows "Saved. Undo" with a one-button form. |
| @@ -329,6 +334,7 @@ The mock-up's header has History. Base decision 2 ("versioned means we can see c |
| - **History**, in the card's header, opens a panel: each change, newest first, with who, when and which fields. |
| - **Inside the value window** each change shows before and after, and **Restore this value** per field. Restore is a new change, checked as in §5.2. |
| - **Past the window** a change shows only who, when and which fields. Base §5: the values are gone, so there is no restore. |
| +- **Payloads from before a reconcile** (option labels before option ids, numbers before the grammar) are shown as the text they hold, with no Restore. |
| - With scripts off, History is a page, `/cards/{id}/history`. |
| ### 5.6 Rejilla's keyboard in the cells |
| @@ -386,7 +392,7 @@ With script, the table is one tab stop: an ARIA `grid` with a roving `tabindex`. |
| | **Money** | — | new, a kind | integer minor units and nothing else: `4800000` for €48,000.00 | |
| | Date | yes | optional end and time (§6.2, Q7) | `2026-11-20`, `2026-11-20T14:30+00:00`, or a start and end joined by `/` | |
| | Choice | yes | a tone per option; options get ids | the option's id (`o_` and hex), no longer its label (§6.2) | |
| -| **Multi-select** | — | new | a JSON array of option ids, in option order | |
| +| **Multi-select** | — | new | a JSON array of option ids, in option order, with no repeats. Normalised to that order when written, read and compared, so `was` never differs by order alone | |
| | **Checkbox** | — | new | `1`, or no value | |
| | **Person** | — | new | a JSON array of member ids | |
| | Web address, Email, Phone | yes | — | as today | |
| @@ -403,17 +409,19 @@ With script, the table is one tab stop: an ARIA `grid` with a roving `tabindex`. |
| ### 6.2 Kind settings |
| -Each kind's settings, a field's help text and whether it is required live in **`field_defs.sealed_settings`**, a JSON object sealed under `type.label` with the field's label (§10.1). Each kind has a closed schema, and anything outside it is refused at write. |
| +Each kind's settings, a field's help text and whether it is required live in **`field_defs.sealed_settings`**, a JSON object sealed under its own purpose, `field.settings` (a type's under `type.settings`), so a key derived for one is never the key for another (§10.1). Each kind has a closed schema, and anything outside it is refused at write. |
| - **Number:** `format`, one of `plain`, `grouped` (1,200), `decimals` with `places` 0–4, or `percent`. |
| - The format is display only. Values are exact decimals and compare as decimals (`math/big`), never as floats. Today's sort parses floats (`index.go`); that changes. |
| - A percent field stores what is shown: `50` is 50%. |
| -- **What a Number accepts,** one grammar for every format: an optional `-`; digits, optionally grouped in threes by `,` before the point (`1,200`, `12,000,000`); an optional `.` and more digits. At most 30 digits in all. **Anything else is refused**, never guessed: `1,5`, `1.200,50`, `1e3`, `NaN`, `Inf`, `0x10` and a second point each get "Enter a number, like 1200 or 1,200.50". Today `writeValues` strips every comma, so `1,5` becomes `15`; that changes. |
| +- **What a Number accepts,** one grammar for every format: an optional `-` (never `+`); digits, optionally grouped in threes by `,` before the point (`1,200`, `12,000,000`); an optional `.` and more digits; a leading point is allowed (`.5`). At most 30 digits in all. **Anything else is refused**, never guessed: `1,5`, `1.200,50`, `1e3`, `NaN`, `Inf`, `0x10`, `+5` and a second point each get "Enter a number, like 1200 or 1,200.50". Today `writeValues` strips every comma, so `1,5` becomes `15`; that changes. |
| +- **The canonical form,** which is what is stored and what `was` holds: no grouping commas, no leading zeros (`0.5`, never `00.5` or `.5`), no trailing fractional zeros (`1.5`, never `1.50`; `2`, never `2.0`), and never `-0`. |
| - **Money:** `currency`, an ISO 4217 code from a list (EUR first). Fixed at creation, because the stored unit depends on it. `AGENTS.md`: money is integer cents. |
| - It accepts the Number grammar, with the currency's symbol or code allowed before or after (`€48,000`, `48000 EUR`). |
| - A value with more decimal places than the currency allows is refused, never rounded. |
| - It is stored as integer minor units, at most 18 digits, so it fits an int64. |
| -- **Values already stored:** a boot reconcile (`AppBecause(0, "number grammar")`) rewrites each stored Number to the canonical form, one logged event per card that changes. A value that does not parse (an old `1e3` is parsed and rewritten; a `NaN` is not) is left as stored, shown with "Not a number" beside it, and sorts last. It is the reconcile's only way to fail, and it fails visibly. |
| +- **Values already stored:** a boot reconcile (`AppBecause(0, "number grammar")`) rewrites each stored **card** Number (`card_values`) to the canonical form, one logged event per card that changes. A value that does not parse (an old `1e3` is parsed and rewritten; a `NaN` is not) is left as stored, shown with "Not a number" beside it, and sorts last. It is the reconcile's only way to fail, and it fails visibly. |
| +- **Entry values are never rewritten.** `entry_values` are immutable (migration 0002's triggers abort an UPDATE, base §3), so a reconcile that touched them would fail boot. Stored entry numbers (a call's Duration) are read tolerantly, as today; the strict grammar applies to entries written from now on. |
| - **Date:** `end` (allowed or not) and `time` (allowed or not). |
| - Turning either on is always allowed. Turning one off is refused while any card uses it: "3 customers have an end date. Clear them first." |
| - **The team's zone** is `FICHAS_TIME_ZONE`, default `Europe/Dublin` (2026-11-13 ruling). The binary embeds `time/tzdata`, because it is cgo-free and the host's zone files are unknown. An unknown zone refuses boot. |
| @@ -425,7 +433,7 @@ Each kind's settings, a field's help text and whether it is required live in **` |
| - **Choice and Multi-select:** options live in `sealed_options` as `[{id, label, tone, retired}]`. They are the team's words. |
| - **Values, views and URLs hold the option's id**, so renaming an option changes one sealed row and nothing else: no card is rewritten, no view or bookmark breaks. |
| - **Removing an option retires it.** Cards that hold it keep showing it; it is no longer offered in pickers or filters. |
| - - **Today's Stage values are labels.** A boot reconcile (`AppBecause(0, "option ids")`) gives every option of every Choice an id and rewrites each card's value from label to id, one logged event per card. Paul is the only user and the data is not real, so this is cheap now and would not be later. |
| + - **Today's Stage values are labels.** A boot reconcile (`AppBecause(0, "option ids")`), per field in one transaction, gives every option an id, **adds a retired option for any stored label no longer in the list**, rewrites each card's value from label to id (`card_values` only, one logged event per card), and writes `sealed_options` in its new shape last. The new shape is the done-marker, so a reconcile interrupted by a crash runs again whole. Entry values are never rewritten (above). Paul is the only user and the data is not real, so this is cheap now and would not be later. |
| - The suite contract shows the label (§6.7). An option's rename moves no card's revision, so memoria keeps the old label until a card next changes: base §10's field-rename item again. |
| - **Person:** `multiple` (true or false). |
| - **Link to…:** `target` (the target type's opaque key) and `multiple`. The target never changes. |
| @@ -487,12 +495,13 @@ Type designer §3, with these changes: |
| - Search over linked titles reads the targets' titles at query time through the link ids, so it needs no stored text. |
| - **On the card:** each link is a chip to the target. The target shows **Linked here**: "3 products link to this customer", listed by title, grouped by type and field. |
| - **Deleting a target** is a soft delete, as every card's is. Nothing cascades, and the link's value is not rewritten. But in **the same transaction**, each card that links to it (from the backlinks, read from `card_values` by unsealing that field's values, since the durable file has no plaintext link column) gets a new revision and one `updated` event, by the person deleting, naming the link field in `ChangedFields`. |
| + - The bump moves `revision` only, **not `updated_at` and not "Edited by"**: nobody edited those cards. The card's History shows it as "A linked card was deleted". |
| - So memoria's copy of each linking card is redrawn (S1 lists it, S2 answers `STALE` for the old revision), and its new text leaves the deleted card out (§6.7). Base §5: "a card that is deleted while the log still holds its old values makes 'delete' a lie"; the same holds for a copy of its title in a sibling. People cards (R5) are the likely target, and they are named third parties. |
| - A linking card shows "deleted card" in place of the chip. |
| - **Renaming a target** does not bump linking cards. In the app the new title shows at once; memoria's copy of each linking card keeps the old title until that card next changes. That is base §10's field-rename item, and it stays open there. |
| - **A link never leaves this instance.** A reference to another app's item is a `ref` (base §3, §9) and keeps every reach rule: it resolves at render, per asker, and an unresolvable one renders nothing, never a count. |
| - **Base §9's "Linked here" counts** are safe for links: every admitted person reads every card (base §6.1), so a count discloses nothing a member cannot open. |
| -- **A link to a card of another type** than the field's target is refused at write. |
| +- **A link to a card of another type** than the field's target, or to a gone card, is refused at write. |
| ### 6.7 What the suite contract sees |
| @@ -541,7 +550,7 @@ Mapa images' decisions, reused for Fichas files. Where Mapa's spec decides, this |
| - **Memory, in three bounds:** |
| - **Receiving:** at most two uploads are read at once (an upload counter, separate from the semaphore below). A slow phone upload holds a receiving slot, never the blob budget. The body is read into memory with `Request.MultipartReader` and a 25 MiB bound; Go's `ParseMultipartForm`, which spills past its memory limit to **plaintext temporary files**, is never used for a file route. |
| - **Blob work** (sealing and storing an upload, reading and opening a file to serve it, making a thumbnail) takes a **weighted semaphore** of 128 MiB, each operation weighing three times its `stored_bytes` (a body, its sealed copy and its opened copy). A thumbnail weighs a few KiB, so a table of 100 thumbnails is never queued behind one large file. Serving waits up to 30 s, as Mapa does; an upload's store step up to 10 s; past that, 503 with `Retry-After`. |
| - - **Decoding** for thumbnails: the one-at-a-time semaphore above, inside the blob budget. |
| + - **Decoding** for thumbnails: the one-at-a-time semaphore above, inside the blob budget, weighted by the decoded size (width × height × 4 bytes, from `DecodeConfig`), not by the file's size. |
| ### 7.3 The `files` table |
| @@ -559,16 +568,23 @@ Mapa images' decisions, reused for Fichas files. Where Mapa's spec decides, this |
| `file_trash (object_key, queued_at)` is the delete queue, as Mapa's `image_trash`. |
| -**One invariant, one writer.** For every Files field of every card: **the value's ids are exactly the file rows for that card and field with `detached_at` null**, in the value's order. Every write that touches a Files field (upload, taking off, Undo, Restore this value, Remove from Fichas, the importer's `AddFile`) goes through one store function, `setFiles`, which writes the value, stamps or clears `detached_at`, bumps the revision and logs, in one transaction. A test walks every write path and checks the invariant after each (LU13). |
| +**One invariant, one writer.** For every Files field of every card: **the value's ids are exactly the file rows for that card and field with `detached_at` null**, in the value's order. Every write that touches a Files field (attaching an upload, taking off, Undo, Restore this value, Remove from Fichas, the importer's `AttachFile`) goes through one store function, `setFiles`, which writes the value, stamps or clears `detached_at`, bumps the revision and logs, in one transaction. A test walks every write path and checks the invariant after each (LU13). |
| + |
| +**What `setFiles` accepts:** only ids whose row is on **this card and this field**. |
| +- A person's edit (`SetField` on a Files field, the edit form) may only **reorder or drop** ids that are attached now. |
| +- **Adding** is an upload's attach only (below). |
| +- **Re-adding a detached id** is Undo or Restore this value only. |
| +- Any other id (another card's file, a detached file named by hand, a stored file not yet attached) is refused, as an unknown value is. |
| ### 7.4 Getting files in, and out |
| -- **On the card:** "Add a file, or drop one here". With script: pick, drop or paste, several at once, each with a `<progress>`. Without: a file input and **Upload** on the card's edit form. |
| +- **On the card:** "Add a file, or drop one here". With script: pick, drop or paste, several at once, each with a `<progress>`. Without: an **Upload** form of its own, `multipart/form-data`, under the card's files and on the edit page, separate from the edit form so a file never rides with the field values. |
| - **In the table:** a Files cell shows a count and the first thumbnail. Clicking it opens the card at its files. |
| -- **Upload** is `POST /cards/{id}/fields/{key}/files`, multipart, bounded by `http.MaxBytesReader` at 25 MiB plus the form. |
| - - The bytes are checked, stripped (images), sealed and stored **before** the transaction. |
| - - The transaction writes the file row, adds its id to the field's value, bumps the card's revision, and logs `updated` on the card with `file_added` in its payload. |
| - - If the transaction fails, the object is deleted, and queued in `file_trash` if that fails too. |
| +- **Upload** is `POST /cards/{id}/fields/{key}/files`, multipart, bounded by `http.MaxBytesReader` at 25 MiB plus the form. **It is `StoreFile` then `AttachFile`**, the same two steps the importer uses (§11), so one path holds every upload's guarantees: |
| + 1. **`StoreFile`, outside any transaction:** check, strip (images), seal, and make the thumbnail. Then **write the `file_trash` rows first** (one for the file's object key, one for the thumbnail's, each with `queued_at` 24 hours ahead), and only then `Put` the objects. A crash at any point leaves at worst a trash row for an object that may or may not exist, which the sweep deletes. |
| + 2. **`AttachFile`, in one transaction** through `setFiles`: re-check the quota; **delete the file's trash rows, and require that the delete removed exactly those rows**, or fail with `ErrFileExpired` (the sweep got there first) and write nothing; write the file row; add its id to the field's value; bump the card's revision; log `updated` on the card with `file_added` in its payload. |
| +- **The sweep claims before it deletes.** For each due trash row it deletes the row in its own transaction, and only if that delete removed the row does it delete the object. So the sweep and `AttachFile` can never both win: an object is deleted only once its trash row is gone, and an attached file's trash row was removed by its attach. |
| +- **The trash rows written by `StoreFile`** are bookkeeping for objects not yet in any card, and log no event (§9). |
| - **Taking a file off a card** is a field edit (§5.1) through `setFiles`: the value loses its id, `detached_at` is stamped, the event is logged, and Undo puts it back by clearing the stamp. |
| - **Removing a file now,** for one that should never have been uploaded: **Remove from Fichas** on its own confirm page (`GET` and `POST /files/{id}/remove`). One transaction, through `setFiles`: |
| - takes the id out of the card's value if it is there, bumps the card's revision and logs the card `updated` (so memoria's copy, which names the file, is redrawn); |
| @@ -577,12 +593,13 @@ Mapa images' decisions, reused for Fichas files. Where Mapa's spec decides, this |
| - **What `GET /files/{id}` serves,** to anyone admitted (base §6.1: every member reads every card and its history): |
| - an attached file of a card that is not gone; |
| - a detached file that is still kept (§7.5), because History and Undo show it. |
| + - **`/files/{id}/thumb` follows exactly the same rules**, and answers 404 for a file with no thumbnail. |
| - **Everything else is the app's ordinary 404**, before any store read and regardless of `If-None-Match`: a removed or swept file, a file of a deleted card, an id that never existed. A signed-out or non-admitted request gets the sign-in door, as every route does. |
| - **A deleted card's files** answer 404 while it is deleted. Cards are never hard-deleted today (`TestACardCannotBeHardDeleted`), so their files are kept with them. |
| ### 7.5 Retention, quota and the store |
| -- **A detached file is kept for the value window** (base §5), so Undo and History can bring it back. Past the window the sweep deletes it. |
| +- **A detached file is kept for the value window** (base §5), so Undo and History can bring it back, and **it counts against the quota** until it is swept or removed. Past the window the sweep deletes it. |
| - **The value window** is built in Phase 1 (Q11), before files exist, so Phase 5's files start with it. |
| - **The sweep** runs at wake, picks candidates by SQL alone, and empties `file_trash` off the boot path (Mapa images §3.3). It never fails boot. |
| - **Quota:** one team total, `FICHAS_FILE_QUOTA`, default 10 GiB. Fichas has no private content (base §6.1), so a team-wide total counts nothing hidden. Upload is refused past it: "Fichas holds 10 GiB of files. Remove some, or ask whoever runs your team's Oficina." |
| @@ -657,10 +674,10 @@ As draft 2 §4: DeepSeek V4 Flash on TensorX through Slides' client, the sentenc |
| | New target from a link picker | `card` | `created`, then `updated` on the linking card | — / the field | values | |
| | A link target deleted (§6.6) | `card` `deleted` on the target, then `card` `updated` on each linking card | | — / the link field | none for the linking cards: their values did not change | |
| | File added, taken off | `card` | `updated` | the field | before and after ids, `file_added` or `file_detached`, `undoable` | |
| -| File removed now | `card` `updated` (if it was attached), then `file` `removed` | | the field / — | the ids; the file's name | |
| +| File removed now | `card` `updated` (if it was attached), then `file` `removed` | | the field / — | the ids on the card event; **no payload** on the file event, so the name of a file removed for being wrong is not kept in the log | |
| | Option renamed, retired, given a tone | `field` | `updated` | — | before and after options | |
| | The boot reconciles: default views, option ids, the number grammar | `view` `created`; `card` `updated` per card changed | | — / the field | as for any write; actor `AppBecause(0, "<reason>")` | |
| -| View created, changed, renamed, reordered, made a team view, deleted, restored | `view` | `created`, `updated`, `deleted` | — | before and after payload | |
| +| View created, changed, renamed, reordered, made a team view, deleted, restored | `view` | `created`, `updated`, `deleted` | — | before and after payload; `undoable` false on the scope move | |
| | Folder created, renamed, reordered, deleted; a type moved | `group`, `type` | `created`, `updated`, `deleted` | — | before and after | |
| | Type and fields created by the designer | `type`, `field` | `created` | — | as today | |
| | Type settings (icon, description, status field, sections) | `type` | `updated` | — | before and after | |
| @@ -676,6 +693,7 @@ As draft 2 §4: DeepSeek V4 Flash on TensorX through Slides' client, the sentenc |
| - **Named exemptions**, as Mapa names retention: |
| - **Type drafts** (save, discard, expiry) log nothing. A draft is one person's scratch work and nothing exists until Create. Create logs every row it makes. The one draft event is the assistant's `drafted`, which records only that a call happened. |
| - **The sweeps** log nothing: the value window erasing event payloads (Q11), detached files past the window, `file_trash`, expired drafts. They remove only what nobody can still reach, and an event would have to name Fichas as the actor. |
| + - **`StoreFile`'s trash rows** (§7.4) log nothing: they are bookkeeping for an object no card holds yet. The attach that follows logs. |
| - **Preference cookies** (density, panel, rail, last view) write no row. |
| - **Every event names its real actor** (ruling 9). An edit is the person's. The boot reconciles are Fichas acting as itself, with a reason (`AppBecause`), as `Seed`'s kind upgrades are today. |
| @@ -688,8 +706,8 @@ As draft 2 §4: DeepSeek V4 Flash on TensorX through Slides' client, the sentenc |
| | Table | Plaintext columns | Sealed columns | Case (base §4.1) | |
| |---|---|---|---| |
| | `type_groups` | `id`, `key`, `ordinal`, times | `sealed_label` | 2, 4 | |
| -| `card_types` (new columns) | `group_id` | `sealed_settings`: icon, description, sections, status field | 2 | |
| -| `field_defs` (new columns) | — | `sealed_settings`: the kind's settings, required, help text. Options gain ids, tones and `retired` inside `sealed_options` | — | |
| +| `card_types` (new columns) | `group_id` | `sealed_settings` (purpose `type.settings`): icon, description, sections, status field | 2 | |
| +| `field_defs` (new columns) | — | `sealed_settings` (purpose `field.settings`): the kind's settings, required, help text. Options gain ids, tones and `retired` inside `sealed_options` | — | |
| | `views` | `id`, `key`, `card_type_id`, `scope`, `owner_id` (personal only), `ordinal`, `revision`, `gone`, times | `sealed_payload` (purpose `view.payload`) | 2, 4 | |
| | `type_drafts` | `id`, `member_id`, times | `sealed_payload` (purpose `draft.payload`) | 2 | |
| | `files` | §7.3 | `sealed_record` | 2 | |
| @@ -741,7 +759,7 @@ The importer's §17 sketches phase 2. This level-up gives it each thing it asks |
| | `url`, `email`, `phone_number` | Web address, Email, Phone | — | |
| | `people` | **Person**, each Notion user mapped to a team member by the importer on the import page; an unmapped user goes into a companion Text field, "<field> (from Notion)" | was a Link to People by name | |
| | `relation` | Link to… the type the related database became | — | |
| -| `files` | **Files**, downloaded through the importer's file transport and stored by `AddFile` (below); external files stay as links in a Text field | was not imported | |
| +| `files` | **Files**, downloaded through the importer's file transport, stored by `StoreFile` and attached by `AttachFile` (below); external files stay as links in a Text field | was not imported | |
| | `formula`, `rollup` | **The last value, as plain data**, in a field of the value's kind, with help text "From Notion: a formula, not kept up to date" | — | |
| | `created_time` | the card's **Created** (`cards.created_at`), set by the import. It is a plaintext timestamp either way, so this discloses nothing new; S1's rows keep their own event times | the sketch put it in history only, which Q11's window erases | |
| | `created_by`, `last_edited_time`, `last_edited_by` | ordinary fields the importer adds when asked: a Person (mapped as `people` is) and a Date, help text "From Notion". Kept as data, so the value window does not erase them | as above | |
| @@ -761,22 +779,24 @@ The importer's §17 sketches phase 2. This level-up gives it each thing it asks |
| // fn returns nil. |
| func (s *Store) ImportTx(ctx context.Context, actor Actor, fn func(tx *ImportWriter) error) error |
| -func (w *ImportWriter) CreateModel(m Model) (ModelResult, error) // §8.2's Create; the store's limits (§8.2), not the assistant's |
| +func (w *ImportWriter) CreateModel(m Model) (ModelResult, error) // §8.2's Create; the store's limits (§8.2), not the assistant's. |
| + // ModelResult maps each draft type and field to its key, and each option to its id |
| +func (w *ImportWriter) AddField(typeKey string, spec FieldSpec) (FieldDef, error) // a field added to a type the import made earlier (Notes, a companion Text, "From Notion" fields); returns its key and option ids |
| func (w *ImportWriter) CreateCard(typeKey string, values map[string]string, createdAt time.Time) (Card, error) |
| func (w *ImportWriter) SetField(cardID int64, key, value, was string) error // §5.2 |
| func (w *ImportWriter) CreateView(typeKey string, v ViewPayload, scope string) (View, error) |
| func (w *ImportWriter) AttachFile(cardID int64, key string, f StoredFile) error // through setFiles (§7.3) |
| -// StoreFile does the object work of §7.4 OUTSIDE any transaction: checks, |
| -// strips, seals, stores, thumbnails, waiting on the semaphores rather |
| -// than failing. It also writes the object's key to file_trash with a |
| -// queued_at 24 hours ahead; AttachFile, inside ImportTx, removes that |
| -// entry with the rest of its write. So a StoredFile never attached is |
| -// deleted by the next sweep after a day, and nothing is orphaned. |
| +// StoreFile does §7.4's step 1 OUTSIDE any transaction: checks, strips, |
| +// seals, thumbnails, writes the trash rows, then stores, waiting on the |
| +// semaphores rather than failing. AttachFile, inside ImportTx, is step 2: |
| +// it re-checks the quota and claims the trash rows, or fails with |
| +// ErrFileExpired. A StoredFile never attached is swept after a day. |
| func (s *Store) StoreFile(ctx context.Context, actor Actor, name string, data io.Reader) (StoredFile, error) |
| ``` |
| -- Typed refusals: `ErrFileTooLarge`, `ErrFileQuota`, `ErrNoFileStore`, `ErrModelLimits`. |
| +- Typed refusals: `ErrFileTooLarge`, `ErrFileQuota`, `ErrNoFileStore`, `ErrFileExpired`, `ErrModelLimits`. |
| +- **A Notion select or multi-select past 200 options** becomes a Text field (a multi-select's values joined by `, `), and the run report says so. |
| - **Relations are written in a second pass,** after every card exists, as `SetField` on each link field. |
| - No network call happens inside `ImportTx`; the importer downloads first, as its §12 already requires for Mapa. |
| @@ -848,22 +868,23 @@ Each phase after that is its own branch from `main`, with mock-ups checked again |
| **Phase 2: saved views.** |
| 1. `[estilo-float]` in estilo, if it has not landed (§3.4). |
| -2. **Option ids** (§6.2): the boot reconcile from labels to ids, and filters by id. Views must never be saved holding labels. |
| -3. The `views` table, `SeedViews`, `viewFor` with `scope.Owned`, the `fichas-views` cookie, the columns cookie retired (§4.3, §4.6, §4.8). |
| -4. The URL grammar: sections, per-kind values, `parse` and `href`, the redirect from today's parameters, the 4,000-byte rule and `POST /t/{type}/preview` (§4.9). |
| -5. The View panel for the table and the cards layouts: filter on any field with §6.3's operators for today's kinds, sort by several, group as one table with a `<tbody>` per group, columns with order, width, hide and freeze (§4.1, §4.4–4.6). |
| -6. The caption (§4.10). |
| -7. The switcher, Save, Save as new, Reset, team and personal scope, the revision check, Manage views, view history, Restore, Undo and deleted views (§4.2, §4.8). |
| -8. Count only (§4.7). |
| -9. Gates LU6, LU7, LU8 and LU12. |
| +2. **Option ids** (§6.2): the boot reconcile from labels to ids, retired options, and filters by id. Views must never be saved holding labels. |
| +3. **The team's zone and numbers,** which views filter and sort on: `FICHAS_TIME_ZONE` with embedded tzdata, the number grammar, its canonical form and its reconcile (card values only), and exact decimal comparison (§6.2). |
| +4. The `views` table, `SeedViews`, `viewFor` with `scope.Owned`, the `fichas-views` cookie, the columns cookie retired (§4.3, §4.6, §4.8). |
| +5. The URL grammar: sections, per-kind values, `parse` and `href`, the redirect from today's parameters, the 4,000-byte rule and `POST /t/{type}/preview` (§4.9). |
| +6. The View panel for the table and the cards layouts: filter on any field with §6.3's operators for today's kinds, sort by several, group as one table with a `<tbody>` per group, columns with order, width, hide and freeze (§4.1, §4.4–4.6). |
| +7. The caption (§4.10). |
| +8. The switcher, Save, Save as new, Reset, team and personal scope, the revision check, Manage views, view history, Restore, Undo and deleted views (§4.2, §4.8). |
| +9. Count only (§4.7). |
| +10. Gates LU6, LU7, LU8 and LU12, and LU1, LU3, LU5, LU9 and LU10 extended to views. |
| **Phase 3: board and calendar.** Both work on today's kinds: a board by a Choice, a calendar by a Date. |
| 1. The board: columns by a Choice (Person and Checkbox once Phase 4 adds them), a move as a field edit with Undo, "Move to…" without script, New in a column, empty columns, the first 100 and "Show all", the phone's snap scroll. |
| 2. The calendar: a month by a Date field, weeks from Monday in the team's zone, "Cards with no date", a drag as a field edit, the phone's agenda. |
| **Phase 4: the new kinds.** Through today's add-field page, which gains them, so they are usable before the stepped designer. |
| -1. `FICHAS_TIME_ZONE` and embedded tzdata; date ends and times (§6.2). |
| -2. The number grammar and its boot reconcile; exact decimals; number formats; Money (§6.2, Q12). |
| +1. Date ends and times (§6.2), on Phase 2's zone. |
| +2. Number formats and Money (§6.2, Q12), on Phase 2's grammar. |
| 3. Checkbox, Multi-select and Person (§6.5), with board columns by Person and Checkbox. |
| 4. Link to…: ids in the index with titles resolved when drawn, the backlink map, Linked here, the picker and its search page, and the linking cards' revisions on a target's delete (§6.6; draft 2's slice D). |
| 5. The People type and Customer's Contacts (§8.4). |
| @@ -884,18 +905,18 @@ Each phase after that is its own branch from `main`, with mock-ups checked again |
| **Every existing gate keeps passing,** unchanged: the file gate (`TestPlaintextNeverReachesTheDatabase`), the allowlist, the index's event feed, the store's revision chain, the suite conformance test and its pinned twelve failures, the markup gates, and `make browser`'s walk. The new gates are LU1–LU16. They run in `make ci` unless marked "browser". Each guard is mutation-tested, with the mutation and date in the test's comment, as Fichas' gates are today. |
| -- **LU1, the file gate grows.** New canaries, written through the real store and routes: a view name, a filter value, a search saved in a view, a folder name, a type description, an icon slug, a section name, help text, a field's currency, an option label, a multi-select option, a person's address, a linked card's title, a file name, a canary inside a file's bytes and inside its EXIF, a draft's sentence, and money and date values. None may appear in the database, its WAL, the blob directory, **or the temporary directory** (a large multipart upload must not spill there). No blob starts with a PNG or JPEG magic number. |
| +- **LU1, the file gate grows.** New canaries, written through the real store and routes: a view name, a filter value in a saved view, a folder name, a type description, an icon slug, a section name, help text, a field's currency, an option label, a multi-select option, a person's address, a linked card's title, a file name, a canary inside a file's bytes and inside its EXIF, a draft's sentence, and money and date values. None may appear in the database, its WAL, the blob directory, **or the temporary directory** (a large multipart upload must not spill there). No blob starts with a PNG or JPEG magic number. |
| - **LU2, the allowlist and settings.** Every new plaintext column is named with its case; `sealed_settings` and `sealed_payload` are `[]byte` and covered by LU1. Each kind's settings schema refuses an unknown key or value at write (validation, since settings are sealed). |
| - **LU3, events.** Every write in §9 logs in the same transaction, and a write whose event fails does not land (`TestAChangeThatCannotBeLoggedDoesNotLand`, extended). One mutant per new write path drops its event and must be caught. The named exemptions are tested as exemptions. The boot reconciles log with `AppBecause` and a reason. |
| - **LU4, writes that do not cross, and Undo.** |
| - A stale `was` is refused with 409 and writes nothing. A repeated identical write succeeds with no event. An unchanged `1,200` or `€48,000.00` is not a change. Two people editing two fields of one card both land. |
| - The edit form is all or nothing on a conflict. |
| - - Undo restores only fields that still hold the event's after value, names the ones it left, logs with `trigger_id`, and refuses (404) a `created` event, another person's event, an entry, a reconcile's change and an event whose payload was erased. Undo skips a removed file and a retired option, and says so. Redo is the undo of an Undo. |
| + - Undo restores only fields that still hold the event's after value, names the ones it left, logs with `trigger_id`, and refuses (404) a `created` event, another person's event, an entry, a reconcile's change and an event whose payload was erased. Undo skips a removed file and an unknown option id, and says so; it may put back a retired option. Redo names an Undo's event, by the same person. |
| - A view's Undo and Restore follow the same rules. |
| - **LU5, a GET writes nothing.** A logical dump of every table is unchanged across every list layout, every panel state, the caption's links, `POST /t/{type}/preview`, the card beside the list, History, Manage views, the designer's GET steps, and file serving (200, 304 and 404). |
| -- **LU6, the query engine.** For each kind and operator, a property test compares the index's answer with a naive reference over random cards: filters, all and any, a condition naming a removed option or field (no cards under "all"), relative dates in the team's zone, "me", sorts with empty values last and stable ties, exact decimal and money order, groups with multi-valued cards in each group. Dates: date-only against timed values on the same day, inclusive ends, "next N days" across midnight, and the two DST changes in Europe/Dublin. |
| +- **LU6, the query engine.** For each kind and operator, a property test compares the index's answer with a naive reference over random cards: filters, all and any, a retired option still matching, a condition naming an unknown option id or a removed field (no cards under "all"), relative dates in the team's zone, "me", sorts with empty values last and stable ties, exact decimal and money order, groups with multi-valued cards in each group. Dates: date-only against timed values on the same day, inclusive ends, "next N days" across midnight, and the two DST changes in Europe/Dublin. |
| - **LU7, the URL and the log.** `parse(href(s)) = s` over random states. A section present in the URL replaces the view's section whole; `f=none` clears. Unknown keys, unsuited operators and unknown option ids are dropped. Today's parameters redirect to the canonical URL. A state past 4,000 bytes never becomes a URL. **The app's log never contains a query string, a value or a file name:** a test captures the log over a filtered list, a 409 conflict, a 500 (an injected store failure), a 404, a sign-in redirect carrying `return_to`, and an upload, and greps for the canaries. |
| -- **LU8, view scope.** Ana's personal view is invisible to Bo on every view route: the switcher's HTML, Manage views, open (`?v=`, the same status, headers and body as a key that never existed and as a deleted one), save, rename, reorder, delete, history, restore, undo and the scope move. A team view changed by Bo is logged with Bo as actor, and Restore brings back the previous payload. A view made a team view shows no history from before that event to anyone but its owner. Team to personal is refused. A stale save is refused. The type's last team view cannot be deleted. A name may repeat. |
| +- **LU8, view scope.** Ana's personal view is invisible to Bo on every view route: the switcher's HTML, Manage views, open (`?v=`, the same status, headers and body as a key that never existed and as a deleted one), save, rename, reorder, delete, history, restore, undo and the scope move. A team view changed by Bo is logged with Bo as actor, and Restore brings back the previous payload. A view made a team view shows no history from before that event to anyone but its owner, and that scope move cannot be undone or restored past. Team to personal is refused. A stale save is refused. The type's last team view cannot be deleted. A name may repeat. |
| - **LU9, the scriptless floor (browser).** With scripts off, with no console error: edit a cell through the edit form, meet a conflict and resolve it, and Undo; open a card beside the list and follow Next across a page; change the filter, sort, group and columns through the panel's form and save a view; switch views; move a board card with "Move to…"; page the calendar; walk the designer's steps; upload a file and remove it through its confirm page. |
| - **LU10, keyboard and accessibility (browser).** A keyboard-only walk: the grid's keys of §5.6 (typing "Oslo" in a cell edits it and opens nothing), the pickers, the panel opened and closed with focus returned, J and K only in the card pane and the narrowed list, Undo with ⌘Z, a group's toggle, the board's Move to, the calendar's days. A polite live region announces "Saved", the Undo, refusals and "No longer in this view". axe-core finds nothing serious on the table, the panel, the card, the board, the calendar, the designer and the phone sheets. |
| - **LU11, phones (browser, 390 px).** The list of rows, the edit sheet, the panel as a modal sheet that holds focus, the card's own screen with ‹ ›, the board's snap, the agenda; no zoom on tap; touch targets at least 44 px. |
| @@ -905,12 +926,15 @@ Each phase after that is its own branch from `main`, with mock-ups checked again |
| - a deleted card's file, a removed file, a swept file and an unknown id give the same 404, with or without `If-None-Match`, and read no object; |
| - a detached file inside the window is served; |
| - `setFiles`' invariant holds after upload, taking off, Undo, Restore, Remove and `AttachFile`; |
| + - `setFiles` refuses another card's file id, a detached id named by an edit, and a stored file not yet attached; an edit may only reorder or drop; |
| + - the sweep and `AttachFile` racing on one trash row: exactly one wins, and an attached file's object is never deleted; `AttachFile` after the sweep fails with `ErrFileExpired` and writes nothing; `AttachFile` re-checks the quota; |
| + - `/files/{id}/thumb` answers as `/files/{id}` does; |
| - Remove from Fichas bumps the card's revision and drops the file from its S3 text; |
| - - a failure between storing the object and the transaction leaves no orphan (the object is deleted or queued); an unattached `StoreFile` is swept after a day; |
| + - a crash at each point of `StoreFile` and between it and `AttachFile` leaves no orphan object: every stored object has a trash row or an attached file row; an unattached `StoreFile` is swept after a day; |
| - `file_trash` is emptied off the boot path, and a bucket outage never fails boot. |
| - **LU14, the suite contract.** S3's text for every new kind in its fixed forms (§6.7), with no member, card, option or file id in it. Conformance is unchanged. |
| - **LU15, the assistant.** With a fake provider capturing each request, no card value canary is ever sent. The answer's limits hold (5 types, 25 fields, 30 options). It is off with no key. The rate limit holds. Its log line holds no sentence and no answer. |
| -- **LU16, links.** A link value is never printed. A linking card shows a target's rename at once, in its cell, its sort, its group and its search, with no write to the linking card. Deleting a target bumps each linking card's revision in the same transaction, with one event each; S2 then answers `STALE` for the old revision and S3's text leaves the target out. Backlinks follow every change to a link value. A link to a card of the wrong type is refused. |
| +- **LU16, links.** A link value is never printed. A linking card shows a target's rename at once, in its cell, its sort, its group and its search, with no write to the linking card. Deleting a target bumps each linking card's revision in the same transaction, with one event each; S2 then answers `STALE` for the old revision and S3's text leaves the target out. Backlinks follow every change to a link value. A link to a card of the wrong type, or to a gone card, is refused. The delete's bump moves neither `updated_at` nor "Edited by". |
| --- |
| @@ -936,7 +960,7 @@ Each phase after that is its own branch from `main`, with mock-ups checked again |
| - **D13, two named exemptions from "every write logs"**: type drafts and the sweeps (§9). |
| - **D14, Fichas makes thumbnails** where Mapa makes no display copies (F6). |
| - **D15, money is a kind** (Q12), where draft 2 had only Number. |
| -- **D16, numbers are stricter and exact.** Today `writeValues` strips every comma (`1,5` becomes `15`) and the sort compares floats. Both change, with a logged reconcile of stored values (§6.2). |
| +- **D16, numbers are stricter and exact.** Today `writeValues` strips every comma (`1,5` becomes `15`) and the sort compares floats. Both change, with a logged reconcile of stored card values; entry values are immutable and are read tolerantly instead (§6.2). |
| - **D17, a type's icon is sealed,** where draft 2 made it plaintext; and field settings are sealed (§8.1, §10.1). |
| - **D18, choice values are option ids,** not labels, with a logged reconcile of today's values (§6.2). Draft 2's option editing rewrites no cards. |
| - **D19, deleting a card bumps the cards that link to it** (§6.6), a write base §5's deletion rule now needs because links exist. |
| @@ -989,3 +1013,31 @@ Choices made while building, where this spec was silent or the build chose diffe |
| | **L10** A Person pick creates a member row | Listed in the leak list | §10.2 | |
| | **L11** No card restore exists | Dropped from LU16; listed as out of scope | §12, LU16 | |
| | **L12** S3's date format was unstated | Fixed forms for dates and money | §6.7 | |
| + |
| +### Round 2: Fable on revision 2 (`0cb3b09`), APPROVE, folded into revision 3 |
| + |
| +No High. Fable: "The Mediums below are spec text fixes to fold in before the phase they touch; none needs another review round." All are folded in here. |
| + |
| +| Finding | Change | Where | |
| +|---|---|---| |
| +| **M1** The 24-hour trash trick could delete an attached file's bytes if the sweep and `AttachFile` raced; trash-row and `Put` order unstated; the thumbnail had no row | `StoreFile` writes trash rows for the file and its thumbnail, then `Put`s. The sweep claims a row by deleting it before deleting the object. `AttachFile` must remove exactly its rows or fail with `ErrFileExpired`, and re-checks the quota. Ordinary uploads use the same two steps. The trash rows are a named §9 exemption | §7.4, §9, §11, LU13 | |
| +| **M2** The number reconcile would hit immutable `entry_values` and fail boot; no canonical form | Both reconciles touch `card_values` only; entry numbers are read tolerantly. The canonical form is defined; `+5` refused, `.5` accepted | §6.2, D16 | |
| +| **M3** The team zone and exact decimals were used in Phases 2 and 3 but landed in Phase 4 | Both, with the number grammar and its reconcile, move to Phase 2 | §14 | |
| +| **M4** An edit could put another card's, or a detached, file id into a Files field | `setFiles` accepts only ids on this card and field; an edit may only reorder or drop; adding is an upload's attach; re-adding is Undo or Restore | §7.3, LU13 | |
| +| **M5** Retired options against "matches nothing" | A retired option still matches and shows "(retired)"; only an unknown id or a missing field matches nothing. The reconcile makes retired options for stored labels no longer listed, per field in one transaction, with the new shape as its done-marker | §4.4, §6.2, §5.3, LU4, LU6 | |
| +| **M6** No `g=none` or "nothing hidden"; paging a calendar month marked the view Changed | `g=none`, `hide=none`. `month` and `all` are navigation, with `q`, `card`, `page` and `panel`. `href` writes only sections that differ. The teammate rule covers present sections | §4.9, §4.5 | |
| +| **M7** The importer could not add a field to a type it made, and `ModelResult` returned nothing usable | `ImportWriter.AddField`; `ModelResult` maps types, fields and options to keys and ids | §11 | |
| +| **M8** Undoing "made a team view" is team to personal by another name | The scope move is not undoable and cannot be restored past. Gated | §4.8, §9, LU8 | |
| +| **L1** The delete bump moved "Edited"; History said nothing; links to gone cards | The bump moves the revision only; History says "A linked card was deleted"; a link to a gone card is refused | §6.6, LU16 | |
| +| **L2** A removed file's event kept its name | The file's `removed` event has no payload | §9 | |
| +| **L3** Settings sealed under `type.label` | Their own purposes, `type.settings` and `field.settings` | §6.2, §10.1 | |
| +| **L4** Thumbnail decodes weighted by file size | Weighted by width × height × 4 | §7.2 | |
| +| **L5** Redo had no route or flag | `redo` in the payload; Redo names an Undo's event, by the same person | §5.3, LU4 | |
| +| **L6** History of payloads from before a reconcile | Shown as text, with no Restore | §5.5 | |
| +| **L7** What the over-long preview page offers | Its form posts to itself; Save posts the state; no caption links, paging or card links | §4.9 | |
| +| **L8** Scriptless upload inside the edit form; thumb route rules; detached files and quota | Upload is its own multipart form; `/thumb` follows `/files/{id}`; detached files count until swept | §7.4, §7.5 | |
| +| **L9** Phase 2 listed too few gates | LU1, LU3, LU5, LU9 and LU10 extended to views | §14 | |
| +| **L10** `SeedViews` would make views for entry types | Card types only | §4.3 | |
| +| **L11** Multi-select order could fake a conflict | Normalised to option order when written, read and compared | §6.1 | |
| +| **L12** A Notion select past 200 options | Becomes Text, reported | §11 | |
| +| **L13** Stale text | The URL example uses option ids; "or made personal" and `AddFile` are gone; LU1's canary is a filter value in a saved view | §4.3, §4.9, §7.3, §11, LU1 | |