The scheduled run's ref claim is the branch name, so the role binds the event (THE-40) #69

Merged
pit merged 1 commit from hermes/THE-40-schedule-ref into main 2026-12-02 21:20:42 +00:00
Owner

paperclip:THE-40

Summary

Forgejo 15.0.9 stores a cron schedule against the default branch's name (main), and the run it creates copies that column into action_run.ref. The run's git context — and so its OIDC token — therefore carries ref: main, not refs/heads/main. The store's renovate role bound the full ref, so the first scheduled run (Monday 04:17Z) would have been refused at auth/jwt/login: the flow's schedule path would fail the first time it ran.

File Change
bao/service/roles/openbao/defaults/main.yml renovate binds repository and event_name: schedule; the full-ref binding is gone
docs/store-identity.md says what each role binds, and why the two differ

Dropping the ref is not a loss: Forgejo schedules only workflows present on the default branch (services/actions/notifier_helper.go), so a scheduled run's ref cannot be another branch. The dispatch role keeps refs/heads/main, and the push roles are untouched.

Evidence

Check Result
mise exec -- make check exit 0 — verify tests: 9 assertions, 0 FAILED
what the schedule holds action_schedule: title=renovate, repo_id=1 (olympus/infra-forge), ref=main, event=push, payload {"action":"schedule"}
what the run takes from it services/actions/schedule_tasks.go at v15.0.9: Ref: cron.Ref, TriggerEvent: schedule

The merge applies the role (the deploy writes auth/jwt/role/renovate and reads it back), so Monday's run logs in against the corrected binding.

paperclip:THE-40 ## Summary Forgejo 15.0.9 stores a cron schedule against the default branch's *name* (`main`), and the run it creates copies that column into `action_run.ref`. The run's git context — and so its OIDC token — therefore carries `ref: main`, not `refs/heads/main`. The store's `renovate` role bound the full ref, so the first scheduled run (Monday 04:17Z) would have been refused at `auth/jwt/login`: the flow's schedule path would fail the first time it ran. | File | Change | | --- | --- | | `bao/service/roles/openbao/defaults/main.yml` | `renovate` binds `repository` and `event_name: schedule`; the full-ref binding is gone | | `docs/store-identity.md` | says what each role binds, and why the two differ | Dropping the ref is not a loss: Forgejo schedules only workflows present on the default branch (`services/actions/notifier_helper.go`), so a scheduled run's ref cannot be another branch. The dispatch role keeps `refs/heads/main`, and the push roles are untouched. ## Evidence | Check | Result | | --- | --- | | `mise exec -- make check` | exit 0 — `verify tests: 9 assertions, 0 FAILED` | | what the schedule holds | `action_schedule`: `title=renovate`, `repo_id=1` (`olympus/infra-forge`), `ref=main`, `event=push`, payload `{"action":"schedule"}` | | what the run takes from it | `services/actions/schedule_tasks.go` at `v15.0.9`: `Ref: cron.Ref`, `TriggerEvent: schedule` | The merge applies the role (the deploy writes `auth/jwt/role/renovate` and reads it back), so Monday's run logs in against the corrected binding.
The scheduled run's ref claim is the branch name, so the role binds the event (THE-40)
All checks were successful
plan / guest-plan-check (pull_request_target) Successful in 17s
pr-checks / check (pull_request) Successful in 47s
10b1fedf82
Forgejo 15.0.9 records a cron schedule against `input.Repo.DefaultBranch` — the
name, `main` — and the run it creates copies that column, so the OIDC token of a
scheduled run carries `ref: main`, not `refs/heads/main`. The `renovate` role
bound the full ref, which refuses the run it exists for: Monday's first
scheduled run would have failed at the store login. It binds the repository and
the event now; Forgejo schedules only workflows present on the default branch,
so the branch cannot be another one. The dispatch role keeps `refs/heads/main`.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
Member

Review started (round 1/5) on 10b1fedf82 — reading the diff now.

**Review started** (round 1/5) on 10b1fedf824ac7699a81325d7aca78ecdd62a8ce — reading the diff now.
bot-minos approved these changes 2026-12-02 21:19:55 +00:00
bot-minos left a comment

Review loop: repo=olympus/infra-secrets · PR #69 · head=10b1fedf824ac7699a81325d7aca78ecdd62a8ce · round=1/5 · verdict=merge

Recommendation: merge

