oliver-zehentleitner / maity
hub + web: the GitHub App on an organisation's installation (api.md:18783ff), for open-source repos in orgs
tsk-2m5jbwemb21x Done Maity Coder Claude 002
Launch scope (Oliver 2026-11-23). From z5j2's owner-path audit (seq 201237), item 6: most open-source repos live in GitHub organisations, but the Maity GitHub App refuses an installation on an organisation (forge_links.py:91; the follow-up is contracted at api.md:18783-18789).
Build the organisation installation as contracted: who may link it (an org admin's installation), how the hub confirms the owner, the repository selection, and the tests. Plan before code, and a security leg. Until it lands, the docs (tsk from item 4) describe the fine-grained token route.
Notes
Maity Review AGY 009 · Nov 24, 2026, 14:13 UTC
Follow-up P3 items from review A2509 on PR #2139 (head
053dc491604371bed539366664c21cbd4ab0d48f), for hub PR 2:- Minor `suspended` wording nits in `docs/api.md` §11.4:
docs/api.md:19782-19783: qualify bullet 1 of "When the hub checks" withactiveso asuspendedlink with a fresh last successful check is not misread as serving while stillsuspended.docs/api.md:19757-19758: align the summary sentence withdocs/api.md:19752-19753(a succeeding mint within the 10-minute staleness window restoresactiveonly for the remainder of that window, never beyond it).docs/api.md:19441-19444anddocs/api.md:19826-19828: listsuspendedalongsidenot_adminfor consistency withdocs/api.md:19754-19755anddocs/api.md:19768.
- Hub PR 2 implementation & test carry-over (`hub/src/maity_hub/forge_links.py:171-177,204`, `hub/src/maity_hub/forge_access.py:227-238`):
- Track the last successful owner-check timestamp separately from
checked_atso a refused mint or unanswered check never extends freshness. - Throttle
suspendedmint retries to 10 minutes and do not cache an installation token minted for asuspendedorg link whose owner check fails or gets no definite answer (matchingdocs/api.md:19733-19735). - Include PR 2 tests covering:
suspendedrecovery via owner check; replacement acrossactive/not_admin/suspended/removed(includingnot_adminbeforeunlinkedand unchangedchecked_aton no definite answer);POST .../repository/confirmmaking no forge calls; non-serving org link fallthrough toowner_token/instanceand per-readerprobe_unavailable/ktw_unavailable/installation_link_invalidresponses.
- PR #2139 body: refresh the PR description from
208f7004to053dc491before merging so its summary and run section match the final head.
Maity Coder Claude 002 · Nov 24, 2026, 14:29 UTC
Precondition for hub PR 2 (ruled by lotse, seq 213417): before PR 2 is built, Ops (3yc2) must confirm that the Maity GitHub App has the organisation Members permission, which the owner check reads. It is not a merge condition for the contract PR #2139, because the contract only describes behaviour and the hub still refuses organisations until PR 2. The old PR body's claim that the App "has had it since it was created" was never checked.
Maity Coder Claude 002 · Nov 24, 2026, 14:30 UTC
Follow-up items from review A2510 on PR #2139 (head
1819fe1b), for hub PR 2 and web PR 3. None of them block the contract PR.- One account record per status change. The failed-check paragraph in §11.4 should say that the
not_adminrecord is written when the status becomesnot_admin, so that it is not repeated on every later check. The replacement clause should use the same plain wording. - §11.3 and freshness. Add one clause saying that §11.3 checks the source on every call, as §11.5 does, so that a cached export never outlives the link's last successful check.
- Wording in `context/integrations.md` (the replacement entry): linking compares no user id, so the list of "the same answers that refuse a link at linking" should not include the "membership of another user id" case.
- Keep the Why. Decision 40057878 should record the narrowed meaning of
organisation_installationand why it was narrowed. - PR body / Ops. The claim that the App has had the Members permission since it was created holds for at most one operator's App. Reword it to match the changelog fragment ("is to ask for"). See also the PR 2 precondition note.
- Nit. Say that the owner check at linking counts as the link's first check and first success.
- Nit for PR 3. A missing Members permission answers
forge_unavailable. A dashboard hint would help operators diagnose that.
- One account record per status change. The failed-check paragraph in §11.4 should say that the
Maity Coder Claude 002 · Nov 24, 2026, 16:59 UTC
Plan, hub PR 2 (contract: api.md §11.4). No merge before Ops confirms Members: Read-only (nte-t875v873ky38).
Files
- tables.py, new migration: two columns (below).
- github_app.py: membership via user token; user by id, org membership via installation token; an unkept mint.
- forge_links.py: verify (Organization), link (forge_user_id, replace), owner_check (forge only, no connection held), apply_check, serves().
- forge_access.py: facts with type, checked_at, owner_ok_at; org path in _by_app; choice kept at most to owner_ok_at+10m; fallthrough.
- forge.py, errors.py: org reason kept apart, one per-reader mapping for routes/probe.py, contract_text.py, keep_the_why.py, ktw_reads.py, ktw.py (§11.3 checks the source per call), import (§6.14).
- routes/forge_links.py: new 403/503, GET /me/forge by serves().
- notifications records/items: not_admin security item.
- api.md, context/integrations.md, changelog.d.
- Tests: test_forge_links, test_forge_access, new test_forge_org_links.
Migration on forge_link: forge_user_id BIG_ID NULL; owner_ok_at UtcDateTime NULL (last successful owner check, apart from checked_at). NULL for User links; for Organization set at linking, checked_at = owner_ok_at = now. No backfill: no Organization row exists yet. Downgrade deletes Organization rows, drops both. Name
<UTC second>_org_link_checkvia make revision, rechain on merge. No slot grant is needed (ids by time, c711af32), but only one open PR may carry a migration (tsk-xqcney05e5fz): Q1.Order of checks
- Link: state -> installation exists -> kind: User id match / Organization membership (definite no = not_organisation_admin, else forge_unavailable) / other = organisation_installation -> only then installation_linked or replacement.
- Choice and GET /me/forge: removed -> nothing. Check due (checked_at 10m+): claimed by a conditional update of checked_at (one process checks); steps 1-3; definite fail -> not_admin, tokens dropped, record only on the change. Serve only if active and owner_ok_at under 10m. Suspended org link: mint at most every 10m, active only in a fresh success, else token not cached. User links: suspended retry throttled to 10m too.
- Replace: removed -> replaced, unlinked record. Else check the existing link at once, re-read under lock: fail -> not_admin record (if new), delete, unlinked, insert; success -> installation_linked, counts as check and success; no answer -> 503, nothing written.
Tests (#2139 body, A2509, A2510): link ok, forge_user_id in no answer; each not-owner and no-answer case; check order; cadence (fresh, due, recent fail, one check over two engines); path (renames, user.id, org.id, 404); no answer keeps owner_ok_at; not_admin serves nothing, token unkept, restore; suspended back only via check; replace over active/not_admin/suspended/removed (record order, checked_at kept on no answer, relink); confirm calls no forge; fallthrough, probe_via; per-reader probe_unavailable, ktw_unavailable, installation_link_invalid, {}; User links unchanged; migration up/down. Contract tests. Runs: SQLite, Postgres, MariaDB 11.4. Counter-check: break each guard, its test fails.
P3 carry-over
- A2509 1a-c: fixed (api.md). 2a, 2b: fixed (code). 2c: tests above. 3: done on #2139.
- A2510 1 record on becoming not_admin: fixed (wording, code). 2 §11.3: fixed (wording, ktw.py). 3, 4 context: fixed. 5: PR 2 body says "is to ask for"; merged #2139 body unchanged. 6 linking = first check and success: fixed (wording, code). 7: deferred to PR 3 (5tj4).
Boundary In: org links (link, re-check, suspend, replace), fallthrough, per-reader answers, migration, P3s. Out: dashboard (PR 3), webhook, per-repo tokens, narrower permissions, the accepted 10m window, the Members permission (Ops), docs/humans.md. P3 = wording that changes no stated behaviour.
Open questions
Q1 Does another open PR carry a migration? I cannot list PRs.
Q2 A link that changes during a replacement's check answers forge_unavailable, no retry. OK?
Q3 OK that the downgrade deletes Organization links?Maity Coder Claude 002 · Nov 24, 2026, 17:33 UTC
Precondition for hub PR 2 (nte-t875v873ky38): confirmed by Ops (seq 215186). The Maity GitHub App has Organization → Members: read today, per GitHub's public App endpoint. The App has existed since 2026-11-23 and was last changed at 11:41Z. No installation was linked before that.
Ops also reported a deviation from §11.4, which is for Oliver: the App has Pull requests: write, while §11.4 says read-only with "no write permission". The hub never writes. The fix is in the App settings (Pull requests → Read-only), and no installation is linked yet. Ops is taking this to Oliver. It doesn't block hub PR 2, which writes nothing.
Maity Coder Claude 003 · Nov 24, 2026, 19:00 UTC
P3 follow-ups from kduz's round-2 review of PR 2193 (approved at ee08da15), non-blocking under the round-2 rule:
- In all ten web/i18n/*.json catalogs, the key
forge.unconfirmedlost the space after its colon whenforge.unavailablewas inserted before it (en/de/es/fr/it/nl/pt line 1425, ja/ko/zh-Hans line 1391). The JSON is valid and the generated bundles are unaffected; it is a one-character fix per file, for the next change to these catalogs. - "until then" in the not_admin wording (forge.org.not_admin, docs/humans.md:203, docs/bring-your-project.md:19, the changelog fragment) is conservative. A former owner who is already an owner again keeps the link when another owner tries to replace it, because that attempt checks at once. The text never promises more than the hub does, so no change is needed unless the wording is revisited.
- In all ten web/i18n/*.json catalogs, the key
Maity Coder Claude 002 · Nov 24, 2026, 21:03 UTC
Follow-up items from the delta reviews of #2192 at
92430dfd(22c5's A2584 and jc4h's A2585, both APPROVE, no P1/P2). None of them block.- The probe's answer while the source choice has no answer. The confirmer then gets
probe_not_configured(no_grant). Boundary (1) promisesprobe_unavailable"while the check has no answer". It fails closed and leaks nothing. This is the same item as A2574 P3-5 and A2573 F4. - The project view's export and an organisation link that serves nothing. The view and the list give
keep_the_why_export: nullwhenever any organisation link in the grants serves nothing, even when another source covers the repository and §11.3 answers. It fails closed, but the contract (§6.1) only namesnullfor "the project has none", and the page then says no dashboard is published. Either state the case in §6.1 and the page text, or narrow the check to exports read through an organisation link. Which of the two is a choice for the lead. Add a test for the covered case. - Wording in `hub/context/probe.md` near the claim entry: "only where it rests on such a link" no longer covers the case where the grants merely hold such a link. Drop "only", or point to the newer bullet.
- A2545 #9, first part. See the lead's private follow-up notes. Both legs judged the deferral sound and fail-closed.
- The probe's answer while the source choice has no answer. The confirmer then gets
Maity Review Team Lead · Nov 24, 2026, 21:05 UTC
Follow-ups from the round-1 delta legs on #2192 (none blocks the merge; details with the lead and lotse):
- In one no-answer case the probe answers "not configured" where the contract names "unavailable". No data is answered either way.
- The project view hides the Keep the Why export in somewhat more cases than §6.1 names. That errs on the side of showing nothing; align the contract or narrow the check.
- A wording nit in hub/context/probe.md about where §11.3 checks the source.
- Five smaller observations from the second vendor's leg, and part 1 of A2545 #9.