gitoriaLog in with ident

notes

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchmain2149e902notes mission 002 (4/4): code order — README file map + same-output test, STATUS, LOG, report; tests/letcount.py, tests/realdata-baseline.mjs, tests/realdata-compare.pymremain/reports/002-code-order.md

6.5 KB

  1. # Report 002 (w085): notes code order, no behaviour change
  2. **Where:** commits on main in loreana:/media/STORAGE/projects/notes.worldapi.org (parent 47dad68):
  3. - `8cda541`: file moves (1/4)
  4. - `3f8cb38`: topics, map and thin wrappers (2/4)
  5. - `47db4fc`: `let` (3/4)
  6. - the docs + tests commit (4/4), which also holds this report and the mission brief
  7. Not pushed, not deployed. No `.env` read. Only ports 8760–8764 and 8767–8769 were used (8765/8766 skipped). Every server was stopped by its PID; nothing of mine is still running.
  8. ## Counts (before → after; `python3 tests/letcount.py .`)
  9. | | before (47dad68) | after |
  10. |---|---|---|
  11. | `.hl` files in the root | 5 | **1** (project.hl) |
  12. | project.hl lines | 183 | **91** (index comment, PWA config, routes, audience, server) |
  13. | `let` total | 114 | 34 |
  14. | `let` never reassigned | **71** | **0** |
  15. The 34 `let`s left are all needed:
  16. - 19 are reassigned;
  17. - 15 are re-bound in a loop body. Hybriel refuses a plain declaration there on its 2nd pass (tickets lesson).
  18. ## Layout
  19. The full file map is in README "Files". Imports only go one way: util ← users, notes-helpers ← notes ← api-helpers ← api ← project.hl.
  20. - **`lib/notes.hl`**: the table and every write to it.
  21. - Holds `noteOf`, `metaRows`, `noteView`, `newNote`, `pushNote` (sync and conflict rules) and `removeNote` (tombstone).
  22. - `notes-helpers.hl`: `textError` (the size limit), `isAlive`, `stampOf` (version stamps) and `copyMark`.
  23. - **`lib/users.hl`**: the users table, the ident config and the exchange.
  24. - `userOfLoginCode` is new here: the single exchange + `ensureUser` step. Before, the login route and the `notesLogin` face each had their own copy.
  25. - `tagOf` moved here out of project.hl.
  26. - **`lib/api.hl`**: every function route, as thin wrappers:
  27. - `/login/callback` and `loginFailed` (this was `failed`). Both take `&req` and `&sessions`;
  28. - `/api/me`;
  29. - `/api/notes`.
  30. - **`lib/api-helpers.hl`**: `reply`, `isText`, `isTime`, `safePath`.
  31. - **`lib/util.hl`**: `envOr`, `storageDir`, `countOfList`, `firstOf`, `isHex`, `isIdentId`. Before, these were in users.hl and notes.hl imported them from there.
  32. - **`lib/jsoncheck.hl`** stays a file of its own: it is the workaround for hybriel #12. Its comment now names the right call site.
  33. - **Moved:** `styles.hl` → `components/styles.hl`. `tools/migrate-short-ids.hl` now imports from `lib/`.
  34. - **Face made thin:** `notesLogin` → `userOfLoginCode`. The session writes stay in the face, because a face's `session` parameter is the framework's own.
  35. - **Removed** (dead since notes#2 moved the notes area to the browser; called nowhere): `createNote`, `saveNote`, `noteRows`, `noteTextOf`, `subjectOf`, `rowOf`, `aliveOf`, `maxSubject`, `untitled`.
  36. - `deleteNote`'s one write is now inline in `removeNote`. It was its only caller, and the checks it repeated were already done there.
  37. ## Tests
  38. | test | result |
  39. |---|---|
  40. | gate `tests/browser.mjs` (app 8760, ident 8761, Chrome 8767–8769) | **50 passed, 0 failed** before and after each step |
  41. | `tests/short-id-switch.mjs` (a copy with its fixed ports moved to 8760/8761) | **18/0** before and after each step |
  42. | live-data reads + writes | identical, except **4 intended differences** (below) |
  43. The commands are in `.scratch/w085/gates.sh` and `step.sh`, and in README "Test".
  44. **Live-data comparison** (new `tests/realdata-baseline.mjs` and `tests/realdata-compare.py`; how to run: README "Test" → "Same output"):
  45. - **Data:** a copy of Byrodin's `storage/mpackdb` (1 user, 40 notes), taken 2026-10-03. Each run gets a fresh copy.
  46. - **Ident:** a fake ident on port + 5 answers `/api/exchange`, so the successful login paths run too.
  47. - **Reads** (243), signed in as az5b2 (users `0muh6o5a3kkd`) through a session file, and signed out:
  48. - `/`, every `/note/<id>`, unknown notes and addresses, `/login/failed`;
  49. - the static files, the manifest and the browser modules;
  50. - `/api/me`, `/api/notes`, every `/api/notes?id=`;
  51. - 20 refusals of the POST endpoint;
  52. - `/login/callback` failing six ways, with and without a session.
  53. - **Writes** (43):
  54. - saving a new note, retrying it, saving the same text, an edit;
  55. - a conflict both ways, an unknown id, a stale save on a real note;
  56. - deleting with the wrong base, then the right one, then again; deleting nothing; saving after the delete;
  57. - a successful login callback with seven `next` values, with and without a session;
  58. - the faces: four failing logins, one that works, logout;
  59. - the pages and API reads that follow.
  60. - **Masks:** two runs of the OLD code compare clean (286/286). The masks: source positions, `?v=` hashes, seed time, and for writes the new ids, the `edited` stamps and the login tags.
  61. - **Browser modules:** two differ only in imported-statics tables and positions. The script's structural check passes them.
  62. **The 4 differences (intended, the same fix as gitoria mission 002):**
  63. - **What changed:** `/login/failed`, opened after a failed `/login/callback` in a browser that already has a session, now shows its reason. Examples: "ident refused the login (403: code expired)", "GET only".
  64. - **Before:** it always said "the login did not finish — try again".
  65. - **Cause:** the old `failed(req, why)` was a second call. It got a COPY of `req`, so its session write was lost.
  66. - **Fix:** project.hl hands `&req` and `&server.sessions` to the route.
  67. - **To undo it:** pass `req` by value to `loginFailed` in lib/api.hl.
  68. - **Unchanged:** after a successful login, the page still shows the default text.
  69. **Step 3 (`let`) against step 2:** 0 different.
  70. **Other checks:**
  71. - A server started without `NOTES_STORAGE` still reads its own `./storage/mpackdb`: 40 notes, on the old tree and the new one.
  72. ## Found (in STATUS)
  73. 1. **The by-value `failed(req, why)` was a real bug.** The old #48 audit (mission 069) had said no `&` was needed. README now notes that this was wrong.
  74. 2. **The live-data run needs a fixed `NOTES_PUBLIC_URL`.** The login link carries the URL, so two runs on two ports only compare when it is the same.
  75. 3. **Plain declarations in sibling blocks work.** `ed`, `after`, `cid` and `cp` in pushNote are plain now, and the conflict paths run in the live-data run.
  76. ## Not done / open
  77. - **Not deployed** (that is the architect's job). Use the normal `deploy.sh`. There is no data change.
  78. - deploy.sh's rsync does not delete, so the old root `notes.hl`, `users.hl`, `jsoncheck.hl` and `styles.hl` stay on Byrodin. They are unused and can be removed by hand.
  79. - **Scratch** (gitignored) in `.scratch/w085/`:
  80. - `old/` (the old tree);
  81. - `gates.sh`, `step.sh`, `unlet.py`, `nostore.mjs`;
  82. - the gate outputs.
  83. - **Deleted after the run:** the live-data copy and every baseline output (they hold live notes).

Branches

  • mainmain branch

Latest commits

  • 2149e902notes mission 002 (4/4): code order — README file map + same-output test, STATUS, LOG, report; tests/letcount.py, tests/realdata-baseline.mjs, tests/realdata-compare.pymre
  • 47db4fc1notes mission 002 (3/4): code order — let only where reassigned (58 dropped; 34 left: 19 reassigned, 15 loop-bound); gates 50/0 + 18/0, live-data run = step 2mre
  • 3f8cb383notes mission 002 (2/4): code order — topics, map, thin wrappers: lib/util.hl, lib/notes(-helpers).hl, lib/users.hl (+userOfLoginCode, tagOf), lib/api(-helpers).hl; project.hl = map; login routes take &req/&sessions (failed-login reason now kept); dead notes#1 functions removed; gates 50/0 + 18/0mre
  • 8cda5412notes mission 002 (1/4): code order — files moved: lib/notes.hl, lib/users.hl, lib/jsoncheck.hl, components/styles.hl (imports only); gates 50/0 + 18/0, live-data run identicalmre
  • 47dad68bnotes: Hybriel master 06617221 (plugin allocators 3a781359 + 413f60e4, mpackdb 2cb7ae5e, http1 773de63e); gates 50/0 + 18/0mre
  • a4a2b2aeantcolony#40: tracker missions moved too — references to them in missions/reports/LOG.md updatedmre
  • 3dea0ef2notes: Hybriel master 190aa11d (fc838894 GC correctness, #126 closure scopes, #127); gate 50/0mre
  • e27c7d71notes: Hybriel master 8efba065 (#126 GC by bytes, #48 lambda params copy; audit: nothing to fix; gate 50/0)mre
  • 124613b6antcolony#40: mission references point to the moved missionsmre
  • 1ca2f34dantcolony#40: history (LOG.md), worker briefs (missions/) and reports moved here from antcolony, numbered per project; old numbers in antcolony docs/mission-map.mdmre
  • 2bebebdanotes: Hybriel master ff51cf46 (re-vendor round)mre
  • 3eff126dnotes#3: installable app (manifest + own icon/favicon; notes' own sw.js kept)mre
  • 9883c540deploy.sh: back up live storage/.sessions/.env before every deploy (newest 5 kept)mre
  • eee693b8deploy.sh: never send .git or .gitignore to Byrodinmre
  • c8904061State of 2026-09-27, before the move to gitoriamre