gitoria

calendar

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit875353c1875353c1calendar mission 009: re-vendor Hybriel master 022a3ac1 (int 6 6b396322 hl:time browser side, int 7 65e8ec21; bin sha256 6e0f77d7, plugins whole)mre875353c1/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

Latest commits

  • 875353c1calendar mission 009: re-vendor Hybriel master 022a3ac1 (int 6 6b396322 hl:time browser side, int 7 65e8ec21; bin sha256 6e0f77d7, plugins whole)mre
  • ce16a4efdeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
  • f490bc8cdeploy: Web Push gate tests/push.mjs (PUSH_GATE_PORT)mre
  • 3af29fc8calendar mission 008 (A8): report, README, LOG, push-shots.mjsmre
  • f91f3663calendar mission 008 (A8): push only asked of the browser when the app has the VAPID settings (pushAvailable); real-FCM E2E scripts (push-real-app.mjs, push-real.mjs)mre
  • bf571badcalendar mission 008 (A8): Turn off on this device (unsubscribes the browser, server drops the device, choice kept), subscribe/refresh when the app is shown again; push gate part 3mre
  • 50985708calendar mission 008 (A7): Web Push report, README, mission, LOGmre
  • ee318774calendar mission 008 (A7): push-real.mjs, push sent log linemre
  • ebda0fd1calendar mission 008 (A7): server-side reminder plan on hl:time (push-plan.hl; hl:time fromLocal in a browser static is refused: repro .scratch/hltime-client), push gate 9/9mre
  • d063dad3calendar mission 008 (A7): Web Push (WIP): lib/push.hl subscriptions + sender clock, faces calPushSave/calPushOff, button subscribes, VAPID tool, tests/push.mjs; instantOf on hl:timemre
  • cf175c80calendar mission 008 (A7): re-vendor Hybriel master 0e3c9830 (bin 9d957fed, plugins whole: hl:crypto Web Push primitives, hl:web sendPush)mre
  • 9bf3c38bcalendar mission 008: re-vendor Hybriel f9833544 (gates old = new); Web Push stopped: hl:crypto half missing on mastermre
  • 186f969bcalendar mission 007: signed-in gate for the first-pointer race (fails on 3c5604f), README theme section, reportmre
  • ba9b4955calendar mission 006: first pointer event no longer re-runs the month (stale overwrite race), gate check, e2e settings cleanup, reportmre
  • bd730759calendar mission 006: theme move (WIP): brief, report, LOG, STATUSmre
  • b117b153calendar mission 006 WIP: reminder row fields keep 44 px; e2e script flagsmre
  • 53e3b0debrowser gate: Log out through the user menu, theme colour rgb(15, 20, 25)mre
  • 90bf9e2ecalendar mission 006 WIP: theme dbe3de7, theme shell (AppHeader/MainMenu/UserMenu/Sidebar/ContentFirst), styles cut to the app's own rules, check-theme gate, e2e toolsmre
  • 3c5604f9identkit: refuse a taken ident port, cold-start deadline, abort on dead ident, clear no-code error (as notes)mre
  • 4996bbe7paths: projects moved into /media/STORAGE/projects/WorldAPI/mre