From 8fc71bbf89efa263d402f38804a9f77a73147452 Mon Sep 17 00:00:00 2001 From: ai-bot Date: Thu, 15 Oct 2026 19:20:26 +0000 Subject: [PATCH] Note: the 32.1/32.2 follow-up, the security alert source and the new traps --- ai-note.md | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/ai-note.md b/ai-note.md index c2a9496..7ed1e35 100644 --- a/ai-note.md +++ b/ai-note.md @@ -8,17 +8,17 @@ Short working handover for the next model. Keep it short. ## Status -- **Done and verified:** sections 1–31 and section 18 steps 1–11. **Section 32.2, the UI pass with the retro theme, and the SVG half of section 32.1, the icon, are also done**, together with **section 32.4, the bug report** (round 32-A and round 32-B) and **section 32.3, the alert and page texts**. Schema version 12. **484 green tests.** The StartOS package is built, sideloaded and running on a StartOS 0.4.0 box; the package version is still `0.1.0:0`. -- **What is left of section 32:** the two PNG icons at 192 and 512 px (they need a rasterizer), 32.6 the documentation drift, and 32.5 the raise to `1.0.0:0` together with section 18 step 12. 32.6 has to come after 32.1–32.2 and before 32.5. One item inside 32.4 is left to the user: **BR-003** — read the 32.4 section below before acting on it, because the report's own wording for it is out of date. +- **Done and verified:** sections 1–31 and section 18 steps 1–11. **Section 32.2, the UI pass with the retro theme, and the SVG half of section 32.1, the icon, are also done**, together with **section 32.4, the bug report** (round 32-A and round 32-B) and **section 32.3, the alert and page texts**. The follow-up round of 32.1 and 32.2 — the favicon, the top-bar brand mark, the footer at the bottom, the single way back, the history button and the three line/table changes in the history view — is done too. Schema version 12. **494 green tests.** The StartOS package is built, sideloaded and running on a StartOS 0.4.0 box; the package version is still `0.1.0:0`. +- **What is left of section 32:** the two PNG icons at 192 and 512 px (they need a rasterizer), 32.6 the documentation drift, and 32.5 the raise to `1.0.0:0` together with section 18 step 12. 32.6 has to come after 32.1–32.2 and before 32.5. One item inside 32.4 is left to the user: **BR-003** — read the 32.4 section below before acting on it, because the report's own wording for it is out of date. The user's own manual pass is also outstanding: the retro theme on a narrow phone, the footer on a short page, the favicon in the tab, the brand mark in the top bar, the history view after the three changes, and the whole box test again. - **A round stops when it is done.** Do not start the next item unless the user asks. - **Verified how:** the automated suite, the user's manual browser testing, and the install and test round on a StartOS 0.4.0 box. The user runs the suite; the agent has no shell. - **Tests:** `python3 -m unittest discover -s tests`. They run on a Windows copy at `C:\Users\\Downloads\helsesjekk`, so they must pass there as well as on Linux. -- **Known gap, still open, folded into 32.6:** `docs/application.md` and `README.md` still describe the API as it was before section 31 — no login/session endpoints, no gating or CSRF rule, the old maintenance command name, the undated export name, and now also the two new summary fields and the moved field reminder. The documentation conflict in the bug report (BR-004) covers the same ground. +- **Known gap, still open, folded into 32.6:** `docs/application.md` and `README.md` still describe the API as it was before section 31 — no login/session endpoints, no gating or CSRF rule, the old maintenance command name, the undated export name, and now also the two new summary fields, the moved field reminder, the added `model` field in the check detail and the icon link on the pages. The documentation conflict in the bug report (BR-004) covers the same ground. ## Section 32 — what is left -- **32.1 The icon — done for the SVG, open for the PNGs.** `icon.svg` at the root and `static/icon.svg` are the same retro drawing: a raised grey window with the navy title bar and three keys. The root file is 1.3 KiB, well under the 40 KiB cap, and it is plain SVG with no font, image or network reference, so the `default-src 'self'` CSP holds. `/icon.svg` was already in `STATIC_FILES`, in the manifest's `icons` entry and in the service worker's allow-list, so no path is new. **What is left:** the 192 and 512 px PNGs, which need a rasterizer the agent does not have. The user rasterizes `static/icon.svg`, adds both to the manifest's `icons` entry with `sizes` and `type: "image/png"`, adds the paths to `STATIC_FILES` in `app.py` and to the allow-list in `static/sw.js`, and updates `tests/test_pwa.py`. The placeholder with `sizes: "any"` is a fine place to stop. -- **32.2 UI polish — done.** See the round 32.2 section below. The only thing left for the user is the manual browser pass on a narrow phone. +- **32.1 The icon — done for the SVG and the favicon, open for the PNGs.** `icon.svg` at the root and `static/icon.svg` are the same retro drawing: a raised grey window with the three keys, centred in the face. **The navy title bar is gone** (the follow-up round removed it), and the keys were recomputed so they are centred: one key group is 21 high, the face inside the bevel runs from 6 to 122, so the centre is 64 and the keys sit at `translate(23, 25.5)`, `(23, 51.5)` and `(23, 77.5)`. The root file is 1.2 KiB, well under the 40 KiB cap, and it is plain SVG with no font, image or network reference, so the `default-src 'self'` CSP holds. Every one of the six pages links `/icon.svg` as its favicon, and the top-bar brand mark is the icon image under the same `brand-mark` class. `/icon.svg` was already in `STATIC_FILES`, in the manifest's `icons` entry and in the service worker's allow-list, so no path is new. **What is left:** the 192 and 512 px PNGs, which need a rasterizer the agent does not have. The user rasterizes `static/icon.svg`, adds both to the manifest's `icons` entry with `sizes` and `type: "image/png"` (**the SVG entry must stay first**, or `test_the_manifest_lists_the_served_icon` breaks), adds the paths to `STATIC_FILES` in `app.py` and to the allow-list in `static/sw.js`, and updates `tests/test_pwa.py`. The placeholder with `sizes: "any"` is a fine place to stop. +- **32.2 UI polish — done**, including the follow-up round. See the round 32.2 section below. The only thing left for the user is the manual browser pass on a narrow phone and over the new points. - **32.3 Alert and page texts — done.** See the round 32.3 section below. - **32.4 The bug report — done.** See the section below for what each finding turned out to be. - **32.6 The documentation drift.** `README.md`, `docs/application.md`, `instructions.md`, `UPDATING.md`, `AGENTS.md` and the package's own i18n strings are all behind the code. `TODO.md` §32.6 lists what is wrong in each. It answers the rest of BR-004, and it must be done after 32.1–32.2 and before 32.5, so the documents describe the released state. @@ -41,26 +41,39 @@ Short working handover for the next model. Keep it short. - **Tests:** `tests/test_health_check_form.py` (+6), `tests/test_app.py` (+2, one renamed), `tests/test_secret_guard.py` (WarningTests rewritten, 6 → 5), `tests/test_key_status.py` (one test renamed and extended) and `tests/test_pwa.py` (colours). The suite went from 477 to 484. - **The help-line test is page-aware on purpose.** `settings.html` has no `class="field-grid"` at all, so the test maps each of the three pages to the block it actually puts under the help line: a field grid on the setup page, a stack on the check form and on the settings page. Do not "simplify" it back to one block name for all three. +## The follow-up round of 32.1 and 32.2 — the icon, the favicon, the footer and the history + +Six small changes, no new feature and no schema change. The whole round is one commit series; the reasoning is in `TODO.md` §32.1 and §32.2 points 16–21. + +- **The icon lost its navy title bar and the keys are centred.** `icon.svg` and `static/icon.svg` are the same drawing. The keys are 21 high per group and the face is 6–122, so the centre is 64 and the translate values are `25.5`, `51.5` and `77.5`. The style, the `viewBox` and the `role`/`aria-label` are unchanged. The `aria-label` is still `VardKey icon`, so `tests/test_pwa.py`'s manifest test (which only checks that `/icon.svg` is served) still passes. +- **The favicon is on all six pages.** `` sits in `` next to the manifest link on the five pages that have one; `/login` has no manifest, so it stands next to the stylesheet there. +- **The brand mark is the icon image.** `` became ``. **The class name is kept**, because the stylesheet and the tests refer to it. `.brand-mark` is now `width: 18px; height: 18px; border: 2px solid; border-color: #ffffff #000000 #000000 #ffffff; background: var(--face); image-rendering: pixelated;` — `display: grid`, `place-items: center`, `color`, `font-size` and `font-weight` are gone, and `IconTests` asserts that `place-items: center` appears nowhere in the sheet. +- **The footer sits at the bottom on a short page.** `body` is a column with `min-height: 100vh` and `min-height: 100dvh`, and `main { flex: 1 1 auto; }` takes the rest, so `.footer` lands at the bottom. No other layout rule was touched. `IconTests` pins those four declarations. +- **There is one way back to the dashboard.** The top-bar `Back to dashboard` link is gone from `history.html`, `settings.html`, `setup.html` and `health-check.html`; the `VardKey` brand mark is the way back. **The link in the blocked-keys note stays** — it points at the dashboard for a different reason, and `tests/test_health_check_form.py` still asserts its wording. `history.html` also lost the `Start annual health check` button: a check is started from the dashboard. +- **The history view changed in three places.** In `static/history.js`, `mergedLine(...)` joins `wallet_software` and `software_version` into one line (`Sparrow Wallet 2.5.1`) and `model` and `firmware_version` into one line (`Blockstream Jade 1.4.1`); a missing part is left out and a pair with neither shows `—`. The `Follow-up closed` table is now `["Alert", "Action", "Closed"]` — **the `Source` column is gone**. +- **The model had to be added to the detail response.** `get_health_check()` did not select `k.model`, so `GET /api/health-checks/` carried no model at all. It is now selected in the key-check query and comes in **in addition** to the fields that were already there; no existing field was renamed. `tests/test_pwa.py`'s `IconTests` and three new tests in `tests/test_health_check_form.py` pin the page and history changes, and `tests/test_alerts.py` pins the alert source below. +- **Tests:** three in `tests/test_alerts.py`, four in `tests/test_pwa.py` and three in `tests/test_health_check_form.py`, so the suite went from 484 to **494**. Nothing in `tests/test_app.py` or `tests/test_database.py` had to change: the added field is additive and no test there asserts a whole record. + ## Section 32.4 — the bug report, as it turned out `BUG-RAPPORT-AI-AGENT.md` carries the full verdicts at the end. In short: - **BR-001 — false positive.** The source files are in `main` and tracked by Git. The report was written from the repository's web view, not from a checkout. - **BR-002 — confirmed and fixed** (round 32-B). See the guard section below. The user has since confirmed by hand that a seed phrase is stopped in the name field and in the address path field. -- **BR-003 — the report's wording is out of date; what is left of it belongs to §32.** The report says the manual end-to-end pass is still open, but it quotes a §31 text that no longer exists, and §16 and §17 record that the manual browser pass and the box tests were run and verified through §31. What is actually outstanding is the **new** manual work §32 adds — the icon (32.1), the UI pass and the retro theme (32.2), the alert texts (32.3), and the whole box test again after the changes (32.5) — plus the user's confirmation that they have been run. Do not re-verify what §16 and §17 already record as done. +- **BR-003 — the report's wording is out of date; what is left of it belongs to §32.** The report says the manual end-to-end pass is still open, but it quotes a §31 text that no longer exists, and §16 and §17 record that the manual browser pass and the box tests were run and verified through §31. What is actually outstanding is the **new** manual work §32 adds — the icon (32.1), the UI pass and the retro theme (32.2), the alert texts (32.3), the follow-up round's pages, and the whole box test again after the changes (32.5) — plus the user's confirmation that they have been run. Do not re-verify what §16 and §17 already record as done. - **BR-004 — falls away.** `AI-STATUS.md` and `DATA-MODEL.md` do not exist in this repository, so there is no conflicting pair to reconcile. The real documentation drift is 32.6. - **BR-005 — verified in code, no behaviour change.** Only `GET /health`, `GET /api/session` and `/login` are open; every other `/api/*` answers `401` and the pages answer `302` to `/login`; every state-changing POST needs a session and the CSRF token (`403`). The `Secure` cookie attribute is deliberately left off, because StartOS terminates TLS and proxies plain HTTP into the container. The report itself says not to change `app.py` behaviour for this one. - **BR-006 — confirmed and fixed.** The CSV export neutralizes a text cell a spreadsheet would read as a formula. - **BR-007 — confirmed and fixed.** The service worker only stores a successful, same-origin, non-redirected response. - **BR-008 — confirmed and fixed.** The address-path comparison is canonical. - **The report was written against a different file set.** It asks for `SECURITY.md`, `PRIVACY.md`, `THREATMODEL.md`, `PLATFORM-ACCESS.md`, `ENCRYPTION.md`, `OFFLINE.md`, `AI-STATUS.md` and `DATA-MODEL.md`; none of them exist here. Do not create them. -- **The counts in the report were partly wrong and are corrected there.** Round 32-A added ten tests, not eight, and `tests/test_secret_guard.py` holds 43, not 44: 5 wordlist tests, 10 detection tests, 17 field-level tests, 6 warning tests and 5 API tests. The suite went from 422 to 475, which is the number the user confirmed. Round 32.3 added two more — one in `tests/test_alerts.py` and one in `tests/test_health_check_form.py` — and round 32.2 added seven net, for 484. The seven are six new tests in `tests/test_health_check_form.py` and two in `tests/test_app.py`, minus the one `WarningTests` test that the rewritten class no longer has. +- **The counts in the report were partly wrong and are corrected there.** Round 32-A added ten tests, not eight, and `tests/test_secret_guard.py` holds 43, not 44: 5 wordlist tests, 10 detection tests, 17 field-level tests, 6 warning tests and 5 API tests. The suite went from 422 to 475, which is the number the user confirmed. Round 32.3 added two more — one in `tests/test_alerts.py` and one in `tests/test_health_check_form.py` — and round 32.2 added seven net, for 484. The seven are six new tests in `tests/test_health_check_form.py` and two in `tests/test_app.py`, minus the one `WarningTests` test that the rewritten class no longer has. The follow-up round of 32.1 and 32.2 added ten more, for 494. ## Round 32.3 — the alert texts and the page texts The eleven rows in `TODO.md` §7 (eight codes, two of which have a key form and a software form) now read alike in shape: what is wrong, which key or software it is about, and what closes the alert. `code`, severity, `source`, the actions and the `software` field are unchanged. The shape is written down in §7, so a new alert follows it. -- **The source names the key or the software, so the message does not repeat it.** `source` is either `Key N: ` or the software name, and it is shown right above the message in the alert list, in brackets on the key card and in front of the message in the form's blocking note. That is why the messages say "this key". The one exception is the cloud-key form of `software_incompatible`: its source is the key, so its message names the software. +- **The source names the key or the software, so the message does not repeat it.** `source` is either `Key N: ` or the software name, and it is shown right above the message in the alert list, in brackets on the key card and in front of the message in the form's blocking note. That is why the messages say "this key". The one exception is the cloud-key form of `software_incompatible`: its source is the key, so its message names the software. **The follow-up round made the security alerts follow this rule too** — see the alerts section below. - **The two forms of a security code carry their own message.** `_VULNERABLE_MESSAGE` and `_COMPROMISED_MESSAGE` were split into `_VULNERABLE_KEY_MESSAGE` / `_VULNERABLE_SOFTWARE_MESSAGE` and `_COMPROMISED_KEY_MESSAGE` / `_COMPROMISED_SOFTWARE_MESSAGE`, because the key form is closed by a rotation and the software form by removing the software. - **Two more constants were pulled out of `_key_alerts`:** `_HARDWARE_FAILURE_MESSAGE` and `_SEED_BACKUP_MESSAGE`. `_SOFTWARE_INCOMPATIBLE_KEY_MESSAGE` is a template with `{software}`. - **"Replace the key" is gone** where the only action offered is `rotate`. **"PROTOCOL 3: key loss" and "follow the key loss procedure" are gone too** — neither term is defined anywhere in the app or the documents, so they pointed at a concept the user does not have. @@ -116,10 +129,11 @@ The package is one service: one daemon, one container, one SQLite database on th The rules are in `TODO.md` §7; these are the traps that have already cost time. - **The acknowledgement stores the key.** `alert_acknowledgements.key_id` is nullable and holds the key the alert belonged to, or `NULL` for a software alert raised by the settings list. An alert with a key is acknowledged and hidden by `(code, key_id)`; an alert without one stays on `(code, source)`. This closed a real bug: a rename — or a `rotate` with `keep_name=false` — used to reopen a closed alert, because `source` carries the name the key has *now*. +- **A key-sourced security alert carries `Key N: `.** `build_alerts()` reads the key checks into two lookups — `key_ids` (name → id) and `key_sources` (name → `Key N: `, built with `_key_source()`) — and `_security_alerts()` takes both. When the provider is the key's own configured name, the key is the source and the alert belongs to it, so it is closed by a rotation; otherwise the source is the plain software name and it is closed by removing that software from the settings. The software form's source is unchanged. **Because the acknowledgement hides a key alert by `key_id`, not by `source`, an alert closed before this change stays closed** — `test_a_key_named_security_alert_is_hidden_by_its_key` pins it. `rotation_alert_targets()`, `software_alert_targets()` and `newest_alert_check_id()` all read the same `build_alerts()`, so they see the same source, which is what keeps an alert closable. - **The contact alert belongs to the checked key.** It gets `key_id` and `source` = `Key N: `, and its message says "this key" and no longer repeats the name (round 32.3). The severity stays `info` and the action stays `contact_updated`. It blocks its key like every other key alert, because `blocking_alert()` and the `blockingAlerts` filter in the form only look at `key_id`. A record without a key check raises no contact alert at all. - **`software_incompatible` has two forms.** A software from the settings list keeps `source` = the software name, `key_id` = `None`, actions `[remove_software]`, and carries `software`. A wallet software that is the name of a configured cloud key can never be removed from the settings, so that form belongs to the checked key instead: `key_id` = the checked key, `source` = `Key N: `, actions `[replace_hardware]`, and **no** `software` value, so a settings removal can never close it. Only that form names the software in its message, because its source is the key. - **`alerts.py` needs the cloud key names.** `build_alerts()` and `collect_alerts()` take `cloud_names=()`, threaded through `rotation_alert_targets()`, `software_alert_targets()`, and the four call sites in `app.py` (`_send_alerts`, `_blocking_alert`, `_rotate_key`, `_close_removed_software`), plus `newest_alert_check_id()`. `app.cloud_key_names(keys)` builds the tuple. If `newest_alert_check_id()` does not get exactly the same names as `collect_alerts()`, the alert's `source` differs, the acknowledgement stores `check_id = None`, `_is_acknowledged()` refuses to hide an alert without a check id, and the alert can never be closed. Keep the default `()` on `build_alerts()`. `_send_health_check_list()` passes the same tuple for its `needs_follow_up` field, for the same reason. -- **The closures that belong to a key are shown.** `app.closed_alerts()` and `database._grouped_closures()` both filter on `key_id IS NOT NULL`, so a rotation, a replaced hardware, an updated contact, and an ignored key alert are listed, while `remove_software` and a software-sourced `ignore` are not. `GET /api/health-checks/` returns them as `closed_alerts`, and the CSV has one last column, `Follow-up closed`, with `code: action (YYYY-MM-DD)`, hanging on the check it closed through `check_id`. +- **The closures that belong to a key are shown.** `app.closed_alerts()` and `database._grouped_closures()` both filter on `key_id IS NOT NULL`, so a rotation, a replaced hardware, an updated contact, and an ignored key alert are listed, while `remove_software` and a software-sourced `ignore` are not. `GET /api/health-checks/` returns them as `closed_alerts`, and the CSV has one last column, `Follow-up closed`, with `code: action (YYYY-MM-DD)`, hanging on the check it closed through `check_id`. The history table shows `Alert`, `Action` and `Closed` only — the source is not a column. - **The key card shows the next due date with the alert note.** `createKeyCard()` in `static/app.js` always renders `Next check due` and adds the alert note on top. `Last checked` was dropped in 32.2, but the note still comes in addition to the date, never instead of it — that is what cost the dates once before, for a key whose only alert was the informational contact one. - **The type is part of a key's identity.** The setup locks it, the settings never change it, and only a rotation may pick the other one: `POST /api/keys//rotate` takes an optional `type`, and leaving it out keeps the current type. `save_key_settings(..., key_type=None)` uses `COALESCE(?, type)`, so the settings and a rotation share one statement. - **A key that becomes a cloud key must not take a taken name.** A cloud key offers its own name as a wallet software choice, and the settings list holds the other choices, so a name the list already holds is refused with `409` through `WalletSoftwareNameInUse` — a `ValidationError` subclass, so it has to be caught before the general `ValidationError` in `_rotate_key`, or the `409` turns into a `400`. `validate_rotation()` therefore takes the wallet software list as a fourth argument. @@ -175,7 +189,7 @@ Pages: `/`, `/setup`, `/settings`, `/health-check`, `/history`, `/login`. Endpoi Maintenance commands, run inside the container by the StartOS actions and usable by hand: `maintenance.py delete-all-data` and `maintenance.py set-admin-password`. Neither is an HTTP endpoint. -The rotate payload is `replaced` + `keep_name` + `name` + `type` + `address_path`, and `type` is optional. `GET /api/health-checks/` also returns `closed_alerts`. The settings page has two sections, and `POST /api/settings/keys` is what a rename alone goes through. +The rotate payload is `replaced` + `keep_name` + `name` + `type` + `address_path`, and `type` is optional. `GET /api/health-checks/` also returns `closed_alerts`, and each of its `key_checks` rows carries `model` as well — the field was added in the follow-up round of 32.1 so the history can show the model and the firmware version on one line, and the fields that were already there keep their names. The settings page has two sections, and `POST /api/settings/keys` is what a rename alone goes through. Five things that are easy to break: @@ -199,12 +213,13 @@ Five things that are easy to break: - **The key card's line order is pinned by two test modules.** `tests/test_key_status.py` asserts `card.append(top, name)` → `card.append(model)` → `card.append(path)`, and `tests/test_health_check_form.py` asserts that the top line is `${String(entry.key_number).padStart(2, "0")} · ${keyTypeLabel(entry.type)}`, that `card.append(type)` is gone, and that the model line is skipped by `sameLabel(entry.model, entry.name)`. Adding a line, reordering them, or dropping `sameLabel()` breaks them. - **The dashboard heading is dynamic and the static description is gone.** `tests/test_app.py` asserts `id="setup-shape"` and the fallback text on the dashboard and `assertNotIn("Bitcoin Multisig Health Monitor")` there, while `tests/test_pwa.py` still asserts that exact description in the manifest. Do not move the one into the other. - **The stylesheet test asserts on the shape of the theme, not on its wording.** `test_stylesheet_is_the_retro_theme` checks the two bevel colour pairs, the dotted focus outline, the font stack, the absence of `box-shadow` and `gradient`, and that every `border-radius` in the sheet is `0`. It reads the values, so a restyled rule that keeps the palette passes, and a rounded corner does not. +- **The brand mark is an image, and the class name is pinned.** `IconTests` in `tests/test_pwa.py` asserts that all six pages carry ``, that the old `` is gone, that the sheet holds `image-rendering: pixelated`, and that `place-items: center` appears nowhere. It also pins `min-height: 100vh`, `min-height: 100dvh`, `flex-direction: column` and the exact string `main { flex: 1 1 auto; }`, which is what keeps the footer at the bottom. Do not style the brand mark as a letter again, and do not drop the `main` rule. - **`make x86` runs `prettier --check startos`, and the config is the SDK's own.** `.prettierrc` is the single line `"@start9labs/start-sdk/prettier.config.json"`, which is `{ trailingComma: "all", tabWidth: 2, semi: false, singleQuote: true }` — everything else is prettier's default, so `printWidth` is 80 and `quoteProps` is `"as-needed"`. That last one silently unquotes a single-word i18n key (`Username: 21`, not `'Username': 21`), and 80 columns decides when an array element or an argument collapses onto one line. Write it the way prettier would, or run `npx prettier --config node_modules/@start9labs/start-sdk/prettier.config.json --write startos`. - **The page heading uses `class="eyebrow"` too.** A regex over `health-check.html` finds `Annual security check` before the numbered sections. `settings.html` starts with the `h1` `Settings`, then `01 / Wallet software` and `02 / Key rotation` — the eyebrow that repeated the `h1` was removed in round 32.3. `tests/test_health_check_form.py` asserts those two lists **exactly**, so a new eyebrow on either page breaks it, and so does a removed one: update the list in the same change. The 32-B warnings deliberately used `class="secret-warning"`, not an eyebrow. - **A static help line that the script overwrites is dead text.** `#software-help` in `health-check.html` was emptied in round 32.3, because `lockSoftwareFields()` fills it before the user can read it. `static/health-check.js` must keep setting it — the wording depends on the selected key. A test pins both halves: the empty element in the markup and `softwareHelp.textContent` in the script. - **`aria-labelledby` may point at the eyebrow.** `login.html`'s first form has no `h2` any more; its `aria-labelledby="login-form-title"` points at the eyebrow `

` that carries the same `id`. Do not add a heading back just to have one, and do not drop the `id`. - **Do not assert on the quoting style of the JavaScript.** `static/health-check.js` uses single quotes for constant selectors and template literals where a `${...}` substitution is needed, and `static/settings.js` uses double quotes. Assert on the selector text, e.g. `[name="address_path"]`, and on quote-free substrings such as `/api/settings` and `/settings?rotate=`. -- **`clean_record()` in `tests/test_alerts.py` has a fixed provider list and carries `key_id` and `wallet_software`.** A test that needs another provider must replace the entry itself, and the recorded software is `Sparrow Wallet`, which is what a software alert names. A test that exercises the cloud-key form of `software_incompatible` has to pass `cloud_names` to `build_alerts()`. The alert texts are asserted there, and **not** in `tests/test_app.py`, which checks the code, the severity, the source, the actions and the `key_id` only — so a message change touches `tests/test_alerts.py` alone. +- **`clean_record()` in `tests/test_alerts.py` has a fixed provider list and carries `key_id` and `wallet_software`.** A test that needs another provider must replace the entry itself, and the recorded software is `Sparrow Wallet`, which is what a software alert names. A test that exercises the cloud-key form of `software_incompatible` has to pass `cloud_names` to `build_alerts()`. The alert texts are asserted there, and **not** in `tests/test_app.py`, which checks the code, the severity, the source, the actions and the `key_id` only — so a message change touches `tests/test_alerts.py` alone. A security alert whose provider is the key's own name carries the **key source**, so a test that looks an alert up by source must use `Key N: ` for that form and the plain software name for the other. - **`sample_payload()` / `unavailable_payload()` are duplicated in `tests/test_validation.py`, `tests/test_database.py`, `tests/test_app.py`, `tests/test_maintenance.py` and `tests/test_secret_guard.py`.** They build the labels from the key's name and the selected software, they always send `contact_info_verified`, and for a hardware key `hardware_works`. They must send the key's **own** `address_path`, because the server compares it with the stored one. - **Every test fixture uses one address path per key** (`ADDRESS_PATH`, `SECOND_ADDRESS_PATH`, `THIRD_ADDRESS_PATH`), because the setup refuses duplicates. `tests/test_app.py` also has `ROTATION_PATHS` and the `rotate()` helper, which picks an unused path per key so a test can rotate several keys in one run. - **`validate_health_check()` takes a third argument** (the wallet software list), and `validate_rotation()` takes a fourth for the same reason. `tests/test_validation.py` and `tests/test_database.py` wrap the first one in a small `validate()` helper. @@ -212,6 +227,8 @@ Five things that are easy to break: - **The other server test modules share `tests/server_session.py`.** `test_export_filename.py`, `test_key_model.py`, `test_key_status.py`, `test_multisig_setup.py`, `test_pwa.py` and `test_secret_guard.py` mix in `SessionMixin`, which signs in through the API and carries the cookies; each class calls `authenticate()` at the end of its own `setUp`. **A test that switches `DATABASE_PATH` to another file has to call `authenticate()` again**, because the session secret lives in the database, so the old cookie is signed with the wrong secret and every request answers `401`. The mixin resolves the path with `app.get_database_path()`, so the admin lands in the file the server actually reads. - **Section 19 records one key per submission**, so a `Check id` in the export can cover up to three keys only for rows saved before section 19. A legacy record with several `key_checks` is read through its first one when an alert needs the key it belongs to. - **The database path default is repeated in sixteen places.** `database.py` carries `database_path="data/vardkey.sqlite3"` as the default of every storage function (fifteen of them), and `app.py` carries it in `get_database_path()`. A missed one makes a single code path read or create the other file, silently. Grep for the old name before and after a rename round. +- **The favicon link sits next to the manifest link, and `/login` has no manifest.** `IconTests` asserts the exact string `` on all six pages, so a reworded or reordered link breaks it. `/icon.svg` is open (it is not in `PROTECTED_PAGES` and does not start with `/api/`), which is what lets the login page and the browser tab read it. +- **`TODO.md` §32.1 lists the PNG steps, and the SVG entry must stay first in `icons`.** `test_the_manifest_lists_the_served_icon` reads `icons[0]`, so a PNG added in front of the SVG turns the suite red. ## Product clarification