gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit109cfc5c109cfc5ctests/ticketskit: keep the rotated session cookie of the tickets login (tickets ST2 session rotation)mre109cfc5c/reports/002-code-order.md

7.5 KB

  1. # Report 002 (w082): gitoria code order, no behaviour change
  2. **Where:** commits on main in loreana:/media/STORAGE/projects/gitoria.worldapi.org:
  3. - `110c279`: file moves (1/4)
  4. - `090a20c`: topics, map and thin wrappers (2/4)
  5. - `cc7bf7b`: `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 8750–8759 were used. Every server and sshd container was stopped by its PID or name; nothing of mine is still running.
  8. ## Counts (before → after; `python3 tests/letcount.py .`)
  9. | | before (fdfb4b1) | after |
  10. |---|---|---|
  11. | `.hl` files in the root | 14 | **1** (project.hl) |
  12. | project.hl lines | 251 | **126** (index comment, PWA config, routes, audience, server) |
  13. | `let` total | 530 | 213 |
  14. | `let` never reassigned | **296** | **0** |
  15. The 213 `let`s left are all needed:
  16. - 125 are reassigned;
  17. - 88 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 / git-helpers / markdown ← users ← repos-helpers ← git ← repos ← tickets-helpers ← homepage / code / pulls / releases ← tickets ← tokens / sshkeys ← transport ← api-helpers ← api ← project.hl.
  20. - **`lib/git.hl`** was 732 lines covering five topics. It is now split:
  21. - `git.hl`: the git calls, branches, `initRepo`, `isEmptyNow`, `tmpDir` (moved here from transport.hl);
  22. - `homepage.hl`, `code.hl`, `pulls.hl`, `releases.hl`: one per topic;
  23. - `git-helpers.hl`: path, name and id checks, tab fields, sizes, and the `|||PR` / `|||RL` subject parsers.
  24. - **`lib/repos.hl`**: the table and every write to it.
  25. - `mayPush` is new here. It is the single "only the owner pushes" rule; before, transport.hl and sshgate.hl each had their own copy.
  26. - `repos-helpers.hl`: slug rules, the row a page shows, `withChange`, `pageTitle`, the Markdown view.
  27. - **`lib/users.hl`**: users and ident.
  28. - `userOfLoginCode` is the one exchange + `ensureUser` step. Before, the login route and the selector face each had their own copy.
  29. - `tagOf` moved here out of project.hl.
  30. - **`lib/tickets.hl`** gained `finishConnect`, the logic of `/settings/connected` (taken out of project.hl).
  31. - `tickets-helpers.hl`: the tickets URL, the answer shapes, `#12` references.
  32. - **`lib/transport.hl`** holds `gitTransport` and `callGit`.
  33. - `transport-helpers.hl`: the Basic password, plain answers, `Git-Protocol`, pkt-line.
  34. - **`lib/sshkeys.hl`** gained `keyLine`, the authorized_keys line (taken out of sshgate.hl).
  35. - **`lib/api.hl`**: every function route, as thin wrappers:
  36. - `/api/repos…`;
  37. - `/login/callback`;
  38. - `/settings/connect…`;
  39. - `/__git/keys` and `/__git/access` (this was sshgate.hl).
  40. - **`lib/api-helpers.hl`**: JSON / Markdown / text answers, `goTo`, `sshGuard`, `repoOfRequest`, `safeNext`.
  41. - **`lib/util.hl`**:
  42. - was localtime.hl;
  43. - also holds env, `storageDir`, the addresses (`publicUrl`, `slugOfHost`, `domainFor`), lists, text checks;
  44. - `newestFirst` replaces three copies of the same insertion sort.
  45. - **Faces made thin:**
  46. - "Make main" → `code.hl makeMain`;
  47. - the Merge answer → `pulls.hl pullsView`;
  48. - the selector login → `userOfLoginCode`.
  49. - The session writes stay in the faces, because a face's `session` parameter is the framework's own.
  50. - **Removed:**
  51. - `jsoncheck.hl` was imported nowhere;
  52. - `git.hl parseView` was called nowhere.
  53. - **Moved:** `styles.hl` → `components/styles.hl`. `tools/migrate-short-ids.hl` now imports from `lib/`.
  54. ## Tests
  55. | test | result |
  56. |---|---|
  57. | gate `tests/browser.mjs` (8750–8759) | **200 passed, 0 failed** before and after each step |
  58. | `tests/push.mjs` | **46/0** before and after each step |
  59. | `tests/ssh.mjs` | **44/0** before and after each step |
  60. | live-data reads + writes | identical, except **1 intended difference** (below) |
  61. The gate commands are in README "Test". The browser gate runs with `GITORIA_GATE_TICKETS_DIR` set to a `git archive HEAD` copy of tickets. The reason: the tickets working tree is currently being changed by another worker, and with it the gate crashed at the start ("tickets name failed").
  62. **Live-data comparison** (new `tests/realdata-baseline.mjs` and `tests/realdata-compare.py`; how to run: README "Test" → "Same output"):
  63. - **Data:** a copy of Byrodin's `storage/mpackdb` + `storage/git`, taken 2026-10-03. Each run gets a fresh copy.
  64. - **Reads** (678), signed in as az5b2 through a session file:
  65. - every page of all 13 repos, signed in and out: `/` including the 3 MB tracker README, code, files, folders, branches, commits, pulls, releases, tickets, settings;
  66. - unknown addresses;
  67. - the 20 browser modules;
  68. - `/api/repos…` as JSON and as Markdown;
  69. - every refs advertisement, v0 and v2;
  70. - the refusals;
  71. - the login, connect and `/__git` routes.
  72. - **Writes** (80):
  73. - faces: create, token, ssh key, Make main, Merge, open ticket, disconnect, remove, login, logout;
  74. - over HTTPS: clone, then push with a token (also refused without one or with a bad one);
  75. - over SSH, through the real sshd container: clone tracker, push a branch to email, refused after the key is removed;
  76. - the pages that follow each write.
  77. - **Tickets:** the connected repo's tickets are a snapshot, served on port 8759, so nothing reaches live tickets. The live tickets API changed its links during this run, which is why a snapshot is needed.
  78. - **Masks:** two runs of the OLD code compare clean (758/758).
  79. - **Browser modules:** they differ only in the tables of imported statics and in source positions. The script checks the component code and the kind of every imported name it uses. Step 3 also changes `var` → `const`.
  80. **The 1 difference (intended, a fix that came with the cleanup):**
  81. - **What changed:** a failed `/login/callback` in a browser that already has a session now shows its reason on `/login/failed`. For example: "login is not set up …".
  82. - **Before:** it always showed "the login did not finish — try again".
  83. - **Cause:** the old `failed(req, why)` was a second call. It got a COPY of `req` and so a copy of the session, and its write was lost.
  84. - **Fix:** project.hl now hands `&req` and `&server.sessions` to the session-writing routes, the same fix as in tickets mission 010.
  85. - **To undo it:** pass `req` by value to `loginFailed` in lib/api.hl.
  86. **Other checks:**
  87. - `tools/migrate-short-ids.hl` loads and refuses exactly as before (no storage, no key, ident down).
  88. - `tests/short-id-switch.mjs` was **not run**: it is historical and uses fixed ports 8724/8725, which are outside my range.
  89. ## Found (in STATUS "Lessons")
  90. 1. **A session-writing route needs `&req` and `&server.sessions`.** gitoria lost the login-failure reason through a by-value `req`.
  91. 2. **The browser module carries the statics of every file a component imports.** Moving a static changes the module's tables and the `?v=` hashes, but not the page. Compare the component code instead.
  92. 3. **The tickets working tree can be mid-change.** Gate against a `git archive HEAD` copy.
  93. 4. **A crashed gate leaves its servers running.** Check `ss -ltnp | grep :875` and kill by PID.
  94. ## Not done / open
  95. - **Not deployed** (that is the architect's job). Use the normal `deploy.sh`. There is no data change.
  96. - deploy.sh's rsync does not delete, so the old root `.hl` files stay on Byrodin. They are unused and can be removed by hand.
  97. - **Scratch** (gitignored) in `.scratch/w082/`:
  98. - `old/` (the old tree, code only);
  99. - `tickets-head/` (code only);
  100. - `gates.sh` (the three gates on 8750–8759);
  101. - `unlet.py`.
  102. - **Deleted after the run:** the live-data copy and every baseline output (they hold live data).

Branches

Latest commits

  • 109cfc5ctests/ticketskit: keep the rotated session cookie of the tickets login (tickets ST2 session rotation)mre
  • 7eb6be27sessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
  • b3911918reports/MG-mobile.md: 404 fixed, rebased gatesMG
  • 9da65b42tests/browser.mjs: 404 checks (host, no hydration wait)MG
  • 00517fafgitoria: shell 404 page for unknown paths (catch-all route, status 404, JSON 404 under /api), 390 gate checksMG
  • d9e977f0reports/MG-mobile.md, LOGMG
  • 2f2725actests/browser.mjs: commit-row check (one row, centred date)MG
  • 4df1ea01tests/browser.mjs: MG phone checks (list first, no dead strip, one branch heading, tab grid, commit rows, PR title row, ticket columns, wrapping commands)MG
  • c52424e9gitoria mobile: repo list before the forms, 3x2 tab grid, no duplicate branch heading, ordered commit rows, aligned ticket rows, pull title on its own row, wrapping clone commands, no dead strip under formsMG
  • 3a95252dG3: cache parsed README blocks by sha256 of the text (bounded LRU), reportmre
  • 570138cddeploy: security gate (tests/security.mjs)mre
  • da6b20fcgitoria SG: security audit fixes (uploadMax 0, Secure cookie on https, session rotation at login, nosniff on function routes, no identity in page data) + tests/security.mjs gate + reportmre
  • f98c981fgitoria B1: report wordingmre
  • c6364cedgitoria B1: compact Markdown blocks (one kind flag per block/span, empty and false fields omitted); same rendered HTML, page values -67%mre
  • cd99d2feWIP gitoria#22: always render the repo level's slot (missing-repo boot hang), pages render nothing without a repo; hydration diagnosis in reports/G2-hydrate.mdmre
  • e5404b9breport: commit idsmre
  • 63cfa21ereports/G2-repotabs.mdmre
  • 9b0516fdgitoria#22: mark the tab underline functional (check-theme), chain E2E: serve/measure split, bring the lisbeth tab to frontmre
  • 19bc1df8gitoria#22: all repo pages under ONE layout level (components/repo.hl, hl:web D-CHAIN): a tab click replaces only the page in the slot; head and tab nav stay the same DOM nodesmre
  • 40658417tests/browser.mjs: wait for the page to be live (hydrated) before clicking Merge — a click on the server-rendered button before the client mounted was lost (flaky 'Clashing change' under load)mre