Fichas level-up spec, revision 4: numbers, money and dates in the reader's locale through rastrillo (Paul's question); Q1-Q12 ruled
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+139
−42
docs/superpowers/specs/2026-11-17-fichas-level-up.md+139 −42
diff --git a/docs/superpowers/specs/2026-11-17-fichas-level-up.md b/docs/superpowers/specs/2026-11-17-fichas-level-up.md| index 109a33e..dbc9cf2 100644 |
| --- a/docs/superpowers/specs/2026-11-17-fichas-level-up.md |
| +++ b/docs/superpowers/specs/2026-11-17-fichas-level-up.md |
| @@ -1,9 +1,9 @@ |
| # Fichas level-up: Escritorio, with Expediente's sentence and Rejilla's cell keys |
| -**Status:** revision 3, 2026-11-17. **APPROVED** by Fable on revision 2 (`0cb3b09`), with 8 medium and 13 low text fixes, which this revision folds in. Nothing is built. |
| +**Status:** revision 4, 2026-11-17. **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. |
| +- 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. |
| - Fable reviewed revision 1 (`00e3ad3`) and found CHANGES REQUIRED: 3 high, 15 medium and 12 low findings. Revision 2 answered all of them. |
| - §18 records each review round and what changed. |
| -- §13's questions to Paul are open. The design is built on the proposed answers, each marked "Proposed, awaiting Paul". |
| **Branch:** `design/level-up-2` (Fichas), from `main` `b791bdd`. The old name `feat/level-up` is a merged branch and is not reused. |
| @@ -71,7 +71,7 @@ The estilo bar stack, as Mapa uses it (Mapa level-up §3.1). Fichas' slots: |
| - **R1:** the rail stays. Its rows keep today's grid: a 16px icon column and the label on one centre line (`TestRailIconsSitOnTheTextsCentreLine`). |
| - **R2, folders:** each type is in at most one folder. A type with no folder sits above the folders. A folder heading is a `<details>`, so it collapses with no script. Which folders are closed is one per-person cookie (`fichas-rail`, the closed folders' opaque keys), as density is. The folder holding the current type is always open. |
| -- **Cookies stay few:** one for the rail (fold and closed folders), one for the panel, one for density, and one (`fichas-views`) mapping each type's key to the view last used, capped at 30 types, oldest dropped. Every one holds opaque keys or this app's words only. |
| +- **Cookies stay few:** one for the rail (fold and closed folders), one for the panel, one for density, one for formats (`fichas-formats`, §6.8), and one (`fichas-views`) mapping each type's key to the view last used, capped at 30 types, oldest dropped. Every one holds opaque keys or this app's words only. |
| - **Each type has its icon** (§8.1) and its card count, as the mock-ups show. |
| - **New type** is a quieter row below a rule. |
| - **⌘\ folds the rail** to icons, and back. The fold is two submit buttons, one per state, and CSS shows the one that fits (Mapa build note 10). `POST /view/rail` sets a cookie, writes no row, logs no event, and returns only to a local path. |
| @@ -237,7 +237,7 @@ The seal tiers do not limit any of this. The list runs on the in-memory index, w |
| | Kind | `xN` holds | |
| |---|---| |
| | Text, long text, URL, email, phone | the text | |
| -| Number, money | the canonical decimal (§6.2); money in minor units | |
| +| 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) | |
| | Date | `2026-11-20`, or `2026-11-20T14:30` in the team's zone; relative tokens `@today`, `@this-week`, `@next-7d` and the like | |
| | `between` | two `xN`, low then high | |
| | Choice, multi-select | option ids (`o_…`) | |
| @@ -264,7 +264,8 @@ Expediente's sentence, as the caption over the table, the board and the calendar |
| - Sort phrases follow the kind: "soonest Next action first", "highest Value first", "A to Z by Name", "newest first". |
| - With no filter: "All 10 customers, most recently edited first." |
| - **Every field, operator and value is a link** to the same URL with `panel=1` and a fragment naming the control (`#panel-filter-0`). With script, clicking it opens the panel in place and focuses the control. |
| -- **It is built on the server** by one function, `describeView(state) []Span`, with golden tests for every operator and kind. Its copy goes through the copy-review skill. |
| +- **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`. |
| +- **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. |
| - **Past three conditions** the sentence wraps; it is never cut. The mock-up round named this as Expediente's weakness, and as a caption, not the control, it can afford to be long. |
| - **On the phone** it sits under the switcher, as the mock-up shows. |
| @@ -294,7 +295,7 @@ Expediente's sentence, as the caption over the table, the board and the calendar |
| **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)`. |
| -- **`was` is the canonical stored form**, as the server rendered it into the editor: `1200`, never `1,200`; money in minor units; option ids; a date as stored. The submitted value is normalised first (§6.2), then compared. |
| +- **`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. |
| - **In order, inside the transaction:** |
| 1. If the field already holds the normalised new value, the write **succeeds with no event**. So a Retry after a lost response, or a second tab making the same change, is not a conflict. |
| 2. If the field holds `was`, the write lands: one `updated` event, one new revision. |
| @@ -332,7 +333,7 @@ Expediente's sentence, as the caption over the table, the board and the calendar |
| 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. |
| - **History**, in the card's header, opens a panel: each change, newest first, with who, when and which fields. |
| -- **Inside the value window** each change shows before and after, and **Restore this value** per field. Restore is a new change, checked as in §5.2. |
| +- **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. |
| - **Past the window** a change shows only who, when and which fields. Base §5: the values are gone, so there is no restore. |
| - **Payloads from before a reconcile** (option labels before option ids, numbers before the grammar) are shown as the text they hold, with no Restore. |
| - With scripts off, History is a page, `/cards/{id}/history`. |
| @@ -354,7 +355,7 @@ With script, the table is one tab stop: an ARIA `grid` with a roving `tabindex`. |
| | Space | tick or untick a checkbox; open a picker | |
| | Delete, Backspace | clear the value (with Undo) | |
| | ⌘C | copy the cell's text | |
| -| ⌘V | paste text into the cell, parsed by its kind; a Choice must match an option | |
| +| ⌘V | paste text into the cell, read by its kind in the reader's locale (§6.8); a Choice must match an option | |
| | Enter on the name | open the card beside the list (the name is not edited in the grid, D1) | |
| | ⌘Z, ⌘⇧Z | undo, redo (§5.3) | |
| @@ -414,14 +415,14 @@ Each kind's settings, a field's help text and whether it is required live in **` |
| - **Number:** `format`, one of `plain`, `grouped` (1,200), `decimals` with `places` 0–4, or `percent`. |
| - The format is display only. Values are exact decimals and compare as decimals (`math/big`), never as floats. Today's sort parses floats (`index.go`); that changes. |
| - A percent field stores what is shown: `50` is 50%. |
| -- **What a Number accepts,** one grammar for every format: an optional `-` (never `+`); digits, optionally grouped in threes by `,` before the point (`1,200`, `12,000,000`); an optional `.` and more digits; a leading point is allowed (`.5`). At most 30 digits in all. **Anything else is refused**, never guessed: `1,5`, `1.200,50`, `1e3`, `NaN`, `Inf`, `0x10`, `+5` and a second point each get "Enter a number, like 1200 or 1,200.50". Today `writeValues` strips every comma, so `1,5` becomes `15`; that changes. |
| -- **The canonical form,** which is what is stored and what `was` holds: no grouping commas, no leading zeros (`0.5`, never `00.5` or `.5`), no trailing fractional zeros (`1.5`, never `1.50`; `2`, never `2.0`), and never `-0`. |
| -- **Money:** `currency`, an ISO 4217 code from a list (EUR first). Fixed at creation, because the stored unit depends on it. `AGENTS.md`: money is integer cents. |
| - - It accepts the Number grammar, with the currency's symbol or code allowed before or after (`€48,000`, `48000 EUR`). |
| - - A value with more decimal places than the currency allows is refused, never rounded. |
| - - It is stored as integer minor units, at most 18 digits, so it fits an int64. |
| -- **Values already stored:** a boot reconcile (`AppBecause(0, "number grammar")`) rewrites each stored **card** Number (`card_values`) to the canonical form, one logged event per card that changes. A value that does not parse (an old `1e3` is parsed and rewritten; a `NaN` is not) is left as stored, shown with "Not a number" beside it, and sorts last. It is the reconcile's only way to fail, and it fails visibly. |
| -- **Entry values are never rewritten.** `entry_values` are immutable (migration 0002's triggers abort an UPDATE, base §3), so a reconcile that touched them would fail boot. Stored entry numbers (a call's Duration) are read tolerantly, as today; the strict grammar applies to entries written from now on. |
| +- **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). |
| +- **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`. |
| +- **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. |
| + - 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. |
| + - A value with more decimal places than the currency allows is refused (`money_precision`), never rounded. |
| + - It is stored as integer minor units in an int64 (rastrillo's range). |
| +- **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. |
| +- **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. |
| - **Date:** `end` (allowed or not) and `time` (allowed or not). |
| - Turning either on is always allowed. Turning one off is refused while any card uses it: "3 customers have an end date. Clear them first." |
| - **The team's zone** is `FICHAS_TIME_ZONE`, default `Europe/Dublin` (2026-11-13 ruling). The binary embeds `time/tzdata`, because it is cgo-free and the host's zone files are unknown. An unknown zone refuses boot. |
| @@ -466,7 +467,9 @@ Each kind's settings, a field's help text and whether it is required live in **` |
| ### 6.4 Search |
| -The Find box matches every value that **shows as text**: option labels, person names, linked cards' titles, file names, and money and dates as they are shown. It never reads a file's contents. |
| +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. |
| + |
| +- **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`, and money as its canonical decimal, `48000`). A query is read as a number in the reader's locale (R2; each reading, when it is ambiguous) and then matched against those canonical forms as text, so `1.200,5` typed in German and `1,200.5` typed in English both find 1200.5. A query that is not a number matches no number or amount. Built with the grammar, in Phase 2. |
| ### 6.5 Inputs and pickers |
| @@ -476,9 +479,10 @@ The Find box matches every value that **shows as text**: option labels, person n |
| | Multi-select | a listbox of checkable options with search | a checkbox per option | |
| | Person | a listbox of the team's people, with search; "Me" first | `<select>` (multiple when the field holds several) | |
| | 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=`) | |
| -| 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 | |
| +| 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) | |
| | Checkbox | a checkbox | a checkbox | |
| -| Money | a text input with the currency's symbol beside it | the same | |
| +| Number | a text input, `inputmode="decimal"`, seeded in the reader's format (§6.8) | the same | |
| +| 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 | |
| | Files | §7.4 | a file input | |
| - **A Link picker's "New <target>"** creates the target card with only its title, and links it, in one transaction with two events. |
| @@ -505,7 +509,8 @@ Type designer §3, with these changes: |
| ### 6.7 What the suite contract sees |
| -S3 (base §6.4) renders each new kind as text: |
| +S3 (base §6.4) renders each new kind as text, **never in a reader's locale** (§6.8): |
| +- numbers in canonical form: `1200.5`; |
| - money with its currency, in a fixed form: `EUR 48000.00`; |
| - dates in a fixed form, independent of the reader: `2026-11-20`, `2026-11-20 14:30 Europe/Dublin`, and a range as `2026-11-20 – 2026-11-22`. The text never depends on who asks or where. (Renames are the one way a revision's text changes, as field renames already do: base §10.); |
| - a checkbox as `Yes`, and an unticked one as nothing; |
| @@ -516,6 +521,68 @@ S3 (base §6.4) renders each new kind as text: |
| No bytes, no file id, no option id and no member or card id reach a sibling. |
| +### 6.8 Formats: the reader's locale (revision 4) |
| + |
| +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. |
| + |
| +**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. |
| + |
| +#### Which locale |
| + |
| +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 offers one language, English. rastrillo's locale middleware negotiates among declared languages only, so for Fichas it always picks `en`; declaring more languages to get formats would add URL prefixes, a language switcher and catalogs to translate, which is not what is wanted. So Fichas chooses the formatting locale itself, per request, in this order: |
| + |
| +1. **The person's own choice**, if they made one (below). |
| +2. **The browser's `Accept-Language`,** in q order as rastrillo's middleware reads it. The first tag that `locales.Resolve` maps to a linked locale without falling back (not `Malformed`, not `UsedDefault`) wins. **A bare language** (`en`, `de`) that is the team default's language yields the team default: a browser that says only `en` gets `en-IE` on Paul's teams, not CLDR's `en`, which writes dates the American way. |
| +3. **The team default,** `FICHAS_LOCALE`, default `en-IE`. Boot refuses a value `locales.CanonicalIdentity` refuses or `locales.Resolve` cannot map without falling back, as an unknown `FICHAS_TIME_ZONE` refuses boot. |
| + |
| +The result goes into the request's localizer, `ui.NewLocalizer("en", <format>, …)`: English words, the reader's formats. Every template takes `$L` and passes it to every locale function, as rastrillo's strict `ui.Pages` requires. Today's `commas` retires. |
| + |
| +- **Every pack is linked:** `locales/modern` replaces `locales/en`. Measured at `b791bdd`: 420 KB on a 28 MB binary (1.5%). |
| +- **The choice** is one cookie, `fichas-formats`, holding a CLDR locale id or nothing (§3.2's list grows by one). It is set on a **Formats** page under the account menu: one `<select>` whose first option is "Your browser's" (naming what that resolves to), then every linked locale by its id with a sample of a number, an amount in euro and a date written in it, so nobody needs a locale's name to pick one. `POST /settings/formats` writes the cookie, no row and no event, and returns to a local path. Phase 2. |
| +- **The formatting locale is never logged, stored in a row, put in a URL or sent to a sibling.** It is the reader's, like density. |
| + |
| +#### Display |
| + |
| +| What | Through | Where | |
| +|---|---|---| |
| +| Counts: "7 of 10 customers", "2 of 7", group counts, a file count | `{{number $L n}}` | every count Fichas draws | |
| +| Number values | `{{number $L v}}` on the canonical string, the field's format (§6.2) as options (R1) | table cells, the card, the narrowed list, board and calendar cards, the caption, the View panel, History, toasts, the conflict message | |
| +| Money | `{{money $L minor code}}` | the same places | |
| +| Dates and times | words, in the team's zone (below; R3) | the same places, and "Edited 2 days ago" | |
| + |
| +- **Number values need R1.** rastrillo's `number` today formats integers and floats through `x/text`, and returns any other string unchanged, so `1200.5` would show as `1200.5` to a German reader. Until R1, Fichas passes an integer canonical string as it is (rastrillo formats it), and passes a fraction as a `float64` **only when that float writes back as exactly the canonical string** (`strconv.FormatFloat(f, 'f', -1, 64)`), which `x/text`'s shortest form then writes with exactly those digits. Any other value (past about 15 significant digits) shows in canonical form. So a displayed number is always exact: localised, or canonical, never rounded. |
| +- **Dates are words until R3.** rastrillo's packs hold number and money data, not CLDR's date patterns. Until they do, Fichas writes dates as it does today: relative words ("today", "in 3 days") with the absolute date in the `title`, and absolute dates as "20 November 2026" and times as "14:30", for every reader. A date in words with the month spelled out is read the same way in every locale, so the only cost is a day-month order an American reader does not use. **A date is never written in figures** (11/12/2026), which is where locales disagree. Month and day names are interface text, so they stay English after R3; R3 changes the order, the abbreviation and the hour cycle. |
| + |
| +#### Input |
| + |
| +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 names no linked locale is refused with "Enter the value again", as rastrillo's `money_reenter` is. |
| + |
| +- **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: |
| + - **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). |
| + - **The page's own group mark wins** (decision 23): `1,500` in English is 1500, and `1.500` in German is 1500. |
| + - **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. |
| + - **The accepted cost,** rastrillo's own: German `1,500` meaning one and a half, pasted into an English page, is 1500. The cell shows the stored value as soon as it saves, and Undo is in the toast. |
| + - **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. |
| + - **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. |
| +- **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. |
| +- **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 card's amount, 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`. |
| +- **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. |
| +- **The JSON cell edit** posts the same names as the form (`<key>`, `<key>.locale`, `<key>.seed`, and money's `<key>.currency`), so one reading serves both, and `was` is compared only after the value is read and made canonical (§5.2). |
| +- **Everywhere else a person types a value** reads it the same way: a filter value in the View panel (then written to the URL canonically, §4.9), a paste (⌘V, §5.6), and the Find box (§6.4). |
| + |
| +#### What rastrillo needs |
| + |
| +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. |
| + |
| +| # | What | Why rastrillo, not Fichas | Needed by | |
| +|---|---|---|---| |
| +| 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, the float bridge above | |
| +| 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 | |
| +| R3 | CLDR's date and time patterns in the packs (medium date, short time, hour cycle), and `{{date $L t}}` and `{{datetime $L t zone}}`, with month and day names from the identity's catalog | The same packs, the same follow-on | Nothing blocks on it. Until it lands, words (above) | |
| +| R4 | The formatting-locale negotiation above, for a one-language app: `rastrillo.FormatLocaleFor(r, fallback)` | Every Oficina app has one language and readers in several countries | Nothing blocks on it. Fichas carries its own (about 30 lines) and switches when it lands | |
| + |
| +**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: digits, the locale's group mark only at valid group positions, its decimal mark at most once, and a leading minus. One convention means one reading, so it cannot be ambiguous; it never rounds, and it writes the canonical form. 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, in every linked locale, reads back through it as the same value. |
| + |
| --- |
| ## 7. Files and images (Q6) |
| @@ -728,6 +795,7 @@ To be added to the leak list in the README: |
| - that a person has drafts in progress, and when. |
| **Outside the file:** |
| +- **The reader's formatting locale** (§6.8) is in their browser's `Accept-Language` and, if they chose one, the `fichas-formats` cookie. Fichas never logs or stores it. |
| - **Filter values and searches in URLs** (Q4): in the browser's history and address bar, in links people share, and in CARLOS' edge logs if they record query strings. Never in the app's own log. |
| - **TensorX** receives the sentence and the type and field labels for each Describe it call (R6, draft 2 §4). TensorX is zero data retention and treated as local (2026-09-19). |
| - **CARLOS' bucket** holds padded ciphertext and its sizes (§7). |
| @@ -750,7 +818,7 @@ The importer's §17 sketches phase 2. This level-up gives it each thing it asks |
| |---|---|---| |
| | `title` | the title field | — | |
| | `rich_text` | Text, or Long text over one line | — | |
| -| `number` | Number with Notion's format; a currency format becomes **Money** in that currency. If any row holds more decimal places than the currency allows, the field falls back to Number with `decimals`, and the report says so | the sketch left format open | |
| +| `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, written in canonical form: no locale reads it (§6.8) | the sketch left format open | |
| | `select` | Choice, colours as tones | — | |
| | `status` | Choice, marked as the type's status | — | |
| | `multi_select` | **Multi-select** | was Text | |
| @@ -766,6 +834,8 @@ The importer's §17 sketches phase 2. This level-up gives it each thing it asks |
| | `unique_id` | Text, print, so Notion's numbers survive | — | |
| | `button`, `verification`, `place` | not imported; `place` as Text | — | |
| +**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. |
| + |
| **A row's page body goes into the card's Notes** (Q9), a Long text field the importer adds when the type has none. |
| - Long text shows paragraphs and line breaks only. The importer's Fichas mapper writes headings as their own lines, list items as "• " lines, to-dos as "☐ " or "☑ ", and links as "text (address)". |
| - A body over 20,000 characters is cut at a paragraph and counted in the run report. Nothing is dropped silently (importer D10). |
| @@ -829,28 +899,28 @@ func (s *Store) StoreFile(ctx context.Context, actor Actor, name string, data io |
| --- |
| -## 13. Open questions for Paul |
| +## 13. Questions for Paul, now ruled |
| -Each answer below is the author's proposal. The design is built on it, and none is a ruling until Paul says so. |
| +Each answer below was the author's proposal. **Paul approved all twelve on 2026-11-17** ("Yes"), so each is now a ruling. |
| -1. **Q1, the direction.** *Proposed, awaiting Paul:* Escritorio, with Expediente's sentence as the caption over the table and Rejilla's keyboard in the cells. (The direction is Paul's ruling of 2026-11-17; the two borrowings are the proposal.) |
| -2. **Q2, team views.** *Proposed, awaiting Paul:* 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. |
| -3. **Q3, saving.** *Proposed, awaiting Paul:* each edit saves at once, is logged, and gets Undo in a toast. There is no per-row Save. |
| -4. **Q4, filter values in the URL.** *Proposed, awaiting Paul:* 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. |
| -5. **Q5, column totals.** *Proposed, awaiting Paul:* count only. A sum would break "never a second calculator". |
| -6. **Q6, files and images.** *Proposed, awaiting Paul:* 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). |
| -7. **Q7, dates.** *Proposed, awaiting Paul:* a date may have an end date and a time, each turned on per field. |
| -8. **Q8, the calendar.** *Proposed, awaiting Paul:* the calendar view is in this level-up. |
| -9. **Q9, Notion page bodies.** *Proposed, awaiting Paul:* a Notion row's page body imports into the card's Notes. |
| -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. *Proposed, awaiting Paul:* no separate mode. **The name opens the card**; every other cell edits in place (D1). |
| -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. *Proposed, awaiting Paul:* 90 days, as Mapa's history, built in Phase 1 with the History panel. |
| -12. **Q12, money as its own kind.** *Proposed, awaiting Paul:* "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. |
| +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.) |
| +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. |
| +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. |
| +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. |
| +5. **Q5, column totals.** *Ruled by Paul, 2026-11-17:* count only. A sum would break "never a second calculator". |
| +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). |
| +7. **Q7, dates.** *Ruled by Paul, 2026-11-17:* a date may have an end date and a time, each turned on per field. |
| +8. **Q8, the calendar.** *Ruled by Paul, 2026-11-17:* the calendar view is in this level-up. |
| +9. **Q9, Notion page bodies.** *Ruled by Paul, 2026-11-17:* a Notion row's page body imports into the card's Notes. |
| +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). |
| +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. |
| +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. |
| --- |
| ## 14. Phasing |
| -**Phase 0:** this spec, reviewed by Fable until no High finding is left. Then Paul's answers to §13. Then stop. |
| +**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. |
| 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`. |
| @@ -864,19 +934,22 @@ Each phase after that is its own branch from `main`, with mock-ups checked again |
| 7. The card beside the list, J and K, Next and Previous across pages (§5.4). |
| 8. The value window (Q11): its length, the sweep that erases payloads past it, and History on the card (§5.5). |
| 9. Phones: the list of rows and the edit sheet (§5.8). |
| -10. Gates LU3, LU4, LU5, LU9, LU10 and LU11 for this phase. |
| +10. **Formats** (§6.8): `locales/modern`, `FICHAS_LOCALE`, the formatting locale from the browser, `$L` in every template, and every count, number and date Phase 1 draws written through it (the float bridge for numbers, words for dates). Number cells read input with the interim strict reading, with the echo and the unchanged-seed rule. |
| +11. Gates LU3, LU4, LU5, LU9, LU10, LU11 and LU17 for this phase. |
| **Phase 2: saved views.** |
| 1. `[estilo-float]` in estilo, if it has not landed (§3.4). |
| 2. **Option ids** (§6.2): the boot reconcile from labels to ids, retired options, and filters by id. Views must never be saved holding labels. |
| 3. **The team's zone and numbers,** which views filter and sort on: `FICHAS_TIME_ZONE` with embedded tzdata, the number grammar, its canonical form and its reconcile (card values only), and exact decimal comparison (§6.2). |
| + - **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 rather than the float bridge. |
| + - The Formats page and its cookie (§6.8), and search by value (§6.4). |
| 4. The `views` table, `SeedViews`, `viewFor` with `scope.Owned`, the `fichas-views` cookie, the columns cookie retired (§4.3, §4.6, §4.8). |
| 5. The URL grammar: sections, per-kind values, `parse` and `href`, the redirect from today's parameters, the 4,000-byte rule and `POST /t/{type}/preview` (§4.9). |
| 6. The View panel for the table and the cards layouts: filter on any field with §6.3's operators for today's kinds, sort by several, group as one table with a `<tbody>` per group, columns with order, width, hide and freeze (§4.1, §4.4–4.6). |
| 7. The caption (§4.10). |
| 8. The switcher, Save, Save as new, Reset, team and personal scope, the revision check, Manage views, view history, Restore, Undo and deleted views (§4.2, §4.8). |
| 9. Count only (§4.7). |
| -10. Gates LU6, LU7, LU8 and LU12, and LU1, LU3, LU5, LU9 and LU10 extended to views. |
| +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. |
| **Phase 3: board and calendar.** Both work on today's kinds: a board by a Choice, a calendar by a Date. |
| 1. The board: columns by a Choice (Person and Checkbox once Phase 4 adds them), a move as a field edit with Undo, "Move to…" without script, New in a column, empty columns, the first 100 and "Show all", the phone's snap scroll. |
| @@ -884,12 +957,12 @@ Each phase after that is its own branch from `main`, with mock-ups checked again |
| **Phase 4: the new kinds.** Through today's add-field page, which gains them, so they are usable before the stepped designer. |
| 1. Date ends and times (§6.2), on Phase 2's zone. |
| -2. Number formats and Money (§6.2, Q12), on Phase 2's grammar. |
| +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). |
| 3. Checkbox, Multi-select and Person (§6.5), with board columns by Person and Checkbox. |
| 4. Link to…: ids in the index with titles resolved when drawn, the backlink map, Linked here, the picker and its search page, and the linking cards' revisions on a target's delete (§6.6; draft 2's slice D). |
| 5. The People type and Customer's Contacts (§8.4). |
| 6. Each kind's filter, sort and group (§6.3), S3's text (§6.7), and the URL values (§4.9). |
| -7. Gates LU2, LU14 and LU16. |
| +7. Gates LU2, LU14 and LU16, and LU17 extended to money. |
| **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. |
| @@ -903,13 +976,13 @@ Each phase after that is its own branch from `main`, with mock-ups checked again |
| ## 15. Gates |
| -**Every existing gate keeps passing,** unchanged: the file gate (`TestPlaintextNeverReachesTheDatabase`), the allowlist, the index's event feed, the store's revision chain, the suite conformance test and its pinned twelve failures, the markup gates, and `make browser`'s walk. The new gates are LU1–LU16. They run in `make ci` unless marked "browser". Each guard is mutation-tested, with the mutation and date in the test's comment, as Fichas' gates are today. |
| +**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. |
| - **LU1, the file gate grows.** New canaries, written through the real store and routes: a view name, a filter value in a saved view, a folder name, a type description, an icon slug, a section name, help text, a field's currency, an option label, a multi-select option, a person's address, a linked card's title, a file name, a canary inside a file's bytes and inside its EXIF, a draft's sentence, and money and date values. None may appear in the database, its WAL, the blob directory, **or the temporary directory** (a large multipart upload must not spill there). No blob starts with a PNG or JPEG magic number. |
| - **LU2, the allowlist and settings.** Every new plaintext column is named with its case; `sealed_settings` and `sealed_payload` are `[]byte` and covered by LU1. Each kind's settings schema refuses an unknown key or value at write (validation, since settings are sealed). |
| - **LU3, events.** Every write in §9 logs in the same transaction, and a write whose event fails does not land (`TestAChangeThatCannotBeLoggedDoesNotLand`, extended). One mutant per new write path drops its event and must be caught. The named exemptions are tested as exemptions. The boot reconciles log with `AppBecause` and a reason. |
| - **LU4, writes that do not cross, and Undo.** |
| - - A stale `was` is refused with 409 and writes nothing. A repeated identical write succeeds with no event. An unchanged `1,200` or `€48,000.00` is not a change. Two people editing two fields of one card both land. |
| + - 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. |
| - The edit form is all or nothing on a conflict. |
| - Undo restores only fields that still hold the event's after value, names the ones it left, logs with `trigger_id`, and refuses (404) a `created` event, another person's event, an entry, a reconcile's change and an event whose payload was erased. Undo skips a removed file and an unknown option id, and says so; it may put back a retired option. Redo names an Undo's event, by the same person. |
| - A view's Undo and Restore follow the same rules. |
| @@ -936,6 +1009,13 @@ Each phase after that is its own branch from `main`, with mock-ups checked again |
| - **LU15, the assistant.** With a fake provider capturing each request, no card value canary is ever sent. The answer's limits hold (5 types, 25 fields, 30 options). It is off with no key. The rate limit holds. Its log line holds no sentence and no answer. |
| - **LU16, links.** A link value is never printed. A linking card shows a target's rename at once, in its cell, its sort, its group and its search, with no write to the linking card. Deleting a target bumps each linking card's revision in the same transaction, with one event each; S2 then answers `STALE` for the old revision and S3's text leaves the target out. Backlinks follow every change to a link value. A link to a card of the wrong type, or to a gone card, is refused. The delete's bump moves neither `updated_at` nor "Edited by". |
| +- **LU17, formats.** |
| + - **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 1200.5 as `1.200,5`; under `en-IE`, `1,234` and `1,200.5`. A value past the float bridge shows canonical, never rounded. No template calls a locale function without `$L`, and `commas` is gone. |
| + - **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. |
| + - **Which locale.** Accept-Language's q order is followed; an unlinked or malformed tag is skipped; a bare language matching the team default's yields the team default; nothing usable yields `FICHAS_LOCALE`; an invalid `FICHAS_LOCALE` refuses boot. The chosen cookie wins (Phase 2). |
| + - **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. |
| + - **Round trip.** For every linked locale, every number Fichas draws (grouped and ungrouped, negative, with a fraction) reads back as the same value, and so does every seed. |
| + |
| --- |
| ## 16. Departures |
| @@ -966,6 +1046,8 @@ Each phase after that is its own branch from `main`, with mock-ups checked again |
| - **D19, deleting a card bumps the cards that link to it** (§6.6), a write base §5's deletion rule now needs because links exist. |
| - **D20, the import may set a card's Created** to Notion's time (§11). |
| - **D21, `maxOptions` rises from 50 to 200** (§8.2), because Notion selects run past 50. |
| +- **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`. |
| +- **D23, formats follow the reader; words do not.** Numbers, money and dates are written in the browser's locale, or the person's choice, with a team default; the interface stays English. Until rastrillo's packs carry date patterns (R3), dates are words in one order for everyone (§6.8). |
| --- |
| @@ -979,6 +1061,21 @@ Choices made while building, where this spec was silent or the build chose diffe |
| ## 18. Findings and what changed |
| +### Revision 4: Paul's question about localisation, 2026-11-17 |
| + |
| +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. |
| + |
| +| Change | Where | |
| +|---|---| |
| +| The formatting locale: the person's choice, then `Accept-Language`, then `FICHAS_LOCALE` (default `en-IE`); every pack linked; English words with the reader's formats through `ui.Localizer` | §6.8, §3.2, §10.2 | |
| +| Counts, numbers, money and dates drawn through `$L` everywhere a value shows; dates in words until R3 | §6.8, §4.10, §5.5 | |
| +| 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 | |
| +| Search matches numbers and money by value in the reader's format | §6.4 | |
| +| 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 | |
| +| The canonical form, the reconcile, S3's text and the Notion mapping stated as locale-free | §6.2, §6.7, §11 | |
| +| Gate LU17; LU4's unchanged-value case restated per locale | §15 | |
| +| D22, D23 | §16 | |
| + |
| ### Round 1: Fable on revision 1 (`00e3ad3`), CHANGES REQUIRED, answered in revision 2 |
| | Finding | Change | Where | |