Round. list_pull_reviews → [] before this one, so this is round 1/5; the dispatch's "1/5" agrees. Fixed point: git diff 4a45309...(merge-base) 10b1fed — 2 files, 13 insertions, 3 deletions, one commit. Head resolved twice, before and after the probes, both 10b1fed.

Spec. paperclip:THE-40 — read live over the control plane: GET /api/issues/THE-40 → 200 (in_progress, updated 2026-12-02T21:03:46Z), its design document E4 — hardening in code → 200, 8423 chars, updated 16:47:06Z. Neither names the ref binding: the ticket's store slice stops at "one policy, ci-renovate, and two JWT roles, renovate for a schedule and renovate-dispatch for a manual run", which the tree already had. So the contract this round judges is the PR body's own: the scheduled run's ref claim is the branch name, the bindings of refs/heads/main therefore refuse it, and the role moves to repository + event.
Standards. AGENTS.md §Decisions and §Checks at the head, and olympus/workshop docs/adr/0013-access-is-granted-to-a-role.md at that repository's main (read live: the Decision lists seven roles and its table carries Updater — the record the page cites resolves). No CONTRIBUTING.md or docs/adr/ in this repo; AGENTS.md is the whole of its own written standard.

Standards

No findings.

The change is one YAML defaults file and one page. The edit is the smallest shape the defect allows: the claim that could never match is removed (bao/service/roles/openbao/defaults/main.yml:180-186 now binds repository and event_name only), the dispatch role keeps its full binding (:187-194), the six push roles are untouched, and the rationale sits in the comment above the list (:103-110) rather than only in the PR body. ansible-playbook --syntax-check bao/service/site.yml parses (rc 0, no-inventory warnings only), and the eight roles' bound_claims parse to exactly the intended maps.

Nothing in the tree reads a ref key off openbao_jwt_roles: the two consumers are the read-back comparison and the write body (bao/service/roles/openbao/tasks/store.yml:283-287, :296-317), both of which take item.bound_claims whole. Dropping a key from the map is therefore a reconciliation the deploy performs, not a template that breaks.

Spec

ADVISORY — docs/store-identity.md:340-341, :463-465: two sentences still state the binding as repository + ref + event for "the role"

Where What it says
docs/store-identity.md:340-341 "the alias is named for the token's subject, and that is the repository and ref the role's own bound_claims already spell"
docs/store-identity.md:463-465 "the role is bound to the repository, to refs/heads/main and to a push event, so a pull-request run cannot obtain an identity at all"

Both sentences were true of all eight roles before this change and are now true of seven. The scheduled role's alias will be repo:olympus/infra-forge:ref:main — the subject is still built from the repository and the ref (services/actions/auth.go:153 at tag v15.0.9), while its bound_claims spell repository and event_name (bao/service/roles/openbao/defaults/main.yml:184-186). The change explains the exception where it edits (:149-153) but not at the two places elsewhere on the page that generalise the rule — the same seam a reader follows when they go looking for the entity name.

ADVISORY, not a blocker: no mechanism is broken, nothing in a rebuild or a rename procedure changes, and the page's own renovate paragraph is now correct. Clearing it: one clause in each sentence scoping it to the push roles (the deploy roles' alias …, the deploy role is bound …), or naming the two roles that bind no ref.

Named, not charged

  • make check at the head is green, on the second run. The first run was rc 2, plan tests: 1 case(s) FAILED — it names the resource the plan would have replaced (missing [terraform_data.guest]), immediately preceded by scripts/tests/plan-check.sh: line 51: printf: write error: Broken pipe. That is the printf | grep -q SIGPIPE race this repo's suites carry (earlier rounds met its twin in scripts/tests/run.sh:63). make plan-test then ran 4/4 green at the head and 4/4 green at the base 4a45309, and a second full make check at the head exited 0 with verify tests: 9 assertions, 0 FAILED — the PR body's evidence line reproduced. Pre-existing, not introduced here.
  • ref: main was the other way to keep the claim, and it is not the one taken. The schedule row stores the default branch's name at detection time (services/actions/notifier_helper.go:617, Ref: input.Repo.DefaultBranch), so a ref: main binding would refuse the run again the day the default branch is renamed — the same failure, one rename later. The comment's argument that the ref is redundant under event_name: schedule holds: the notifier only detects schedules on the default branch (notifier_helper.go:583). A judgement call the author reasoned and wrote down, so it is not charged.
  • renovate's store identity is a second entity from forge's — repo:olympus/infra-forge:ref:main rather than …ref:refs/heads/main. That is the store's own alias rule (subject, first login), the role's policy attaches at login, and the page's alias list (:312-320) is about the push roles. Named so it is not later read as a surprise.

Verified

Probe Result
git ls-remote origin refs/pull/69/head 10b1fedf…, equal to the dispatch's head, read before the first wave and after the last; worktree at that commit, git status --porcelain empty
GET /api/v1/version on the instance 15.0.9+gitea-1.22.0 — the tag the change's comment names
the mechanism, read from forgejo/forgejo at tag v15.0.9 (source tarball, fetched live) notifier_helper.go:617 writes the schedule row's ref as input.Repo.DefaultBranch (the name), :583 — "Only working in default branch"; schedule_tasks.go:132 copies it into the run (Ref: cron.Ref) and :136 sets TriggerEvent: schedule; context.go:27 — ref := run.Ref, verbatim, and :54 — EventName: run.TriggerEvent; auth.go:127 puts ctxVal("ref") into the ID token's ref claim and :153 builds the subject repo:%s:ref:%s. A push run carries refs/heads/main through the same lines unchanged (context_test.go:118-150), which is what makes the scheduled run's main a difference in run.Ref and nothing else
what the fix leaves a scheduled run's token claims ref=main, event_name=schedule, repository=olympus/infra-forge; the two remaining bindings match all three of the values they name, and the removed one could never have matched
the apply on merge tasks/store.yml:263-287 reads each role back and compares TTLs, policies, audience and bound_claims; :296-317 writes the role when they differ, role_type: jwt, bound_claims as the whole map. bao/service/site.yml:7 runs the role, and AGENTS.md §Checks has deploy.yml starting that service layer on a push to main — so the merge reconciles auth/jwt/role/renovate
ansible-playbook --syntax-check bao/service/site.yml rc 0 (no-inventory warnings only)
the eight roles' bound_claims at the head parsed: six push roles and renovate-dispatch carry refs/heads/main; renovate is {repository, event_name}
mise exec -- make check at the head run 1 rc 2 (the flake above), run 2 rc 0 — verify tests: 9 assertions, 0 FAILED
make plan-test ×4 at the head, ×4 at the base 4a45309 8/8 rc 0
commit statuses at 10b1fed pr-checks / check (pull_request) success 47s; plan / guest-plan-check (pull_request_target) success 17s — both required contexts green at the head
olympus/workshop ADR-0013 at main the Decision names seven roles and its table carries Updater — the record docs/store-identity.md:147 cites resolves
secrets in the diff none. The hunk removes one claim value and adds comment prose; no credential, path value or token appears

Could not verify

  • The action_schedule row itself (title=renovate, repo_id=1, ref=main, event=push). That is the author's read of the forge database on 141; I did not repeat it. The code path above forces the same value from the same column, so the binding decision rests on the source and not on that row alone.
  • The first scheduled run. It has not happened yet (the design document puts it at Monday 04:17Z), so the end-to-end auth/jwt/login from a scheduled run is unproven. What this round proves is the claim value the binding has to match; the login itself is Monday's evidence.

Counts and the gate

Axis BLOCKER ADVISORY Worst
Standards 0 0 —
Spec 0 1 two page sentences stating the old three-claim rule for every role

Zero blockers and one counted advisory: merging. The advisory travels as advice — it is one clause in each of two sentences and needs no round of its own.

This change touches the store's JWT roles on 144, which the charter lists as tier-1. The dispatch puts that class's hold elsewhere and the state on the findings, so I applied that narrowing, as round 2 of #64 did: no board card was opened (THE-40 is the card — in_progress, its design document carries the board's answer on the Updater role), and merging remains the board's gate beside this review's.

<!-- minos review-loop: repo=olympus/infra-secrets pr=69 head=10b1fedf824ac7699a81325d7aca78ecdd62a8ce round=1/5 axes=standards,spec --> Review loop: repo=olympus/infra-secrets · PR #69 · head=10b1fedf824ac7699a81325d7aca78ecdd62a8ce · round=1/5 · verdict=merge Recommendation: merge **Round.** `list_pull_reviews` → `[]` before this one, so this is round 1/5; the dispatch's "1/5" agrees. Fixed point: `git diff 4a45309...(merge-base) 10b1fed` — 2 files, 13 insertions, 3 deletions, one commit. Head resolved twice, before and after the probes, both `10b1fed`. **Spec.** `paperclip:THE-40` — read live over the control plane: `GET /api/issues/THE-40` → 200 (`in_progress`, updated 2026-12-02T21:03:46Z), its design document *E4 — hardening in code* → 200, 8423 chars, updated 16:47:06Z. Neither names the `ref` binding: the ticket's store slice stops at *"one policy, `ci-renovate`, and two JWT roles, `renovate` for a schedule and `renovate-dispatch` for a manual run"*, which the tree already had. So the contract this round judges is the PR body's own: the scheduled run's `ref` claim is the branch *name*, the bindings of `refs/heads/main` therefore refuse it, and the role moves to repository + event. **Standards.** `AGENTS.md` §Decisions and §Checks at the head, and `olympus/workshop` `docs/adr/0013-access-is-granted-to-a-role.md` at that repository's `main` (read live: the Decision lists seven roles and its table carries **Updater** — the record the page cites resolves). No `CONTRIBUTING.md` or `docs/adr/` in this repo; `AGENTS.md` is the whole of its own written standard. ## Standards No findings. The change is one YAML defaults file and one page. The edit is the smallest shape the defect allows: the claim that could never match is removed (`bao/service/roles/openbao/defaults/main.yml:180-186` now binds `repository` and `event_name` only), the dispatch role keeps its full binding (`:187-194`), the six push roles are untouched, and the rationale sits in the comment above the list (`:103-110`) rather than only in the PR body. `ansible-playbook --syntax-check bao/service/site.yml` parses (rc 0, no-inventory warnings only), and the eight roles' `bound_claims` parse to exactly the intended maps. Nothing in the tree reads a `ref` key off `openbao_jwt_roles`: the two consumers are the read-back comparison and the write body (`bao/service/roles/openbao/tasks/store.yml:283-287`, `:296-317`), both of which take `item.bound_claims` whole. Dropping a key from the map is therefore a reconciliation the deploy performs, not a template that breaks. ## Spec ### ADVISORY — `docs/store-identity.md:340-341`, `:463-465`: two sentences still state the binding as repository + ref + event for "the role" | Where | What it says | | --- | --- | | `docs/store-identity.md:340-341` | *"the alias is named for the token's subject, and that is the `repository` and `ref` the role's own `bound_claims` already spell"* | | `docs/store-identity.md:463-465` | *"the role is bound to the repository, to `refs/heads/main` and to a `push` event, so a pull-request run cannot obtain an identity at all"* | Both sentences were true of all eight roles before this change and are now true of seven. The scheduled role's alias will be `repo:olympus/infra-forge:ref:main` — the subject is still built from the repository and the ref (`services/actions/auth.go:153` at tag `v15.0.9`), while its `bound_claims` spell `repository` and `event_name` (`bao/service/roles/openbao/defaults/main.yml:184-186`). The change explains the exception where it edits (`:149-153`) but not at the two places elsewhere on the page that generalise the rule — the same seam a reader follows when they go looking for the entity name. ADVISORY, not a blocker: no mechanism is broken, nothing in a rebuild or a rename procedure changes, and the page's own renovate paragraph is now correct. **Clearing it:** one clause in each sentence scoping it to the push roles (`the deploy roles' alias …`, `the deploy role is bound …`), or naming the two roles that bind no ref. ## Named, not charged - **`make check` at the head is green, on the second run.** The first run was rc 2, `plan tests: 1 case(s) FAILED` — `it names the resource the plan would have replaced (missing [terraform_data.guest])`, immediately preceded by `scripts/tests/plan-check.sh: line 51: printf: write error: Broken pipe`. That is the `printf | grep -q` SIGPIPE race this repo's suites carry (earlier rounds met its twin in `scripts/tests/run.sh:63`). `make plan-test` then ran 4/4 green at the head and 4/4 green at the base `4a45309`, and a second full `make check` at the head exited 0 with `verify tests: 9 assertions, 0 FAILED` — the PR body's evidence line reproduced. Pre-existing, not introduced here. - **`ref: main` was the other way to keep the claim, and it is not the one taken.** The schedule row stores the default branch's *name* at detection time (`services/actions/notifier_helper.go:617`, `Ref: input.Repo.DefaultBranch`), so a `ref: main` binding would refuse the run again the day the default branch is renamed — the same failure, one rename later. The comment's argument that the ref is redundant under `event_name: schedule` holds: the notifier only detects schedules on the default branch (`notifier_helper.go:583`). A judgement call the author reasoned and wrote down, so it is not charged. - **`renovate`'s store identity is a second entity from `forge`'s** — `repo:olympus/infra-forge:ref:main` rather than `…ref:refs/heads/main`. That is the store's own alias rule (subject, first login), the role's policy attaches at login, and the page's alias list (`:312-320`) is about the push roles. Named so it is not later read as a surprise. ## Verified | Probe | Result | | --- | --- | | `git ls-remote origin refs/pull/69/head` | `10b1fedf…`, equal to the dispatch's head, read before the first wave and after the last; worktree at that commit, `git status --porcelain` empty | | `GET /api/v1/version` on the instance | `15.0.9+gitea-1.22.0` — the tag the change's comment names | | the mechanism, read from `forgejo/forgejo` at tag `v15.0.9` (source tarball, fetched live) | `notifier_helper.go:617` writes the schedule row's ref as `input.Repo.DefaultBranch` (the *name*), `:583` — *"Only working in default branch"*; `schedule_tasks.go:132` copies it into the run (`Ref: cron.Ref`) and `:136` sets `TriggerEvent: schedule`; `context.go:27` — `ref := run.Ref`, verbatim, and `:54` — `EventName: run.TriggerEvent`; `auth.go:127` puts `ctxVal("ref")` into the ID token's `ref` claim and `:153` builds the subject `repo:%s:ref:%s`. A push run carries `refs/heads/main` through the same lines unchanged (`context_test.go:118-150`), which is what makes the scheduled run's `main` a difference in `run.Ref` and nothing else | | what the fix leaves | a scheduled run's token claims `ref=main`, `event_name=schedule`, `repository=olympus/infra-forge`; the two remaining bindings match all three of the values they name, and the removed one could never have matched | | the apply on merge | `tasks/store.yml:263-287` reads each role back and compares TTLs, policies, audience and `bound_claims`; `:296-317` writes the role when they differ, `role_type: jwt`, `bound_claims` as the whole map. `bao/service/site.yml:7` runs the role, and `AGENTS.md` §Checks has `deploy.yml` starting that service layer on a push to `main` — so the merge reconciles `auth/jwt/role/renovate` | | `ansible-playbook --syntax-check bao/service/site.yml` | rc 0 (no-inventory warnings only) | | the eight roles' `bound_claims` at the head | parsed: six push roles and `renovate-dispatch` carry `refs/heads/main`; `renovate` is `{repository, event_name}` | | `mise exec -- make check` at the head | run 1 rc 2 (the flake above), run 2 rc 0 — `verify tests: 9 assertions, 0 FAILED` | | `make plan-test` ×4 at the head, ×4 at the base `4a45309` | 8/8 rc 0 | | commit statuses at `10b1fed` | `pr-checks / check (pull_request)` success 47s; `plan / guest-plan-check (pull_request_target)` success 17s — both required contexts green at the head | | `olympus/workshop` ADR-0013 at `main` | the Decision names seven roles and its table carries **Updater** — the record `docs/store-identity.md:147` cites resolves | | secrets in the diff | none. The hunk removes one claim value and adds comment prose; no credential, path value or token appears | ## Could not verify - **The `action_schedule` row itself** (`title=renovate`, `repo_id=1`, `ref=main`, `event=push`). That is the author's read of the forge database on 141; I did not repeat it. The code path above forces the same value from the same column, so the binding decision rests on the source and not on that row alone. - **The first scheduled run.** It has not happened yet (the design document puts it at Monday 04:17Z), so the end-to-end `auth/jwt/login` from a scheduled run is unproven. What this round proves is the claim value the binding has to match; the login itself is Monday's evidence. ## Counts and the gate | Axis | BLOCKER | ADVISORY | Worst | | --- | ---: | ---: | --- | | Standards | 0 | 0 | — | | Spec | 0 | 1 | two page sentences stating the old three-claim rule for every role | Zero blockers and one counted advisory: merging. The advisory travels as advice — it is one clause in each of two sentences and needs no round of its own. This change touches the store's JWT roles on 144, which the charter lists as tier-1. The dispatch puts that class's hold elsewhere and the state on the findings, so I applied that narrowing, as round 2 of #64 did: no board card was opened (THE-40 is the card — `in_progress`, its design document carries the board's answer on the Updater role), and merging remains the board's gate beside this review's.
pit merged commit 095dbd4260 into main 2026-12-02 21:20:42 +00:00
pit deleted branch hermes/THE-40-schedule-ref 2026-12-02 21:20:42 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
olympus/infra-secrets!69
No description provided.