Fichas level-up spec, revision 2: answer Fable's round 1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+299
−122
docs/superpowers/specs/2026-11-17-fichas-level-up.md+299 −122
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 d2e5859..aafd585 100644 |
| --- a/docs/superpowers/specs/2026-11-17-fichas-level-up.md |
| +++ b/docs/superpowers/specs/2026-11-17-fichas-level-up.md |
| @@ -1,6 +1,7 @@ |
| # Fichas level-up: Escritorio, with Expediente's sentence and Rejilla's cell keys |
| -**Status:** revision 1, 2026-11-17. For review. Nothing is built. |
| +**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. |
| - §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". |
| @@ -69,7 +70,8 @@ The estilo bar stack, as Mapa uses it (Mapa level-up §3.1). Fichas' slots: |
| ### 3.2 Rail |
| - **R1:** the rail stays. Its rows keep today's grid: a 16px icon column and the label on one centre line (`TestRailIconsSitOnTheTextsCentreLine`). |
| -- **R2, folders:** each type is in at most one folder. A type with no folder sits above the folders. A folder heading is a `<details>`, so it collapses with no script. Its open state is a per-person cookie, as density is. The folder holding the current type is always open. |
| +- **R2, folders:** each type is in at most one folder. A type with no folder sits above the folders. A folder heading is a `<details>`, so it collapses with no script. Which folders are closed is one per-person cookie (`fichas-rail`, the closed folders' opaque keys), as density is. The folder holding the current type is always open. |
| +- **Cookies stay few:** one for the rail (fold and closed folders), one for the panel, one for density, and one (`fichas-views`) mapping each type's key to the view last used, capped at 30 types, oldest dropped. Every one holds opaque keys or this app's words only. |
| - **Each type has its icon** (§8.1) and its card count, as the mock-ups show. |
| - **New type** is a quieter row below a rule. |
| - **⌘\ folds the rail** to icons, and back. The fold is two submit buttons, one per state, and CSS shows the one that fits (Mapa build note 10). `POST /view/rail` sets a cookie, writes no row, logs no event, and returns only to a local path. |
| @@ -123,7 +125,8 @@ In the header's lead slot: the current view's name, its scope ("Team", or a lock |
| - **Team views**, each with its layout icon, in the team's order. |
| - **Only you**, the person's own views, by name. |
| - **Save what you see as a new view:** a name, and "Who sees it": *Everyone in <team>* ("A team view. Anyone can use it; changes are saved for everyone.") or *Only you* ("Your own view. Nobody else sees it, or that it exists."). Cancel and Save view. |
| -- **Manage views…**, a page (`/t/{type}/views`) to rename, reorder (Move up and Move down buttons), delete (its own confirm page), and see each team view's history with Restore (§4.8). |
| +- **Manage views…**, a page (`/t/{type}/views`) to rename, reorder (Move up and Move down buttons), delete (its own confirm page), and see each view's history with Restore (§4.8). |
| +- **Names need not be unique,** across scopes or within one. A refusal for a taken name would tell Bo that a personal view of that name exists. |
| With scripts off the switcher is a `<details>` menu of links, and Save as new is its own page. |
| @@ -141,9 +144,14 @@ 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.** The migration that adds views (§10.1) makes "All <plural>" for each type from today's defaults: table, every column, no filter, newest first. It can be changed but not deleted. |
| +**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")`. |
| +- **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. |
| -**Which view opens at `/t/{type}`:** the last one this person used for the type, from a cookie holding the view's opaque key, or else the first team view. A key that no longer resolves for this reader falls back without saying why. |
| +**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. |
| +- **At `/t/{type}?v=<key>`:** that view, or the app's ordinary 404 if it does not resolve for this reader. The 404 is byte for byte the same whether the key never existed, was deleted, or names someone else's personal view (LU8). |
| ### 4.4 Filter on any field |
| @@ -151,7 +159,8 @@ A saved view is one card type's: |
| - **One level: all or any.** The conditions are joined by "and" ("Match all") or by "or" ("Match any"), one switch for the view. "Is any of" covers most "or" within one field. Nested groups are out (§12; D3). |
| - **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. |
| -- **A condition on a field that no longer exists,** or on an option that was removed, is dropped when the view is drawn. The panel says "1 condition was left out: its field was removed". |
| +- **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. |
| - **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. |
| @@ -163,8 +172,10 @@ The seal tiers do not limit any of this. The list runs on the in-memory index, w |
| - **Group by** a Choice, Multi-select, Person, Checkbox, Link, or a date (by day, week, month or year), or Created, Edited or Created by. |
| - Groups follow the Choice's option order; other groups sort A–Z; "No <field>" comes last. |
| - A card with several values (multi-select, a link to several) appears **in each of its groups**. Group counts then add up to more than the total, and the foot says so: "7 customers, some in more than one group". |
| - - A group heading is a `<details>` with its count. It collapses with no script. |
| -- **Paging stays 100 cards a page.** A group that crosses a page boundary repeats its heading, marked "continued". |
| + - **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. |
| ### 4.6 Columns |
| @@ -187,13 +198,17 @@ The seal tiers do not limit any of this. The list runs on the in-memory index, w |
| - **A team view** is the team's. **Anyone admitted may change, rename, reorder or delete it.** |
| - Each change is one event naming the person, with the before and after payload sealed (§9). |
| - - The Save toast offers **Undo** for 10 seconds. |
| - - **Manage views…** shows each team view's history ("Niamh changed the filter, 2 hours ago") with **Restore** inside the value window (base §5). Restore is a new change, logged, never a rewind. |
| + - The Save toast offers **Undo** for 10 seconds: `POST /t/{type}/views/{key}/undo` with the event id, checked as a card Undo is (§5.3). |
| + - **Manage views…** shows each team view's history ("Niamh changed the filter, 2 hours ago") with **Restore** inside the value window (base §5), with no timer. Restore is a new change, logged, never a rewind. |
| + - **A deleted team view** is listed under "Deleted views" on Manage views, with Restore, for the value window. |
| - **A personal view** is its owner's. |
| - - Nobody else can list, open or learn that it exists. Another person asking for its key gets the app's ordinary 404, byte for byte the same as a key that never existed (gate LU8). |
| + - Nobody else can list, open or learn that it exists (§4.3's 404, gate LU8). |
| - Its events name its owner. The event log is plaintext, so the file (never the app) shows that a person has personal views and when they changed (§10.2). |
| - **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. |
| -- **Make a personal view a team view**, and back, from Manage views. Each is logged. Making a team view personal is refused while it is the type's only team view. |
| +- **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. |
| + - **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. |
| ### 4.9 The URL (Q4) |
| @@ -205,15 +220,33 @@ The seal tiers do not limit any of this. The list runs on the in-memory index, w |
| &m=any&f0=<field key>&o0=any&x0=Lead&x0=Contacted |
| &s=<field key>&s=-<field key>&g=<field key>&gb=week |
| &cols=<key>:228,<key>:124&hide=<key>&frz=1 |
| - &bf=<field key>&cf=<field key>&month=2026-11 |
| + &bf=<field key>&be=1&cf=<field key>&month=2026-11 |
| &q=<search>&card=<card id>&page=2 |
| ``` |
| -- **Keys are opaque** (`f_` and hex, `v_` and hex). 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. |
| +- **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. |
| +- **Values, by kind:** |
| + |
| +| Kind | `xN` holds | |
| +|---|---| |
| +| Text, long text, URL, email, phone | the text | |
| +| Number, money | the canonical decimal (§6.2); money in minor units | |
| +| Date | `2026-11-20`, or `2026-11-20T14:30` in the team's zone; relative tokens `@today`, `@this-week`, `@next-7d` and the like | |
| +| `between` | two `xN`, low then high | |
| +| Choice, multi-select | option ids (`o_…`) | |
| +| Checkbox | no value; the operator says ticked or not | |
| +| Person, Created by, Edited by | member ids, or `@me` | |
| +| Link to… | card ids | |
| + |
| +- **`panel=1`** opens the panel on the server, for the caption's links and the scriptless form. It is not part of the view and never makes it "Changed". |
| +- **Today's parameters keep working** by redirect (302) to the canonical URL: `view=cards` to `layout=cards`, `sort` and `dir` to `s`, and a choice field's `<key>=<label>` to a condition on that option's id. |
| - **The URL is canonical:** parameters in a fixed order, so the same state is always the same link (`listState.href` today). `parse(href(s)) = s` is a gate (LU7). |
| - **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 not drawn as a URL. The page says "This view is too long to keep in the address. Save it as a view to keep it." |
| +- **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. |
| - **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 |
| @@ -224,8 +257,8 @@ Expediente's sentence, as the caption over the table, the board and the calendar |
| - Values join as "Lead, Contacted or Proposal" for "is any of", and "Pilot and Grant-funded" for "has all of". |
| - "Match any" joins conditions with "or". |
| - Sort phrases follow the kind: "soonest Next action first", "highest Value first", "A to Z by Name", "newest first". |
| - - With no filter: "All 10 customers, newest first." |
| -- **Every field, operator and value is a link** to the same URL with the panel open at that control (`#panel-filter-0` and the panel cookie set by a POST on click with script, or the `panel=1` parameter without it). With script, clicking it opens the panel and focuses the control. |
| + - With no filter: "All 10 customers, most recently edited first." |
| +- **Every field, operator and value is a link** to the same URL with `panel=1` and a fragment naming the control (`#panel-filter-0`). With script, clicking it opens the panel in place and focuses the control. |
| - **It is built on the server** by one function, `describeView(state) []Span`, with golden tests for every operator and kind. Its copy goes through the copy-review skill. |
| - **Past three conditions** the sentence wraps; it is never cut. The mock-up round named this as Expediente's weakness, and as a caption, not the control, it can afford to be long. |
| - **On the phone** it sits under the switcher, as the mock-up shows. |
| @@ -249,22 +282,29 @@ Expediente's sentence, as the caption over the table, the board and the calendar |
| - The header's lead slot says "Saving…", then "Saved". |
| - A toast says "Stage changed to Won. Undo", for 10 seconds. |
| - **A refused value** (a bad email, a number that is not a number, an empty title) stays in the editor with the message beside it (`FormError`, today's wording). Nothing is written. |
| +- **An edit that takes a card out of the view** (Stage set to Won under "Stage is Lead", or a new value in the sorted column) does not move or hide the row at once. The row stays where it is, marked "No longer in this view" (a word and an icon, never colour alone), and focus stays on its cell. The next navigation, or the view's Refresh link, redraws the list. |
| - **Entries do not edit.** A call log is a fact about a past moment (base §3). Click to edit applies to cards only. |
| ### 5.2 Writes that do not cross |
| -**Each field write carries what the editor saw** (`was`), and the store compares it inside the transaction. |
| +**Each field write carries what the editor saw** (`was`), and the store compares it inside the transaction, as `SetField(ctx, actor, cardID, key, value, was)`. |
| -- If the field still holds `was`, the write lands. |
| -- If it does not, it is refused with 409, and the editor says "Niamh changed this to Contacted a moment ago", with **Keep theirs** and **Use mine**. Use mine is a second POST with the new `was`. |
| +- **`was` is the canonical stored form**, as the server rendered it into the editor: `1200`, never `1,200`; money in minor units; option ids; a date as stored. The submitted value is normalised first (§6.2), then compared. |
| +- **In order, inside the transaction:** |
| + 1. If the field already holds the normalised new value, the write **succeeds with no event**. So a Retry after a lost response, or a second tab making the same change, is not a conflict. |
| + 2. If the field holds `was`, the write lands: one `updated` event, one new revision. |
| + 3. Otherwise it is refused with 409, and the editor says "Niamh changed this to Contacted a moment ago", with **Keep theirs** and **Use mine**. Use mine is a second POST with the current value as `was`. |
| - Two people editing different fields of one card never collide. |
| -- This is why there is no whole-card save with script: a form that sends every field overwrites a teammate's change it never saw. The scriptless edit form (§5.7) sends `was` for every field it shows and changes only the fields that differ from it. |
| +- **The scriptless edit form** sends `was` for every field it shows and changes only the fields whose submitted value differs from its `was`. **It is all or nothing:** if any changed field conflicts, nothing is written, and the form comes back (409) with each conflicting field showing theirs and mine, as two radio buttons, and one Save. A field that did not conflict keeps what was typed. |
| +- This is why there is no whole-card save with script: a form that sends every field overwrites a teammate's change it never saw. |
| ### 5.3 Undo |
| - **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." |
| - - The new event is `updated`, by the person, with `trigger_id` naming the undone event. |
| + - 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. |
| - 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. |
| @@ -275,7 +315,10 @@ Expediente's sentence, as the caption over the table, the board and the calendar |
| - **The name opens the card in a pane** beside the list: `?card=<id>` in the list's URL, so it is a link, bookmarkable, and works with scripts off. |
| - **The list narrows** to a column of rows (title, status pill, one face field), with the view's name and count at its top and a back arrow that closes the card. |
| - **The pane** shows the card's title, its type, "Edited by Niamh 2 days ago", "2 of 7 in Open pipeline", its fields in sections (§8.2, step 3), then the call log, notes, files, and **Linked here** (§6.6). |
| -- **J and K** move to the next and previous card in the list's order, when focus is not in an input. The pane's top has **Next** and **Previous** links, with `rel="next"` and `rel="prev"`, which the keys follow. So the keys work as links, and the links work with no script. |
| +- **J and K** move to the next and previous card in the list's order. They act **only while focus is in the card pane or the narrowed list, and not in an input**. They are inert in the table's grid, where a printable key starts an edit, and everywhere else. That keeps them inside WCAG 2.1.4's "active only when that component has focus". |
| +- **The pane's top has Next and Previous links**, with `rel="next"` and `rel="prev"`, which the keys follow. So the keys work as links, and the links work with no script. |
| + - The server computes them from the whole ordered list, not the page, so Next from the 100th card is the 101st, and the narrowed list moves to its page. |
| + - **A card not in the list** (`?card=` from a bookmark, or a card the person just edited out of the view) is shown with "Not in this view" in place of "2 of 7", and no Next or Previous. |
| - **Full page** opens `/cards/{id}`, as today. **Close** (✕ or Esc) returns to the list. |
| - **The list keeps its scroll** and the open card's row is marked (`aria-current="true"`, a left rule, and its background). |
| @@ -306,7 +349,7 @@ With script, the table is one tab stop: an ARIA `grid` with a roving `tabindex`. |
| | Delete, Backspace | clear the value (with Undo) | |
| | ⌘C | copy the cell's text | |
| | ⌘V | paste text into the cell, parsed by its kind; a Choice must match an option | |
| -| O, or Enter on the name | open the card beside the list | |
| +| Enter on the name | open the card beside the list (the name is not edited in the grid, D1) | |
| | ⌘Z, ⌘⇧Z | undo, redo (§5.3) | |
| - **Pasting a range of cells** is out (§12). |
| @@ -342,32 +385,48 @@ With script, the table is one tab stop: an ARIA `grid` with a roving `tabindex`. |
| | Number | yes | a format (§6.2) | a canonical decimal string: `-1200.5` | |
| | **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 | the option's label | |
| -| **Multi-select** | — | new | a JSON array of option labels, in option order | |
| +| 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 | |
| | **Checkbox** | — | new | `1`, or no value | |
| | **Person** | — | new | a JSON array of member ids | |
| | Web address, Email, Phone | yes | — | as today | |
| | **Link to…** | — | new (type designer slice D) | a JSON array of card ids | |
| | **Files** | — | new (§7) | a JSON array of file public ids | |
| -**Built-ins, shown as columns and filterable:** Created and Edited (`cards.created_at`, `updated_at`), Created by (`cards.owner_id`), Edited by (the actor of the card's last event), and Last call (today's derived column). |
| +**Built-ins, shown as columns and filterable:** |
| +- **Created** and **Edited** (`cards.created_at`, `updated_at`); |
| +- **Created by** (`cards.owner_id`, provenance); |
| +- **Edited by**: the actor of the card's last `created` or `updated` event **made by a person**. An app-actor event (a reconcile, a kind upgrade) and an `entry_added` do not count; a card no person has edited shows its creator; |
| +- **Last call** (today's derived column). |
| **A field's kind still never changes** once it exists (`UpdateField`, base §4). Kinds that only widen are settings, not kinds: a date gaining an end or a time, a person or link field going from one to several. |
| ### 6.2 Kind settings |
| -`field_defs.settings` is a small JSON object of **this app's words only** (§10.1). Each kind has a closed schema; anything else is refused at write, and a gate fuzzes it (LU2). |
| +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. |
| - **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%. |
| -- **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. A value with more decimal places than the currency allows is refused, never rounded. |
| +- **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. |
| +- **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. |
| - **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." |
| - - A timed value is stored as an instant with its offset, entered and shown in the team's zone, with the zone named in the picker. A date-only value is a calendar date. |
| - - An end is never before its start. Start and end are both dates, or both times. |
| + - **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. |
| + - A timed value is stored as an instant with its offset (`2026-11-20T14:30+00:00`), entered and shown in the team's zone, with the zone named in the picker. A date-only value is a calendar date. |
| + - **A date-only value means the whole local day.** For sorting it is the start of that day in the team's zone, and on a tie it comes before a timed value of the same day. "Is today", "this week" and grouping by day use the local day the instant falls in. |
| + - **An end is inclusive,** as Notion's is: 20 to 22 November covers three days. An end is never before its start. Start and end are both dates, or both times. |
| - Sorting and filtering use the start. "Is on or overlaps" is the calendar's test. |
| -- **Choice and Multi-select:** options with tones live in `sealed_options` (they are the team's words). Renaming an option in the fields editor rewrites every card that holds it, in one transaction, one event per card, as `upgradeKind` does today. Removing an option leaves cards that hold it showing it, as today. |
| + - **"The next N days" includes today;** "the last N days" includes today too. "This week" runs Monday to Sunday. |
| +- **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. |
| + - 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. |
| - **Files:** `images_only` (true or false). |
| @@ -421,19 +480,32 @@ The Find box matches every value that **shows as text**: option labels, person n |
| ### 6.6 Links between cards |
| -Type designer §3, unchanged except as stated: |
| +Type designer §3, with these changes: |
| - **The value** is the target card ids, sealed, never printed. |
| -- **The index** resolves each id to the target's title and builds backlinks from the event feed. |
| +- **The index holds ids, never copied titles.** A linking card's displayed titles, its sort key ("by first linked title"), its group and the link part of its search text are resolved **when a list is drawn**, from the live target in the index. So a target's rename or deletion shows everywhere at once, and nothing in the index goes stale. |
| + - The reverse map (backlinks) is derived: when `Sync` reloads a card, it removes that card's old link ids from the map and adds its new ones. |
| + - 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. |
| -- **A deleted target** is soft-deleted, as every card is. The link stays and shows "deleted card". Nothing cascades. |
| +- **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`. |
| + - 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. |
| ### 6.7 What the suite contract sees |
| -S3 (base §6.4) renders each new kind as text: money with its currency ("€48,000.00"), dates with their end and time, a checkbox as "Yes" (and an empty one as nothing), multi-select labels joined by ", ", people by name or address, links by the targets' titles, and files by name. No bytes, no file id and no member id reach a sibling. |
| +S3 (base §6.4) renders each new kind as text: |
| +- money with its currency, in a fixed form: `EUR 48000.00`; |
| +- dates in a fixed form, independent of the reader: `2026-11-20`, `2026-11-20 14:30 Europe/Dublin`, and a range as `2026-11-20 – 2026-11-22`. The text never depends on who asks or where. (Renames are the one way a revision's text changes, as field renames already do: base §10.); |
| +- a checkbox as `Yes`, and an unticked one as nothing; |
| +- multi-select labels joined by `, `, retired options included; |
| +- people by roster name, or by address in the lone shape; |
| +- links by the live targets' titles, **leaving out a gone target entirely**; |
| +- files by name. |
| -A linked card's title changing does not move the linking card's revision, so memoria's copy keeps the old title until the linking card next changes. It is base §10's field-rename item again, and it stays open there. |
| +No bytes, no file id, no option id and no member or card id reach a sibling. |
| --- |
| @@ -461,11 +533,15 @@ Mapa images' decisions, reused for Fichas files. Where Mapa's spec decides, this |
| - **Serving:** `nosniff`, `default-src 'none'; sandbox`, `Cross-Origin-Resource-Policy: same-origin`, `Cache-Control: private, max-age=3600, immutable`, `ETag` from the public id (Mapa images §1.4). |
| - An allowlisted image is `inline`, with its sniffed type. |
| - Anything else is `attachment`, with `application/octet-stream` and the sealed file name in an RFC 5987 `filename*`. |
| -- **Thumbnails:** made only for inline images up to 4,096 px on the long side, decoded once in pure Go (`image/*` and `golang.org/x/image/webp`), scaled to 320 px on the long side, and encoded as JPEG or, for images with transparency, PNG. |
| +- **Thumbnails are made once, at upload,** never on a GET. Only for inline images up to 4,096 px on the long side: decoded in pure Go (`image/*` and `golang.org/x/image/webp`), scaled to 320 px on the long side, encoded as JPEG or, for images with transparency, PNG, then sealed and stored. |
| - A decode semaphore admits **one** decode at a time. A 4,096 × 4,096 PNG is about 64 MiB unpacked. The figure is measured on the instance at build time and recorded in the build notes. |
| + - **A thumbnail that fails** (a decode error, the semaphore's wait) leaves `thumb_key` empty, and the file shows its type icon. It never fails the upload. |
| - With script, a JPEG over 4,096 px is scaled to 4,096 px in the browser before upload, as Mapa does. So phone photos get previews. |
| - Larger images, and every other file, show a type icon. |
| -- **The blob semaphore** (Mapa images §1.4) covers every upload, serve and thumbnail. It admits two at a time at 25 MiB (a body, its sealed copy and its opened copy, about 75 MiB each). Waiters queue; a wait past 10 s answers 503 with `Retry-After`. |
| +- **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. |
| ### 7.3 The `files` table |
| @@ -476,13 +552,15 @@ Mapa images' decisions, reused for Fichas files. Where Mapa's spec decides, this |
| | `card_id`, `field_def_id` | yes | where it is; structural (base §4.1 case 2). Scope is "the card is not gone" | |
| | `owner_id` | yes | who uploaded it. Member id, provenance, as `cards.owner_id` | |
| | `created_at` | yes | ordering and retention | |
| -| `detached_at` (nullable) | yes | when it was taken off the card. Retention runs over it | |
| +| `detached_at` (nullable) | yes | when it was taken off its card's field. Retention runs over it | |
| | `stored_bytes` | yes | the ciphertext's size, padded to 64 KiB, for the quota | |
| | `object_key`, `thumb_key` | yes | bucket keys: hashes of ciphertext | |
| | `sealed_record` | sealed | the file name, the sniffed type, the true size, and an image's width and height | |
| `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). |
| + |
| ### 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. |
| @@ -491,17 +569,24 @@ Mapa images' decisions, reused for Fichas files. Where Mapa's spec decides, this |
| - 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. |
| -- **Taking a file off a card** is a field edit (§5.1): the value loses its id, `detached_at` is stamped, the event is logged, and Undo puts it back. |
| -- **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 write deletes the row, queues the object, and logs `removed` on the file. The bytes go straight after. |
| -- **A deleted card's files** answer 404 while it is deleted. Cards are never hard-deleted today (`TestACardCannotBeHardDeleted`), so they are kept with it. |
| +- **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); |
| + - deletes the row, queues the object in `file_trash`, and logs `removed` on the file. |
| + The bytes go straight after the transaction. Undo and Restore can never bring a removed file back: they skip an id with no row, and say so (§5.3). |
| +- **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. |
| + - **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. |
| -- **The value window is not built yet.** Until it is, detached files are kept, and only Remove from Fichas deletes bytes. Q11 proposes the window. |
| +- **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." |
| -- **CARLOS:** Fichas has no store today. The setup is Mapa images §8's, with `--app fichas`: read the plan first, refuse a plan that forces scanning onto ciphertext, `store create`, check `scan status`, restart, `curl /api/version`. Paul runs it, or the agent with his say-so, after Phase 6 is deployed. Until then upload answers 503 (F4). |
| +- **CARLOS:** Fichas has no store today. The setup is Mapa images §8's, with `--app fichas`: read the plan first, refuse a plan that forces scanning onto ciphertext, `store create`, check `scan status`, restart, `curl /api/version`. Paul runs it, or the agent with his say-so, after Phase 5 is deployed. Until then upload answers 503 (F4). |
| --- |
| @@ -511,7 +596,9 @@ Draft 2 on `origin/design/type-designer` is the design. This section records wha |
| ### 8.1 Folders and icons (slice A) |
| -As draft 2 §1: `type_groups`, `card_types.group_id` and `card_types.icon` (a slug from a curated list of about 40), the rail of §3.2, and `/groups` to rename, reorder and delete, each change logged. |
| +As draft 2 §1: `type_groups`, `card_types.group_id`, an icon per type (a slug from a curated list of about 40), the rail of §3.2, and `/groups` to rename, reorder and delete, each change logged. |
| + |
| +**One change: the icon is sealed.** Draft 2 made `card_types.icon` plaintext because it is "our own list". But an icon chosen for a type says what the type is about (a stethoscope, a gavel), which is the vocabulary base §4.3 keeps out of the file, and nothing needs it from SQL: the rail is drawn from the index. So the icon, the type's description, its sections and its status field live in **`card_types.sealed_settings`** (§10.1). |
| ### 8.2 The steps (slices B and C) |
| @@ -519,7 +606,7 @@ As draft 2 §2, at its URLs, every step a server-rendered page with its own URL, |
| 1. **Start:** Describe it (when the assistant is configured), a template, or blank. |
| 2. **Name and look:** singular and plural, icon, folder, a one-line description. |
| -3. **Fields:** one editable list. Each row: label, kind, required, help text, and the kind's settings (§6.2). Sections between rows. Add, Remove, Move up and Move down are submit buttons. |
| +3. **Fields:** one editable list. Each row: label, kind, required, help text, and the kind's settings (§6.2). Sections between rows. Add, Remove, Move up and Move down are submit buttons. **Remove is for draft fields only** (below). |
| 4. **Status and card:** the status field, the card face, and the default sort, which becomes the type's first team view (§4.3). |
| 5. **Review and create:** one transaction, every row logged. |
| @@ -527,20 +614,23 @@ As draft 2 §2, at its URLs, every step a server-rendered page with its own URL, |
| - **The kinds list** is §6.1's: Text, Long text, Number, Money, Date, Choice, Multi-select, Checkbox, Person, Email, Phone, Web address, Link to…, Files. |
| - **The preview panel** in the mock-up ("What this makes") is the `[estilo-float]` panel, showing a sample row, the other types the draft also makes, and its fields. |
| - **Step 4's default sort** makes the type's "All <plural>" team view, rather than a setting on the type. |
| -- **Step 3 on a live type** (draft 2's "Afterwards") is the same editor. Kinds still never change. |
| +- **Step 3 on a live type** (draft 2's "Afterwards") is the same editor. Kinds still never change, and **a live field cannot be removed** in this level-up. Today's code has no field removal (`schema.go` has `AddField` and `UpdateField` only), and removing one needs its own design: its values, the views and URLs that name it, the files in a Files field, backlinks, and S3. It is listed in §12. A live field can be moved, renamed, and hidden from every view. |
| +- **The store's limits for a model**, whoever makes it (the designer, a template, the importer): at most 20 types, 100 fields a type, and 200 options a Choice. Today's `maxOptions` of 50 rises to 200 for every Choice. The assistant's tighter limits (5 types, 25 fields, 30 options; draft 2 §4) bind the assistant only. |
| ### 8.3 Templates (R4) |
| | Template | Fields | |
| |---|---| |
| | **People** | Name (title, print), Email (print), Phone (print), Role (text), Notes (long text) | |
| -| **Organisations** | Name (title, print), Web address (print), Email (print), Phone (print), Stage (Choice), Next action (Date), Notes (long text), **People** (Link to People, several). Made together with People | |
| +| **Organisations** | Name (title, print), Web address (print), Email (print), Phone (print), Stage (Choice), Next action (Date), Notes (long text), **People** (Link to the seeded People type, `t_person`, several) | |
| | **Projects** | Name (title, print), Status (Choice: Idea, Planned, Active, Done, Dropped), Owner (Person), Start (Date), Due (Date), Notes | |
| | **Products** | Name (title, print), Status (Choice: Idea, Designing, Building, Launched, Retired), Category (Choice), Price (Money, EUR), Launch date (Date), Notes | |
| | **Applications** | Applicant (title, print), Email (print), Programme (Choice), Status (Choice: Received, Reviewing, Shortlisted, Accepted, Declined), Received (Date), Files (Files), Notes | |
| Every field takes its kind's default tier (`DefaultTier`). No template field is plaintext. |
| +**People is seeded** (§8.4, R5), so R4's People template is met by the seeded type: Start shows it as "People: already here", linking to it, and Organisations links to it rather than making a second People type. Templates use Link, Person, Money and Files, which is why the designer comes after the new kinds and files (§14). |
| + |
| ### 8.4 Customer gains Contacts (R5) |
| - **A seeded People type** (`t_person`), with the People template's fields and tiers. Seeded types enter the catalogue only with a per-field tier review (base §4.4); the review is the table above. |
| @@ -562,25 +652,32 @@ As draft 2 §4: DeepSeek V4 Flash on TensorX through Slides' client, the sentenc |
| | Write | object_kind | kind | ChangedFields | Payload (sealed) | |
| |---|---|---|---|---| |
| -| A field edit (cell, card, board move, calendar move) | `card` | `updated` | the field | before and after | |
| -| Undo, Restore this value | `card` | `updated`, `trigger_id` = the undone event | the fields | before and after | |
| +| A field edit (cell, card, board move, calendar move) | `card` | `updated` | the field | before, after, `undoable` | |
| +| Undo, Redo, Restore this value | `card` | `updated`, `trigger_id` = the undone event | the fields | before and after | |
| | New target from a link picker | `card` | `created`, then `updated` on the linking card | — / the field | values | |
| -| File added, taken off | `card` | `updated` | the field | before and after ids, and `file_added` or `file_detached` | |
| -| File removed now | `file` | `removed` | — | the file's name | |
| -| Option renamed (rewrites cards) | `field` `updated`, then `card` `updated` per card | | the field | before and after | |
| -| View created, changed, renamed, reordered, moved between scopes, deleted, restored | `view` | `created`, `updated`, `deleted` | — | before and after payload | |
| +| 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 | |
| +| 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 | |
| | 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 | |
| | Field settings and help | `field` | `updated` | — | before and after | |
| -| A draft made by the assistant | `type` | `drafted` | — | none; the actor and that it happened | |
| +| A draft made by the assistant | `draft`, object id 0 | `drafted` | — | none: the actor and that it happened | |
| - **The suite feed** (S1) is unchanged: it reads `object_kind = card` events only. New object kinds are not items. |
| +- **The index's feed** (`Index.Sync`) learns the new object kinds by name. Today any event that is not a card or an entry rebuilds the whole index under its write lock (`index.go`, the `default:` branch), which would make every view save cost a cold load. So: |
| + - `view`, `file` and `draft` events change nothing the index holds, and are skipped; |
| + - `group` and `type` settings events reload that type's metadata (label, icon, folder), not its cards; |
| + - `field` events reload that one type (labels, options, settings); |
| + - a kind the switch does not name still rebuilds everything, as the safe default, and a test fails if any kind this level-up writes reaches it (LU12). |
| - **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 sweep** (detached files past the window, `file_trash`, expired drafts) logs nothing. It removes only what nobody can still reach, and an event would have to name Fichas as the actor. |
| - - **Preference cookies** (density, panel, rail, folder state, last view) write no row. |
| -- **Every event names its real actor** (ruling 9). An edit is the person's. Nothing here is written by Fichas as itself. |
| + - **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. |
| + - **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. |
| --- |
| @@ -591,14 +688,14 @@ 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`, `icon`, `status_key` | `sealed_description`, `sealed_sections` | 2, 4 | |
| -| `field_defs` (new columns) | `settings`, `required` | `sealed_help` (and options gain tones inside `sealed_options`) | 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` | — | |
| | `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 | |
| | `file_trash` | `object_key`, `queued_at` | — | 2 | |
| -- **`field_defs.settings` is this app's words only:** format names, ISO currency codes, booleans, place counts and an opaque target type key. A closed schema per kind refuses anything else at write, so a team's words cannot reach it (LU2). It says, without the key, that a field is money in euros, or that one type links to another. |
| +- **Settings are sealed, not plaintext.** Revision 1 of this spec made them plaintext under case 4, but nothing reads them by SQL: the index unseals them at wake. Plaintext would have said, without the key, that a field is money in euros, or that one type links to another, which is the kind of vocabulary base §4.3 keeps out. Their closed schemas are validation now, not a leak barrier. |
| - **A view's name, filters, values, sorts and columns are all in its sealed payload.** Only its type, scope, owner and order are plaintext, as type drafts are. |
| - **Every new value kind is sealed in `card_values`** under `field.value`, as today. Person and Link values are member and card ids **inside the seal**, never plaintext foreign keys, so the file does not show who is assigned what or which cards link. |
| - **`TestNoPlaintextColumnEscapesTheAllowlist`** names every new plaintext column with its case. The file gate's canaries grow (LU1). |
| @@ -607,8 +704,8 @@ As draft 2 §4: DeepSeek V4 Flash on TensorX through Slides' client, the sentenc |
| To be added to the leak list in the README: |
| - the number of saved views per type, which are personal, whose they are, and when each changed; |
| -- the number of folders and which types are in each; each type's icon; |
| -- each field's settings: that a field is money and in which currency, that a date takes times or ends, that a link points at a given type, that a person or link field holds several; |
| +- the number of folders and which types are in each; |
| +- a `members` row for each person picked in a Person field, as a print and a sealed address, even if they have never signed in. Today a row exists only for someone who has written. It says the instance knows of that address, not which card names them; |
| - the number of files on each card and in each field, who uploaded each, when, when it was taken off, and its size to within 64 KiB; |
| - that a person has drafts in progress, and when. |
| @@ -616,11 +713,12 @@ To be added to the leak list in the README: |
| - **Filter values and searches in URLs** (Q4): in the browser's history and address bar, in links people share, and in CARLOS' edge logs if they record query strings. Never in the app's own log. |
| - **TensorX** receives the sentence and the type and field labels for each Describe it call (R6, draft 2 §4). TensorX is zero data retention and treated as local (2026-09-19). |
| - **CARLOS' bucket** holds padded ciphertext and its sizes (§7). |
| +- **The app's own log** never records a query string, a file name or a value (LU7). |
| ### 10.3 The in-memory index |
| -- **It holds every new kind unsealed,** as it holds today's: options, people's display names, linked titles and backlinks, and file records (never bytes). |
| -- **It is still fed only by the event log.** Every write above logs, so the index never needs telling. |
| +- **It holds every new kind unsealed,** as it holds today's: options, people's display names, link ids and the backlink map, settings, and file records (never bytes). Linked titles are read from the targets when a list is drawn (§6.6), never copied. |
| +- **It is still fed only by the event log.** Every write above logs, and §9 says what each kind of event reloads. |
| - **Saved views are not in the index.** A list request reads and unseals the one view it draws, and the switcher's list of names. |
| - **The cost:** base §4.2's trigger stands. At today's measure (5,000 customers and 10,000 calls: 225 ms cold, 0.37 ms a search), adding backlinks and person names is small. LU12 measures a filtered, sorted, grouped query at 5,000 cards and fails past 20 ms warm. |
| @@ -634,7 +732,7 @@ The importer's §17 sketches phase 2. This level-up gives it each thing it asks |
| |---|---|---| |
| | `title` | the title field | — | |
| | `rich_text` | Text, or Long text over one line | — | |
| -| `number` | Number with Notion's format; a currency format becomes **Money** in that currency | the sketch left format open | |
| +| `number` | Number with Notion's format; a currency format becomes **Money** in that currency. If any row holds more decimal places than the currency allows, the field falls back to Number with `decimals`, and the report says so | the sketch left format open | |
| | `select` | Choice, colours as tones | — | |
| | `status` | Choice, marked as the type's status | — | |
| | `multi_select` | **Multi-select** | was Text | |
| @@ -645,7 +743,8 @@ The importer's §17 sketches phase 2. This level-up gives it each thing it asks |
| | `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 | |
| | `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`, `created_by`, `last_edited_time`, `last_edited_by` | the import's event payload, sealed: Notion's times and names kept as history, as Mapa's import does | — | |
| +| `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 | |
| | `unique_id` | Text, print, so Notion's numbers survive | — | |
| | `button`, `verification`, `place` | not imported; `place` as Text | — | |
| @@ -653,11 +752,33 @@ The importer's §17 sketches phase 2. This level-up gives it each thing it asks |
| - Long text shows paragraphs and line breaks only. The importer's Fichas mapper writes headings as their own lines, list items as "• " lines, to-dos as "☐ " or "☑ ", and links as "text (address)". |
| - A body over 20,000 characters is cut at a paragraph and counted in the run report. Nothing is dropped silently (importer D10). |
| -**The store functions the importer calls,** never the HTTP routes, each by the importing person as actor: |
| -- `CreateModel(ctx, actor, Model)`: the designer's Create (§8.2 step 5) from a model, the same structure Describe it and templates produce. |
| -- `CreateCard`, as today, and `SetField(ctx, actor, cardID, key, value, was)`, §5.2's write. |
| -- `AddFile(ctx, actor, cardID, key, name string, data io.Reader) (File, error)`: §7.4's upload, waiting on the blob semaphore rather than failing. Typed refusals: `ErrFileTooLarge`, `ErrFileQuota`, `ErrNoFileStore`. |
| +**The store functions the importer calls,** never the HTTP routes, each by the importing person as actor. The importer's crash-safe re-runs need its own map row (Notion id to Fichas id) to land **in the same transaction** as the write it records (importer §13, §14.1), so each write function has a form that takes a hook run inside its transaction: |
| + |
| +```go |
| +// ImportTx runs fn inside one store transaction. Every write below, |
| +// called on tx, logs its events in that transaction, and fn may write |
| +// the importer's own rows (its map) beside them. Nothing lands unless |
| +// 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) 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. |
| +func (s *Store) StoreFile(ctx context.Context, actor Actor, name string, data io.Reader) (StoredFile, error) |
| +``` |
| + |
| +- Typed refusals: `ErrFileTooLarge`, `ErrFileQuota`, `ErrNoFileStore`, `ErrModelLimits`. |
| - **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. |
| **Views:** a Notion view becomes a Fichas team view where each of its filters and sorts maps onto §6.3's operators. One that does not map is listed in the report, not approximated (importer §17). |
| @@ -682,6 +803,9 @@ The importer's §17 sketches phase 2. This level-up gives it each thing it asks |
| | Previews of PDFs and documents | Trigger: people open files only to see what they are | |
| | Comments on cards | Not asked for | |
| | Editing entries | Base §11: never. A correction is a new entry | |
| +| Removing a field from a live type | Needs its own design: values, views and URLs naming it, files, backlinks, S3 (§8.2). Trigger: a field someone wants gone, not hidden | |
| +| Restoring a deleted card | Not built today, and not designed here. Trigger: a card deleted by mistake | |
| +| Collapsed groups kept across visits, or without script | Trigger: grouped views long enough that people collapse the same groups every time | |
| --- |
| @@ -711,46 +835,48 @@ Each answer below is the author's proposal. The design is built on it, and none |
| Each phase after that is its own branch from `main`, with mock-ups checked against the round's (Paul, 2026-09-29: "mockups before implementing"), `make ci` and `make browser` green at every commit, a Fable review, and then a merge and a deploy, so Paul uses each phase while the next is built. Deploys follow the Fichas rule: `git fetch`, check `carlos releases` for a newer live build, `carlos restart` after deploy, and poll `/api/version`. |
| **Phase 1: edit in place.** The first thing Paul can use. |
| -1. The stacked header, the menus and the lead slot's save state (§3.1). The rail's fold (§3.2). |
| -2. `SetField`: one field, compare-and-set on `was`, one event (§5.2). `POST /cards/{id}/fields/{key}`, JSON with script, redirect without. |
| -3. Click to edit in the table and on the card, for today's kinds (§5.1). The scriptless cell links and the edit form's `was` (§5.7). |
| -4. Undo: the toast, ⌘Z and ⌘⇧Z, the scriptless "Saved. Undo" (§5.3). |
| -5. Rejilla's keys (§5.6). |
| -6. The card beside the list, J and K, Next and Previous links (§5.4). |
| -7. History on the card (§5.5), and the value window's length (Q11) with its sweep of event payloads. |
| -8. Phones: the list of rows and the edit sheet (§5.8). |
| -9. Gates LU3, LU4, LU5, LU9 and LU10 for this phase. |
| +1. The stacked header, the menus and the lead slot's save state (§3.1). The rail's fold and the cookies of §3.2. |
| +2. `Index.Sync` learns object kinds by name (§9), before anything new writes events. |
| +3. `SetField`: one field, the three-step compare of §5.2, one event. `POST /cards/{id}/fields/{key}`, JSON with script, redirect without. The edit form's `was` and its all-or-nothing conflict page. |
| +4. Click to edit in the table and on the card, for today's kinds (§5.1), with "No longer in this view" (§5.1). The scriptless cell links (§5.7). |
| +5. Undo and Redo: the route's rules, the toast, ⌘Z and ⌘⇧Z, the scriptless "Saved. Undo" (§5.3). |
| +6. Rejilla's keys (§5.6). |
| +7. The card beside the list, J and K, Next and Previous across pages (§5.4). |
| +8. The value window (Q11): its length, the sweep that erases payloads past it, and History on the card (§5.5). |
| +9. Phones: the list of rows and the edit sheet (§5.8). |
| +10. Gates LU3, LU4, LU5, LU9, LU10 and LU11 for this phase. |
| **Phase 2: saved views.** |
| 1. `[estilo-float]` in estilo, if it has not landed (§3.4). |
| -2. The `views` table and its migration, "All <plural>" for each type, the columns cookie retired (§4.3, §4.6). |
| -3. The URL grammar, `parse` and `href`, and the length cap (§4.9). |
| -4. The View panel for the table and the cards layouts: filter on any field with §6.3's operators, sort by several, group, columns with order, width, hide and freeze (§4.1, §4.4–4.6). |
| -5. The caption (§4.10). |
| -6. The switcher, Save, Save as new, Reset, team and personal scope, the revision check, Manage views, view history and Restore (§4.2, §4.8). |
| -7. Count only (§4.7). |
| -8. Gates LU6, LU7, LU8 and LU12. |
| +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. |
| **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 or Checkbox, a card's move as a field edit with Undo, "Move to…" without script, New in a column, empty columns, the phone's snap scroll. |
| +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: folders and the stepped designer** (draft 2's slices A, B and C, with §8.2's changes). Folders and icons; drafts; steps 1, 2, 3 and 5 with templates and blank; step 4; the step 3 editor on live types. |
| - |
| -**Phase 5: the new kinds.** |
| -1. Number formats with exact decimals, and Money (§6.2, Q12). |
| -2. Date ends and times (§6.2). |
| -3. Checkbox, Multi-select and Person (§6.5). |
| -4. Link to…, backlinks, Linked here, the picker and its search page (§6.6; draft 2's slice D). |
| +**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). |
| +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). |
| -6. Each kind's filter, sort and group (§6.3), S3's text (§6.7), and the designer's kinds list. |
| +6. Each kind's filter, sort and group (§6.3), S3's text (§6.7), and the URL values (§4.9). |
| 7. Gates LU2, LU14 and LU16. |
| -**Phase 6: files and images** (§7). The shared walker in rastrillo, if Mapa has not built it; the `files` table, upload, serve, thumbnails, remove, retention, quota; then the CARLOS store steps of §7.5 with Paul. Gate LU13. |
| +**Phase 5: files and images** (§7). The shared walker in rastrillo, if Mapa has not built it; the `files` table and `setFiles`; upload, serve, thumbnails at upload, remove, retention, quota, the three memory bounds; then the CARLOS store steps of §7.5 with Paul. Gate LU13. |
| + |
| +**Phase 6: folders and the stepped designer** (draft 2's slices A, B and C, with §8's changes). Folders and sealed icons; drafts; steps 1 to 5 with templates (every kind they use now exists) and blank; the step 3 editor on live types, with no field removal. |
| **Phase 7: describe it** (§8.5, draft 2's slice E). After Paul sets `FICHAS_TENSORX_API_KEY`. Gate LU15. |
| -**Then the Notion import's phase 2** may start: it needs Phases 4, 5 and 6, and §11's store functions. |
| +**Then the Notion import's phase 2** may start: it needs Phases 4, 5 and 6, and §11's `ImportTx`. |
| --- |
| @@ -758,22 +884,33 @@ 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, a section name, help text, an option tone's option, 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, or the blob directory. No blob starts with a PNG or JPEG magic number. |
| -- **LU2, the allowlist and settings.** Every new plaintext column is named with its case. `field_defs.settings` refuses any key or value outside its kind's closed schema; a fuzz test writes random strings through every settings path and none reaches the column. |
| -- **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. |
| -- **LU4, writes that do not cross, and Undo.** A stale `was` is refused with 409 and writes nothing. Two people editing two fields of one card both land. Undo restores only fields that still hold the event's after value, names the ones it left, and logs with `trigger_id`. Only the change's author can undo from the toast. |
| -- **LU5, a GET writes nothing.** A logical dump of every table is unchanged across every list layout, every panel state, the caption's links, the card beside the list, History, Manage views, the designer's GET steps, and file serving (200 and 304). |
| -- **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, 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 with times compare as instants; date-only values as dates. |
| -- **LU7, the URL.** `parse(href(s)) = s` over random states. Unknown keys, unsuited operators and non-options are dropped. A state past 4,000 bytes is refused with the sentence. **The app's log never contains a query string:** a test captures the log over a filtered list request and greps for the filter value. |
| -- **LU8, view scope.** Ana's personal view is invisible to Bo: the switcher's HTML, Manage views, `/t/{type}?v=<Ana's key>` (the same status, headers and body as a key that never existed), and the save routes. A team view changed by Bo is logged with Bo as actor, and Restore brings back the previous payload. A stale save is refused. The type's last team view cannot be deleted or made personal. |
| -- **LU9, the scriptless floor (browser).** With scripts off, with no console error: edit a cell through the edit form and Undo it; open a card beside the list and follow Next; 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, the pickers, the panel opened and closed with focus returned, J and K, Undo with ⌘Z, the board's Move to, the calendar's days. A polite live region announces "Saved", the Undo, and refusals. axe-core finds nothing serious on the table, the panel, the card, the board, the calendar, the designer and the phone sheets. |
| +- **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. |
| +- **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. |
| + - 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. |
| +- **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. |
| +- **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. |
| -- **LU12, speed.** At 5,000 cards and 10,000 entries: a query with three filters, two sorts and a group answers in under 20 ms warm; the cold load stays within 10% of today's 225 ms plus what backlinks cost, recorded in the build notes. |
| -- **LU13, files.** Mapa images' IMG2, IMG5 and IMG6, for Fichas: padding and the hash check, metadata stripped from inline images with the pixels unchanged, the format refusals, headers (`inline` only for allowlisted images, `attachment` otherwise), 25 MiB and the quota refused, 503 with no store, the semaphores' bounds, thumbnails only within 4,096 px, a failed transaction deleting its object, `file_trash` emptied off the boot path. |
| -- **LU14, the suite contract.** S3's text for every new kind (§6.7), with no member id, card id or file id in it. Conformance is unchanged. |
| +- **LU12, speed.** At 5,000 cards and 10,000 entries: a query with three filters, two sorts and a group answers in under 20 ms warm; the cold load stays within 10% of today's 225 ms plus what backlinks cost, recorded in the build notes. **A view save, a file event and a draft event cause no card reload**, and every object kind this level-up writes is named in `Sync`'s switch. |
| +- **LU13, files.** Mapa images' IMG2, IMG5 and IMG6, for Fichas: padding and the hash check, metadata stripped from inline images with the pixels unchanged, the format refusals, headers (`inline` only for allowlisted images, `attachment` otherwise), 25 MiB and the quota refused, 503 with no store, the three memory bounds, thumbnails only within 4,096 px and made at upload, a thumbnail failure not failing the upload. And scope and lifecycle: |
| + - signed-out and non-admitted requests get the door; |
| + - 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`; |
| + - 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; |
| + - `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. Backlinks follow the event log, including after a target is deleted ("deleted card") and restored. 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 is refused. |
| --- |
| @@ -788,16 +925,23 @@ Each phase after that is its own branch from `main`, with mock-ups checked again |
| - **D5, the columns cookie retires** rather than becoming a personal default (§4.6). |
| - **D6, weeks start on Monday** with no switch. The mock-up's toggle is dropped; the team's zone and Monday are the 2026-11-13 defaults. |
| - **D7, the calendar on a phone is an agenda,** not the month grid. |
| +- **D8, groups collapse with script only,** and not across visits: a `<details>` cannot sit inside a table (§4.5). |
| +- **D9, a team view cannot be made personal.** The mock-up's switcher implied either way; one person could take a view from everyone (§4.8). |
| ### From the base spec and draft 2, each for the reviewer |
| -- **D8, a type designer exists.** Base decision 6 and §11 ("a type designer: a second stack asks for it") are superseded by Paul's 2026-11-12 rulings (draft 2). Base §4.3 still holds: types are rows, never DDL, and user fields are never plaintext. |
| -- **D9, the catalogue gains People** (R5), with §8.3's tier table as its review (base §4.4). |
| -- **D10, files are a new kind of object,** with plaintext coordinates (§7.3) and a bucket. Base §4.1's cases 2 and 4 cover them; §10.2 states what they show. |
| -- **D11, two named exemptions from "every write logs"**: type drafts and the sweep (§9). |
| -- **D12, Fichas makes thumbnails** where Mapa makes no display copies (F6). |
| -- **D13, money is a kind** (Q12), where draft 2 had only Number. |
| -- **D14, number sorting is exact.** Today's sort compares floats (`index.go`). It now compares decimals, which changes no order a person could see except between values that differ past a float's precision. |
| +- **D10, a type designer exists.** Base decision 6 and §11 ("a type designer: a second stack asks for it") are superseded by Paul's 2026-11-12 rulings (draft 2). Base §4.3 still holds: types are rows, never DDL, and user fields are never plaintext. |
| +- **D11, the catalogue gains People** (R5), with §8.3's tier table as its review (base §4.4). |
| +- **D12, files are a new kind of object,** with plaintext coordinates (§7.3) and a bucket. Base §4.1's case 2 covers them; §10.2 states what they show. |
| +- **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). |
| +- **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. |
| +- **D20, the import may set a card's Created** to Notion's time (§11). |
| +- **D21, `maxOptions` rises from 50 to 200** (§8.2), because Notion selects run past 50. |
| --- |
| @@ -811,4 +955,37 @@ Choices made while building, where this spec was silent or the build chose diffe |
| ## 18. Findings and what changed |
| -*Rounds are recorded here as they happen.* |
| +### Round 1: Fable on revision 1 (`00e3ad3`), CHANGES REQUIRED, answered in revision 2 |
| + |
| +| Finding | Change | Where | |
| +|---|---|---| |
| +| **H1** A link target's rename or deletion did not reach linking cards: the index reloads only the card an event names, and memoria kept a deleted card's title for ever | The index holds link ids and resolves titles when a list is drawn; backlinks are a derived map. Deleting a target bumps each linking card's revision in the same transaction, one event each. S3 leaves a gone target out. Gated | §6.6, §6.7, §9, §10.3, LU14, LU16, D19 | |
| +| **H2** Remove from Fichas left the card's value, revision and S3 text untouched; attachment had two unreconciled sources; serving a detached file was unstated | One invariant (value ids = rows not detached) and one writer, `setFiles`, for every Files write. Remove strips the id, bumps the revision and logs the card. Undo and Restore skip removed files. What `GET /files/{id}` serves is listed; everything else is the ordinary 404 | §7.3, §7.4, §5.3, §9, LU13 | |
| +| **H3** Personal-view privacy broke on scope moves; anyone could hide a team view; the 404 rule contradicted itself | History as others see it starts when a view became a team view. Team to personal is not offered. One rule: a cookie key falls back silently, `?v=` that does not resolve is always the same 404. Names need not be unique. `viewFor` with `scope.Owned` on every view route. LU8 covers every route | §4.2, §4.3, §4.8, LU8, D9 | |
| +| **M1** Every non-card event rebuilt the whole index | `Sync` names each object kind and what it reloads; views, files and drafts reload nothing. Gated | §9, LU12 | |
| +| **M2** URL state over a saved view was undefined; values per kind, `panel=1` and the long-state case were missing | Sections override whole, never by delta; `f=none`. A value table per kind. `panel=1` defined. Past 4,000 bytes: script keeps state in the page; scriptless posts to a no-write preview | §4.9, §4.10, LU5, LU7 | |
| +| **M3** Retry conflicts, the form of `was`, the scriptless conflict page, what Undo accepts, and a view's Undo were unstated | A write already holding the new value succeeds with no event. `was` is canonical. The edit form is all or nothing, with a conflict page. Undo accepts only a person's `undoable` `updated` event on that card. A view Undo route | §5.2, §5.3, §4.8, LU4 | |
| +| **M4** "The migration makes All <plural>" cannot be SQL; contradictory deletion rules; wrong default sort | `SeedViews`, a boot reconcile beside `Seed`, logged as the app; new types get theirs at Create. Only the last team view is protected. Default sort is last edited first | §4.3, §9 | |
| +| **M5** New plaintext columns no case needed (settings, required, icon, status) | All sealed in `sealed_settings`. Only `group_id` stays plaintext (case 2) | §8.1, §10.1, LU2, D17 | |
| +| **M6** Renaming an option broke views and bookmarks, and a dropped condition widened a view | Options get ids; values, views and URLs hold ids; a logged reconcile converts today's labels. A condition that no longer makes sense matches nothing, with a notice | §4.4, §6.1, §6.2, §4.9, LU6, D18 | |
| +| **M7** Time zones could not be built: no setting, no tzdata; date-only against timed values undefined | `FICHAS_TIME_ZONE`, embedded tzdata, boot refused on an unknown zone. Date-only is the whole local day; ends inclusive; "next N days" includes today. DST cases gated | §6.2, LU6 | |
| +| **M8** `1,5` became `15`; float-parsed values like `1e3` and `NaN` exist | One strict grammar, 30 digits; money at most 18 digits. A logged reconcile of stored values; an unparseable one shows "Not a number" | §6.2, D16 | |
| +| **M9** Typing "Oslo" in a cell opened the card; single-letter keys broke WCAG 2.1.4 | `O` dropped. J and K act only in the card pane and the narrowed list | §5.4, §5.6, LU10 | |
| +| **M10** `<details>` cannot wrap table rows | One table, a `<tbody>` per group with a heading row; collapse with script only | §4.5, D8 | |
| +| **M11** Templates needed kinds from later phases; two People types | The new kinds and files come before the designer. Organisations links to the seeded People | §8.3, §14 | |
| +| **M12** Removing a field from a live type was assumed, not designed | Remove is for draft fields only; live removal is out, with a trigger | §8.2, §12 | |
| +| **M13** Thumbnail traffic and slow uploads could starve the semaphore; thumbnails' timing; no scope or lifecycle gates for files | Receiving counted apart; a 128 MiB byte-weighted semaphore; serving waits 30 s; thumbnails at upload, their failure harmless. LU13 gains scope and lifecycle | §7.2, LU13 | |
| +| **M14** The importer needed its map row in the same transaction, a view writer, model limits, Notion times that outlive the window, and a currency fallback | `ImportTx` with `CreateModel`, `CreateCard` (with Created), `SetField`, `CreateView`, `AttachFile`; `StoreFile` outside it. The store's own model limits. Notion's created time sets Created; the rest are fields. Money falls back to Number | §11, §8.2, D20, D21 | |
| +| **M15** An edit that takes a row out of the view; a card not in the list; Next across pages | The row stays, marked "No longer in this view". A card not in the list says so and has no Next. Next is computed over the whole list | §5.1, §5.4 | |
| +| **L1** The payload sweep was not named; the window's phase was inconsistent | Named among the sweeps; the window is built in Phase 1 | §9, §7.5 | |
| +| **L2** The draft event had no object | `draft`, object id 0 | §9 | |
| +| **L3** A cookie per type and per folder | One cookie each for the rail and for last views | §3.2 | |
| +| **L4** Today's URL parameters would break | They redirect to the canonical URL | §4.9 | |
| +| **L5** Paging for multi-group cards, boards and calendars | Rows count each appearance; boards show 100 a column; calendars do not page | §4.5 | |
| +| **L6** "Edited by" for app and entry events | The last person's `created` or `updated` | §6.1 | |
| +| **L7** A team view's Undo lived only in a 10 s toast | History and Restore on Manage views, with no timer; deleted views restorable | §4.8 | |
| +| **L8** Multipart spills to plaintext temp files | `MultipartReader` only; the temp directory is in LU1 | §7.2, LU1 | |
| +| **L9** The log gate covered one request | It covers a 409, a 500, a 404, a sign-in redirect and an upload | LU7 | |
| +| **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 | |