| 1 | # Fichas level-up: Escritorio, with Expediente's sentence and Rejilla's cell keys |
| 2 | |
| 3 | **Status:** revision 4, 2026-11-17, aligned with Mapa's locale work (build note 85) the same day. **APPROVED** by Fable on revision 2 (`0cb3b09`); revision 3 folded in its mediums and lows. **Paul approved the spec and its proposed answers Q1–Q12 on 2026-11-17** ("Yes"), so §13's answers are rulings. |
| 4 | - Revision 4 answers Paul's question of the same day, *"are we using Rastrillo's ability to localise things like numbers and currencies etc?"*: numbers, money and dates are now written and read in the reader's locale through rastrillo (§6.8). Storage and every canonical form are unchanged. |
| 5 | - Fable reviewed revision 1 (`00e3ad3`) and found CHANGES REQUIRED: 3 high, 15 medium and 12 low findings. Revision 2 answered all of them. |
| 6 | - §18 records each review round and what changed. |
| 7 | |
| 8 | **Branch:** `design/level-up-2` (Fichas), from `main` `b791bdd`. The old name `feat/level-up` is a merged branch and is not reused. |
| 9 | |
| 10 | **What still binds:** |
| 11 | - the base spec, `2026-09-19-fichas-design.md`: §0's one rule, §2 ("never a second calculator"), §4's seal boundary and in-memory index, §4.3's no-DDL rule, §5's event log, §6's suite contract and §9's reach rules; |
| 12 | - the type-designer draft 2, `2026-11-12-type-designer-design.md` on `origin/design/type-designer` (`f415c00`), with Paul's rulings R1–R6. This spec absorbs its slices A–E (§8), so that branch is not built on its own; |
| 13 | - `AGENTS.md`'s hard rules: `scope.Owned`, no request body bound to a model, forward-only migrations, money as integer cents, screens that work with scripts off, confirm pages for destructive actions, `make ci`. |
| 14 | |
| 15 | **This spec changes no trust property.** It adds kinds of value, objects and screens. Every new column is either sealed or named in §10's leak list with its reason. |
| 16 | |
| 17 | **Mock-ups:** `oficina/polish-audit/fichas-ux/`: `c.html` (Escritorio), `b.html` (Expediente, for the sentence), `a.html` (Rejilla, for the cell keys), `index.html` (the round, its seal table and its Notion table), and `shots/`. `shots/current/` is today's app at `b791bdd`. The mock-ups are the reference for look and measurement. They move things with script and fake their data; the build renders everything on the server. |
| 18 | |
| 19 | **Prior art this spec reuses, and does not restate:** |
| 20 | - Mapa's level-up (`mapa` `2026-11-14-mapa-level-up.md`): the house structure, the stacked header, the floating glass panel, the fold, and the scriptless-floor discipline. |
| 21 | - Mapa images (`mapa` `design/images`, `2026-11-17-mapa-images.md`, revision 2, `c27a292`): sealed bytes in the CARLOS store, served through the app (§7). |
| 22 | - The Notion importer (`mapa` `design/notion-import`, `2026-11-17-notion-import.md`, revision 2, `fda6c12`), whose §17 sketches phase 2, databases into Fichas. §11 says what this level-up gives it. |
| 23 | |
| 24 | --- |
| 25 | |
| 26 | ## 1. Why |
| 27 | |
| 28 | Paul, 2026-11-17: *"Fichas probably needs a lot of features like configurable columns, saved views, click to edit etc. etc."* Saved views, personal and team, were ruled on 2026-11-12. |
| 29 | |
| 30 | He was shown three directions: Rejilla (a grid), Expediente (views in the rail, a sentence, the card as a page) and Escritorio (a View panel, a view switcher in the header, the card beside the list). He ruled, 2026-11-17: **Escritorio.** *"I think Escritorio is more consistent with the other apps as we're guiding them."* |
| 31 | |
| 32 | Two things are borrowed from the other directions (Q1): |
| 33 | - **Expediente's sentence**, as a caption over the table. It says what the view shows, and each of its words opens the matching part of the View panel. |
| 34 | - **Rejilla's keyboard in the cells**: arrows move, Enter edits, typing replaces, Esc cancels. |
| 35 | |
| 36 | ## 2. What was chosen |
| 37 | |
| 38 | - **Header:** Docs', Slides' and Mapa's I2 stacked header (estilo `39792ae`, already pinned). It carries Fichas' mark, the title, the menus File, Edit, View, Type and Help (File was Card until build note 24), the **view switcher** and the save state in the lead slot, the **View** toggle, the primary action ("New customer") and the account. |
| 39 | - **Rail:** Fichas' rail stays (R1), with **folders** as collapsible headings (R2), an icon per type, New type below a rule, and ⌘\ to fold it. |
| 40 | - **The View panel:** one floating glass panel, Docs' inspector for data. It holds the layout (Table, Board, Calendar, Cards), filter, sort, group, and columns with order, width, hide and freeze. Its foot says "Changed" when the view differs from what is saved, with Reset, Save and Save as new. |
| 41 | - **The caption:** one sentence over the table: "Customers where Stage is Lead, Contacted or Proposal and Next action is before 1 December, soonest Next action first." Each underlined word opens that part of the panel. |
| 42 | - **The table:** click a cell to change it. Each change saves at once, is logged, and gets Undo in a toast (Q3). The keyboard moves between cells. |
| 43 | - **The card beside the list:** the name opens the card in a pane beside a narrowed list. J and K walk the list. Its fields are quiet inputs, always editable. "Full page" opens it on its own. |
| 44 | - **Saved views:** team views anyone may change, each change logged and undoable; personal views only their owner sees (Q2). |
| 45 | - **Board and calendar** layouts (Q8). |
| 46 | - **New field kinds:** date with an optional end and time (Q7), number formats and money, checkbox, multi-select, person, link to another type, and files and images (Q6). |
| 47 | - **The stepped type designer**, with folders, templates and "describe it", as draft 2 specified. |
| 48 | - **Phone:** the panel is a sheet, the table is a list of rows, the card is its own screen. |
| 49 | |
| 50 | --- |
| 51 | |
| 52 | ## 3. The shell |
| 53 | |
| 54 | ### 3.1 Header |
| 55 | |
| 56 | The estilo bar stack, as Mapa uses it (Mapa level-up §3.1). Fichas' slots: |
| 57 | |
| 58 | | Slot | Contents | |
| 59 | |---|---| |
| 60 | | Mark | Fichas' mark, linking to `/` | |
| 61 | | Title | The type's plural on a list ("Customers"); the card's title on a card's full page; "New type" in the designer. Not renamed in place: a type is renamed in its settings, a card on its card | |
| 62 | | Menubar | **File** (build note 24; it was Card), first as in Docs, Slides and Mapa: New, Open full page, History, Delete…, and Import from Notion… after New once the Notion databases phase gives Fichas an importer · **Edit**: Undo, Redo · **View**: Show View panel, Table, Board, Calendar, Cards, Density, Fold rail · **Type**: Fields, Card layout, Type settings, New type, Folders · **Help** | |
| 63 | | Lead | The view switcher (§4.2) and the save state: "Saved", "Saving…", or "Couldn't save" with Retry | |
| 64 | | Actions | View (toggles the panel, `aria-pressed`), the primary "New <singular>". Search left the bar (build note 23): it is the rail's first row | |
| 65 | | Account | estilo's account menu, as today | |
| 66 | |
| 67 | - **Search stays per type.** ⌘K focuses the type's Find box. A search across every type is out (§12). |
| 68 | - **Every menu item is a link or a form.** With scripts off, each menu is estilo's `<details>` menu. |
| 69 | |
| 70 | ### 3.2 Rail |
| 71 | |
| 72 | - **R1:** the rail stays. Its rows keep today's grid: a 16px icon column and the label on one centre line (`TestRailIconsSitOnTheTextsCentreLine`). |
| 73 | - **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. |
| 74 | - **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. |
| 75 | - **Each type has its icon** (§8.1) and its card count, as the mock-ups show. |
| 76 | - **Search is the rail's first row** (build note 23): the type's Find box, ⌘K beside it. |
| 77 | - **New type** is a quieter row below a rule. |
| 78 | - **⌘\ 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. |
| 79 | - **Below 800px** the rail is estilo's Menu sheet. |
| 80 | |
| 81 | ### 3.3 Breakpoints |
| 82 | |
| 83 | | Width | Layout | |
| 84 | |---|---| |
| 85 | | ≥ 1280px | rail 232px, the work, and the panel (340px) floating over the work's inline end. With the card open: rail, list (288px), card | |
| 86 | | 800–1279px | the rail folds by default (a saved choice wins). The panel floats over the table, which scrolls under it | |
| 87 | | < 800px | the bar's Menu sheet; the table becomes a list (§5.6); the panel is a bottom sheet; the card is its own screen | |
| 88 | |
| 89 | At 1440px with the rail, the table and the panel open, the page has three columns. The mock-up round named this as Escritorio's cost. The panel is closed by default, and a person's choice to keep it open is remembered (§4.1). |
| 90 | |
| 91 | ### 3.4 estilo |
| 92 | |
| 93 | - **The floating glass panel moves into estilo** as `[estilo-float]`: the glass, the rim and shadow, the dark values, and the placement helper. |
| 94 | - Docs' inspector is the first implementation and Mapa's Links panel the second. Mapa's build note 23 left the extraction to "the second adopter's" next step, and it has not happened. Fichas is the third, so the extraction is due now. |
| 95 | - Phase 2 (§14) does it on an estilo branch if it has not landed by then. Docs and Mapa adopt it at their next re-pin. |
| 96 | - **The rail's folder headings and fold** stay Fichas' own. Mapa's sidebar is the likely second implementation; when it adopts them, they move. |
| 97 | - **The calendar date picker** is rastrillo's `calendar.js`, which Fichas leaves out today (`vendoredIsMine`; `datetime.js` falls back to the browser's picker). The picker in the mock-ups (quick picks, a month grid, the zone named) is new work in `datetime.js`, with the browser's picker as the scriptless floor. |
| 98 | |
| 99 | --- |
| 100 | |
| 101 | ## 4. Views |
| 102 | |
| 103 | ### 4.1 The View panel |
| 104 | |
| 105 | - **What it is:** Docs' inspector pattern, in `[estilo-float]` glass, 340px wide, 12px under the header and 12px in from the inline end. |
| 106 | - It is an `<aside>` labelled "View", not a modal. Focus moves into it when it is opened from the View button, and back to the button on Esc. |
| 107 | - Its open state is a per-person cookie (`POST /view/panel`), as the rail's is. It is closed by default. |
| 108 | - **Sections, for a table:** |
| 109 | 1. **Layout:** Table, Board, Calendar, Cards, as a segmented control (radio buttons). |
| 110 | 2. **Filter** (§4.4), with a count: "7 of 10". |
| 111 | 3. **Sort** (§4.5). |
| 112 | 4. **Group** (§4.5). |
| 113 | 5. **Columns** (§4.6). |
| 114 | - **For a board:** Layout, Filter, **Columns by** (a Choice, Person or Checkbox field), Show empty columns, and **Each card shows**. |
| 115 | - **For a calendar:** Layout, Filter, **Date field**, and **Each card shows**. |
| 116 | - **For cards:** Layout, Filter, Sort, and **Each card shows**. |
| 117 | - **The foot:** when the state differs from the saved view, a "Changed" mark (a dot and the word), **Reset**, and **Save**. For a team view Save reads "Save for everyone". **Save as new…** opens the switcher's save form (§4.2). |
| 118 | - **Every change applies at once with script.** The panel rewrites the URL (`history.replaceState`) and the work redraws from the server's HTML fragment. Nothing is written until Save. |
| 119 | - **A value a person types into the panel is never put in the URL as typed** (§6.8): what `1.500` means depends on the reader's locale. The panel posts typed values as `tN`, with the page's locale as `tN.locale`, to `POST /t/{type}/apply`, which reads them (§6.8), writes nothing, and answers with the canonical URL: a 303 without script, the URL itself to the script, which puts it in the address. `parse` never reads `tN`, and `xN` is never read through a locale. Picked values (options, people, cards, relative date tokens) and dates from the date input are already canonical and go into the URL directly. |
| 120 | - **With scripts off, the panel is a POST form.** "Apply" posts it to `POST /t/{type}/apply`, and the 303 lands on the same URL a script would have made. "Add a condition", "Then by…" and the column moves post to the same route with the button's name, and land on the same URL with one more row or a moved row. `apply` writes nothing (gate LU5). |
| 121 | - **A refused value** (an ambiguous `1.500` under R2, or a bad `tN.locale`) writes no URL: the route redraws the panel (422) with the message beside the control. |
| 122 | - **A state past 4,000 bytes** is rendered as `POST /t/{type}/preview` renders it (§4.9), not redirected. "Add a condition", "Then by…" and the column moves are submit buttons that redraw the form with one more row or a moved row. No GET writes anything (gate LU5). |
| 123 | |
| 124 | ### 4.2 The view switcher |
| 125 | |
| 126 | In the header's lead slot: the current view's name, its scope ("Team", or a lock and "Only you"), and a chevron. It opens a menu: |
| 127 | |
| 128 | - **Find a view**, a filter over the list (with script). |
| 129 | - **Team views**, each with its layout icon, in the team's order. |
| 130 | - **Only you**, the person's own views, by name. |
| 131 | - **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. |
| 132 | - **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). |
| 133 | - **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. |
| 134 | |
| 135 | With scripts off the switcher is a `<details>` menu of links, and Save as new is its own page. |
| 136 | |
| 137 | ### 4.3 What a view is |
| 138 | |
| 139 | A saved view is one card type's: |
| 140 | - name; |
| 141 | - layout: table, board, calendar or cards; |
| 142 | - filter: conditions, and whether all or any must match; |
| 143 | - sorts, in order; |
| 144 | - group, and for a date, its bucket; |
| 145 | - columns: order, widths, hidden ones, and how many are frozen; |
| 146 | - for a board, its field and whether empty columns show; for a calendar, its date field; |
| 147 | - card face: which fields each card or board card shows. |
| 148 | |
| 149 | **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. |
| 150 | |
| 151 | **Each type always has at least one team view.** |
| 152 | - **Where the first one comes from:** a view's name and payload are sealed, so no SQL migration can write one. The `views` table comes from a migration; its rows come from a **boot-time reconcile**, `SeedViews`, beside `Seed`. For each card type of scope `card` (never an entry type such as Call log) with no team view, it writes "All <plural>" from today's defaults (table, every column but long text, no filter, **last edited first**, which is today's `SortUpdated` descending) in one transaction, logged as `AppBecause(0, "default view")`. |
| 153 | - **New types** get theirs inside `CreateType` and the designer's Create (§8.2), in the same transaction as the type. |
| 154 | - **The last team view of a type** cannot be deleted. Any other team view, "All <plural>" included, can be. |
| 155 | |
| 156 | **Which view opens:** |
| 157 | - **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. |
| 158 | - **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). |
| 159 | |
| 160 | ### 4.4 Filter on any field |
| 161 | |
| 162 | - **Every field and built-in can be filtered,** with operators that suit its kind (§6.3's table). Built-ins are Created, Edited, Created by, Edited by and Last call. |
| 163 | - **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). |
| 164 | - **At most 12 conditions** per view. |
| 165 | - **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. |
| 166 | - **Conditions name options by their opaque ids** (§6.2), so renaming an option never touches a view or a bookmark. |
| 167 | - **A retired option** (§6.2) still matches: the cards holding it are still there. The caption and the panel show it as "Lost (retired)". |
| 168 | - **A condition that no longer makes sense** (its field is gone, or an option id it names is unknown to the field) is never silently dropped, because dropping it would widen the view. Under "Match all" the view shows no cards; under "Match any" the condition matches nothing. Either way the caption and the panel say "1 condition refers to something that was removed", with Remove it. |
| 169 | - **Search** (the Find box, `q`) still applies on top of the filter, over every value that shows as text (§6.4). |
| 170 | |
| 171 | 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. |
| 172 | |
| 173 | ### 4.5 Sort and group |
| 174 | |
| 175 | - **Sort by several fields,** each ascending or descending. Empty values sort last in either direction, as today (`TestSortingPutsEmptyValuesLast`). Ties fall back to the card's id, so a sort is stable. |
| 176 | - **How each kind sorts** is in §6.3's table. Numbers and money compare exactly, as decimals (§6.2), never as floats. |
| 177 | - **Group by** a Choice, Multi-select, Person, Checkbox, Link, or a date (by day, week, month or year), or Created, Edited or Created by. |
| 178 | - Groups follow the Choice's option order; other groups sort A–Z; "No <field>" comes last. |
| 179 | - 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". |
| 180 | - **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. |
| 181 | - **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. |
| 182 | - **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". |
| 183 | - **Boards and calendars do not page.** A board column shows its first 100 cards and a "Show all 140" link (`all=<option id>`, a navigation parameter, §4.9). A calendar shows its whole month. |
| 184 | |
| 185 | ### 4.6 Columns |
| 186 | |
| 187 | - **Order:** the view holds the order of the columns it knows. A field added to the type later appears at the end, shown, as today's cookie rule does ("the cookie holds what is hidden, so a field added later appears"). |
| 188 | - **Hide and show:** an eye toggle per row. The title column cannot be hidden. |
| 189 | - **Width:** in px, from 64 to 640. With script, drag a header edge; double-click it to fit the widest visible value. In the panel, a number. A column with no width takes its kind's default. |
| 190 | - **Freeze:** a pin. Every column up to and including the pinned one is frozen (`position: sticky` at the inline start) while the table scrolls sideways. The title column is frozen by default. |
| 191 | - **Reorder:** with script, drag a row in the panel or a header in the table. In the panel and without script, Move up and Move down buttons. |
| 192 | - **Long text** can be a column, cut to one line. Today it is never one. |
| 193 | - **The columns cookie retires** (`fichas-hide-<type>`). Paul is the only user and the data is not real, so nothing is carried over; columns now live in views (D5). |
| 194 | |
| 195 | ### 4.7 Count only (Q5) |
| 196 | |
| 197 | - The foot of the table says how many cards are shown, of how many: "7 of 10 customers". |
| 198 | - Each group heading shows its count. |
| 199 | - A column's foot may show **a count**: filled, empty, or distinct values. It never shows a sum, an average, a minimum or a maximum. Base §2: *"Never a second calculator… if a number belongs to a Sheet, the card cites the cell."* A sum under a Value column is a calculation over a team's money that Fichas would then answer for. |
| 200 | - **The trigger to revisit** is Paul ruling otherwise on Q5. |
| 201 | |
| 202 | ### 4.8 Team and personal views (Q2) |
| 203 | |
| 204 | - **A team view** is the team's. **Anyone admitted may change, rename, reorder or delete it.** |
| 205 | - Each change is one event naming the person, with the before and after payload sealed (§9). |
| 206 | - 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). |
| 207 | - **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. |
| 208 | - **A deleted team view** is listed under "Deleted views" on Manage views, with Restore, for the value window. |
| 209 | - **A personal view** is its owner's. |
| 210 | - Nobody else can list, open or learn that it exists (§4.3's 404, gate LU8). |
| 211 | - 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). |
| 212 | - **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. |
| 213 | - **Moving between scopes:** |
| 214 | - **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. |
| 215 | - **The scope move cannot be undone** or restored past, by anyone: undoing it would be team to personal by another name. Its event is marked not undoable. |
| 216 | - **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. |
| 217 | - **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. |
| 218 | - **Limits:** 50 team views per type, and 50 personal views per person per type. |
| 219 | |
| 220 | ### 4.9 The URL (Q4) |
| 221 | |
| 222 | **Every state is a link.** Today the list's search, choice filters, sort and page are in the URL (`list.go`), and that stays the rule. |
| 223 | |
| 224 | ``` |
| 225 | /t/{type}?v=<view key>&layout=board |
| 226 | &m=any&f0=<field key>&o0=any&x0=<option id>&x0=<option id> |
| 227 | &s=<field key>&s=-<field key>&g=<field key>&gb=week |
| 228 | &cols=<key>:228,<key>:124&hide=<key>&frz=1 |
| 229 | &bf=<field key>&be=1&cf=<field key> |
| 230 | &month=2026-11&all=<option id> |
| 231 | &q=<search>&card=<card id>&page=2 |
| 232 | ``` |
| 233 | |
| 234 | - **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. |
| 235 | - **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. |
| 236 | - **Parameters override by section, never by delta.** The sections are: layout; filter (`m`, `fN`, `oN`, `xN`); sort (`s`); group (`g`, `gb`); columns (`cols`, `hide`, `frz`); board (`bf`, `be`); calendar (`cf`, `month`). If any parameter of a section is present, that whole section comes from the URL and the view's saved section is ignored. `f=none`, `s=none`, `g=none` and `hide=none` say "no filter", "no sort", "no group" and "nothing hidden" explicitly. So a removed condition is expressible, and a teammate saving the view never changes **the sections present in** an unsaved URL; sections it leaves out follow the saved view. `v` only names the base for "Changed" and for Save. |
| 237 | - **`href` writes only the sections that differ from the saved view,** so a saved view's own URL stays clean and "Changed" means a section is present. |
| 238 | - **Navigation is not part of a view:** `q`, `card`, `page`, `panel`, `month` (the calendar's month) and `all` (a board column shown in full). They never make the view "Changed" and are never saved. |
| 239 | - **Values, by kind:** |
| 240 | |
| 241 | | Kind | `xN` holds | |
| 242 | |---|---| |
| 243 | | Text, long text, URL, email, phone | the text | |
| 244 | | Number, money | the canonical decimal (§6.2); money in minor units. Never the reader's format: the panel reads a typed value in the reader's locale and writes it canonically (§6.8) | |
| 245 | | Date | `2026-11-20`, or `2026-11-20T14:30` in the team's zone; relative tokens `@today`, `@this-week`, `@next-7d` and the like | |
| 246 | | `between` | two `xN`, low then high | |
| 247 | | Choice, multi-select | option ids (`o_…`) | |
| 248 | | Checkbox | no value; the operator says ticked or not | |
| 249 | | Person, Created by, Edited by | member ids, or `@me` | |
| 250 | | Link to… | card ids | |
| 251 | |
| 252 | - **`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". |
| 253 | - **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. |
| 254 | - **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). |
| 255 | - **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`). |
| 256 | - **A state longer than 4,000 bytes** is never written as a URL. |
| 257 | - **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. |
| 258 | - **Without script,** the panel's form switches from GET to POST at that size (the server counts while rendering), to `POST /t/{type}/preview`, which renders the list for the posted state and writes nothing, with the same sentence. On that page the panel's form posts to the same route and Save posts the state; the caption's words, paging and the card links are not offered, so nothing on it needs the state in a URL. That route is listed with the GETs in LU5. |
| 259 | - **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. |
| 260 | |
| 261 | ### 4.10 The caption |
| 262 | |
| 263 | Expediente's sentence, as the caption over the table, the board and the calendar. |
| 264 | |
| 265 | - **The shape:** "<Plural> where <field> <operator> <values> and <field> <operator> <value>, <sort phrase>, grouped by <field>." |
| 266 | - Values join as "Lead, Contacted or Proposal" for "is any of", and "Pilot and Grant-funded" for "has all of". |
| 267 | - "Match any" joins conditions with "or". |
| 268 | - Sort phrases follow the kind: "soonest Next action first", "highest Value first", "A to Z by Name", "newest first". |
| 269 | - With no filter: "All 10 customers, most recently edited first." |
| 270 | - **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. |
| 271 | - **Values are written in the reader's format** (§6.8): "Value is over 1.200,5" for a German reader, while the URL holds `1200.5`. |
| 272 | - **It is built on the server** by one function, `describeView(state, L) []Span`, with golden tests for every operator and kind. Its copy goes through the copy-review skill. |
| 273 | - **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. |
| 274 | - **On the phone** it sits under the switcher, as the mock-up shows. |
| 275 | |
| 276 | --- |
| 277 | |
| 278 | ## 5. Editing |
| 279 | |
| 280 | ### 5.1 Click to edit (Q3) |
| 281 | |
| 282 | - **In the table,** every cell except the title is the editor for its field. Click it, or move to it and press Enter, or start typing. |
| 283 | - **The name opens the card** beside the list (§5.4). It is a link. Renaming happens on the card (D1). |
| 284 | - Text, long text, number, money, URL, email and phone edit in the cell, with an input of the right type and keyboard (`inputmode`). |
| 285 | - Choice, multi-select, person and link open a picker with search (§6.5). |
| 286 | - A date opens the date picker (§3.4). |
| 287 | - A checkbox ticks on click or Space. |
| 288 | - Files open the card at its files field. |
| 289 | - **On the card,** every field is a quiet input, always editable, saved when it loses focus or when a picker closes. |
| 290 | - **Each change saves at once.** There is no per-row Save. |
| 291 | - One field, one `POST /cards/{id}/fields/{key}`, one `updated` event, one new card revision. |
| 292 | - The header's lead slot says "Saving…", then "Saved". |
| 293 | - A toast says "Stage changed to Won. Undo", for 10 seconds. |
| 294 | - **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. |
| 295 | - **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. |
| 296 | - **Entries do not edit.** A call log is a fact about a past moment (base §3). Click to edit applies to cards only. |
| 297 | |
| 298 | ### 5.2 Writes that do not cross |
| 299 | |
| 300 | **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)`. |
| 301 | |
| 302 | - **`was` is the canonical stored form**, as the server rendered it into the editor: `1200`, never `1,200` or `1.200`; money in minor units; option ids; a date as stored. It is never in the reader's format. The submitted value is read in the locale its page was drawn in and made canonical first (§6.8), then compared. |
| 303 | - **In order, inside the transaction:** |
| 304 | 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. |
| 305 | 2. If the field holds `was`, the write lands: one `updated` event, one new revision. |
| 306 | 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`. |
| 307 | - Two people editing different fields of one card never collide. |
| 308 | - **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. |
| 309 | - 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. |
| 310 | |
| 311 | ### 5.3 Undo |
| 312 | |
| 313 | - **Undo reverses one event,** by a new event. `POST /cards/{id}/undo` with the event id. |
| 314 | - **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). |
| 315 | - 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." |
| 316 | - A before value that can no longer be written is left and named: an option id the field no longer knows, a file since removed or swept (§7.4), a link to a card since deleted. A retired option is still known, so Undo can put it back. |
| 317 | - The new event is `updated`, by the person, with `trigger_id` naming the undone event and `redo` false. **Redo** is `POST /cards/{id}/undo` naming that Undo's event, by the same person, by the same rules; its event carries `redo` true. An Undo's own event is otherwise not undoable. |
| 318 | - 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. |
| 319 | - **⌘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. |
| 320 | - **With scripts off,** after the edit form saves, the card shows "Saved. Undo" with a one-button form. |
| 321 | - **Undo needs the event's sealed payload,** so it works only inside the value window (base §5). A toast is far inside it. |
| 322 | |
| 323 | ### 5.4 The card beside the list |
| 324 | |
| 325 | - **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. |
| 326 | - **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. |
| 327 | - **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). |
| 328 | - **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". |
| 329 | - **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. |
| 330 | - 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. |
| 331 | - **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. |
| 332 | - **Full page** opens `/cards/{id}`, as today. **Close** (✕ or Esc) returns to the list. |
| 333 | - **The list keeps its scroll** and the open card's row is marked (`aria-current="true"`, a left rule, and its background). |
| 334 | |
| 335 | ### 5.5 History on the card |
| 336 | |
| 337 | The mock-up's header has History. Base decision 2 ("versioned means we can see changes") has no screen today. This adds the smallest one. |
| 338 | |
| 339 | - **History**, in the card's header, opens a panel: each change, newest first, with who, when and which fields. |
| 340 | - **Inside the value window** each change shows before and after, in the reader's format (§6.8), and **Restore this value** per field. Restore is a new change, checked as in §5.2. |
| 341 | - **Past the window** a change shows only who, when and which fields. Base §5: the values are gone, so there is no restore. |
| 342 | - **Payloads from before a reconcile** (option labels before option ids, numbers before the grammar) are shown as the text they hold, with no Restore. |
| 343 | - With scripts off, History is a page, `/cards/{id}/history`. |
| 344 | |
| 345 | ### 5.6 Rejilla's keyboard in the cells |
| 346 | |
| 347 | With script, the table is one tab stop: an ARIA `grid` with a roving `tabindex`. |
| 348 | |
| 349 | | Key | Does | |
| 350 | |---|---| |
| 351 | | Arrows | move the active cell | |
| 352 | | Home, End | first and last cell in the row | |
| 353 | | ⌘↑, ⌘↓ | first and last row | |
| 354 | | Enter | edit the cell; in an editor, save and move down | |
| 355 | | ⇧Enter | in an editor, save and move up | |
| 356 | | Tab, ⇧Tab | in an editor, save and move right or left; otherwise leave the grid | |
| 357 | | a printable key | edit, replacing the value with what is typed | |
| 358 | | Esc | cancel the edit; again, leave the grid to the Find box | |
| 359 | | Space | tick or untick a checkbox; open a picker | |
| 360 | | Delete, Backspace | clear the value (with Undo) | |
| 361 | | ⌘C | copy the cell's text | |
| 362 | | ⌘V | paste text into the cell, read by its kind in the reader's locale (§6.8); a Choice must match an option | |
| 363 | | Enter on the name | open the card beside the list (the name is not edited in the grid, D1) | |
| 364 | | ⌘Z, ⌘⇧Z | undo, redo (§5.3) | |
| 365 | |
| 366 | - **Pasting a range of cells** is out (§12). |
| 367 | - **A long-text editor** takes Enter as a new line, and ⌘Enter to save, as the call log does today. |
| 368 | |
| 369 | ### 5.7 The scriptless floor |
| 370 | |
| 371 | **Every screen works with scripts off** (`AGENTS.md`). For editing: |
| 372 | |
| 373 | - **The table is a plain table.** The name links to the card. Every other cell is a link to the card's edit form with that field focused: `/cards/{id}/edit?field=<key>#<key>`. The 2026-11-12 stretched row link goes (D1). |
| 374 | - **The edit form** is today's, with every new kind's input (§6.5). It sends `was` for each field and saves only what changed (§5.2). It returns to the list it came from, with "Saved. Undo". |
| 375 | - **The card beside the list** is server-rendered. Its fields are a form with one Save button. Next and Previous are links. |
| 376 | - **Pickers** are `<select>`s, checkboxes and radio buttons (§6.5). |
| 377 | |
| 378 | ### 5.8 Phones |
| 379 | |
| 380 | - **The table becomes a list of rows**, as the mock-up shows: the title, the status pill, and the next two face fields. |
| 381 | - **Tapping a value** opens a bottom sheet with that field's editor, Save at its foot, and the same Undo toast. Tapping the title opens the card as its own screen, with ‹ › for previous and next. |
| 382 | - **The View panel** is a bottom sheet, a modal dialog with focus held inside it until it is closed. |
| 383 | - **Inputs are at least 16px,** so iOS does not zoom (`TestNoZoomOnTap`). Touch targets are at least 44px. |
| 384 | - **The board** scrolls sideways with scroll snap, one column at a time. **The calendar** is a list of days with cards for the month (an agenda), not a grid. |
| 385 | |
| 386 | --- |
| 387 | |
| 388 | ## 6. Field kinds |
| 389 | |
| 390 | ### 6.1 The kinds |
| 391 | |
| 392 | | Kind | Today | New | Value, as sealed | |
| 393 | |---|---|---|---| |
| 394 | | Text | yes | — | the text | |
| 395 | | Long text | yes | can be a column | the text, at most 20,000 characters (`maxLong`) | |
| 396 | | Number | yes | a format (§6.2) | a canonical decimal string: `-1200.5` | |
| 397 | | **Money** | — | new, a kind | integer minor units and nothing else: `4800000` for €48,000.00 | |
| 398 | | 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 `/` | |
| 399 | | Choice | yes | a tone per option; options get ids | the option's id (`o_` and hex), no longer its label (§6.2) | |
| 400 | | **Multi-select** | — | new | a JSON array of option ids, in option order, with no repeats. Normalised to that order when written, read and compared, so `was` never differs by order alone | |
| 401 | | **Checkbox** | — | new | `1`, or no value | |
| 402 | | **Person** | — | new | a JSON array of member ids | |
| 403 | | Web address, Email, Phone | yes | — | as today | |
| 404 | | **Link to…** | — | new (type designer slice D) | a JSON array of card ids | |
| 405 | | **Files** | — | new (§7) | a JSON array of file public ids | |
| 406 | |
| 407 | **Built-ins, shown as columns and filterable:** |
| 408 | - **Created** and **Edited** (`cards.created_at`, `updated_at`); |
| 409 | - **Created by** (`cards.owner_id`, provenance); |
| 410 | - **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; |
| 411 | - **Last call** (today's derived column). |
| 412 | |
| 413 | **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. |
| 414 | |
| 415 | ### 6.2 Kind settings |
| 416 | |
| 417 | Each kind's settings, a field's help text and whether it is required live in **`field_defs.sealed_settings`**, a JSON object sealed under its own purpose, `field.settings` (a type's under `type.settings`), so a key derived for one is never the key for another (§10.1). Each kind has a closed schema, and anything outside it is refused at write. |
| 418 | |
| 419 | - **Number:** `format`, one of `plain`, `grouped` (1,200), `decimals` with `places` 0–4, or `percent`. |
| 420 | - 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. |
| 421 | - A percent field stores what is shown: `50` is 50%. |
| 422 | - **What a Number accepts** is read in the reader's locale, by rastrillo's normalising reading with no currency (§6.8, R2). Input with exactly one plausible reading is accepted; input whose readings disagree is refused with both written out; nothing is guessed or rounded. At most 30 digits in all. `1e3`, `NaN`, `Inf`, `0x10`, letters, two decimal marks and malformed groups (`1,,2`, `12,.5`) are refused: "Enter a number, like 1200.5" (the example in the reader's format). Today `writeValues` strips every comma, so `1,5` becomes `15`; that changes. Revision 3's English-only grammar is gone (D22). |
| 423 | - **The canonical form,** which is what is stored, what `was` holds and what the URL and the suite see, whatever the reader's locale: no group marks, `.` as the decimal point, no leading zeros (`0.5`, never `00.5` or `.5`), no trailing fractional zeros (`1.5`, never `1.50`; `2`, never `2.0`), and never `-0`. |
| 424 | - **Money:** `currency`, an ISO 4217 code from rastrillo's storage set (EUR first). Fixed at creation, because the stored unit depends on it. `AGENTS.md`: money is integer cents. |
| 425 | - It is read by rastrillo's money field, `form.Money` with `LocaleEcho` (§6.8): the reader's locale, the field's own currency in any CLDR spelling at either end (`€48.000` in German, `48,000 EUR` in English), and another currency's spelling refused. |
| 426 | - A value with more decimal places than the currency allows is refused (`money_precision`), never rounded. |
| 427 | - It is stored as integer minor units in an int64 (rastrillo's range). |
| 428 | - **Values already stored:** a boot reconcile (`AppBecause(0, "number grammar")`) rewrites each stored **card** Number (`card_values`) to the canonical form, one logged event per card that changes. A value that does not parse (an old `1e3` is parsed and rewritten; a `NaN` is not) is left as stored, shown with "Not a number" beside it, and sorts last. It is the reconcile's only way to fail, and it fails visibly. **The reconcile uses no locale:** it reads stored text, which today's `writeValues` wrote with `.` as the decimal point and every comma stripped, never a person's input. So it is unchanged by §6.8. |
| 429 | - **Entry values are never rewritten.** `entry_values` are immutable (migration 0002's triggers abort an UPDATE, base §3), so a reconcile that touched them would fail boot. Stored entry numbers (a call's Duration) are read tolerantly, as today; entries written from now on are read as §6.8 reads any number. |
| 430 | - **Date:** `end` (allowed or not) and `time` (allowed or not). |
| 431 | - 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." |
| 432 | - **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. |
| 433 | - 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. |
| 434 | - **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. |
| 435 | - **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. |
| 436 | - Sorting and filtering use the start. "Is on or overlaps" is the calendar's test. |
| 437 | - **"The next N days" includes today;** "the last N days" includes today too. "This week" runs Monday to Sunday. |
| 438 | - **Choice and Multi-select:** options live in `sealed_options` as `[{id, label, tone, retired}]`. They are the team's words. |
| 439 | - **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. |
| 440 | - **Removing an option retires it.** Cards that hold it keep showing it; it is no longer offered in pickers or filters. |
| 441 | - **Today's Stage values are labels.** A boot reconcile (`AppBecause(0, "option ids")`), per field in one transaction, gives every option an id, **adds a retired option for any stored label no longer in the list**, rewrites each card's value from label to id (`card_values` only, one logged event per card), and writes `sealed_options` in its new shape last. The new shape is the done-marker, so a reconcile interrupted by a crash runs again whole. Entry values are never rewritten (above). Paul is the only user and the data is not real, so this is cheap now and would not be later. |
| 442 | - 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. |
| 443 | - **Person:** `multiple` (true or false). |
| 444 | - **Link to…:** `target` (the target type's opaque key) and `multiple`. The target never changes. |
| 445 | - **Files:** `images_only` (true or false). |
| 446 | |
| 447 | ### 6.3 What each kind can do |
| 448 | |
| 449 | | Kind | Filter | Sort | Group | Tier | |
| 450 | |---|---|---|---|---| |
| 451 | | Title (Name) | contains, is, is empty | A–Z | — | sealed + print | |
| 452 | | Text | contains, is, is empty | A–Z | — | sealed (print only by the Advanced override) | |
| 453 | | Long text | contains, is empty | — | — | sealed, never print | |
| 454 | | Number | =, ≠, <, ≤, >, ≥, between, is empty | numeric | — | sealed | |
| 455 | | Money | as Number | numeric | — | sealed | |
| 456 | | Date | is, before, after, between, relative (§4.4), is empty | by start | day, week, month, year | sealed | |
| 457 | | Choice | is, is any of, is none of, is empty | option order | yes | sealed, never print | |
| 458 | | Multi-select | has any of, has all of, has none of, is empty | — | yes, one group per option | sealed, never print | |
| 459 | | Checkbox | ticked, not ticked | ticked first | yes | sealed, never print | |
| 460 | | Person | is, is any of, is me, is empty | by name | yes | sealed, never print | |
| 461 | | Link to… | includes, is empty | by first linked title | yes, by linked card | sealed, never print | |
| 462 | | Web address, Email, Phone | contains, is, is empty | A–Z | — | sealed + print | |
| 463 | | Files | has files, has none | — | — | file names sealed; rows §7.3 | |
| 464 | | Created, Edited | as Date | yes | as Date | plaintext (structural, base §4.2) | |
| 465 | | Created by, Edited by | is, is any of, is me | by name | yes | plaintext member id (structural) | |
| 466 | | Last call | before, after, never | yes | — | derived from entries | |
| 467 | |
| 468 | - **"—" is a product choice, not a seal limit:** grouping by a free-text value is possible, and useless. |
| 469 | - **The print tier is only where base §4.1 allows:** high-cardinality values. Choice, Multi-select, Checkbox, Person and Link never print, because a few equality classes give the values away, and a link print would publish who links to whom (type designer §3). |
| 470 | - **No user field is ever plaintext** (base §4.3). The plaintext rows are the ones the app ships. |
| 471 | |
| 472 | ### 6.4 Search |
| 473 | |
| 474 | The Find box matches every value that **shows as text**: option labels, person names, linked cards' titles, file names, and dates as they are shown. It never reads a file's contents. |
| 475 | |
| 476 | - **Numbers and money match by value, in the reader's format** (§6.8). What a number looks like depends on who is reading, and the index holds one search text per card, so the index keeps each number and amount in canonical form only (`1200.5`; money as its canonical decimal, `48000`). The Find box is a GET and carries no locale echo, so its query is read in **the request's** locale: |
| 477 | - as a number, by R2, under every reading when it is ambiguous; |
| 478 | - and as money in each Money field's currency, so the field's own symbol or code is allowed (`€48,000`). |
| 479 | A reading matches a number or amount **equal** to it by value, never as a substring, so `48` does not find 1480. `1.200,5` typed in German and `1,200.5` in English both find 1200.5. A query that reads as a number still matches text too, as any query does. Built with the grammar, in Phase 2. |
| 480 | |
| 481 | ### 6.5 Inputs and pickers |
| 482 | |
| 483 | | Kind | With script | Without script | |
| 484 | |---|---|---| |
| 485 | | Choice | a listbox with search and tones | `<select>` | |
| 486 | | Multi-select | a listbox of checkable options with search | a checkbox per option | |
| 487 | | Person | a listbox of the team's people, with search; "Me" first | `<select>` (multiple when the field holds several) | |
| 488 | | Link to… | a search-as-you-type listbox of the target type's cards by title, then "New <target>" | a `<select>` up to 200 cards; past 200, a "Search and pick" page (`/cards/{id}/fields/{key}/pick?q=`) | |
| 489 | | Date | the date picker (§3.4); a time input when the field allows times; an end when it allows ends | `<input type="date">`, `type="time"`, a second pair for the end. The browser shows them in its own locale and posts ISO, which `form.Date` and `form.DateTime` read (§6.8) | |
| 490 | | Checkbox | a checkbox | a checkbox | |
| 491 | | Number | a text input, `inputmode="decimal"`, seeded in the reader's format (§6.8) | the same | |
| 492 | | Money | rastrillo's `field-money`: a text input with the currency's symbol and ISO code beside it, seeded with `form.SeedMoney` (§6.8) | the same | |
| 493 | | Files | §7.4 | a file input | |
| 494 | |
| 495 | - **A Link picker's "New <target>"** creates the target card with only its title, and links it, in one transaction with two events. |
| 496 | - **The people a Person field offers** are the admission list: `FICHAS_OWNERS` in the lone shape, and the home's roster once Fichas runs in team mode. Picking one finds or creates that member's row, in the same transaction as the write. |
| 497 | - A person is shown by their roster name where there is one. Until then (the lone shape has no names), by their address, with the part before `@` in cells and the whole address in the title attribute and the picker. |
| 498 | - A member who has left the admission list stays on the cards that name them, marked "no longer in the team" in the picker, and cannot be newly chosen. |
| 499 | |
| 500 | ### 6.6 Links between cards |
| 501 | |
| 502 | Type designer §3, with these changes: |
| 503 | - **The value** is the target card ids, sealed, never printed. |
| 504 | - **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. |
| 505 | - 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. |
| 506 | - Search over linked titles reads the targets' titles at query time through the link ids, so it needs no stored text. |
| 507 | - **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. |
| 508 | - **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`. |
| 509 | - The bump moves `revision` only, **not `updated_at` and not "Edited by"**: nobody edited those cards. The card's History shows it as "A linked card was deleted". |
| 510 | - 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. |
| 511 | - A linking card shows "deleted card" in place of the chip. |
| 512 | - **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. |
| 513 | - **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. |
| 514 | - **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. |
| 515 | - **A link to a card of another type** than the field's target, or to a gone card, is refused at write. |
| 516 | |
| 517 | ### 6.7 What the suite contract sees |
| 518 | |
| 519 | S3 (base §6.4) renders each new kind as text, **never in a reader's locale** (§6.8): |
| 520 | - numbers in canonical form: `1200.5`; |
| 521 | - money with its currency, in a fixed form: `EUR 48000.00`; |
| 522 | - 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.); |
| 523 | - a checkbox as `Yes`, and an unticked one as nothing; |
| 524 | - multi-select labels joined by `, `, retired options included; |
| 525 | - people by roster name, or by address in the lone shape; |
| 526 | - links by the live targets' titles, **leaving out a gone target entirely**; |
| 527 | - files by name. |
| 528 | |
| 529 | No bytes, no file id, no option id and no member or card id reach a sibling. |
| 530 | |
| 531 | ### 6.8 Formats: the reader's locale (revision 4) |
| 532 | |
| 533 | Paul, 2026-11-17: *"are we using Rastrillo's ability to localise things like numbers and currencies etc?"* Not until this revision. Fichas linked only `locales/en` (`render.go`), counted with its own `commas`, and revision 3 gave Number an English-only grammar of its own. From here, rastrillo is the one way Fichas writes and reads numbers, money and dates. **The interface stays English;** this is about formats only. |
| 534 | |
| 535 | **Nothing stored changes.** Numbers stay the canonical decimal string (§6.2), money integer minor units plus an ISO code, dates ISO. Sealed values, `was` (§5.2), the URL grammar (§4.9), event payloads, the suite contract's text (§6.7) and memoria's copy are canonical and locale-free, and a value never holds a reader's format. The number grammar's reconcile (§6.2) and the Notion import's mapping (§11: a Notion number is a JSON number, written canonically) are unchanged. The reader's locale applies at exactly two edges: drawing a value, and reading what a person typed. |
| 536 | |
| 537 | #### Which locale |
| 538 | |
| 539 | **Fichas follows Mapa's build note 85** (Mapa `feat/locale`, `3895499`, Fable APPROVED), so two Oficina apps never pick a reader's format two ways. rastrillo separates a page's **language** (its identity: the catalogs and the `/xx/` routes) from its **formatting locale** (`ui.Localizer`'s `Format`, the CLDR locale `{{number}}` and `{{money}}` write in). Fichas speaks one language, English, and offers six formats: **en-IE, en-GB, en-US, de, fr and es**, the locales Mapa's date patterns cover (below). Per request, in this order: |
| 540 | |
| 541 | 1. **The person's own choice,** when they made one (below). |
| 542 | 2. **The browser's `Accept-Language`, among the six,** matched by rastrillo's own negotiation (`Locales.Negotiate`, built with the team's locale first) handed **a request carrying that header and nothing else**. rastrillo's `Locales.Middleware` is not used: it would also take a `/de/` path prefix and its `rastrillo_locale` cookie over the header, and Fichas writes neither (Mapa's review round 8, M2). A region falls to its language (`de-AT` reads German, `fr-CA` French), and another English (`en-AU`, or a bare `en`) reads the team's when the team's is English. |
| 543 | 3. **The team's,** `FICHAS_LOCALE`, `en-IE` unless set. Boot refuses a value that is not CLDR's spelling (`en_IE`: "write en-IE"), is not one of the six, or is offered without its rastrillo pack linked (`locales.CheckConfig`). |
| 544 | |
| 545 | The locale's localizer is `ui.NewLocalizer(<code>, locales.Resolve(<code>).ID, t)`, where `t` is rastrillo's base catalog (`rastrillo.BaseCatalog()`) with its `{name}` substitution, so the framework partials' own strings and `form.Money`'s error keys stay English. The page's echo (below) carries the resolved id, which is what rastrillo's echo check accepts. **Fichas keeps rendering through `ui.Funcs`,** not `ui.Pages`, whose localizers are fixed per declared identity; so every page's data carries `L` (and the date formatter, `D`), every locale function in every template is called with them, and a call without `L` silently formats in English. LU17's template check is what enforces that. Today's `commas` retires. |
| 546 | |
| 547 | - **The packs linked** are the six's: `locales/en`, `de`, `fr` and `es`, as Mapa's. |
| 548 | - **The person's own choice,** Phase 2, as Mapa's: "Date and number format" in a settings page under the account menu, a select whose first option is "Your browser's: <name>" and then each of the six, named in English with today written its way. `POST /settings/format` keeps the code sealed on the member row (`members.sealed_locale`, its own seal purpose), logs `member` `locale_set`, refuses a code not offered (422), and writes nothing when the choice is unchanged; a stored code no longer offered reads as unset. No cookie. |
| 549 | - **The browser's locale is never logged, stored or put in a URL; a chosen one is stored only sealed.** Neither is ever sent to a sibling. |
| 550 | |
| 551 | #### Display |
| 552 | |
| 553 | | What | Through | Where | |
| 554 | |---|---|---| |
| 555 | | Counts: "7 of 10 customers", "2 of 7", group counts, a file count | `{{number $L n}}` | every count Fichas draws | |
| 556 | | Number values | until R1: the canonical string with the pack's decimal mark (below); from R1: `{{number $L v}}`, the field's format (§6.2) as options | table cells, the card, the narrowed list, board and calendar cards, the caption, the View panel, History, toasts, the conflict message | |
| 557 | | Money | `{{money $L minor code}}` | the same places | |
| 558 | | Dates and times | Mapa's CLDR 48 date patterns, in the reader's locale, in the team's zone (below) | the same places, and "Edited 2 days ago" | |
| 559 | |
| 560 | - **Number values need R1, and wait for it.** rastrillo's `number` today formats through `x/text`, whose CLDR data is older than the packs' and disagrees with them on marks in dozens of locales (in Spanish and French, below). A value drawn by one and read by the other could come back a thousand times wrong, silently; among the six, rastrillo's `number` writes `1.234` in Spanish and U+00A0 in French where CLDR 48 writes `1234` and U+202F (Mapa's round 8, L3, reported for rastrillo). So **until R1, Fichas draws a number value from the pack's data alone, in the form it reads:** the canonical digits, the pack's ordinary decimal mark (`locales.Locale.Decimal`), no group marks, ASCII digits and an ASCII minus: `1200,5` for a German reader, `1200.5` for an Irish one. That is exact to 30 digits and is today's ungrouped display, so it is also what `plain` (§6.2) means until Phase 4 brings the other formats. From R1, display and reading share the packs, and grouping returns. |
| 561 | - **Counts stay on `{{number $L n}}`** (`x/text`), which groups them: a count is never read back, so its marks cannot be misread. |
| 562 | - **Dates use Mapa's patterns and formatter, copied** (build note 85): rastrillo's packs carry number and money data and **no date patterns**, so Mapa carries CLDR 48's date patterns itself (`internal/mapa/locale/dates.json`, generated from ICU 78.3 by `make locale-dates` and checked against it for every day of 2024 to 2026) with one interpreter (`locale/format.go`). Fichas copies that package, `dates.json` and its tests, with attribution, into `internal/fichas/locale`, and regenerates nothing itself: a change comes from Mapa. **It should move into rastrillo** (R3) so no third copy is ever made. What a reader sees: a date in the locale's own pattern and names ("Fri, 20 Nov", "Freitag, 20. November 2026", "Friday, November 20, 2026"), a time in its own cycle ("21:09", "9:09 PM"), in the team's zone (Fichas has no per-reader zone, unlike Mapa). |
| 563 | - **Week start: two rules, kept apart.** A calendar grid and the picker's columns (Phase 3) start on the reader's locale's first day, as Mapa's do. But **"this week", "last week" and "next week" in a filter, a relative token or a group run Monday to Sunday in the team's zone for every reader** (§6.2): a team view must return the same cards to an en-US reader as to an Irish one. Mapa could move its week wholly to the locale because it has no other "this week". |
| 564 | - **What stays as it is:** `<html lang>` stays `en`; Fichas passes rastrillo no `Locales`, so no `/_locale` switcher is mounted; the error page draws in the team's locale. Interface words stay English ("in 3 days", "yesterday", "ago", "Edited by"), so a German reader's "Edited by niamh 2 days ago" mixes languages by design, as Mapa's does. Relative words run to two weeks either side; past that, the locale's date; every `<time>` carries the full date (and, for a moment, the time) in its title. |
| 565 | |
| 566 | #### Input |
| 567 | |
| 568 | Each input is read in **the locale the page was drawn in**, which the form echoes (`<key>.locale`, as rastrillo's `LocaleEcho` does), never the locale the request would negotiate now: a person who changes their choice in another tab must not have `1.500` read the other way. An echo that is not one of the six offered locales' resolved ids is refused with "Enter the value again", as rastrillo's `money_reenter` is: a pack links many regions (`locales/en` links `en-ES`, `locales/de` links `de-CH`), and Fichas never draws a page in those. |
| 569 | |
| 570 | - **Numbers** are read by **R2**, rastrillo's normalising money reading (rastrillo's multi-currency money spec, §5.1 and Paul's decisions 22 and 23) with no currency spelling and no exponent: |
| 571 | - **One plausible reading is accepted,** whatever the locale: `1,200.5` and `1200,5` in English, `1.200,5` and `1200,5` in German, `1 200,5` in French, `1’200.5` in Swiss German, `1,20,000` anywhere (Indian grouping). |
| 572 | - **The page's own group mark wins** (decision 23): `1,500` in English is 1500, and `1.500` in German is 1500. |
| 573 | - **Readings that disagree are refused, and both are written out:** exactly when the only separator is one `.` or `,` with one to three digits before it and exactly three after it, and the reader's locale does not group with it: `1.500` in English, `1,500` in German or French. "This could be 1.5 or 1500. Enter the one you mean." (rastrillo's `money_ambiguous`, each choice written so it cannot be misread: no group marks, and a fourth fraction digit where exactly three would remain.) Nothing is written. |
| 574 | - **The accepted cost,** rastrillo's own: German `1,500` meaning one and a half, pasted into an English page, is 1500. Undo is in the toast. |
| 575 | - **Signs:** R2 takes signs as rastrillo's money reading does (a leading `+`, `-` or U+2212, a trailing `-` or U+2212, or parentheses around the whole value). The interim reading takes a leading `-`, U+2212 or the locale's own minus, after bidi marks are removed. |
| 576 | - **Kept from revision 3:** exact decimals (`math/big`, never floats), at most 30 digits, nothing rounded, the canonical form, and refusal of exponents, `NaN`, `Inf`, hex, letters, two decimal marks and malformed groups. |
| 577 | - **Changed from revision 3** (D22): input with one reading is no longer refused for being un-English. `1,5` in an English page is 1.5, its only reading; `1.200,50` is 1200.5; `+5` is 5, as rastrillo's sign rules read it. Money and Number now read input by one rule, so one table never reads `1.500` two ways. |
| 578 | - **The seed** an editor starts from is the value in the reader's format **without group marks** (rastrillo's `currency.InputValue` rule: a group mark is what can make the same digits mean a thousand times more under another reading): `1200,5` for a German reader. **An unchanged seed is no change:** when the posted text equals the seed of `was`, the value is `was`, with no reading at all, as `form.Money`'s `Stored` rule keeps an ambiguous seed. So `1,234` (one point two three four, in German) saves untouched. |
| 579 | - **Money** is rastrillo's money field end to end: `form.Field{Kind: form.Money, Currency: <the field's code>, LocaleEcho: true}`, `parsed.Minor`, `form.SeedMoney` for the seed, `Stored` set to the posted `was` in minor units (nil when `was` is empty), so an unchanged seed of the value the editor saw is kept and the transaction's compare (§5.2) decides the rest, `Negative: true` (revision 3 allowed a minus; a refund is money too), and the `field-money` partial, in the scriptless form and the cell editor alike. The currency is always the server's; a posted currency that differs is refused (`money_currency_changed`). Decimals past the currency's are `money_precision`. |
| 580 | - **Dates and times** need no locale: `<input type="date">` and `type="time"` show the date in the browser's own locale and post ISO, and the picker (§3.4) posts ISO too. `form.Date` and `form.DateTime`, with `Field.Location` the team's zone, read it. **A date typed in numbers** (the picker's text box, Phase 3) is read as Mapa's picker reads one: either separator (`/` or `.`), in the reader's order. `12/11` is 12 November in en-IE and December 11 in en-US; `12.11.2026` in German; a four-digit year first is year, month, day anywhere. A two-digit year, a mixed separator, a fourth part, a sign and a day that does not exist read as no date. Gated in Phase 3 with Mapa's shared cases. |
| 581 | - **The cell edit posts a form-encoded body, never JSON,** with the same names as the form (`<key>`, `was.<key>`, `<key>.locale`, and money's `<key>.seed` and `<key>.currency`), because rastrillo's `form.Parse` reads posted form values; it gets JSON back. A number posts no seed: its unchanged-seed check is computed on the server from `was.<key>` and the echoed locale, so no posted seed is ever trusted. So one reading serves both, and `was` is compared only after the value is read and made canonical (§5.2). The cell text it returns is drawn in the echoed page locale, not the request's. |
| 582 | - **Everywhere else a person types a value** reads it the same way: a filter value in the View panel (posted and turned into a canonical URL, §4.1), and a paste (⌘V, §5.6). **The Find box is the exception:** it is a GET, so it carries no echo, and its query is read in the request's locale, under every reading (§6.4). |
| 583 | |
| 584 | #### What rastrillo needs |
| 585 | |
| 586 | Checked against the version Fichas pins (`v0.35.1-0.20261116213651-96812beacacc`) and rastrillo's `main` (`70413911`, v0.36.0 release prep), which adds nothing here. **Phase 1 needs no newer rastrillo. Phase 2 does,** for R1 and R2. |
| 587 | |
| 588 | | # | What | Why rastrillo, not Fichas | Needed by | |
| 589 | |---|---|---|---| |
| 590 | | R1 | `{{number $L x}}` reads the packs: a canonical decimal string formatted exactly, with options for grouping, minimum fraction digits and percent. The packs gain the plain-number group mark and the percent pattern | rastrillo's money spec lists "`{{number}}` and dates reading the packs" as its own follow-on (§13, decision 7), with `x/text`'s drift from CLDR recorded (Appendix A.5) | Phase 2, before the grammar. Until then, ungrouped values from the pack's decimal mark (above) | |
| 591 | | R2 | A plain number reading: `number.ParseNormalized(locale, s) (string, error)` returning the canonical decimal, a strict `number.Parse`, an `AmbiguousError` with `Choices`, and `form.Number` (`LocaleEcho`, `Strict`, `Stored`) with a `field-number` partial | It is money's §5.1 with no currency and no exponent, so it shares `currency`'s tokenizer, conventions and groupings rather than copying them; a copy in Fichas would drift from money's, and one table would read `1.500` two ways. rastrillo's money spec lists "a plain numeric field kind" as follow-on work too | Phase 2's grammar. Built first, on a rastrillo branch, reviewed there and pinned | |
| 592 | | R3 | CLDR's date and time patterns in the packs, with one formatter: Mapa's `locale` package and `dates.json`, moved into rastrillo | The same packs, the same follow-on; Mapa and Fichas each carry a copy until then, and a third app must not | Nothing blocks on it. Until it lands, the copy (above) | |
| 593 | | R4 | The header-only negotiation above, for a one-language app (`Locales.Negotiate` on a bare request, which Mapa and Fichas each build by hand) | Every Oficina app has one language and readers in several countries | Nothing blocks on it | |
| 594 | |
| 595 | **Phase 1 reads numbers without R2.** Phase 1 edits today's kinds in place, Number among them, before the grammar. Its interim reading is the **strict** one, the reader's own convention only, as rastrillo's `Strict` money fields read, on the same pack data Phase 1 draws numbers from: |
| 596 | - digits (ASCII, or the locale's own ten); the pack's ordinary decimal mark (`Decimal`) at most once; and a leading minus; |
| 597 | - every space a person can type (space, no-break space, narrow no-break space) is one mark, and U+0027 is U+2019, as rastrillo's `Clean` and parser treat them; |
| 598 | - the pack's group mark (`CurrencyGroup`, the only one the packs carry until R1) only at valid group positions of the pack's grouping, and **not at all** where that mark is also a decimal mark in the locale (`CurrencyGroup` equal to `Decimal`, or `CurrencyDecimal` differing from `Decimal`, as in `fr-CH`). So `1,200` from an English reader is 1200, and no mark is ever read both ways. |
| 599 | |
| 600 | One convention means one reading, so it cannot be ambiguous; it never rounds, and it writes the canonical form. Phase 1 draws numbers without group marks, so nothing it draws depends on the group mark being read right. It is built on rastrillo's locale data (`locales.Resolve` and `locales.Data`), in one file, and is deleted when R2 lands in Phase 2. Anything it refuses gets "Enter a number, like 1200,5." in the reader's format. A test holds that every number Fichas draws and every seed, in every offered locale, read back through it as the same value. |
| 601 | |
| 602 | --- |
| 603 | |
| 604 | ## 7. Files and images (Q6) |
| 605 | |
| 606 | Mapa images' decisions, reused for Fichas files. Where Mapa's spec decides, this section cites it; where Fichas differs, it says why. |
| 607 | |
| 608 | ### 7.1 Decisions |
| 609 | |
| 610 | | # | Decision | From Mapa images | |
| 611 | |---|---|---| |
| 612 | | F1 | **Bytes are sealed in Fichas, under Fichas' DEK, before they leave the process.** New seal purposes `file`, `file.record` and `file.thumb`. Plaintext is padded to the next 64 KiB before sealing. Stored as `application/octet-stream` | decision 1 | |
| 613 | | F2 | **Readers get files only through Fichas**, at `GET /files/{id}` and `/files/{id}/thumb`. Never presigned, never public | decision 2 | |
| 614 | | F3 | **The object key is the SHA-256 of the ciphertext.** Every seal draws a fresh nonce. The bytes read are checked against the key before opening | decision 3 | |
| 615 | | F4 | **Development and tests use `blobs.Dir`.** Production with no store boots, and upload answers 503: "Files aren't set up on this Fichas yet". A partial store boots too, with a loud log | decision 4 | |
| 616 | | F5 | **Any file type may be stored, up to 25 MiB.** Only PNG, JPEG, GIF and WebP are shown inline, and only after Mapa's metadata walker. Everything else downloads as an attachment | Mapa takes images only, at 10 MiB. Fichas holds proposals, contracts and floor plans (the mock-up), so it takes files; 25 MiB is Q6's figure | |
| 617 | | F6 | **Thumbnails are made in the app**, sealed, and stored as their own objects | Mapa makes no display copies (its §9). A card's file list needs previews, and a bucket service cannot read ciphertext | |
| 618 | |
| 619 | ### 7.2 Safety |
| 620 | |
| 621 | - **Types are decided from the bytes**, never from the name or the claimed type. |
| 622 | - **Inline images** follow Mapa images §5 exactly: the format allowlist, `DecodeConfig` limits (10,000 px a side, 50 MP), and the metadata walker. SVG is never inline; it downloads. |
| 623 | - **The walker is shared, never copied.** Whichever of Mapa and Fichas builds first puts the sniffing and the walker in rastrillo (`rastrillo/imagesafe`), and the other adopts it. Two copies would drift, and the second would miss the next fix. |
| 624 | - **Other files are stored as uploaded.** A PDF's author, or a document's tracked changes, stay in it. Help says so. |
| 625 | - **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). |
| 626 | - An allowlisted image is `inline`, with its sniffed type. |
| 627 | - Anything else is `attachment`, with `application/octet-stream` and the sealed file name in an RFC 5987 `filename*`. |
| 628 | - **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. |
| 629 | - 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. |
| 630 | - **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. |
| 631 | - 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. |
| 632 | - Larger images, and every other file, show a type icon. |
| 633 | - **Memory, in three bounds:** |
| 634 | - **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. |
| 635 | - **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`. |
| 636 | - **Decoding** for thumbnails: the one-at-a-time semaphore above, inside the blob budget, weighted by the decoded size (width × height × 4 bytes, from `DecodeConfig`), not by the file's size. |
| 637 | |
| 638 | ### 7.3 The `files` table |
| 639 | |
| 640 | | Column | Plaintext? | Why | |
| 641 | |---|---|---| |
| 642 | | `id` | yes | the row's key | |
| 643 | | `public_id` | yes | the URL's id: random base 36, never sequential | |
| 644 | | `card_id`, `field_def_id` | yes | where it is; structural (base §4.1 case 2). Scope is "the card is not gone" | |
| 645 | | `owner_id` | yes | who uploaded it. Member id, provenance, as `cards.owner_id` | |
| 646 | | `created_at` | yes | ordering and retention | |
| 647 | | `detached_at` (nullable) | yes | when it was taken off its card's field. Retention runs over it | |
| 648 | | `stored_bytes` | yes | the ciphertext's size, padded to 64 KiB, for the quota | |
| 649 | | `object_key`, `thumb_key` | yes | bucket keys: hashes of ciphertext | |
| 650 | | `sealed_record` | sealed | the file name, the sniffed type, the true size, and an image's width and height | |
| 651 | |
| 652 | `file_trash (object_key, queued_at)` is the delete queue, as Mapa's `image_trash`. |
| 653 | |
| 654 | **One invariant, one writer.** For every Files field of every card: **the value's ids are exactly the file rows for that card and field with `detached_at` null**, in the value's order. Every write that touches a Files field (attaching an upload, taking off, Undo, Restore this value, Remove from Fichas, the importer's `AttachFile`) goes through one store function, `setFiles`, which writes the value, stamps or clears `detached_at`, bumps the revision and logs, in one transaction. A test walks every write path and checks the invariant after each (LU13). |
| 655 | |
| 656 | **What `setFiles` accepts:** only ids whose row is on **this card and this field**. |
| 657 | - A person's edit (`SetField` on a Files field, the edit form) may only **reorder or drop** ids that are attached now. |
| 658 | - **Adding** is an upload's attach only (below). |
| 659 | - **Re-adding a detached id** is Undo or Restore this value only. |
| 660 | - Any other id (another card's file, a detached file named by hand, a stored file not yet attached) is refused, as an unknown value is. |
| 661 | |
| 662 | ### 7.4 Getting files in, and out |
| 663 | |
| 664 | - **On the card:** "Add a file, or drop one here". With script: pick, drop or paste, several at once, each with a `<progress>`. Without: an **Upload** form of its own, `multipart/form-data`, under the card's files and on the edit page, separate from the edit form so a file never rides with the field values. |
| 665 | - **In the table:** a Files cell shows a count and the first thumbnail. Clicking it opens the card at its files. |
| 666 | - **Upload** is `POST /cards/{id}/fields/{key}/files`, multipart, bounded by `http.MaxBytesReader` at 25 MiB plus the form. **It is `StoreFile` then `AttachFile`**, the same two steps the importer uses (§11), so one path holds every upload's guarantees: |
| 667 | 1. **`StoreFile`, outside any transaction:** check, strip (images), seal, and make the thumbnail. Then **write the `file_trash` rows first** (one for the file's object key, one for the thumbnail's, each with `queued_at` 24 hours ahead), and only then `Put` the objects. A crash at any point leaves at worst a trash row for an object that may or may not exist, which the sweep deletes. |
| 668 | 2. **`AttachFile`, in one transaction** through `setFiles`: re-check the quota; **delete the file's trash rows, and require that the delete removed exactly those rows**, or fail with `ErrFileExpired` (the sweep got there first) and write nothing; write the file row; add its id to the field's value; bump the card's revision; log `updated` on the card with `file_added` in its payload. |
| 669 | - **The sweep claims before it deletes.** For each due trash row it deletes the row in its own transaction, and only if that delete removed the row does it delete the object. So the sweep and `AttachFile` can never both win: an object is deleted only once its trash row is gone, and an attached file's trash row was removed by its attach. |
| 670 | - **The trash rows written by `StoreFile`** are bookkeeping for objects not yet in any card, and log no event (§9). |
| 671 | - **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. |
| 672 | - **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`: |
| 673 | - 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); |
| 674 | - deletes the row, queues the object in `file_trash`, and logs `removed` on the file. |
| 675 | 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). |
| 676 | - **What `GET /files/{id}` serves,** to anyone admitted (base §6.1: every member reads every card and its history): |
| 677 | - an attached file of a card that is not gone; |
| 678 | - a detached file that is still kept (§7.5), because History and Undo show it. |
| 679 | - **`/files/{id}/thumb` follows exactly the same rules**, and answers 404 for a file with no thumbnail. |
| 680 | - **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. |
| 681 | - **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. |
| 682 | |
| 683 | ### 7.5 Retention, quota and the store |
| 684 | |
| 685 | - **A detached file is kept for the value window** (base §5), so Undo and History can bring it back, and **it counts against the quota** until it is swept or removed. Past the window the sweep deletes it. |
| 686 | - **The value window** is built in Phase 1 (Q11), before files exist, so Phase 5's files start with it. |
| 687 | - **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. |
| 688 | - **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." |
| 689 | - **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). |
| 690 | |
| 691 | --- |
| 692 | |
| 693 | ## 8. The type designer |
| 694 | |
| 695 | Draft 2 on `origin/design/type-designer` is the design. This section records what this spec changes in it, and nothing else. |
| 696 | |
| 697 | ### 8.1 Folders and icons (slice A) |
| 698 | |
| 699 | 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. |
| 700 | |
| 701 | **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). |
| 702 | |
| 703 | ### 8.2 The steps (slices B and C) |
| 704 | |
| 705 | As draft 2 §2, at its URLs, every step a server-rendered page with its own URL, scriptless, held in a sealed `type_drafts` payload. |
| 706 | |
| 707 | 1. **Start:** Describe it (when the assistant is configured), a template, or blank. |
| 708 | 2. **Name and look:** singular and plural, icon, folder, a one-line description. |
| 709 | 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). |
| 710 | 4. **Status and card:** the status field, the card face, and the default sort, which becomes the type's first team view (§4.3). |
| 711 | 5. **Review and create:** one transaction, every row logged. |
| 712 | |
| 713 | **Changes from draft 2:** |
| 714 | - **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. |
| 715 | - **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. |
| 716 | - **Step 4's default sort** makes the type's "All <plural>" team view, rather than a setting on the type. |
| 717 | - **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. |
| 718 | - **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. |
| 719 | |
| 720 | ### 8.3 Templates (R4) |
| 721 | |
| 722 | | Template | Fields | |
| 723 | |---|---| |
| 724 | | **People** | Name (title, print), Email (print), Phone (print), Role (text), Notes (long text) | |
| 725 | | **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) | |
| 726 | | **Projects** | Name (title, print), Status (Choice: Idea, Planned, Active, Done, Dropped), Owner (Person), Start (Date), Due (Date), Notes | |
| 727 | | **Products** | Name (title, print), Status (Choice: Idea, Designing, Building, Launched, Retired), Category (Choice), Price (Money, EUR), Launch date (Date), Notes | |
| 728 | | **Applications** | Applicant (title, print), Email (print), Programme (Choice), Status (Choice: Received, Reviewing, Shortlisted, Accepted, Declined), Received (Date), Files (Files), Notes | |
| 729 | |
| 730 | Every field takes its kind's default tier (`DefaultTier`). No template field is plaintext. |
| 731 | |
| 732 | **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). |
| 733 | |
| 734 | ### 8.4 Customer gains Contacts (R5) |
| 735 | |
| 736 | - **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. |
| 737 | - **Customer gains Contacts** (`f_contacts`), a Link to People, several. Seed adds a missing field, as it does today; it refuses to boot on a changed kind or tier, as today. |
| 738 | - Today's Customer has Email and Phone of its own. They stay. Moving them onto People is a choice for Paul once Contacts is in use. |
| 739 | |
| 740 | ### 8.5 Describe it (slice E, R3, R6) |
| 741 | |
| 742 | As draft 2 §4: DeepSeek V4 Flash on TensorX through Slides' client, the sentence and the team's type and field labels sent, **never card values**, the answer validated as untrusted input and only ever a draft, nothing made until Create, a 20 s timeout, a rate limit, one log line with no sentence and no answer. |
| 743 | |
| 744 | - **The key is Fichas' own:** `FICHAS_TENSORX_API_KEY` (R6), from 1Password (Tito account, Oficina vault, "Fichas TensorX Key"). Paul runs the `carlos secrets set` himself, because `op` is not signed in from the agent's session. Unset, the Describe card is not offered. |
| 745 | - **What it may draft** is §6.1's kinds and settings, so a draft can hold a Link between two new types, a Person, money, and dates with ends. |
| 746 | |
| 747 | --- |
| 748 | |
| 749 | ## 9. Events |
| 750 | |
| 751 | **Every write lands an event in the same transaction** (base §5; the index's change feed depends on it, `index.go`). This is the full list of writes this level-up adds. |
| 752 | |
| 753 | | Write | object_kind | kind | ChangedFields | Payload (sealed) | |
| 754 | |---|---|---|---|---| |
| 755 | | A field edit (cell, card, board move, calendar move) | `card` | `updated` | the field | before, after, `undoable` | |
| 756 | | Undo, Redo, Restore this value | `card` | `updated`, `trigger_id` = the undone event | the fields | before and after | |
| 757 | | New target from a link picker | `card` | `created`, then `updated` on the linking card | — / the field | values | |
| 758 | | 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 | |
| 759 | | File added, taken off | `card` | `updated` | the field | before and after ids, `file_added` or `file_detached`, `undoable` | |
| 760 | | File removed now | `card` `updated` (if it was attached), then `file` `removed` | | the field / — | the ids on the card event; **no payload** on the file event, so the name of a file removed for being wrong is not kept in the log | |
| 761 | | Option renamed, retired, given a tone | `field` | `updated` | — | before and after options | |
| 762 | | 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>")` | |
| 763 | | A person's own format set or cleared (§6.8) | `member` | `locale_set` | — | none: the actor and that it happened, as Mapa's | |
| 764 | | View created, changed, renamed, reordered, made a team view, deleted, restored | `view` | `created`, `updated`, `deleted` | — | before and after payload; `undoable` false on the scope move | |
| 765 | | Folder created, renamed, reordered, deleted; a type moved | `group`, `type` | `created`, `updated`, `deleted` | — | before and after | |
| 766 | | Type and fields created by the designer | `type`, `field` | `created` | — | as today | |
| 767 | | Type settings (icon, description, status field, sections) | `type` | `updated` | — | before and after | |
| 768 | | Field settings and help | `field` | `updated` | — | before and after | |
| 769 | | A draft made by the assistant | `draft`, object id 0 | `drafted` | — | none: the actor and that it happened | |
| 770 | |
| 771 | - **The suite feed** (S1) is unchanged: it reads `object_kind = card` events only. New object kinds are not items. |
| 772 | - **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: |
| 773 | - `view`, `file`, `draft` and `member` events change nothing the index holds, and are skipped; |
| 774 | - `group` and `type` settings events reload that type's metadata (label, icon, folder), not its cards; |
| 775 | - `field` events reload that one type (labels, options, settings); |
| 776 | - 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). |
| 777 | - **Named exemptions**, as Mapa names retention: |
| 778 | - **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. |
| 779 | - **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. |
| 780 | - **`StoreFile`'s trash rows** (§7.4) log nothing: they are bookkeeping for an object no card holds yet. The attach that follows logs. |
| 781 | - **Preference cookies** (density, panel, rail, last view) write no row. |
| 782 | - **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. |
| 783 | |
| 784 | --- |
| 785 | |
| 786 | ## 10. The seal boundary |
| 787 | |
| 788 | ### 10.1 New columns |
| 789 | |
| 790 | | Table | Plaintext columns | Sealed columns | Case (base §4.1) | |
| 791 | |---|---|---|---| |
| 792 | | `type_groups` | `id`, `key`, `ordinal`, times | `sealed_label` | 2, 4 | |
| 793 | | `card_types` (new columns) | `group_id` | `sealed_settings` (purpose `type.settings`): icon, description, sections, status field | 2 | |
| 794 | | `field_defs` (new columns) | — | `sealed_settings` (purpose `field.settings`): the kind's settings, required, help text. Options gain ids, tones and `retired` inside `sealed_options` | — | |
| 795 | | `members` (new column) | — | `sealed_locale` (purpose `member.locale`): a person's own format, Phase 2 | — | |
| 796 | | `views` | `id`, `key`, `card_type_id`, `scope`, `owner_id` (personal only), `ordinal`, `revision`, `gone`, times | `sealed_payload` (purpose `view.payload`) | 2, 4 | |
| 797 | | `type_drafts` | `id`, `member_id`, times | `sealed_payload` (purpose `draft.payload`) | 2 | |
| 798 | | `files` | §7.3 | `sealed_record` | 2 | |
| 799 | | `file_trash` | `object_key`, `queued_at` | — | 2 | |
| 800 | |
| 801 | - **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. |
| 802 | - **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. |
| 803 | - **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. |
| 804 | - **`TestNoPlaintextColumnEscapesTheAllowlist`** names every new plaintext column with its case. The file gate's canaries grow (LU1). |
| 805 | |
| 806 | ### 10.2 What the durable file shows that it did not |
| 807 | |
| 808 | To be added to the leak list in the README: |
| 809 | - the number of saved views per type, which are personal, whose they are, and when each changed; |
| 810 | - the number of folders and which types are in each; |
| 811 | - 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; |
| 812 | - 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; |
| 813 | - that a person has drafts in progress, and when; |
| 814 | - that a person set their own format, and when (the `locale_set` event and the row's `updated_at`), never which; and a `members` row may exist for someone who has only set a format. |
| 815 | |
| 816 | **Outside the file:** |
| 817 | - **The reader's formatting locale** (§6.8) is in their browser's `Accept-Language`, which Fichas never logs or stores. A format a person chooses (Phase 2) is sealed on their member row; the file shows only that the row has a sealed value. |
| 818 | - **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. |
| 819 | - **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). |
| 820 | - **CARLOS' bucket** holds padded ciphertext and its sizes (§7). |
| 821 | - **The app's own log** never records a query string, a file name or a value (LU7). |
| 822 | |
| 823 | ### 10.3 The in-memory index |
| 824 | |
| 825 | - **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. |
| 826 | - **It is still fed only by the event log.** Every write above logs, and §9 says what each kind of event reloads. |
| 827 | - **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. |
| 828 | - **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. |
| 829 | |
| 830 | --- |
| 831 | |
| 832 | ## 11. What the Notion import needs (Q9) |
| 833 | |
| 834 | The importer's §17 sketches phase 2. This level-up gives it each thing it asks for. The mapping in that sketch is revised as follows, and the importer spec takes this table when it writes phase 2. |
| 835 | |
| 836 | | Notion property | Fichas | Changed from the sketch | |
| 837 | |---|---|---| |
| 838 | | `title` | the title field | — | |
| 839 | | `rich_text` | Text, or Long text over one line | — | |
| 840 | | `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. Notion's API gives a JSON number, decoded as `json.Number` (never through a `float64`, which is inexact past 15 digits), exponents expanded, and written in canonical form: no locale reads it (§6.8) | the sketch left format open | |
| 841 | | `select` | Choice, colours as tones | — | |
| 842 | | `status` | Choice, marked as the type's status | — | |
| 843 | | `multi_select` | **Multi-select** | was Text | |
| 844 | | `date` | Date, with end and time turned on for the field when any row uses them | the sketch left ranges and times open | |
| 845 | | `checkbox` | **Checkbox** | was a Yes / No Choice | |
| 846 | | `url`, `email`, `phone_number` | Web address, Email, Phone | — | |
| 847 | | `people` | **Person**, each Notion user mapped to a team member by the importer on the import page; an unmapped user goes into a companion Text field, "<field> (from Notion)" | was a Link to People by name | |
| 848 | | `relation` | Link to… the type the related database became | — | |
| 849 | | `files` | **Files**, downloaded through the importer's file transport, stored by `StoreFile` and attached by `AttachFile` (below); external files stay as links in a Text field | was not imported | |
| 850 | | `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" | — | |
| 851 | | `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 | |
| 852 | | `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 | |
| 853 | | `unique_id` | Text, print, so Notion's numbers survive | — | |
| 854 | | `button`, `verification`, `place` | not imported; `place` as Text | — | |
| 855 | |
| 856 | **Every value the importer writes is canonical** (§6.2): it calls the store functions below with canonical numbers, minor units and ISO dates, never text to be read in a locale. |
| 857 | |
| 858 | **A row's page body goes into the card's Notes** (Q9), a Long text field the importer adds when the type has none. |
| 859 | - 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)". |
| 860 | - A body over 20,000 characters is cut at a paragraph and counted in the run report. Nothing is dropped silently (importer D10). |
| 861 | |
| 862 | **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: |
| 863 | |
| 864 | ```go |
| 865 | // ImportTx runs fn inside one store transaction. Every write below, |
| 866 | // called on tx, logs its events in that transaction, and fn may write |
| 867 | // the importer's own rows (its map) beside them. Nothing lands unless |
| 868 | // fn returns nil. |
| 869 | func (s *Store) ImportTx(ctx context.Context, actor Actor, fn func(tx *ImportWriter) error) error |
| 870 | |
| 871 | func (w *ImportWriter) CreateModel(m Model) (ModelResult, error) // §8.2's Create; the store's limits (§8.2), not the assistant's. |
| 872 | // ModelResult maps each draft type and field to its key, and each option to its id |
| 873 | func (w *ImportWriter) AddField(typeKey string, spec FieldSpec) (FieldDef, error) // a field added to a type the import made earlier (Notes, a companion Text, "From Notion" fields); returns its key and option ids |
| 874 | func (w *ImportWriter) CreateCard(typeKey string, values map[string]string, createdAt time.Time) (Card, error) |
| 875 | func (w *ImportWriter) SetField(cardID int64, key, value, was string) error // §5.2 |
| 876 | func (w *ImportWriter) CreateView(typeKey string, v ViewPayload, scope string) (View, error) |
| 877 | func (w *ImportWriter) AttachFile(cardID int64, key string, f StoredFile) error // through setFiles (§7.3) |
| 878 | |
| 879 | // StoreFile does §7.4's step 1 OUTSIDE any transaction: checks, strips, |
| 880 | // seals, thumbnails, writes the trash rows, then stores, waiting on the |
| 881 | // semaphores rather than failing. AttachFile, inside ImportTx, is step 2: |
| 882 | // it re-checks the quota and claims the trash rows, or fails with |
| 883 | // ErrFileExpired. A StoredFile never attached is swept after a day. |
| 884 | func (s *Store) StoreFile(ctx context.Context, actor Actor, name string, data io.Reader) (StoredFile, error) |
| 885 | ``` |
| 886 | |
| 887 | - Typed refusals: `ErrFileTooLarge`, `ErrFileQuota`, `ErrNoFileStore`, `ErrFileExpired`, `ErrModelLimits`. |
| 888 | - **A Notion select or multi-select past 200 options** becomes a Text field (a multi-select's values joined by `, `), and the run report says so. |
| 889 | - **Relations are written in a second pass,** after every card exists, as `SetField` on each link field. |
| 890 | - No network call happens inside `ImportTx`; the importer downloads first, as its §12 already requires for Mapa. |
| 891 | |
| 892 | **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). |
| 893 | |
| 894 | **Out, and the importer says so:** formulas and rollups as live values, Notion's status groups, page icons and covers. |
| 895 | |
| 896 | --- |
| 897 | |
| 898 | ## 12. Out of scope |
| 899 | |
| 900 | | Thing | Why, and the trigger to revisit | |
| 901 | |---|---| |
| 902 | | **Formulas and rollups** | Base §2: never a second calculator. A formula engine is also a query engine over sealed values. Imported formulas keep their last value as data. Trigger: Paul rules otherwise | |
| 903 | | Sums, averages, minimums and maximums under a column | Q5. Trigger: Paul rules otherwise on Q5 | |
| 904 | | Nested "or" groups in a filter | One all-or-any switch covers the cases seen. Trigger: a view that needs "(A and B) or C" | |
| 905 | | Manual order of cards on a board, or a list | Needs a rank stored per card. Trigger: someone asks to drag a card above another | |
| 906 | | Pasting a range of cells; fill down | Bulk entry is Sheets' job (base decision 1). Trigger: an import or bulk fix that a person does by hand | |
| 907 | | Search across every type | Today's search is per type. Trigger: more than a handful of types in use | |
| 908 | | Automations, buttons, conditional colours, charts | Not asked for | |
| 909 | | Sharing a view outside the team | Suite ruling 2: never cross-team | |
| 910 | | Week and day calendar views; a calendar across types | Month and agenda cover a CRM. Trigger: a type with timed dates in daily use | |
| 911 | | Server display copies beyond one thumbnail | Trigger: card pages with many photos feel slow on a phone | |
| 912 | | Previews of PDFs and documents | Trigger: people open files only to see what they are | |
| 913 | | Comments on cards | Not asked for | |
| 914 | | Editing entries | Base §11: never. A correction is a new entry | |
| 915 | | 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 | |
| 916 | | Restoring a deleted card | Not built today, and not designed here. Trigger: a card deleted by mistake | |
| 917 | | Collapsed groups kept across visits, or without script | Trigger: grouped views long enough that people collapse the same groups every time | |
| 918 | |
| 919 | --- |
| 920 | |
| 921 | ## 13. Questions for Paul, now ruled |
| 922 | |
| 923 | Each answer below was the author's proposal. **Paul approved all twelve on 2026-11-17** ("Yes"), so each is now a ruling. |
| 924 | |
| 925 | 1. **Q1, the direction.** *Ruled by Paul, 2026-11-17:* Escritorio, with Expediente's sentence as the caption over the table and Rejilla's keyboard in the cells. (The direction and the two borrowings are both Paul's rulings of 2026-11-17.) |
| 926 | 2. **Q2, team views.** *Ruled by Paul, 2026-11-17:* anyone in the team may change a team view. Each change is logged and can be undone. Personal views belong to their owner, and nobody else sees that they exist. |
| 927 | 3. **Q3, saving.** *Ruled by Paul, 2026-11-17:* each edit saves at once, is logged, and gets Undo in a toast. There is no per-row Save. |
| 928 | 4. **Q4, filter values in the URL.** *Ruled by Paul, 2026-11-17:* filter values sit in the URL in the clear, as search already does, so views can be bookmarked. Saved views are stored sealed, and their URL holds only a key. |
| 929 | 5. **Q5, column totals.** *Ruled by Paul, 2026-11-17:* count only. A sum would break "never a second calculator". |
| 930 | 6. **Q6, files and images.** *Ruled by Paul, 2026-11-17:* sealed before upload, thumbnails made in the app, 25 MiB per file. *Note:* the brief said "the same as Mapa", but Mapa's images spec (revision 2) sets **10 MiB per image**. This spec takes 25 MiB for any file, because Fichas holds documents as well as pictures, and holds inline images to Mapa's other limits (formats, 50 MP, 10,000 px). |
| 931 | 7. **Q7, dates.** *Ruled by Paul, 2026-11-17:* a date may have an end date and a time, each turned on per field. |
| 932 | 8. **Q8, the calendar.** *Ruled by Paul, 2026-11-17:* the calendar view is in this level-up. |
| 933 | 9. **Q9, Notion page bodies.** *Ruled by Paul, 2026-11-17:* a Notion row's page body imports into the card's Notes. |
| 934 | 10. **Q10, a click on a row.** On 2026-11-12 Paul ruled that "inline grid editing, if it comes, is a separate mode, so a row click always opens the card". Escritorio's table edits a cell on click. *Ruled by Paul, 2026-11-17:* no separate mode. **The name opens the card**; every other cell edits in place (D1). |
| 935 | 11. **Q11, the value window.** Undo past the toast, Restore in History, and keeping detached files all live inside base §5's bounded window, which has no length and is not built. *Ruled by Paul, 2026-11-17:* 90 days, as Mapa's history, built in Phase 1 with the History panel. |
| 936 | 12. **Q12, money as its own kind.** *Ruled by Paul, 2026-11-17:* "Money" is a kind, with its currency fixed when the field is made, stored as integer cents (`AGENTS.md`). A Notion currency number becomes Money. |
| 937 | |
| 938 | --- |
| 939 | |
| 940 | ## 14. Phasing |
| 941 | |
| 942 | **Phase 0:** this spec, reviewed by Fable until no High finding is left. Then Paul's answers to §13 (given 2026-11-17). Then stop. |
| 943 | |
| 944 | 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`. |
| 945 | |
| 946 | **Phase 1: edit in place.** The first thing Paul can use. |
| 947 | 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. |
| 948 | 2. `Index.Sync` learns object kinds by name (§9), before anything new writes events. |
| 949 | 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. |
| 950 | 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). |
| 951 | 5. Undo and Redo: the route's rules, the toast, ⌘Z and ⌘⇧Z, the scriptless "Saved. Undo" (§5.3). |
| 952 | 6. Rejilla's keys (§5.6). |
| 953 | 7. The card beside the list, J and K, Next and Previous across pages (§5.4). |
| 954 | 8. The value window (Q11): its length, the sweep that erases payloads past it, and History on the card (§5.5). |
| 955 | 9. Phones: the list of rows and the edit sheet (§5.8). |
| 956 | 10. **Formats** (§6.8): the six offered locales and their packs, `FICHAS_LOCALE`, the header-only negotiation, Mapa's date patterns and formatter copied into `internal/fichas/locale`, `L` and `D` in every template, and every count, number and date Phase 1 draws written through them (counts through `{{number $L}}`, number values ungrouped with the pack's decimal mark, dates by Mapa's patterns). Number cells read input with the interim strict reading, with the echo and the unchanged-seed rule. |
| 957 | 11. Gates LU3, LU4, LU5, LU9, LU10, LU11 and LU17 for this phase. |
| 958 | |
| 959 | **Phase 2: saved views.** |
| 960 | 1. `[estilo-float]` in estilo, if it has not landed (§3.4). |
| 961 | 2. **Option ids** (§6.2): the boot reconcile from labels to ids, retired options, and filters by id. Views must never be saved holding labels. |
| 962 | 3. **The team's zone and numbers,** which views filter and sort on: `FICHAS_TIME_ZONE` with embedded tzdata, the number grammar, its canonical form and its reconcile (card values only), and exact decimal comparison (§6.2). |
| 963 | - **First, rastrillo's R1 and R2** (§6.8), on a rastrillo branch with its own review, then pinned. The number reading becomes R2's, the interim strict reading is deleted, and number values are drawn by R1, grouped, rather than ungrouped from the pack's decimal mark. |
| 964 | - The person's own format, sealed on the member row (§6.8): a migration adding `members.sealed_locale`, the `member.locale` seal purpose, the `locale_set` event, `Sync` skipping `member`; and search by value (§6.4). |
| 965 | 4. The `views` table, `SeedViews`, `viewFor` with `scope.Owned`, the `fichas-views` cookie, the columns cookie retired (§4.3, §4.6, §4.8). |
| 966 | 5. The URL grammar: sections, per-kind values, `parse` and `href`, the redirect from today's parameters, the 4,000-byte rule, `POST /t/{type}/preview` and `POST /t/{type}/apply` (§4.1, §4.9). |
| 967 | 6. The View panel for the table and the cards layouts: filter on any field with §6.3's operators for today's kinds, sort by several, group as one table with a `<tbody>` per group, columns with order, width, hide and freeze (§4.1, §4.4–4.6). |
| 968 | 7. The caption (§4.10). |
| 969 | 8. The switcher, Save, Save as new, Reset, team and personal scope, the revision check, Manage views, view history, Restore, Undo and deleted views (§4.2, §4.8). |
| 970 | 9. Count only (§4.7). |
| 971 | 10. Gates LU6, LU7, LU8 and LU12, and LU1, LU3, LU5, LU9 and LU10 extended to views, and LU17 extended to R2's reading, the caption, the panel and search. |
| 972 | |
| 973 | **Phase 3: board and calendar.** Both work on today's kinds: a board by a Choice, a calendar by a Date. |
| 974 | 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. |
| 975 | 2. The calendar: a month by a Date field, its weeks from the reader's locale's first day (filters' "this week" stays Monday to Sunday, §6.8), in the team's zone, the picker reading typed dates as Mapa's does (§6.8), "Cards with no date", a drag as a field edit, the phone's agenda. |
| 976 | |
| 977 | **Phase 4: the new kinds.** Through today's add-field page, which gains them, so they are usable before the stepped designer. |
| 978 | 1. Date ends and times (§6.2), on Phase 2's zone. |
| 979 | 2. Number formats and Money (§6.2, Q12), on Phase 2's grammar: R1's options for the formats, and rastrillo's money field end to end (§6.8). |
| 980 | 3. Checkbox, Multi-select and Person (§6.5), with board columns by Person and Checkbox. |
| 981 | 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). |
| 982 | 5. The People type and Customer's Contacts (§8.4). |
| 983 | 6. Each kind's filter, sort and group (§6.3), S3's text (§6.7), and the URL values (§4.9). |
| 984 | 7. Gates LU2, LU14 and LU16, and LU17 extended to money. |
| 985 | |
| 986 | **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. |
| 987 | |
| 988 | **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. |
| 989 | |
| 990 | **Phase 7: describe it** (§8.5, draft 2's slice E). After Paul sets `FICHAS_TENSORX_API_KEY`. Gate LU15. |
| 991 | |
| 992 | **Then the Notion import's phase 2** may start: it needs Phases 4, 5 and 6, and §11's `ImportTx`. |
| 993 | |
| 994 | --- |
| 995 | |
| 996 | ## 15. Gates |
| 997 | |
| 998 | **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–LU17. 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. |
| 999 | |
| 1000 | - **LU1, the file gate grows.** New canaries, written through the real store and routes: a view name, a filter value in a saved view, a folder name, a type description, an icon slug, a section name, help text, a field's currency, an option label, a multi-select option, a person's address, a linked card's title, a file name, a canary inside a file's bytes and inside its EXIF, a draft's sentence, and money and date values. None may appear in the database, its WAL, the blob directory, **or the temporary directory** (a large multipart upload must not spill there). No blob starts with a PNG or JPEG magic number. |
| 1001 | - **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). |
| 1002 | - **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. |
| 1003 | - **LU4, writes that do not cross, and Undo.** |
| 1004 | - A stale `was` is refused with 409 and writes nothing. A repeated identical write succeeds with no event. An unchanged seed is not a change in any locale, ambiguous ones included (`1,234` for 1.234 in German). `1,200` typed by an English reader, or `1.200` by a German one, over a stored 1200 is not a change, nor is `€48,000.00` over 4800000 cents. Two people editing two fields of one card both land. |
| 1005 | - The edit form is all or nothing on a conflict. |
| 1006 | - Undo restores only fields that still hold the event's after value, names the ones it left, logs with `trigger_id`, and refuses (404) a `created` event, another person's event, an entry, a reconcile's change and an event whose payload was erased. Undo skips a removed file and an unknown option id, and says so; it may put back a retired option. Redo names an Undo's event, by the same person. |
| 1007 | - A view's Undo and Restore follow the same rules. |
| 1008 | - **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`, `POST /t/{type}/apply`, the card beside the list, History, Manage views, the designer's GET steps, and file serving (200, 304 and 404). |
| 1009 | - **LU6, the query engine.** For each kind and operator, a property test compares the index's answer with a naive reference over random cards: filters, all and any, a retired option still matching, a condition naming an unknown option id or a removed field (no cards under "all"), relative dates in the team's zone, "me", sorts with empty values last and stable ties, exact decimal and money order, groups with multi-valued cards in each group. Dates: date-only against timed values on the same day, inclusive ends, "next N days" across midnight, and the two DST changes in Europe/Dublin. |
| 1010 | - **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. |
| 1011 | - **LU8, view scope.** Ana's personal view is invisible to Bo on every view route: the switcher's HTML, Manage views, open (`?v=`, the same status, headers and body as a key that never existed and as a deleted one), save, rename, reorder, delete, history, restore, undo and the scope move. A team view changed by Bo is logged with Bo as actor, and Restore brings back the previous payload. A view made a team view shows no history from before that event to anyone but its owner, and that scope move cannot be undone or restored past. Team to personal is refused. A stale save is refused. The type's last team view cannot be deleted. A name may repeat. |
| 1012 | - **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. |
| 1013 | - **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. |
| 1014 | - **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. |
| 1015 | - **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. |
| 1016 | - **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: |
| 1017 | - signed-out and non-admitted requests get the door; |
| 1018 | - 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; |
| 1019 | - a detached file inside the window is served; |
| 1020 | - `setFiles`' invariant holds after upload, taking off, Undo, Restore, Remove and `AttachFile`; |
| 1021 | - `setFiles` refuses another card's file id, a detached id named by an edit, and a stored file not yet attached; an edit may only reorder or drop; |
| 1022 | - the sweep and `AttachFile` racing on one trash row: exactly one wins, and an attached file's object is never deleted; `AttachFile` after the sweep fails with `ErrFileExpired` and writes nothing; `AttachFile` re-checks the quota; |
| 1023 | - `/files/{id}/thumb` answers as `/files/{id}` does; |
| 1024 | - Remove from Fichas bumps the card's revision and drops the file from its S3 text; |
| 1025 | - a crash at each point of `StoreFile` and between it and `AttachFile` leaves no orphan object: every stored object has a trash row or an attached file row; an unattached `StoreFile` is swept after a day; |
| 1026 | - `file_trash` is emptied off the boot path, and a bucket outage never fails boot. |
| 1027 | - **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. |
| 1028 | - **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. |
| 1029 | - **LU16, links.** A link value is never printed. A linking card shows a target's rename at once, in its cell, its sort, its group and its search, with no write to the linking card. Deleting a target bumps each linking card's revision in the same transaction, with one event each; S2 then answers `STALE` for the old revision and S3's text leaves the target out. Backlinks follow every change to a link value. A link to a card of the wrong type, or to a gone card, is refused. The delete's bump moves neither `updated_at` nor "Edited by". |
| 1030 | |
| 1031 | - **LU17, formats.** |
| 1032 | - **Drawn in the reader's format.** Rendered under `Accept-Language: de-DE`, the table, the card, the narrowed list, History, the toast and the conflict message show a count as `1.234` and a Number of 1200.5 (format `plain`, which is every Number until Phase 4) as `1200,5`; under `en-IE`, `1,234` and `1200.5`. From R1 (Phase 2), the same with `grouped`: `1.200,5` and `1,200.5`. A 30-digit value shows every digit. No template calls a locale function without `L`, and `commas` is gone. |
| 1033 | - **Never stored in it.** The same edit posted from a German page and from an English page stores the same bytes, logs the same payload, and leaves the URL, `was`, S3's text and memoria's copy identical. |
| 1034 | - **Which locale.** Over HTTP: `de-AT` reads German, `fr-CA` French, `en-AU` and a bare `en` the team's English, `ja,pt-BR` and no header the team's; a `/de/` prefix is a 404 and a `rastrillo_locale` cookie is ignored; an invalid or unoffered `FICHAS_LOCALE` refuses boot. The person's own choice wins (Phase 2). |
| 1035 | - **Dates.** A date field, "Edited by … ago" past two weeks, and History's times are written in the reader's locale (`Fri, 20 Nov` in en-IE, `Fri, Nov 20` in en-US, `Fr., 20. Nov.` in German, a 12-hour time in en-US); the copied `dates.json` matches Mapa's byte for byte. No template writes a date except through `L`'s locale, and no handler formats a date for a person with `time.Format`. |
| 1036 | - **The person's own format (Phase 2),** Mapa's set: sealed and logged once; 422 on a code not offered, with no row; an unchanged save writes nothing; a stale code reads as unset; reading writes nothing; "Your browser's" clears it. |
| 1037 | - **Read in the page's locale.** The echoed locale is used, not the request's; a bad echo is refused and writes nothing. Phase 1's interim reading refuses what is not the locale's own convention and is never ambiguous; Phase 2's R2 refuses `1.500` in English and `1,500` in German with both readings named, takes `1,500` in English and `1.500` in German as 1500, and writes nothing on a refusal. |
| 1038 | - **Round trip.** For every offered locale, every number Fichas draws in each offered locale (negative, with a fraction, and from R1 grouped) reads back as the same value, and so does every seed. |
| 1039 | - **Formats never reach a URL.** `xN` holds canonical values only; a typed filter value reaches the URL only through `POST /t/{type}/apply` (Phase 2). |
| 1040 | |
| 1041 | --- |
| 1042 | |
| 1043 | ## 16. Departures |
| 1044 | |
| 1045 | ### From the mock-ups |
| 1046 | |
| 1047 | - **D1, the name opens the card.** The mock-up opened the card from an arrow beside the name, and let the name be edited in place. Here the name is a link to the card, and renaming happens on the card. It keeps the part of Paul's 2026-11-12 ruling that matters (a click on the name always opens the card) and gives up the rest (Q10). |
| 1048 | - **D2, Owner is a Person field, sealed.** The mock-up's seal table said "the shipped Owner stays plaintext". `cards.owner_id` is provenance, "who put this here" (`models.go`), never an assignment. It shows as **Created by**. A field a person sets, such as a customer's owner, is a Person field and sealed. |
| 1049 | - **D3, one all-or-any switch** instead of "or" groups (§4.4). |
| 1050 | - **D4, no manual order on a board.** A board's columns are sorted by the view's sort (§12). |
| 1051 | - **D5, the columns cookie retires** rather than becoming a personal default (§4.6). |
| 1052 | - **D6, a calendar's week starts on the reader's locale's first day,** as Mapa's does, with no switch; the mock-up's toggle is dropped. "This week" in filters and groups stays Monday to Sunday in the team's zone, the 2026-11-13 default, so a team view answers every reader alike (§6.8). |
| 1053 | - **D7, the calendar on a phone is an agenda,** not the month grid. |
| 1054 | - **D8, groups collapse with script only,** and not across visits: a `<details>` cannot sit inside a table (§4.5). |
| 1055 | - **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). |
| 1056 | |
| 1057 | ### From the base spec and draft 2, each for the reviewer |
| 1058 | |
| 1059 | - **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. |
| 1060 | - **D11, the catalogue gains People** (R5), with §8.3's tier table as its review (base §4.4). |
| 1061 | - **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. |
| 1062 | - **D13, two named exemptions from "every write logs"**: type drafts and the sweeps (§9). |
| 1063 | - **D14, Fichas makes thumbnails** where Mapa makes no display copies (F6). |
| 1064 | - **D15, money is a kind** (Q12), where draft 2 had only Number. |
| 1065 | - **D16, numbers are stricter and exact.** Today `writeValues` strips every comma (`1,5` becomes `15`) and the sort compares floats. Both change, with a logged reconcile of stored card values; entry values are immutable and are read tolerantly instead (§6.2). |
| 1066 | - **D17, a type's icon is sealed,** where draft 2 made it plaintext; and field settings are sealed (§8.1, §10.1). |
| 1067 | - **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. |
| 1068 | - **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. |
| 1069 | - **D20, the import may set a card's Created** to Notion's time (§11). |
| 1070 | - **D21, `maxOptions` rises from 50 to 200** (§8.2), because Notion selects run past 50. |
| 1071 | - **D22, a number is read the way rastrillo reads money** (§6.8), replacing revision 3's English-only grammar: input with one plausible reading is accepted in any locale (`1,5` in English is 1.5), and input whose readings disagree is refused. Revision 3 refused `1,5`, `1.200,50` and `+5`. |
| 1072 | - **D23, formats follow the reader; words do not.** Numbers, money and dates are written in the browser's locale among six, or the person's choice, with a team default, exactly as Mapa does (its build note 85); the interface stays English. Dates use Mapa's CLDR patterns and formatter, copied until they move into rastrillo (R3). |
| 1073 | |
| 1074 | --- |
| 1075 | |
| 1076 | ## 17. Build notes |
| 1077 | |
| 1078 | Choices made while building, where this spec was silent or the build chose differently. Each is the smallest reasonable choice. A reviewer who disagrees changes the code and this list together. |
| 1079 | |
| 1080 | ### Phase 1 (`feat/level-up-phase-1`) |
| 1081 | |
| 1082 | 1. **The account is at the bar's end,** as §2 says and the mock-ups draw it, not at the rail's foot; the rail's foot holds the fold. `TestTheBarEndsWithTheAccountMenu` replaces the rail-foot test. |
| 1083 | 2. **The View dropdown stays in the toolbar** (density and columns, the `fichas-hide-<type>` cookie) until Phase 2's View panel replaces it. The bar has no View toggle in Phase 1; the View menu carries Table, Cards, density and the fold. |
| 1084 | 3. **History is a page, with script too:** `/cards/{id}/history`, linked from the bar, the Card menu and the pane. §5.5's panel is the same content, and waits for `[estilo-float]` in Phase 2. |
| 1085 | 4. **A date cell edits with the browser's own date input.** §3.4's picker (quick picks, a month grid, the zone named) is new work in `datetime.js` and is built with the calendar in Phase 3; the browser's picker is its scriptless floor anyway. |
| 1086 | 5. **"No longer in this view" is not marked under the default sort** (last edited first), where every edit would move its row to the top and the mark would mean nothing. It is marked when the card stops matching the search or the filters, or the list is sorted by the field just changed. |
| 1087 | 6. **A printable key opens an empty editor and lets the browser type the character into it,** rather than seeding the editor with `e.key`: composition and dead keys then work. A test cannot tell the two apart (DevTools sends the character as its own event), so `TestTheKeyboardWalk` names that one surviving mutant. |
| 1088 | 7. **Popups (the Choice picker, a refusal, a conflict) are pinned to the viewport** under their cell, because the table's scrolling box would clip them. |
| 1089 | 8. **A redo is undoable,** so ⌘Z after ⇧⌘Z undoes it again; an Undo's own event is only ever redone (§5.3). |
| 1090 | 9. **A scriptless save comes back with a flag, never with text:** `?saved=<event>`, `?undone=<event>`, `?refused=1`, `?conflict=1`. The notice's words are Fichas' own, and its Undo form posts to the card the event is on, looked up from the event. A crafted link cannot put words on the page. |
| 1091 | 10. **An edit form posted without `was.<key>`** (a client older than this form) is checked against the value as the handler loaded it. Fichas' own forms always send `was`. |
| 1092 | 11. **The value window's sweep** runs from `main`, once at start and then hourly, off the boot path; a failure is logged and tried again. |
| 1093 | 12. **Numbers and dates** follow §6.8's Phase 1 rules, as aligned with Mapa's build note 85: the six offered locales, negotiated from `Accept-Language` alone; numbers drawn ungrouped with the pack's decimal mark and read by the interim strict reading in `numberread.go`, with the echo and the unchanged-seed rule; counts through rastrillo's `{{number}}`; dates by Mapa's patterns and formatter, copied into `internal/fichas/locale` and pinned to Mapa's by sha256. A number stored before the grammar in a non-canonical form (`1.500`) is drawn as stored until Phase 2's reconcile rewrites it. |
| 1094 | 13. **estilo hides the brand's name in a stacked bar,** which leaves its link with no accessible name (axe-core's `link-name`). `frame.css` keeps the name for screen readers; the fix belongs in estilo. |
| 1095 | 14. **The scriptless browser gate (LU9) turns page scripts off with `Emulation.setScriptExecutionDisabled`** and reads the DOM through DevTools' DOM domain only, because chromedp's visibility checks need script. |
| 1096 | 15. **The phone's list of rows** shows the title, the first Choice as its pill, and the first two other values, rather than "the next two face fields": face fields are a Cards-layout setting, and the table's columns are what the reader chose to see. |
| 1097 | 16. **Line endings are normalised to LF** for every value written, and compared newline-blind, because a form posts CRLF, script LF, and Notes written before hold CRLF (Fable's Phase 1 review, H1). |
| 1098 | 17. **`Index.Sync` rebuilds on a `group` event** (no group is written before Phase 6, which will say which types a folder change touches) and when a field event's field is gone; `reloadType` reloads the type's cards as well as its labels, where §9 says metadata, because a field's rename or options change how every card of the type is drawn. |
| 1099 | 18. **With a card open beside the list, the bar's title is the card's,** as on its full page: the card is the open object. |
| 1100 | 19. **The conflict line says "You changed this … in another tab."** when the last change was the person's own, and never "a moment ago", which the event's time does not back. |
| 1101 | 20. **A web address stored with `http://` keeps it.** A field draws an address without its scheme; posted back untouched it is the stored value, so the forms never rewrite `http://` to `https://` behind a person's back. An address a person types without a scheme gets `https://`, as before (Fable's Phase 1 review, round 2, accepted). |
| 1102 | 21. **A `<time>` whose text is a date in the reader's locale carries that locale's `lang`** (WCAG 3.1.2); one whose text is the interface's English ("in 3 days") does not. Line endings are compared newline-blind in one place, `EditFields`, and the forms' handlers do not repeat it. |
| 1103 | 22. **The new user-facing strings** are in `copy-review/level-up-phase-1/strings.json` for Paul's copy review; none is reviewed yet. |
| 1104 | |
| 1105 | ### After Phase 1 |
| 1106 | |
| 1107 | 23. **The header has no Search** (Paul, 2026-11-18: "I think we can just lose the search icon in the header"; amends §3.1 and §3.2). The bar's Search, made a lens with "Search ⌘K" as its tooltip that morning (main `6a57585`), is gone, and the rail never had one, so Search moved there, where Mapa has it: the rail's first row, "Search" with ⌘K beside it while the rail is open, the icon with "Search" as its tooltip when folded; and below 800px the Menu sheet's first row (the bar's `Nav`, which the sheet draws), the only Search a phone has on a card or History, which have no Find box. Each goes to the type's Find box (`/t/<type>#find`), focusing it in place on the list. ⌘K, from a page with no Find box, goes where the rail's row goes, never from inside a field; the row (`data-fichas-search`) is in the page below 800px too, where the rail is not drawn. estilo's `Action.IconOnly` stays for a later action. `browser_search_entries_test.go` holds it: no Search in the bar at 1440, 1000, 800 and 390, scripts on and off, nor "Search ⌘K" anywhere; the rail's row open and folded (by width and by choice), from the list and a card, scripts on and off; the sheet's one first row on the list, a card and History; ⌘K and Ctrl+K at three widths, and nothing from inside a field; axe at four widths; no shift in the bar. |
| 1108 | 24. **File is the first menu** (Paul, 2026-11-22: "Why is there no 'File' menu? I would have thought File -> Import was a thing"; amends §2 and §3.1). The Card menu is now File (`id="fichas-menu-file"`), as in Docs, Slides and Mapa (Mapa level-up build note 87), and keeps its rows: New <singular> ("New card" off a type), and on a card Open full page, History and Delete…, last and set apart. **Import has a place but no row.** Fichas has no importer yet; the Notion databases phase (§11, the importer's §17) adds "Import from Notion…" after New, as Mapa has it, for its importers only. Until then File draws no Import, rather than a row that leads nowhere. With scripts off File is a `<details>` of links, and below 800px the menus are the bar's own second row (estilo's Menu sheet carries the types and actions, never the menus), so a phone reaches the same rows. No shortcut changed. Copy: "File" went through Luna (`copy-review/file-menu`). Gates: `frame_test.go` holds the menus' order and File's rows off a type, on a type and on a card; `browser_file_menu_test.go` checks File is the first menu and shown, with the same rows, each on screen with File open, at 1440 and 390, scripts on and off, on the list and a card, with no import link anywhere; File → New customer by pointer at both widths; and axe with File open at 1440 and 390. |
| 1109 | |
| 1110 | --- |
| 1111 | |
| 1112 | ## 18. Findings and what changed |
| 1113 | |
| 1114 | ### Revision 4: Paul's question about localisation, 2026-11-17 |
| 1115 | |
| 1116 | Paul approved the spec and Q1–Q12 the same day, and asked whether Fichas uses rastrillo's localisation of numbers and currencies. It did not. Revision 4 changes how values are drawn and read, and nothing that is stored. |
| 1117 | |
| 1118 | | Change | Where | |
| 1119 | |---|---| |
| 1120 | | The formatting locale: the person's choice, then `Accept-Language`, then `FICHAS_LOCALE` (default `en-IE`); English words with the reader's formats through `ui.Localizer` (the packs linked and the choice's storage superseded by the alignment row below) | §6.8, §3.2, §10.2 | |
| 1121 | | Counts, numbers, money and dates drawn through `$L` everywhere a value shows | §6.8, §4.10, §5.5 | |
| 1122 | | Number input read by rastrillo's normalising reading (R2), money by `form.Money` with `LocaleEcho`, dates by `form.Date` from the browser's ISO; the echo, the seed without group marks, the unchanged-seed rule | §6.2, §6.5, §6.8, §5.2, §5.6 | |
| 1123 | | Search matches numbers and money by value, read in the request's locale | §6.4 | |
| 1124 | | Phase 1 draws number values ungrouped from the pack's decimal mark until R1, so drawing and reading share one data source (Fable revision 4, H1) | §6.8, LU17 | |
| 1125 | | Typed filter values are posted and turned into a canonical URL by `POST /t/{type}/apply`, never put in the URL as typed (Fable revision 4, M1) | §4.1, §6.8, LU5, LU17 | |
| 1126 | | What rastrillo needs, R1 to R4, and which phase needs each; Phase 1 needs no newer rastrillo and carries an interim strict reading | §6.8, §14 | |
| 1127 | | The canonical form, the reconcile, S3's text and the Notion mapping stated as locale-free | §6.2, §6.7, §11 | |
| 1128 | | Gate LU17; LU4's unchanged-value case restated per locale | §15 | |
| 1129 | | Fable's diff check of the alignment (`4b9ec24`): APPROVE, four Mediums (week start kept Monday for filters, the en-IE short date, the `member` event in §9, §10 and the feed, echoes limited to the six) and seven Lows, folded in | §6.8, §9, §10, LU17 | |
| 1130 | | **Aligned with Mapa's build note 85** (the coordinator, 2026-11-17): six offered formats, header-only negotiation through `Locales.Negotiate` on a bare request, the person's own choice sealed on the member row rather than a cookie, and dates written with Mapa's CLDR patterns and formatter, copied, in place of words in one order | §3.2, §6.8, §10.2, LU17, D23 | |
| 1131 | | D22, D23 | §16 | |
| 1132 | |
| 1133 | **Fable's diff check of revision 4** (`36df131`): CHANGES REQUIRED, one High (Phase 1 drew numbers through `x/text` and read them with the packs, whose marks disagree in dozens of locales), four Mediums (typed filter values in the URL; money's `Stored`; the cell edit's body; grouping before Phase 4) and eleven Lows. All folded in above. **Fable's re-check of the fixes** (`533f0f3`): **APPROVE**, with four Lows (the edges of `apply`, the scriptless panel's method, typed spaces and apostrophes, and the number seed), folded in here. |
| 1134 | |
| 1135 | ### Round 1: Fable on revision 1 (`00e3ad3`), CHANGES REQUIRED, answered in revision 2 |
| 1136 | |
| 1137 | | Finding | Change | Where | |
| 1138 | |---|---|---| |
| 1139 | | **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 | |
| 1140 | | **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 | |
| 1141 | | **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 | |
| 1142 | | **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 | |
| 1143 | | **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 | |
| 1144 | | **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 | |
| 1145 | | **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 | |
| 1146 | | **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 | |
| 1147 | | **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 | |
| 1148 | | **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 | |
| 1149 | | **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 | |
| 1150 | | **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 | |
| 1151 | | **M10** `<details>` cannot wrap table rows | One table, a `<tbody>` per group with a heading row; collapse with script only | §4.5, D8 | |
| 1152 | | **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 | |
| 1153 | | **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 | |
| 1154 | | **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 | |
| 1155 | | **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 | |
| 1156 | | **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 | |
| 1157 | | **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 | |
| 1158 | | **L2** The draft event had no object | `draft`, object id 0 | §9 | |
| 1159 | | **L3** A cookie per type and per folder | One cookie each for the rail and for last views | §3.2 | |
| 1160 | | **L4** Today's URL parameters would break | They redirect to the canonical URL | §4.9 | |
| 1161 | | **L5** Paging for multi-group cards, boards and calendars | Rows count each appearance; boards show 100 a column; calendars do not page | §4.5 | |
| 1162 | | **L6** "Edited by" for app and entry events | The last person's `created` or `updated` | §6.1 | |
| 1163 | | **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 | |
| 1164 | | **L8** Multipart spills to plaintext temp files | `MultipartReader` only; the temp directory is in LU1 | §7.2, LU1 | |
| 1165 | | **L9** The log gate covered one request | It covers a 409, a 500, a 404, a sign-in redirect and an upload | LU7 | |
| 1166 | | **L10** A Person pick creates a member row | Listed in the leak list | §10.2 | |
| 1167 | | **L11** No card restore exists | Dropped from LU16; listed as out of scope | §12, LU16 | |
| 1168 | | **L12** S3's date format was unstated | Fixed forms for dates and money | §6.7 | |
| 1169 | |
| 1170 | ### Round 2: Fable on revision 2 (`0cb3b09`), APPROVE, folded into revision 3 |
| 1171 | |
| 1172 | No High. Fable: "The Mediums below are spec text fixes to fold in before the phase they touch; none needs another review round." All are folded in here. |
| 1173 | |
| 1174 | | Finding | Change | Where | |
| 1175 | |---|---|---| |
| 1176 | | **M1** The 24-hour trash trick could delete an attached file's bytes if the sweep and `AttachFile` raced; trash-row and `Put` order unstated; the thumbnail had no row | `StoreFile` writes trash rows for the file and its thumbnail, then `Put`s. The sweep claims a row by deleting it before deleting the object. `AttachFile` must remove exactly its rows or fail with `ErrFileExpired`, and re-checks the quota. Ordinary uploads use the same two steps. The trash rows are a named §9 exemption | §7.4, §9, §11, LU13 | |
| 1177 | | **M2** The number reconcile would hit immutable `entry_values` and fail boot; no canonical form | Both reconciles touch `card_values` only; entry numbers are read tolerantly. The canonical form is defined; `+5` refused, `.5` accepted | §6.2, D16 | |
| 1178 | | **M3** The team zone and exact decimals were used in Phases 2 and 3 but landed in Phase 4 | Both, with the number grammar and its reconcile, move to Phase 2 | §14 | |
| 1179 | | **M4** An edit could put another card's, or a detached, file id into a Files field | `setFiles` accepts only ids on this card and field; an edit may only reorder or drop; adding is an upload's attach; re-adding is Undo or Restore | §7.3, LU13 | |
| 1180 | | **M5** Retired options against "matches nothing" | A retired option still matches and shows "(retired)"; only an unknown id or a missing field matches nothing. The reconcile makes retired options for stored labels no longer listed, per field in one transaction, with the new shape as its done-marker | §4.4, §6.2, §5.3, LU4, LU6 | |
| 1181 | | **M6** No `g=none` or "nothing hidden"; paging a calendar month marked the view Changed | `g=none`, `hide=none`. `month` and `all` are navigation, with `q`, `card`, `page` and `panel`. `href` writes only sections that differ. The teammate rule covers present sections | §4.9, §4.5 | |
| 1182 | | **M7** The importer could not add a field to a type it made, and `ModelResult` returned nothing usable | `ImportWriter.AddField`; `ModelResult` maps types, fields and options to keys and ids | §11 | |
| 1183 | | **M8** Undoing "made a team view" is team to personal by another name | The scope move is not undoable and cannot be restored past. Gated | §4.8, §9, LU8 | |
| 1184 | | **L1** The delete bump moved "Edited"; History said nothing; links to gone cards | The bump moves the revision only; History says "A linked card was deleted"; a link to a gone card is refused | §6.6, LU16 | |
| 1185 | | **L2** A removed file's event kept its name | The file's `removed` event has no payload | §9 | |
| 1186 | | **L3** Settings sealed under `type.label` | Their own purposes, `type.settings` and `field.settings` | §6.2, §10.1 | |
| 1187 | | **L4** Thumbnail decodes weighted by file size | Weighted by width × height × 4 | §7.2 | |
| 1188 | | **L5** Redo had no route or flag | `redo` in the payload; Redo names an Undo's event, by the same person | §5.3, LU4 | |
| 1189 | | **L6** History of payloads from before a reconcile | Shown as text, with no Restore | §5.5 | |
| 1190 | | **L7** What the over-long preview page offers | Its form posts to itself; Save posts the state; no caption links, paging or card links | §4.9 | |
| 1191 | | **L8** Scriptless upload inside the edit form; thumb route rules; detached files and quota | Upload is its own multipart form; `/thumb` follows `/files/{id}`; detached files count until swept | §7.4, §7.5 | |
| 1192 | | **L9** Phase 2 listed too few gates | LU1, LU3, LU5, LU9 and LU10 extended to views | §14 | |
| 1193 | | **L10** `SeedViews` would make views for entry types | Card types only | §4.3 | |
| 1194 | | **L11** Multi-select order could fake a conflict | Normalised to option order when written, read and compared | §6.1 | |
| 1195 | | **L12** A Notion select past 200 options | Becomes Text, reported | §11 | |
| 1196 | | **L13** Stale text | The URL example uses option ids; "or made personal" and `AddFile` are gone; LU1's canary is a filter value in a saved view | §4.3, §4.9, §7.3, §11, LU1 | |
| 1197 | |