gitoriaLog in with ident

calendar

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchmain2881119fcalendar mission 001 (4/4): code order — README layout + same-output test, STATUS, LOG, report; tests/letcount.py (sub-folders), tests/realdata-baseline.mjs, tests/realdata-compare.pymremain/reports/001-code-order.md

7.4 KB

  1. # Report 001 (w085): calendar code order, no behaviour change
  2. **Where:** commits on main in loreana:/media/STORAGE/projects/calendar.worldapi.org (parent d6c5929):
  3. - `c6fbd01`: file moves (1/4)
  4. - `f5ce6b1`: topics, map and thin faces (2/4)
  5. - `3b2a4cd`: `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. This ran after notes mission 002, in the same session.
  8. ## Counts (before → after; `python3 tests/letcount.py .`, which now also scans sub-folders)
  9. | | before (d6c5929) | after |
  10. |---|---|---|
  11. | `.hl` files in the root | 4 | **1** (project.hl) |
  12. | project.hl lines | 107 | **65** (index comment, PWA config, routes, audience, server) |
  13. | `let` total | 256 | 110 |
  14. | `let` never reassigned | **147** (52 of them in components/month-view/month-view.hl) | **0** |
  15. The 110 `let`s left are all needed:
  16. - 67 are reassigned;
  17. - 43 are re-bound in a loop body (hybriel#128).
  18. ## Layout
  19. The full file map is in README "Layout". Imports only go one way: util ← users, settings, events-helpers ← events ← api-helpers ← api ← project.hl.
  20. - **`lib/events.hl`**: the table and every write to it.
  21. - Holds `saveEvent`, `createEvent`, `changeEvent`, `deleteEvent`, `eventsBetween` and `upcoming`.
  22. - `soonOf` is here now (before, it was in the calendar component).
  23. - The faces' answers are `calendarView` and `settingsView`. Before, all five faces built the same object of four calls themselves.
  24. - **`lib/events-helpers.hl`**: `build`, `viewOf`, `isLocalId`, `validWindow` (out of the component), the size limits, and `byStart` (the hand sort that was inside `eventsBetween`).
  25. - **`lib/settings.hl`**: the settings table and the default reminders: `settingsOf`, `defaultsOf`, `saveDefaults`. Before, these were in events.hl.
  26. - **`lib/users.hl`**: users and ident.
  27. - `userOfLoginCode` is new here: the single exchange + `ensureUser` step. Before, the login route and the `calendarLogin` face each had their own copy.
  28. - `tagOf` moved here out of project.hl.
  29. - **`lib/api.hl`**: `/login/callback` and `loginFailed` (this was `failed`). Both take `&req` and `&sessions`.
  30. - **`lib/api-helpers.hl`**: `safePath`.
  31. - **`lib/util.hl`**: `envOr`, `storageDir`, `countOfList`, `firstOf`, `isHex`, `isIdentId`. Before, these were in users.hl.
  32. - **Moved:** `styles.hl` → `components/styles.hl`. `tools/migrate-short-ids.hl` now imports from `lib/`.
  33. - **`components/month-view/` stays as it is.** It is the vendored month view, extended here, with its own README. Its `dates.hl`, `reminders.hl` and `clock.hl` are shared with the server. Only its imports changed, and its `let`s.
  34. - **Faces made thin:**
  35. - `calLoad`, `calSave`, `calDelete`, `calSettingsLoad`, `calSettingsSave`, `calSaveQueued`: check the session and the input, call `lib/`, answer;
  36. - `calendarLogin` → `userOfLoginCode`. The session writes stay in the face.
  37. ## Tests
  38. | test | result |
  39. |---|---|
  40. | gate `tests/browser.mjs` (app 8760, ident 8761, Chrome 8767–8769) | **78 passed, 0 failed** before and after steps 1 and 2. After step 3: 3 of 4 runs 78/0; 1 run 36/1 |
  41. | `tests/short-id-switch.mjs` (8760/8761) | **18/0** before and after each step |
  42. | live-data reads + writes | identical, except **the intended differences** (below) |
  43. **The failed gate run:** it timed out on "next month". That is the known flake on a loaded machine (STATUS 2026-09-26). The three re-runs were green, and the live-data run covers paging through `calLoad`.
  44. **Live-data comparison** (new `tests/realdata-baseline.mjs` and `tests/realdata-compare.py`; how to run: README "Run, test, deploy" → "Same output"):
  45. - **Data:** a copy of Byrodin's `storage/mpackdb`: 1 user, 6 events, no settings row.
  46. - **Ident:** a fake ident on port + 5.
  47. - **Reads** (53):
  48. - `/` signed in, signed out, and in de and fr;
  49. - `/login/failed`, the static files, the manifest, `/__hl/sw.js` and the browser modules;
  50. - `calLoad` for all events and for every month that has one, plus 5 other or bad windows, and signed out;
  51. - `calSettingsLoad`;
  52. - `/login/callback` failing six ways, with and without a session.
  53. - **Writes** (69):
  54. - creating an appointment, an all-day event over three days, a one-day event, an overnight event in Tokyo, own reminders, and none;
  55. - 18 field refusals;
  56. - not an object, a bad window, signed out;
  57. - an edit;
  58. - the offline queue (`calSaveQueued` with a `local-` id, again, then an edit and a delete with that id);
  59. - deletes: again, unknown, null, bad window, signed out;
  60. - a live event changed and deleted;
  61. - the defaults saved, saved again, refused twice, refused signed out;
  62. - logins through the button, with `next` values and with a session;
  63. - the login face, four ways; logout;
  64. - the reads that follow.
  65. - **Masks:** two runs of the OLD code compare clean (122/122).
  66. - What they mask: source positions, `?v=` and `hl-shell-` hashes, the request times (also double-escaped), the port in the echoed Host header, and for writes the new ids, ms stamps and login tags.
  67. - The structural module check now ignores `this.x` and the component's own methods. Before, month-view's method `build` clashed with the imported `build` of events-helpers.
  68. **The intended differences:**
  69. 1. **The failed-login reason is kept** (3 answers, the same fix as gitoria 002 and notes 002).
  70. - **What changed:** `/login/failed`, opened after a failed `/login/callback` in a browser that has a session, now shows the reason. Example: "ident refused the login (403: code expired)".
  71. - **Before:** it said "the login did not finish — try again".
  72. - **To undo it:** pass `req` by value to `loginFailed`.
  73. 2. **The calendar component's browser module** no longer carries `validWindow` and `soonOf`. They moved to `lib/`, and only the server faces ever called them.
  74. **Step 3 (`let`) against step 2:** 0 different, including every browser module.
  75. **Other checks:**
  76. - A server without `CALENDAR_STORAGE` still reads its own `./storage/mpackdb`: 6 events, on the old tree and the new one.
  77. - In the compiled month view, every `build(…)` call is still `this.build` (checked in the module).
  78. ## Found (in STATUS)
  79. 1. **A plain declaration that is used AFTER its block breaks in the browser.** The browser target makes it a block-scoped `const`. `.scratch/w085/unlet.py` now keeps `let` in that case. A small test proved the check works; nothing in calendar needed it.
  80. 2. **The browser module hoists the imports of every imported file as module constants.** For example `const build=$_N.build` from events-helpers sits next to month-view's own method `build`. This is harmless, because the method is called as `this.build`, but it confuses a by-name comparison.
  81. 3. **The old #48 audit missed the lost `failed(req)` write.** README now notes this.
  82. ## Not done / open
  83. - **Not deployed** (that is the architect's job). Use the normal `./deploy.sh`. There is no data change.
  84. - rsync does not delete, so the old root `events.hl`, `users.hl` and `styles.hl` stay on Byrodin. They are unused and can be removed by hand.
  85. - The service worker's cache name changes with the new module hashes, as it does after any code change.
  86. - **The "next month" gate flake is still open** (pre-existing).
  87. - **Scratch** (gitignored) in `.scratch/w085/`:
  88. - `old/`;
  89. - `gates.sh`, `step.sh`, `unlet.py` (with the after-the-block check), `nostore.mjs`;
  90. - the gate outputs.
  91. - **Deleted after the run:** the live-data copy and every baseline output.

Branches

  • mainmain branch

Latest commits

  • 2881119fcalendar mission 001 (4/4): code order — README layout + same-output test, STATUS, LOG, report; tests/letcount.py (sub-folders), tests/realdata-baseline.mjs, tests/realdata-compare.pymre
  • 3b2a4cd0calendar mission 001 (3/4): code order — let only where reassigned (147 dropped incl. components/month-view; 110 left: 67 reassigned, 43 loop-bound); gates 78/0 (3 of 4 runs; 1 known 'next month' flake) + 18/0, live-data run = step 2mre
  • f5ce6b1dcalendar mission 001 (2/4): code order — topics, map, thin faces: lib/util.hl, lib/events(-helpers).hl (+calendarView/settingsView/soonOf), lib/settings.hl, lib/users.hl (+userOfLoginCode, tagOf), lib/api(-helpers).hl; project.hl = map; login route takes &req/&sessions (failed-login reason now kept); gates 78/0 + 18/0mre
  • c6fbd011calendar mission 001 (1/4): code order — files moved: lib/events.hl, lib/users.hl, components/styles.hl (imports only); gates 78/0 + 18/0, live-data run identicalmre
  • d6c59290calendar: Hybriel master 06617221 (plugin allocators 3a781359 + 413f60e4, mpackdb 2cb7ae5e, http1 773de63e); gates 78/0 + 18/0mre
  • 7bd0337ccalendar: Hybriel master 190aa11d (fc838894 GC correctness, #126 closure scopes, #127); gates 78/0 + 18/0mre
  • ff41310ccalendar: Hybriel master 8efba065 (#126 memory, #48 lambda copy; audit: no & needed)mre
  • 14ba08c7antcolony#40: mission references point to the moved missionsmre
  • 99c73346antcolony#40: history (LOG.md), worker briefs (missions/) and reports moved here from antcolony, numbered per project; old numbers in antcolony docs/mission-map.mdmre
  • 76edaa62calendar: Hybriel master ff51cf46 (re-vendor round, static workaround removed)mre
  • 90a3fc2cdeploy.sh: back up live storage/.sessions/.env before every deploy (newest 5 kept)mre
  • 6722b72ddeploy.sh: never send .git or .gitignore to Byrodinmre
  • be099807State of 2026-09-27, before the move to gitoriamre