gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit358474bf358474bflog: P50 livemre358474bf/reports/P50-REPORT.md

4.2 KB

  1. # P50 — refuse direct pushes to the main branch (gitoria#50)
  2. ## What changed
  3. - **Setting** (default OFF, existing repos unchanged): owner button in Settings > Visibility, `components/settings.hl:45-48,92-93,234-248` (state text + "Refuse direct pushes to the main branch" / "Allow direct pushes"). Stored as field `protect` of the repo record: `lib/repos.hl:268-294` (`syncProtect`, `isProtectedMain`, `setProtectMain`; owner only, others get `only the owner can change this`), `lib/repos-helpers.hl` `withChange` keeps the field. The repo JSON (`rowOf`, /api/repos) is NOT changed, so docs/apps-api.md is untouched.
  4. - **Enforcement in the server**: new `docker/sshd/hooks/pre-receive`. It reads `<repo>.git/gitoria-protect` (the branch name = the repo's main-branch/PR-target setting, else `main`; no file = off; written by the setting and rewritten by "Make main", `lib/repos.hl:258-266`). HTTPS: `lib/transport.hl:45-53` passes `-c core.hooksPath=<app>/docker/sshd/hooks` to receive-pack (`lib/git.hl:17` `hooksDir`). SSH: `docker/sshd/gitoria-shell:36-37` sets `core.hooksPath=/usr/local/share/gitoria-hooks`; `docker/sshd/Dockerfile` copies the hook there (the sshd image must be rebuilt on deploy).
  5. - **Message** (one line, git shows it as `remote: gitoria: ...`): `direct pushes to 'main' are refused in this repository. Push a branch with a '|||PR ' commit and merge it on the /pulls page.`
  6. - **Decision on scope**: refused = update (also force) and delete of the protected branch. Allowed = all other branches, all tags, and the creation of the branch (old id all zeros, so the first push to an empty repo works). Merge button / merge API use `update-ref`, not a push, and work.
  7. - README: new short section "Refuse direct pushes to the main branch". `deploy.sh`: `tests/protect-main.mjs` joins GATES.
  8. ## Tests
  9. `tests/protect-main.mjs`: 41 passed, 0 failed (ports 8731 app, 8733 sshd, 8735 ident). Real ident login, real git, the real sshd container. Covers: OFF: push + update over HTTPS and SSH works, no marker; member, stranger and signed-out user cannot switch it on, and a member cannot switch it off; the owner switches it on (settings page shows the state); ON: update, force push and delete of main refused over HTTPS and SSH with the message and main unmoved; branch and tag pushes (HTTPS and SSH) work; two `|||PR` branches become PRs and merge via API (`POST /api/pulls/N/merge`) and the Merge-button face (`gitoriaMergePull`); empty repo: switched on, first push creating main works, second refused; after "Make main" to `feat2` the marker names `feat2`, feat2 is refused and main is free; OFF again works. It fails on a broken hook: during development an earlier run with the marker mis-written (literal `\n`, hybriel#44) made all 6 refusal checks FAIL.
  10. - Note on "403": the setting is changed by the page's server face (like Make private), which answers `{error}` with HTTP 200 for a non-owner; there is no REST route (no API change wanted). The test asserts the error and that nothing was stored.
  11. ## Gates (LC_ALL=C, ports 8720-8739 via GITORIA_GATE_* / *_PORT; 8734 is held by another process, avoided)
  12. check-theme 86 files 0 problems; browser 293/0; create-api 47/0; signin-return 3/0; security 82/0; private 158/0; ident-access-gitoria 30/0; apps 95/0; pull-numbers 48/0; pull-ssh 20/0; app-token 42/0; reviews 98/0; events 52/0; pr-page 61/0; status 61/0; limits 53/0; status-keyed 13/0; member-merge 82/0; protect-main 41/0.
  13. ## DOCS
  14. - Used: HL-PRIMER.md, CODE-ORDER.md, settings.hl's own working shapes (button + `emit server`).
  15. - Gap: COMPONENTS.md/HL-PRIMER have no checkbox/form-switch shape, so I used the existing button toggle of "Make private" (no workaround JS).
  16. - Gap: `'\n'` in a string is not a newline (hybriel#44, known in util.hl `NL`); cost me one test round.
  17. - Gap: `on` is a reserved word and cannot be a parameter name (compile error); not mentioned in the primer.
  18. - Not tried in his Chrome (no UI layout change beyond one more paragraph + button in the existing Visibility section, reusing the `#togglepriv` style); screenshot proof left to the lead.
  19. ## Stopped / cleaned
  20. No process of mine left (gate servers, docker `gitoria-sshd-pmgate` removed; scratch store deleted; no Chrome of mine). Local `bin` symlink removed, not committed. Nothing pushed or deployed.

Branches

Latest commits

  • 358474bflog: P50 livemre
  • 477d7bdcMerge branch 'p50'mre
  • 00efc06fP50 reportmre
  • e3f85afblog: commit mention slipmre
  • 4d1a4cf4log: #25 numbersmre
  • 1af0a60ddocs: H25 run() correctionmre
  • eefa2dbcRepo setting: refuse direct pushes to the main branch (pre-receive over HTTPS and ssh)mre
  • 8c8ba2f1log: PR flow announcedmre
  • fa00cd35log: Kunibert pings provenmre
  • 3a68cfaclog: components decisionmre
  • 87de8e31log: Kunibert connected to 9 app reposmre
  • c22aff69log: PR-only rollout startedmre
  • 25309981log: STOP and paused workers 2026-11-08mre
  • 5286803alog: worker briefs and reports of 2026-11-08mre
  • 85c86605log: 2026-11-08 Arachne on list shapemre
  • cb634512log: 2026-11-08 keyed lists livemre
  • 07c98d4aLists: keyed rows with @id, remove(id) and one whole-list assignment instead of hand-rebuilt loopsmre
  • 0db0d81elog: 2026-11-08 day52 live, W30 startedmre
  • b05f6d92tests/status: the gate's 3 s app token expired during the restart; it lives 60 s like status-keyedmre
  • 1e8f4f0avendor: Hybriel set-day52 (fault-path leak fix #335, keyed rows #331)mre