Add the annia pause lever to the oz console #94

Open
tepichord wants to merge 13 commits from feat/90-annia-pause-lever-oz-console into main
Owner

Closes #90

Automated PR created by forgejo-done adapter.

Closes #90 Automated PR created by forgejo-done adapter.
Introduces annia.ts with constants, isPausedByAnnotation, readPaused,
and setPaused for toggling autoscaling.keda.sh/paused on the
annia-wakeup ScaledJob. Uses client.request() directly (not get/patch
which prefix /api/v1) to reach the CRD. Tests cover parse semantics
(KEDA fail-safe), fake-transport read/write paths, and patch bodies
(RFC 7386 merge-patch: null to remove, "true" to pause).

Refs: #90
Adds paused boolean to SimulatedState, a pause branch in
applySimulated (handled before the numeric-PR guard since pause has
no PR number), and reset of paused in resetSimulatedState. Tests
verify the toggle, isolation from other state, and reset.

Refs: #90
New POST handler at /api/pause following the pattern of api/delete and
api/activate: preview-build guard first (logs and simulates), then
auth+CSRF check, then the real read-toggle-patch via annia helpers.
Redirects to /?paused=0|1 on success.

Refs: #90
Every return path in +page.server.ts now includes an annia field
({ paused: boolean | null }), including the !user early return and
the preview-mode branch. The preview-mode notice handles the pause
action. +page.svelte renders an annia section above the table with
status display and a form POST to /api/pause, in both modes.

Refs: #90
Adds Role and RoleBinding preview-console-annia-pause in the annia
namespace granting exactly get/patch on scaledjobs.keda.sh. No delete,
no list/watch, no verbs on jobs or pods. The annia namespace is
created by #25.

Refs: #90
Refs: #90
The console identity paragraph now mentions the scaledjobs get/patch
grant in the annia namespace alongside the existing namespaces patch
grant, in the same breath as the expiry patch.

Refs: #90
Extends test_preview_console_rbac_is_bounded to verify the
preview-console-annia-pause Role grants exactly get/patch on
scaledjobs.keda.sh in the annia namespace, and the RoleBinding
targets preview-console in preview-system.

Refs: #90
Refs: #90
The `as keyof Record<string, unknown>` cast let the indexed access land
on an `unknown`, which `strict` rejects (TS7053: element implicitly has
an 'any' type). Narrow metadata/annotations to records as `k8s.ts` does,
then index with the plain annotation key. `deno task check` went from
one error to zero.

Refs: #90
The pause test read the body but discarded the headers, so nothing held
`request()` to `application/merge-patch+json` — the media type that
makes resume-by-removal work. Assert it on the fake transport.

Refs: #90
The rule-set assertion only checked the scaledjobs/keda.sh entry, so an
extra rule on the same Role — a `delete`, a verb on `jobs` or `pods` —
would pass. Assert the rule count too, which is what the surrounding
comment and the issue's boundary claim say.

Refs: #90
docs: resolve the annia pause cross-references
All checks were successful
ci/woodpecker/pr/gates Pipeline was successful
b4c65d1d38
`(§ annia)` in AGENTS.md named no section, and `(annia pause, § above)`
in §11h pointed at nothing above it. Name §11h explicitly and drop the
empty parenthetical.

Refs: #90
All checks were successful
ci/woodpecker/pr/gates Pipeline was successful
Required
Details
This pull request has changes conflicting with the target branch.
  • AGENTS.md
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/90-annia-pause-lever-oz-console:feat/90-annia-pause-lever-oz-console
git switch feat/90-annia-pause-lever-oz-console
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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
tepichord/milner!94
No description provided.