32.7 handover: status, the new round section, the robots and menu rules, and the new traps

This commit is contained in:
ai-bot committed 2026-10-16 17:24:19 +00:00
1 parent 9b0ac81715
commit 2abbf078a6
1 file changed
+33 -13
+33 -13
View File
@@ -8,12 +8,12 @@ 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.1, the icon, is done** — the SVG drawing, the favicon on every page, the top-bar brand mark and the two 192 and 512 px PNGs — together with **section 32.2, the UI pass with the retro theme**, **section 32.3, the alert and page texts**, and **section 32.4, the bug report** (round 32-A and round 32-B). 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. **498 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:** **32.7 the dashboard menu and the dashboard clean-up** — the six checkboxes in `TODO.md` §32.7 — then 32.6 the documentation drift, and then 32.5 the raise to `1.0.0:0` together with section 18 step 12. 32.6 has to come after the rounds it documents, and 32.5 last. 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, installing the PWA with the two PNG icons, the history view after the three changes, and the whole box test again.
- **Done and verified:** sections 1–31 and section 18 steps 1–11. **Section 32.1, the icon, is done** — the SVG drawing, the favicon on every page, the top-bar brand mark and the two 192 and 512 px PNGs — together with **section 32.2, the UI pass with the retro theme**, **section 32.3, the alert and page texts**, **section 32.4, the bug report** (round 32-A and round 32-B), and **section 32.7, the dashboard menu and the dashboard clean-up**. 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. **511 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:** 32.6 the documentation drift, and then 32.5 the raise to `1.0.0:0` together with section 18 step 12. 32.6 has to come after the rounds it documents, and 32.5 last. 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 top-bar menu and the cleaned dashboard, installing the PWA with the two PNG icons, 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\<brukarnamn>\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, the moved field reminder, the added `model` field in the check detail, the icon link on the pages and the two PNG icons. The documentation conflict in the bug report (BR-004) covers the same ground. Section 32.7 adds the top-bar menu, the removed dashboard cards, the `Download CSV` link on the history page, and the robots rule to the same list.
- **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, the icon link on the pages, the two PNG icons, the top-bar menu, the removed dashboard cards, the `Download CSV` link on the history page and the robots rule. The documentation conflict in the bug report (BR-004) covers the same ground.
## Section 32 — what is left
@@ -21,10 +21,22 @@ Short working handover for the next model. Keep it short.
- **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.7 The dashboard menu and the dashboard clean-up — open.** Six checkboxes in `TODO.md` §32.7: a `Menu` drop-down in the top bar instead of the Sign out button (`Start health check`, `Settings`, `History`, a separator, `Sign out`); the `Configured setup` / `Your keys` heading and the `#key-count` label gone, with `#key-list` moved up under `#setup-shape`; the `Next check` card gone and the earliest due date moved into `Attention`; no placeholder text in an empty alert list; the dashboard history card gone with `Download CSV` moved to `/history`; and no indexing or crawling (`static/robots.txt`, a `noindex, nofollow` meta on all six pages, and an `X-Robots-Tag` header from `_send_security_headers()`). No schema change, no new endpoint, no new feature, and `static/robots.txt` is the only new file. It has to be done before 32.6, so the documents describe the released state.
- **32.7 The dashboard menu and the dashboard clean-up — done.** Six points, all in `TODO.md` §32.7: the `Menu` drop-down in the top bar instead of the Sign out button; the `Configured setup` / `Your keys` heading and the `#key-count` label gone, with `#key-list` moved up under `#setup-shape`; the `Next check` card gone and the earliest due date moved into `Attention`; no placeholder text in an empty alert list; the dashboard history card gone with `Download CSV` moved to `/history`; and no indexing or crawling (`static/robots.txt`, a `noindex, nofollow` meta on all six pages, and an `X-Robots-Tag` header from `_send_security_headers()`). No schema change, no new endpoint, no new feature, and `static/robots.txt` is the only new file. See the round 32.7 section below. It had to be done before 32.6, so the documents describe the released state.
- **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 32.7 and before 32.5, so the documents describe the released state.
- **32.5 The version raise.** `0.1.0:0` → `1.0.0:0`, once the items above are done and the user says so. No schema change, no new endpoint, no new feature. `startos/versions/` stays empty, because the app migrates its own schema.
## Round 32.7 — the top-bar menu and the dashboard clean-up
Six points, all in `TODO.md` §32.7. No schema change, no new endpoint, no new feature, no new document, and `static/robots.txt` is the only new file.
- **The menu is built by `static/session.js`, not by the pages.** It replaced the lone Sign out button, and it is added on the five application pages — `/login` has none, because `session.js` is not loaded there. The items are `Start health check` → `/health-check`, `Settings` → `/settings`, `History` → `/history`, a separator, and `Sign out`. The first three are `<a>` and Sign out is a `<button type="button">`. The panel is hidden until the button is pressed and closes on `Escape`, on a click outside it and after a choice. **`session.js` still creates its own `.topbar-actions` wrapper**, so no page's markup had to change for the wrapper. The new classes are `.menu`, `.menu-button`, `.menu-panel`, `.menu-item` and `.menu-separator`, all in the retro theme and with no inline style, because the CSP allows none.
- **`static/index.html` lost its own navigation.** The `Start annual health check` button in `.page-heading` and the whole `<div class="topbar-actions">` with the Settings link are gone, together with the `Configured setup` / `Your keys` section, the `#key-count` span, the `Next check` card and the `history-card` block. `#key-list` now stands inside `section.page-heading`, right after `#setup-shape`. The context links stay: the `/` link in the blocked-keys note, `Open the settings` in `setup.js`, the `/settings` links in `app.js` (`createRotateLink` and `createRemoveSoftwareControl`) and `Open the alert list` on the key card.
- **The Attention card is the only summary card.** `renderSummary()` in `app.js` drives it alone: the heading is unchanged (`Nothing overdue` / `1 key overdue` / `N keys overdue`), the detail line is the overdue list when something is overdue, and otherwise `Earliest next check <YYYY-MM-DD>, for Key N: <name>.` — the two old lines (`No key has passed its next check date.` and `Earliest next check, for key …`) are gone. With no `next_check_due` anywhere, the fallback is still `No key has a next check date yet. Save a health check to schedule one.` `.overview-grid` is one column at every width and is no longer named in the media query.
- **An empty alert list renders no text at all.** `renderAlerts()` empties `#alerts-list` and leaves `alertCount` at `No alerts`. The placeholder in the markup and the failure branch (offline / `Alerts could not be loaded.`) stay.
- **The export link moved to the history page.** `static/history.html` carries `<a class="secondary-button" href="/api/export">Download CSV</a>` in `.page-heading`, **with no `download` attribute**, so the dated filename from `Content-Disposition` still wins. The dead `history-card` half of the CSS selector is gone; `.card-actions` stays, because the rule is shared.
- **No indexing, no crawling.** `static/robots.txt` is `User-agent: *` + `Disallow: /`, served through `STATIC_FILES` as `text/plain; charset=utf-8` and deliberately **not** in the `SHELL` list of `static/sw.js`. `_send_security_headers()` in `app.py` adds `X-Robots-Tag: noindex, nofollow`, so the pages, the JSON, a redirect, the CSV and the static files are all covered in one place. All six pages carry `<meta name="robots" content="noindex, nofollow">` in `<head>`.
- **Tests:** thirteen new ones. Eight in `tests/test_health_check_form.py` (no setup block and no key count; no Next check card and no history block; the earliest line; the empty alert list; the menu; the menu classes; the robots meta on all six pages; the history export link), four in `tests/test_app.py` (the dashboard carries no navigation link of its own; the history page's CSV download; `/robots.txt`; the `X-Robots-Tag` header on every answer, plus one for a redirect in `AuthApiTests`), and one in `tests/test_pwa.py` (robots.txt is served but is not part of the shell). Two existing tests were **replaced, not deleted**: `test_dashboard_links_to_the_form_the_history_the_export_and_the_settings` in `tests/test_app.py` became `test_the_dashboard_carries_no_navigation_link_of_its_own`, and `test_the_dashboard_link_does_not_override_the_filename` in `tests/test_export_filename.py` became `test_the_history_link_does_not_override_the_filename`, which now reads `static/history.html` and asserts the dashboard has no export link. The suite went from 498 to **511 tests**.
## Round 32.2 — the UI pass and the retro theme
`static/styles.css` was rewritten as a Windows application of the mid-1990s: background `#c0c0c0`, fields `#ffffff`, dark edge `#808080`, darkest `#000000`, a navy `#000080` title bar with white text, and no rounded corner, shadow or gradient anywhere. Depth comes from two-tone bevels only. Headings are title bars, buttons are raised and go sunken on `:active`, fields are sunken wells, focus is the classic `outline: 1px dotted #000000`, and the tables are a 1 px grid. The responsive rules and every selector the scripts and the tests rely on are unchanged, including the exact string `.rotation-list { margin-top: 22px; }`.
@@ -70,7 +82,7 @@ Seven small changes, no new feature and no schema change. The reasoning is in `T
- **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 follow-up round of 32.1 and 32.2 added fourteen more in total, for 498.
- **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 fourteen more in total, for 498, and round 32.7 added thirteen, for **511**.
## Round 32.3 — the alert texts and the page texts
@@ -111,14 +123,14 @@ Seven points, done in the order 7, 5, 4, 3, 2, 1, 6 — the data model first, be
- **`maintenance.py`**, with `delete-all-data` and `set-admin-password`.
- **The installable PWA**, without offline data: `static/sw.js` (an allow-list of shell paths only), `static/manifest.webmanifest`, `static/icon.svg` and the two PNGs beside it, the registration and offline state in `static/app.js`, and the manifest link on the five pages.
- **The flexible threshold** (`2 ≤ key_count ≤ 15`, `1 ≤ threshold ≤ key_count`), still for **one** setup only.
- **The dated export name**, `YYYY-MM-DD-vardkey-export.csv`. The `download` attribute in `static/index.html` was removed, because one with a value overrides the server's `Content-Disposition` filename.
- **The dated export name**, `YYYY-MM-DD-vardkey-export.csv`. The `download` attribute in `static/index.html` was removed, because one with a value overrides the server's `Content-Disposition` filename; since 32.7 the link lives in `static/history.html` and carries none either.
## Section 30 — the StartOS package
The package is one service: one daemon, one container, one SQLite database on the persistent `main` volume, mounted at `/data`. No Postgres, no Redis, no external backend, no extra container. The decisions are in `TODO.md` section 30.
- **The application and the package share one repository, at the root.** That is a deliberate deviation from the guide's "a package repo is not a fork of the application": the rule assumes a published upstream image or a git submodule, and VardKey has neither. `AGENTS.md` states the deviation so nobody adds an `upstream-project/` submodule to "fix" it.
- **Anything the `Dockerfile` does not `COPY` is not in the image.** The modules go in with `COPY *.py ./` and the assets with `COPY static ./static`; `.dockerignore` keeps `tests`, `data`, `node_modules`, `javascript` and the build output out of the context. `static/` must be copied: `app.py` answers `/health` from code, but every page is read from `ROOT/static`, so an image without it reports a healthy service whose whole UI answers `404`.
- **Anything the `Dockerfile` does not `COPY` is not in the image.** The modules go in with `COPY *.py ./` and the assets with `COPY static ./static`; `.dockerignore` keeps `tests`, `data`, `node_modules`, `javascript` and the build output out of the context. `static/` must be copied: `app.py` answers `/health` from code, but every page is read from `ROOT/static`, so an image without it reports a healthy service whose whole UI answers `404`. `static/robots.txt` is served the same way, so it is in the image too.
- **Three things must agree.** `startos/utils.ts` holds `uiPort` (8080); `startos/main.ts` passes it as `PORT` and uses it in the readiness URL; `startos/interfaces.ts` binds it. Change one alone and the readiness check never goes green. The `DATABASE_PATH` constant in the same file is what puts the database on the volume. The readiness check is `checkWebUrl` against `http://127.0.0.1:8080/health` — and `/health` must stay open, or StartOS reports the service as unhealthy. A red `ECONNREFUSED 127.0.0.1:8080` blip before `VardKey listening on port 8080` is just the first poll landing before Python has bound the socket; nothing to fix.
- **Two actions**, registered through `Actions.of()` in `startos/actions/index.ts`, with their strings in `startos/i18n/dictionaries/`: `deleteAllData.ts` (`delete-all-data`) and `setAdminPassword.ts` (`set-admin-password`). Both run `maintenance.py` in a `withTemp` subcontainer, behind a confirmation the handler enforces. The generated password never travels into the container: `maintenance.py` generates it there and prints it, which is the packaging guide's own password-reset pattern.
- **Backups.** `startos/backups.ts` is `sdk.Backups.ofVolumes('main')`. StartOS stops the service for the duration of a backup, so the database file is quiescent while it is copied — the open question section 30 raised needed no snapshot hook, and it is not a known limitation.
@@ -160,10 +172,14 @@ The rules are in `TODO.md` §7; these are the traps that have already cost time.
- **An alert is closed by the user, not by a newer check.** A newer check that raises nothing does not clear an older alert, and a key with an open alert cannot get a new check at all.
- **An acknowledgement stores the action name, not a free reason**, and only the actions the endpoint performs are accepted. `rotate` has its own endpoint, because it requires a new address path.
- **The export is plain CSV only.** XLSX is not built and the app does not promise Excel compatibility. The column names and the column order are an agreement; do not change them. A text cell that a spreadsheet would read as a formula is neutralized with a leading apostrophe, and that is the only change a cell may receive.
- **The PWA cache stores only a valid shell answer.** `isCacheable()` in `static/sw.js` requires `response.ok`, `response.type === "basic"` and `!response.redirected`, so a login page (or an error page) can never replace the cached shell. The allow-list is the other half: the worker never names `/api/*`, `/health` or `/login`.
- **The PWA cache stores only a valid shell answer.** `isCacheable()` in `static/sw.js` requires `response.ok`, `response.type === "basic"` and `!response.redirected`, so a login page (or an error page) can never replace the cached shell. The allow-list is the other half: the worker never names `/api/*`, `/health`, `/login` or `/robots.txt`.
- **No page is meant to be crawled.** All six pages carry `<meta name="robots" content="noindex, nofollow">` in `<head>`, `_send_security_headers()` in `app.py` adds `X-Robots-Tag: noindex, nofollow`, and `static/robots.txt` answers `Disallow: /`. A new page has to carry the meta, and `static/robots.txt` must **not** be added to the service worker's shell list. The header is not sent by `send_error()` — that is, a `404` and a `500` answer without it — which is deliberate: the header covers the pages, the JSON, a redirect, the CSV and the static files, which is what the round asked for.
- **A free-text field refuses a wallet secret, and the guard runs before the length limit.** See the 32-B section above. The refusal is a `ValidationError`, the message never repeats the value, and the password is not checked. The reminder that says so is one line in the key setup, not one per field (32.2).
- **Every alert message says what is wrong, which key or software, and what closes it**, and it does not repeat the name in `source` — except the cloud-key form of `software_incompatible`. See the round 32.3 section above and `TODO.md` §7.
- **The two new summary fields are additive and mean what they say.** `key_names` follows `key_numbers`; `needs_follow_up` is a property of the saved check, so it does not change when an alert is closed or a key is renamed. Do not "fix" it to follow `collect_alerts()`, which hides acknowledged alerts and would rewrite history.
- **The navigation lives in the top bar, not on the page.** `static/session.js` builds the `Menu` button, the panel and the `.topbar-actions` wrapper on the five application pages; `/login` has none. The dashboard markup therefore carries no `href` for `/health-check`, `/settings`, `/history` or `/api/export`, and `Download CSV` is on the history page. Do not add a navigation link back to the dashboard markup: `tests/test_app.py`'s `test_the_dashboard_carries_no_navigation_link_of_its_own` pins it.
- **The Attention card is the only summary card.** Its detail line carries the overdue list when something is overdue and the earliest due date otherwise; `nextCheckTitle` and `nextCheckDetail` no longer exist, and `.overview-grid` is one column at every width.
- **An empty alert list renders nothing.** The count beside the heading says `No alerts`; do not put placeholder text back into `#alerts-list`.
- **The prohibition lists** in sections 1 and 13 of `TODO.md` stay unticked. They are standing prohibitions, to be re-confirmed before release — with the one amendment for the installable PWA.
- **Whether a date is overdue is decided in the browser**, so `/api/key-status` stays independent of the current date.
- **`/api/previous-values` still returns a `security` map** that nothing consumes any more, and its `address_path` per key is no longer used by the form, which pre-fills the path from `keys.address_path`. Both are deliberate: removing them would shrink the endpoint, but nothing breaks while they stay.
@@ -196,7 +212,7 @@ The rotate payload is `replaced` + `keep_name` + `name` + `type` + `address_path
Five things that are easy to break:
- New static files must be added to `STATIC_FILES` in `app.py`, or they return `404`. That includes `/settings`, `/settings.js`, `/login`, `/login.js`, `/session.js`, `/sw.js`, `/manifest.webmanifest`, `/icon.svg`, the two raster icons `/icon-192.png` and `/icon-512.png`, and `/robots.txt` once section 32.7 lands.
- New static files must be added to `STATIC_FILES` in `app.py`, or they return `404`. That includes `/settings`, `/settings.js`, `/login`, `/login.js`, `/session.js`, `/sw.js`, `/manifest.webmanifest`, `/icon.svg`, the two raster icons `/icon-192.png` and `/icon-512.png`, and — since 32.7 — `/robots.txt`, which is `text/plain; charset=utf-8` and is deliberately absent from the service worker's shell list.
- `/api/setup`, `/api/settings`, `/api/alerts`, `/api/key-status`, `/api/previous-values` and `/api/session` are extra endpoints that are not in the minimum list in section 11.
- `STORAGE_ERRORS` in `app.py` includes `RuntimeError`, because `list_keys()` raises it for a partial setup. Keep it there, or a broken database answers with a traceback instead of a `500`. It also includes `ValueError`, so `validate_admin_credentials()` has to be called in its own `try` and mapped to a `400` before the storage handler — and it is why a refused secret has to be a `ValidationError` rather than a bare `ValueError`.
- The settings, rotation and acknowledgement endpoints keep the same error handling as the existing ones: a bad payload is a `400`, an unknown key or alert is a `404`, a locked or duplicate address path is a `409`, and a broken database is a `500`. `DuplicateAddressPath` and `WalletSoftwareNameInUse` must be caught before the general `ValidationError` — in `_save_key_settings` and `_rotate_key` respectively — or the `409` turns into a `400`. A missing or invalid session is a `401`, and a missing CSRF token is a `403`.
@@ -206,8 +222,8 @@ Five things that are easy to break:
- **`with sqlite3.connect(...)` does not close the connection.** It only commits or rolls back the transaction. On Windows the database file stays locked and `TemporaryDirectory.cleanup()` fails with `WinError 32`. Always close explicitly with `try`/`finally`; see `write_schema()` in `tests/test_database.py`.
- **A module the image is missing is a runtime error, not a build error.** `auth.py` was left out of the `Dockerfile` because the module list was written before it existed, and both `app.py` and `maintenance.py` then died with `ModuleNotFoundError` inside the container while every test stayed green. The `COPY *.py ./` line is what stops that recurring. After any change to the image, check the modules, not just the tests. `secret_guard.py` is covered by the same line.
- **Every server test module needs a session, and a redirect makes a missing one look like a pass.** A page fetched without a session answers `302 → /login`, and `urllib` follows it, so an assertion on page markup reads the login page's HTML instead of failing with `401`. Use `tests/server_session.py`'s `SessionMixin`, and note that the manifest and the icons are open while the pages are not.
- **`urlopen` raises `HTTPError` on a 4xx.** A test that expects a `400` has to catch it and read the body from the exception; `tests/test_secret_guard.py`'s `post_status()` helper is the pattern.
- **Every server test module needs a session, and a redirect makes a missing one look like a pass.** A page fetched without a session answers `302 → /login`, and `urllib` follows it, so an assertion on page markup reads the login page's HTML instead of failing with `401`. Use `tests/server_session.py`'s `SessionMixin`, and note that the manifest, the icons and `/robots.txt` are open while the pages are not.
- **`urlopen` raises `HTTPError` on a 4xx.** A test that expects a `400` has to catch it and read the body from the exception; `tests/test_secret_guard.py`'s `post_status()` helper is the pattern. A `302` behaves the same way when the opener refuses to follow it, which is how `tests/test_app.py` reads a redirect's headers.
- **A field has a length limit, and the guard runs before it.** A test that pastes an 80-character seed phrase into a 60-character label field gets a secret refusal, not a length refusal. Use a WIF key (52 characters) or a BIP38 key (58) when a test needs a secret that *fits* a short field, and use the seed phrase where the field has room. Both sides are pinned in `tests/test_secret_guard.py`.
- **A `required` control inside a `display:none` container still blocks submission.** The browser refuses to submit and logs "An invalid form field is not focusable". Hiding a section is not enough: the required flags must be cleared, or the section must render something other than required fields. That is why `renderSecurityChecks()` shows an empty note instead of cards when a key could not be checked, why `syncUncheckableState()` clears the flags on the wallet software and the compatibility select — also for a cloud key, whose grid is hidden — and why `syncRequiredFields()` clears the flag on `hardware_works` and `seed_backup_verified`. The rotation fields follow the same rule: the type is `disabled` until the key is marked for rotation, the path is `disabled` when the key has a saved check and is not marked, and the script refuses to send an empty path. The login page sidesteps it with two separate forms, so only the visible one is ever validated.
- **The mismatch confirmation follows its warning.** `#address-path-confirmed` is `required` only while `#address-path-warning` is visible, so the browser itself stops the submission and a required control is never hidden.
@@ -227,11 +243,15 @@ Five things that are easy to break:
- **`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.
- **`tests/test_app.py` has seven test classes.** `ServerTestCase` starts the server and keeps the session and CSRF cookies a sign-in returns; `AppHandlerTests`, `RenamedSetupTests`, `SettingsApiTests`, `RotationApiTests` and `AcknowledgementApiTests` store the default or renamed setup and call `authenticate()`; `AuthApiTests` starts from a database with **no admin** and covers the gating, the first-run admin, the login and logout, and the CSRF check; and `KeySetupApiTests` creates its admin through `POST /api/admin` and otherwise starts from an empty database. A new test must go in the class whose setup it needs. Every request helper sends the cookies and the CSRF header, and `assert_status()` is the one place an error status is expected.
- **`tests/test_app.py` has seven test classes.** `ServerTestCase` starts the server and keeps the session and CSRF cookies a sign-in returns; `AppHandlerTests`, `RenamedSetupTests`, `SettingsApiTests`, `RotationApiTests` and `AcknowledgementApiTests` store the default or renamed setup and call `authenticate()`; `AuthApiTests` starts from a database with **no admin** and covers the gating, the first-run admin, the login and logout, the CSRF check and the robots header on a redirect; and `KeySetupApiTests` creates its admin through `POST /api/admin` and otherwise starts from an empty database. A new test must go in the class whose setup it needs. Every request helper sends the cookies and the CSRF header, and `assert_status()` is the one place an error status is expected.
- **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 `<link rel="icon" type="image/svg+xml" href="/icon.svg">` on all six pages, so a reworded or reordered link breaks it. `/icon.svg` and the two PNGs are open (they are not in `PROTECTED_PAGES` and do not start with `/api/`), which is what lets the login page and the browser tab read them.
- **The favicon link sits next to the manifest link, and `/login` has no manifest.** `IconTests` asserts the exact string `<link rel="icon" type="image/svg+xml" href="/icon.svg">` on all six pages, so a reworded or reordered link breaks it. `/icon.svg`, the two PNGs and `/robots.txt` are open (they are not in `PROTECTED_PAGES` and do not start with `/api/`), which is what lets the login page, the browser tab and a crawler read them.
- **`#key-count` still exists in `setup.html`, but not on the dashboard.** The dashboard's counter span was removed in 32.7; `setup.html` still has the `Key slots` input with `id="key-count"` and `name="key_count"`. The two are on different pages and were never the same element, so assert per file: `assertNotIn('id="key-count"', index.html)` and `assertNotIn("keyCount", app.js)` are what `tests/test_health_check_form.py` pins.
- **A `display: grid` panel ignores the `hidden` attribute.** `.menu-panel` is a grid, so the browser's own `[hidden] { display: none }` loses to it. The sheet carries `.menu-panel[hidden] { display: none; }` for that reason, the same way `.form-stack[hidden]`, `.field-grid[hidden]` and `.form-section[hidden]` already did. Do not drop that rule.
- **The menu's outside-click listener has to allow the button's own click.** The button's handler runs first and toggles the panel; the document listener then sees a target inside `.menu` and does nothing. Reordering them, or replacing `menu.contains(event.target)` with a check on the panel alone, makes the button close the panel it just opened.
- **The export link moved, and two tests moved with it.** `tests/test_export_filename.py` now reads `static/history.html` and asserts the dashboard has no `/api/export` link, and `tests/test_app.py`'s dashboard test became `test_the_dashboard_carries_no_navigation_link_of_its_own`. A future round that adds a link to the dashboard has to update both, not delete them.
## Product clarification