Skip to content

feat: per-region check periods with spread control, check-group management, grouped pagination, agent quotas, chi router - #156

Merged
fclairamb merged 79 commits into
mainfrom
batch/2026-07-19-2
Jul 21, 2026
Merged

fclairamb merged 79 commits into
mainfrom
batch/2026-07-19-2

Conversation

@fclairamb

Copy link
Copy Markdown
Owner

Summary

  • Multi-region checks now run at the full period in every region. The configured period applies per region (a 1-minute check on 3 regions runs every minute in each region, previously every 3 minutes per region), staggered evenly across the period by default. A new optional regionSpread field — first-class column, API + "Region spread" control on the check form (all locales) — overrides the stagger (e.g. 1s for near-simultaneous cross-region sampling); validated 0 ≤ spread < period. Existing multi-region jobs are migrated by an idempotent startup reconcile (migration 007_v0_6_0).
    Behavior change: a multi-region check now executes regions × more often and its entitlement consumption is counted as regions × 60s / period; the check form and org Usage page state this.
  • Check groups: edit page with escalation-policy picker (+ list indicator), direct edit/delete row actions, edit-page delete, breadcrumb.
  • Checks list API: opt-in sort=group with a composite keyset cursor so the grouped index paginates without slicing groups apart; fixes the false empty state for groups whose checks live on later pages.
  • Private locations: new maxDeportedAgents entitlement enforced at token mint + agent enrollment, agent usage on the org Usage page, SaaS plan-gate ladder.
  • Router migration: uptrace/bunrouter (archived) → go-chi/chi behind the in-repo httpx adapter, keeping error-returning handlers; table-driven route-precedence parity tests.
  • Fixes: sub-minute checks no longer stall on idle workers (fetcher wakes on a next-eligible hint, in-process + deported agents); dialog grid no longer blows out on long unbreakable content (enrollment tokens).

Test plan

  • Backend suite (unit + testcontainers PG/SQLite) green per-spec (chore: all checks passing gates)
  • Playwright E2E: region-spread field, check-group escalation, grouped pagination empty-state guard, dialog containment
  • Route-precedence parity tests for the chi migration
  • Startup reconcile idempotence covered on both DBs

🤖 Generated with Claude Code

fclairamb and others added 30 commits July 19, 2026 22:26
…ute checks hold on idle workers and deported agents

A 10s-period check on a deported agent ran once per minute: the fetcher's
only periodic wake was a flat 1-minute poll, while the per-job claim-ahead
clamp (min(FetchMaxAhead, period/2, 30s)) makes a 10s job claimable only 5s
before it is due — so on an idle agent the post-completion re-claim always
missed and the job waited out the full fallback minute. The in-process
worker had the same latent bug, masked by busy pools whose completions keep
re-triggering claims.

The claim path now returns how long until the earliest still-unleased job in
scope becomes claimable (computed inside the claim tx, after the lease
writes, over a bounded horizon + scan, range-scanning the existing
check_jobs_scheduled_at_idx), the agent WS jobs frame carries it as an
optional retryInMs (old agents/servers safely degrade to the old cadence),
and the fetcher sleeps exactly that long — floored at 100ms, capped by the
unchanged 1-minute fallback.

Spec: specs/done/2026/07/2026-07-20-03-sub-minute-checks-idle-worker-poll.md

Co-Authored-By: Claude Fable 5 <[email protected]>
Split database-model.md and api-specification.md into per-topic
directories, correct entitlements.md and other pages that had drifted
from the actual code, add deported-agents.md, and refresh
roadmap/competitors pages. Also gitignore local agent-keys.json and
*.db-journal artifacts.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
DialogContent/AlertDialogContent are display:grid with no explicit
columns, so direct children default to an automatic min-width of their
min-content size. The enrollment-token dialog's <pre> docker command and
<code> token (both unbreakable single-line text) forced the grid track
past max-w-lg, and since the primitives had no overflow-hidden, the
oversized content painted past the dialog's visible rounded border,
looking like torn UI fragments over the backdrop.

Fix at the shared primitive level ([&>*]:min-w-0 on DialogContent and
AlertDialogContent) so every dialog is protected, plus local min-w-0/
max-w-full on the token-reveal markup as defense in depth.
@fclairamb
fclairamb enabled auto-merge (squash) July 21, 2026 11:28
@fclairamb
fclairamb merged commit a08bfd8 into main Jul 21, 2026
11 checks passed
@fclairamb
fclairamb deleted the batch/2026-07-19-2 branch July 21, 2026 11:49
@fclairamb fclairamb mentioned this pull request Jul 21, 2026
fclairamb added a commit that referenced this pull request Jul 21, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.6.0](v0.5.0...v0.6.0)
(2026-07-21)


### Features

* per-region check periods with spread control, check-group management,
grouped pagination, agent quotas, chi router
([#156](#156))
([a08bfd8](a08bfd8))


### Bug Fixes

* **deps:** update dependency recharts to v3.10.0
([#155](#155))
([6c855f4](6c855f4))
* **deps:** update github.com/dop251/goja digest to 0fc1d42
([#150](#150))
([05b578c](05b578c))
* **deps:** update go dependencies (non-major)
([#154](#154))
([03ce71c](03ce71c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: Claude Fable 5 <[email protected]>
fclairamb and others added 13 commits July 21, 2026 19:47
…lers

CheckForm's submit builder already included regionSpread in the data
object it hands to onSubmit, but both route handlers
(checks.new.tsx / checks.$checkUid.edit.tsx) build their
Create/UpdateCheckRequest by hand-picking fields from that object —
regionSpread was missing from both lists, so it was silently dropped
before the request was ever sent (same class of bug as spec
2026-07-15-04's confirmation/recovery period regression, which is why
the edit route already carries a "keep this list in sync" warning
comment). Caught by the new region-spread persistence E2E test.
Covers: absent with a single region and appears once a second is
selected; a custom spread persists across save/reload; clearing it
restores the automatic-default placeholder; an out-of-range value
shows the inline validation error and blocks save. Uses the
lightweight POST /private-regions endpoint (as check-ssh-tunnel.spec.ts
does) to get a real second region without needing agent enrollment.
Adds a secondary "Region Spread" number+unit input to the check
create/edit form's Scheduling card, rendered only when 2+ regions are
selected. Reuses the number+unit duration-input pattern (now with a
seconds unit) already used for the period input.

- Shows the computed automatic default (period / region count) as help
  text when empty, and mirrors the backend 0 <= spread < period bound
  client-side, blocking submit with an inline error.
- Save semantics mirror the checkGroupUid/escalationPolicyUid PATCH
  idiom: a value sets the override, "" clears it back to automatic on
  edit, and the key is omitted when the field isn't visible or on
  create with nothing typed (0 is a valid explicit value, never treated
  as unset).
- The existing regions hint line now names the custom spread when one
  is set ("staggered {{spread}} apart").
This was referenced Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant