refactor: detectSessionNeed single source; run-targets trust unification; perf + UX - #124
Conversation
…ion; perf + UX improvements Closes the remaining improvement backlog from the tier-targeting review rounds (PRs #121-#123): - NEW auth-session.detectSessionNeed(workflow): one pure detector (parse setup → owner scope → evaluate against brokered secrets) consumed by the run route, run-targets, schedule create/PATCH, run-now, and the scheduler tick — the "does this workflow need a session?" answer can no longer drift between routes. stampOwnerSession accepts the precomputed requirement, eliminating the duplicate getBrokeredSecretNames query per scheduler tick and per run-now. - run-targets derives needsSession from that detector (not "any brokered secret anywhere"), and gates agents.mine on session trust: a dispatcher who is neither owner nor workflow-org member no longer sees their own tokens offered for a credential-injected workflow the targeted branch would 403 (shared listings stay — attestation+consent is the sanctioned cross-user path). - Region job filter gains an indexable fast-path: eq(target_region) covers pooled rows (stamped at creation, never cleared), regex only for site-pinned targeted/legacy rows. - api.test's Organization Roles suite cleans up the admin-owner org it creates (owners can't leave via API), closing the cross-suite "admin has no org" pollution race that bit three gate runs. - console-workflow-detail Job History reads the {data,total} response shape (was typed as a bare array — table silently broke). - The tier auto-hop announces itself with a toast instead of silently moving the user's selection. 🤖 Built with SMT <smt@agora.build>
🤖 Claude Code ReviewReviewed the merge ref ( Findings below, roughly by severity.
|
Summary
Closes the remaining improvement backlog from the tier-targeting review rounds (#121–#123):
detectSessionNeed()— one detector everywhere. New pure helper in auth-session (parse setup → owner scope → evaluate against brokered secrets) consumed by the run route, run-targets, schedule create/PATCH, run-now, and the scheduler tick.stampOwnerSessiontakes the precomputed requirement, killing the duplicategetBrokeredSecretNamesquery per scheduler tick / run-now.needsSessionnow comes from the same detector the run route enforces with (a misconfigured pair no longer mislabels tiers — dispatch fails with the real misuse error);agents.mineis gated on session trust so a stranger on a credential-injected workflow isn't offered tokens the targeted branch would 403 (shared listings stay — the sanctioned attestation+consent path).eq(target_region)covers pooled rows (stamped at creation, never cleared at claim); the collation-safe regex remains only for site-pinned targeted/legacy rows.{data,total}response as a bare array (silently broken table).Test plan
wf[0]race); run-your-own E2E 13/0.agents.minegating, the misconfigured-pair tier labeling, and the toast.Generated with SMT smt@agora.build