ai-note: record section 22 and the JavaScript quoting note

This commit is contained in:
ai-bot committed 2026-10-02 15:12:27 +00:00
1 parent e35e906b08
commit b8bc7a185d
1 file changed
+10 -7
+10 -7
View File
@@ -7,10 +7,9 @@ Short working handover for the next model. Keep it short.
## Status ## Status
- **Done and verified:** section 19 (one key per submission) and section 18 steps 1–8. - **Done and verified:** section 19 (one key per submission), section 20 (hidden fields that are derived or carried forward), section 21 (English status values, on-demand address path, all alerts on the dashboard), and section 18 steps 1–8.
- **Done and verified:** section 20 (hidden fields that are derived or carried forward). - **Recorded, NOT implemented:** section 22 (an unavailable key makes the rest optional). It is agreed and written into `TODO.md`. The code and tests still enforce the old, stricter contract.
- **Done, NOT verified:** section 21 (English status values, on-demand address path, all alerts on the dashboard). The code and the tests are written and committed; nobody has run the suite yet. If a test fails, fix the code, not the test, unless the test itself is wrong. - **Tests:** 112 test methods, all passing at the end of section 21. The user runs them: `python3 -m unittest discover -s tests` from `/home/snes/start9/helsesjekk`.
- **Tests:** 111 test methods (87 passed before section 21). The user runs them: `python3 -m unittest discover -s tests` from `/home/snes/start9/helsesjekk`.
- **Then:** steps 9–12 (StartOS package, persistent volume, backup/restore, `.s9pk`). - **Then:** steps 9–12 (StartOS package, persistent volume, backup/restore, `.s9pk`).
## Ground rules ## Ground rules
@@ -24,6 +23,7 @@ Short working handover for the next model. Keep it short.
- The HTTP tests create their own database and server per test. Keep them order-independent; a shared database already caused one order-dependent failure. - The HTTP tests create their own database and server per test. Keep them order-independent; a shared database already caused one order-dependent failure.
- Record a new decision in `TODO.md` and this note **before** implementing it, and mark it as not implemented until the tests pass. - Record a new decision in `TODO.md` and this note **before** implementing it, and mark it as not implemented until the tests pass.
- `gitea_update_file` needs a fresh `preview_id` from `gitea_preview_file` for the same path and content. `gitea_create_file` returns `422` on an existing file. - `gitea_update_file` needs a fresh `preview_id` from `gitea_preview_file` for the same path and content. `gitea_create_file` returns `422` on an existing file.
- 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. Assert on the selector text, e.g. `[name="address_path"]`.
## Settled decisions — do not re-open ## Settled decisions — do not re-open
@@ -33,7 +33,7 @@ Short working handover for the next model. Keep it short.
4. Security status per submission: for keys 1 and 2 the form shows the key's product and the chosen software only; the third provider is hidden and its last saved status is carried forward, and it becomes visible again when that status was `VULNERABLE` or `COMPROMISED`. The stored rows are unchanged, so alerts, history and export are unaffected. 4. Security status per submission: for keys 1 and 2 the form shows the key's product and the chosen software only; the third provider is hidden and its last saved status is carried forward, and it becomes visible again when that status was `VULNERABLE` or `COMPROMISED`. The stored rows are unchanged, so alerts, history and export are unaffected.
5. Wallet software is `Sparrow Wallet` or `Nunchuk`; key 3 is fixed to Nunchuk. One software field plus one version field (`wallet_software`, `software_version`). 5. Wallet software is `Sparrow Wallet` or `Nunchuk`; key 3 is fixed to Nunchuk. One software field plus one version field (`wallet_software`, `software_version`).
6. `seed_backup_verified` (keys 1–2 only) and `address_path_verified` are `OK`/`PROBLEM` and mandatory when the key is available. Removed: `seed_backup_status`, `address_verified`, `derivation_height`. 6. `seed_backup_verified` (keys 1–2 only) and `address_path_verified` are `OK`/`PROBLEM` and mandatory when the key is available. Removed: `seed_backup_status`, `address_verified`, `derivation_height`.
7. An unavailable key hides and empties the other key fields; the key note stays. The only alert is `key_unavailable` (see decision 18 for the cloud key). 7. An unavailable key hides and empties the other key fields; the key note stays. The only alert is `key_unavailable` (see decision 17 for the cloud key).
8. Legacy rows keep rendering. The migration maps `1` → `OK`, `0` → `PROBLEM` and folds the old status into `seed_backup_verified`. 8. Legacy rows keep rendering. The migration maps `1` → `OK`, `0` → `PROBLEM` and folds the old status into `seed_backup_verified`.
9. A negative cloud result (`cloud_health_status = PROBLEM` or `cloud_provider_operational = 0`) raises the critical `cloud_provider_problem`; it stays for rows where the key was available. 9. A negative cloud result (`cloud_health_status = PROBLEM` or `cloud_provider_operational = 0`) raises the critical `cloud_provider_problem`; it stays for rows where the key was available.
10. The prohibition lists in sections 1 and 13 stay unticked. They are standing prohibitions, to be re-confirmed before release. 10. The prohibition lists in sections 1 and 13 stay unticked. They are standing prohibitions, to be re-confirmed before release.
@@ -41,7 +41,7 @@ Short working handover for the next model. Keep it short.
12. The dashboard shows status and dates per key on the key cards. The summary cards are "Next check" (earliest due, naming the key) and "Attention" (how many keys are overdue). Whether a date is overdue is decided in the browser, so the API stays independent of the current date. 12. The dashboard shows status and dates per key on the key cards. The summary cards are "Next check" (earliest due, naming the key) and "Attention" (how many keys are overdue). Whether a date is overdue is decided in the browser, so the API stays independent of the current date.
13. The export is **plain CSV only**, one row per key check, with `Check id` grouping the rows of one submission. XLSX is not built and the app does not promise Excel compatibility. `export.py` holds the column list and the writer; `database.list_export_rows()` builds the rows and joins BIP327, SLIP39, and the security statuses into one cell per column. 13. The export is **plain CSV only**, one row per key check, with `Check id` grouping the rows of one submission. XLSX is not built and the app does not promise Excel compatibility. `export.py` holds the column list and the writer; `database.list_export_rows()` builds the rows and joins BIP327, SLIP39, and the security statuses into one cell per column.
14. **Key 3 collects only `Availability`.** `Cloud health check` and `Provider operational` left the form and are derived: `Availability` = Yes → `cloud_health_status` = `OK` and `cloud_provider_operational` = `1`; No → `PROBLEM` and `0`; unanswered → both empty. Server validation keeps the derived cloud values for the cloud key when `available` is `0`. The columns stay for old rows. 14. **Key 3 collects only `Availability`.** `Cloud health check` and `Provider operational` left the form and are derived: `Availability` = Yes → `cloud_health_status` = `OK` and `cloud_provider_operational` = `1`; No → `PROBLEM` and `0`; unanswered → both empty. Server validation keeps the derived cloud values for the cloud key when `available` is `0`. The columns stay for old rows.
15. **Key 3 software compatibility is hidden and derived:** `Availability` = Yes → `OK`, No → `NOT_ASSESSED` (was `IKKJE_VURDERT`, renamed by decision 19). Consequence: key 3 can no longer raise `software_incompatible`. 15. **Key 3 software compatibility is hidden and derived:** `Availability` = Yes → `OK`, No → `NOT_ASSESSED`. Consequence: key 3 can no longer raise `software_incompatible`.
16. **Placeholders:** `firmware_version` and `address_path` show the previously saved value; `software_version` only when the same software is chosen again. Every derived or carried-forward value is listed in the review panel before saving, marked as such. 16. **Placeholders:** `firmware_version` and `address_path` show the previously saved value; `software_version` only when the same software is chosen again. Every derived or carried-forward value is listed in the review panel before saving, marked as such.
17. **One merged critical alert for key 3** when the key was unavailable: *"This key was not available and the cloud provider is recorded as not operating. Check the provider status and replace the key before continuing; the remaining checks for this key cannot be recorded."* `cloud_provider_problem` stays for rows where the key was available. 17. **One merged critical alert for key 3** when the key was unavailable: *"This key was not available and the cloud provider is recorded as not operating. Check the provider status and replace the key before continuing; the remaining checks for this key cannot be recorded."* `cloud_provider_problem` stays for rows where the key was available.
18. **General statuses are English:** `OK`, `PROBLEM`, `NOT_ASSESSED`. `NOT_ASSESSED` replaced `IKKJE_VURDERT` on all four columns that used it: `health_checks.software_compatibility_status`, `key_checks.cloud_health_status`, `tool_checks.bip327_status`, `tool_checks.slip39_status`. The form and validation reject the old value. 18. **General statuses are English:** `OK`, `PROBLEM`, `NOT_ASSESSED`. `NOT_ASSESSED` replaced `IKKJE_VURDERT` on all four columns that used it: `health_checks.software_compatibility_status`, `key_checks.cloud_health_status`, `tool_checks.bip327_status`, `tool_checks.slip39_status`. The form and validation reject the old value.
@@ -49,6 +49,8 @@ Short working handover for the next model. Keep it short.
20. **`Address path` is only recorded when `Address path verified` is `OK`.** The field is hidden and cleared otherwise. The server does not enforce this; the form does. 20. **`Address path` is only recorded when `Address path verified` is `OK`.** The field is hidden and cleared otherwise. The server does not enforce this; the form does.
21. **`/api/alerts` covers every saved check**, not only the newest, so a warning is never lost when a newer check for another key is saved. Each alert carries `check_id` and `checked_at`. Identical alerts (same `code` and `source`) are merged and only the newest is listed. Critical first, then newest first. `alerts.collect_alerts()` holds the merge; `app.py` only loads the records. 21. **`/api/alerts` covers every saved check**, not only the newest, so a warning is never lost when a newer check for another key is saved. Each alert carries `check_id` and `checked_at`. Identical alerts (same `code` and `source`) are merged and only the newest is listed. Critical first, then newest first. `alerts.collect_alerts()` holds the merge; `app.py` only loads the records.
22. **`Helsesjekk` and `data/helsesjekk.sqlite3` are deliberate exceptions** to the English rule and are documented as such in `README.md`. 22. **`Helsesjekk` and `data/helsesjekk.sqlite3` are deliberate exceptions** to the English rule and are documented as such in `README.md`.
23. **`Availability` is required and only offers Yes/No.** The form has no "Not assessed" option for it, and the server rejects a payload without `available`. The `available IS NULL` branches in `_key_check` and `derivedValues` are then unreachable from the form; legacy rows with `NULL` still render and raise no alert.
24. **An unavailable key records nothing else.** When `available` is `0`, `wallet_software`, `tool_checks`, and `ai_security_checks` must be empty; the form hides and clears those three parts and sends `null` and `[]`. A non-empty value is a `400`, not something dropped silently. `software_compatibility_status` may be omitted and is stored as `NOT_ASSESSED`. No schema change. Key 3 keeps its derived cloud values and the merged alert.
## Data model (schema version 6) ## Data model (schema version 6)
@@ -58,6 +60,7 @@ Short working handover for the next model. Keep it short.
- `ai_security_checks`: `provider`, `status` (English), `comments`. - `ai_security_checks`: `provider`, `status` (English), `comments`.
- Startup migration rebuilds `key_checks` and `ai_security_checks` when they still use the old layout, and rebuilds `health_checks`, `key_checks`, and `tool_checks` when their `CHECK` constraints still allow `IKKJE_VURDERT`. - Startup migration rebuilds `key_checks` and `ai_security_checks` when they still use the old layout, and rebuilds `health_checks`, `key_checks`, and `tool_checks` when their `CHECK` constraints still allow `IKKJE_VURDERT`.
- The table definitions are `{table}` templates so a rebuild can create the same table under a temporary name. `health_checks` is a parent table, so the whole migration runs with `PRAGMA foreign_keys = OFF`, checks `PRAGMA foreign_key_check` before committing, and rolls back on any failure. `test_status_values_migrate_to_english` and `test_the_rebuilt_parent_table_keeps_its_foreign_keys` cover this. - The table definitions are `{table}` templates so a rebuild can create the same table under a temporary name. `health_checks` is a parent table, so the whole migration runs with `PRAGMA foreign_keys = OFF`, checks `PRAGMA foreign_key_check` before committing, and rolls back on any failure. `test_status_values_migrate_to_english` and `test_the_rebuilt_parent_table_keeps_its_foreign_keys` cover this.
- Section 22 needs no schema change: `wallet_software` is already nullable, and the standards and security results live in their own tables.
## API ## API
@@ -70,7 +73,7 @@ Two things that are easy to break:
## Remaining work ## Remaining work
- **Verify section 21.** Run the tests. If they pass, tick section 21 and re-confirm steps 4 and 6 in section 18, then update this note. - **Implement section 22.** `validation.py` (require `available`, relax the three parts), `static/health-check.js` (availability options, hide and clear the three parts, payload), `static/styles.css` if a new `[hidden]` rule is needed, `README.md` (POST contract), and the tests. Then tick section 22 and steps 4 and 6 in section 18, and update this note.
- **Steps 9–12.** StartOS package (`startos/manifest`, `main.ts`, `interfaces.ts`, `backups.ts`, `init/`, `instructions.md`, `icon.svg`, `Makefile`), persistent volume, backup/restore, restart testing, and the final `.s9pk`. - **Steps 9–12.** StartOS package (`startos/manifest`, `main.ts`, `interfaces.ts`, `backups.ts`, `init/`, `instructions.md`, `icon.svg`, `Makefile`), persistent volume, backup/restore, restart testing, and the final `.s9pk`.
## Product clarification ## Product clarification