Skip to content

feat(aws-control): report a snapshot nightly granted on a non-default account - #22660

Merged
iamwhatever merged 1 commit into
mainfrom
kc-wt-12374
Nov 1, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
kc-wt-12374

Conversation

@dodgeblaster

@dodgeblaster dodgeblaster commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Tell the operator when a nightly snapshot they switched on will never run because it is granted on an account the schedule does not visit.

Turning on the nightly snapshot records the grant per account, but the nightly loop only ever runs against the resolved default account. So an operator who turns it on while viewing a non-default account gets a switch that reads back on and a schedule that never visits it. The sessions kind already explains this silence; the snapshot kind had no equivalent, so a granted-and-idle snapshot nightly said nothing.

Why it matters

The loss only surfaces at the one event the backup exists to survive: the operator believes nightly snapshots are protecting the account, the host is lost, and there is no archive. A console that can only show the grant as "on" is making a promise the schedule never keeps.

Not a goal

  • Making the nightly loop run on non-default accounts. The loop resolving one account is the existing design; this PR reports the gap, it does not change which account the schedule visits.
  • Any new condition for the snapshot kind beyond the account one. The snapshot kind has no host-capability or redaction gate (those are sessions-only), so it carries exactly the other_account condition.

What changed (motivation → approach → change)

The sessions kind solved this exact silence (#12190): a blocked-code predicate, a status field beside the grant, and a console string. The snapshot kind is the one surface that pattern was not extended to, and every shape question was already settled there, so this mirrors it.

In src/kiro_crew/apps/builtins/aws_control/backend, backup_parts/nightly.py gains scheduled_snapshot_blocked_code(*, scheduled_account) returning other_account or None — its one condition, since no capability or redaction gate applies to the snapshot kind — re-exported through backup.py. scheduled_account is required with no default: due_for_nightly reads nothing here and is unchanged, so the only caller is the per-account status route, which always answers explicitly. routes_parts/backups.py adds a nightlyBlocked status field computed with the same scheduled_account == default comparison the sessions field uses. In website/src/apps/aws-control, DrivePageBackup.tsx renders the notice under the snapshot switch and types.ts carries the new field; the switch maps only the one other_account code and shows nothing for an unknown one, so no unused fallback string is added. The console string goes into every catalogue under website/src/i18n/locales (en-XA regenerated), and docs/system-specs/modules/aws-control.md documents the snapshot mirror.

Backwards compatibility

Compatible: the new backend function and the nightlyBlocked status field are additive; due_for_nightly and every existing field are untouched. An older frontend ignores the new field, and an older backend omits it — the panel reads an absent nightlyBlocked as "not blocked", the safe direction.

Removes nothing: no path, record, key or function is removed, renamed or narrowed.

Tests

  • test_aws_control_nightly_snapshot_blocked.py: the blocked code answers None for the default account and other_account for a non-default one; the code carries no prose; the snapshot kind reports neither the host nor the redaction block even when both would block the sessions kind; and due_for_nightly is unaffected by the account condition.
  • test_aws_control_routes_backup.py: the status payload carries nightlyBlocked: other_account for a grant on a non-default account and null for the default one, each beside an unchanged grant.
  • DrivePage.errorSurfaces.test.tsx: the notice renders under the snapshot switch only when the grant is on and nightlyBlocked is set, stays absent when the grant is off or nothing is in the way, and an older backend omitting the field shows no block.
  • test_aws_control_backup_composition_contract.py: the new export is added to the facade's frozen inventory.

Manual verification

Captured the backup panel in both states against a Vite dev server with the API stubbed (no gateway, no credentials, no real AWS). See Screenshots.

Screenshots / video

The snapshot switch granted on the default account — no notice, the healthy baseline:

default account, no notice

The same switch granted on an account the schedule does not visit — the new notice renders in warn colour directly under it:

granted on a non-default account, notice shown

Related Issues

Closes #12374

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of df41340e66adbd4d7b3298799a7d2d367c39c2da — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks. The change adds a reporting field only. It applies the sessions-kind pattern that is already in place, has a safe default when the field is absent, and the screenshot shows the new notice.

Notes

  • default_account_id() is now awaited twice per status request (lines 148 and 175 of routes_parts/backups.py). Resolving it once and reusing the value would keep both notices in agreement if the default account changes between the two calls.

[DESIGN-REVIEWED] df41340

Description read

[DESCRIPTION-READ] 1647105555d86d15d3c111df285f0038dc75b884f3d4f54d07a07f984431a93e

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of df41340e66adbd4d7b3298799a7d2d367c39c2da — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. One small wrapper exists only to look like the sessions version.

Notes

  • Item 3 — inherited (symmetry): the new public function scheduled_snapshot_blocked_code contains only if not scheduled_account: return BLOCK_OTHER_ACCOUNT; return None. It has one consumer, the status route (grepped scheduled_snapshot_blocked_code under src/), and the description justifies it as "this mirrors it". The function cannot fail and needs no thread, yet it adds a facade export, a frozen-inventory row and a spec paragraph. Subtraction: delete the function, its backup.py re-export, its FROZEN_NAMES row and the paragraph about it in the spec. Compute the field inline in the route instead: "nightlyBlocked": None if account == default else backup_mod.BLOCK_OTHER_ACCOUNT.

What this change ships

Inventory (6 items) — 5 justified

Intent: tell operators when a nightly snapshot they turned on can never run, because they turned it on for a non-default account. ADDITION (reporting only; which account the schedule visits does not change).

  1. A warning appears under the snapshot switch when it is on for a non-default account — justified
  2. The GET /backup/{account} payload gains a nightlyBlocked field — justified
  3. New facade function scheduled_snapshot_blocked_code — one consumer, generalized; a one-line wrapper of a comparison
  4. A new console string in every locale catalogue — justified
  5. The notice also says "You can still start the backup yourself", reusing the existing generic key — justified
  6. The aws-control spec describes the snapshot block — justified

[FIRST-PRINCIPLES-REVIEWED] df41340

Description read

[DESCRIPTION-READ] 0528aa503755665e64fb7d4d1633271be799ad3840c59c16de6c30d6327efb74

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of df41340e66adbd4d7b3298799a7d2d367c39c2da — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The blind reader read the new notice correctly: "the nightly switch, even though it's on, does nothing for the account I'm using." It says what is happening and offers a next step.

Notes

  • backup_nightly_blocked_other_account: the reader did not know "what 'default account' means or which account I'm on." Put the default account's name in the sentence, e.g. "Nightly snapshots only run for {{defaultAccount}}…".
  • The notice sits between the two switches with only pb-2 spacing, so the reader couldn't be sure "whether it's about the switch above it or the one below." Tie it visually to the snapshot switch: tighten the gap above it, or start the text at the switch label's indent.

[UX-REVIEWED] df41340

Description read

[DESCRIPTION-READ] 014cf677dcdf9b7ada80aeab145c108ddd0a2151c8030b4a10908556c3f66240

That sha256 names everything this verdict read: the PR description, plus the 5 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed df41340e66adbd4d7b3298799a7d2d367c39c2da — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] df41340

Verdict parsed from the review's SHA-scoped output markers for commit df41340e66adbd4d7b3298799a7d2d367c39c2da.

False positive or not applicable? A repository writer can comment:
/ai-review override fable df41340e66adbd4d7b3298799a7d2d367c39c2da false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of df41340e66adbd4d7b3298799a7d2d367c39c2da and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] df41340

False positive or not applicable? A repository writer can comment:
/ai-review override gpt df41340e66adbd4d7b3298799a7d2d367c39c2da false-positive: <reason, 20 to 500 characters>

@dodgeblaster
dodgeblaster force-pushed the kc-wt-12374 branch 3 times, most recently from 30e13d9 to b5cafbd Compare October 21, 2026 05:02
@dodgeblaster

Copy link
Copy Markdown
Contributor Author

self-added: no
mechanism: named reporting predicate scheduled_snapshot_blocked_code

  • Item 3 — oversized: inline the one-line wrapper (span=7d8318caef13)

Rebutted as proportional. This is the snapshot half of a matched pair: scheduled_sessions_blocked_code is a named, unit-tested predicate for the same "can this scheduled kind run on this account" question, and the status route reads the two identically. Inlining only the snapshot one splits that pair, so a reader comparing the two switches' backends meets a function on one side and a bare ternary on the other.
The function is also the unit-test seam: test_aws_control_nightly_snapshot_blocked.py asserts the predicate directly, independent of the aiohttp route. Inlining moves that logic behind the route handler, where the same property costs a request fixture to test.
The sessions kind grew from one condition to three (host, redaction, account); keeping the snapshot answer in one named place means a future second snapshot condition extends the predicate rather than re-growing an inlined comparison back into a function under review.

@dodgeblaster

Copy link
Copy Markdown
Contributor Author
  • "Default account" points nowhere (span=ca58000dd17d)

needs-a-decision. The snapshot notice mirrors the sessions notice (backup_nightly_sessions_blocked_other_account), which uses the identical "default account" term under the switch directly above this one. Defining or linking the term is a copy change that should apply to BOTH notices, not diverge the snapshot one from its sessions sibling — a maintainer call on shared panel vocabulary, outside this PR's goal of mirroring the sessions pattern.

@dodgeblaster

Copy link
Copy Markdown
Contributor Author
  • The switch and the notice disagree (span=c83c4991a5ee)

needs-a-decision. The finding itself notes this is "inherited from the sessions pattern": keeping the grant switch interactive while the notice says the schedule is idle is the maintainer-settled behaviour of the sessions kind, which this PR mirrors. Adding a "the setting is kept" clause here would word the snapshot notice differently from the adjacent sessions notice — a cross-kind copy decision the maintainer owns, not a defect in this mirror.

@dodgeblaster

Copy link
Copy Markdown
Contributor Author
  • Name the button in the next line (span=7aaac805d295)

needs-a-decision. The "you can still start the backup yourself" next line is the shared key backup_nightly_sessions_blocked_next, rendered under both the sessions and snapshot switches. Naming "Back up now" means either changing that shared sessions string (out of this PR's scope) or forking a snapshot-only copy that diverges from the sessions notice — a maintainer copy call on shared vocabulary.

… account

The nightly snapshot grant is recorded per account by set_nightly while the
loop resolves one account, so switching it on while viewing a non-default
account reads back on and never runs. The sessions kind already reports this;
the snapshot kind had no equivalent, so a granted-and-idle snapshot nightly was
silent.

Mirror the sessions pattern for the snapshot kind: scheduled_snapshot_blocked_code
(its one condition is other_account; due_for_nightly is unchanged), a nightlyBlocked
status field computed with the same scheduled_account comparison, and a notice
rendered under the snapshot switch with its own console string across the locale
catalogues.

Closes #12374
@dodgeblaster
dodgeblaster marked this pull request as ready for review October 30, 2026 00:41
@dodgeblaster
dodgeblaster requested review from a team and KiroCrewCaptain as code owners October 30, 2026 00:41
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 30, 2026

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:

Approving at df41340.

This closes a silent gap: a nightly snapshot switched on while viewing a non-default account read back as on, but the nightly loop only ever visits the default account, so nothing was backed up. The status route now reports nightlyBlocked: other_account beside the grant using the same default-account comparison as nightlySessionsBlocked, and the panel shows a warn line under the snapshot switch. Main does not have this yet, and #12374 is still open.

Checked: flipping the snapshot scheduled_account comparison in routes_parts/backups.py reddens test_the_scheduled_account_gets_no_snapshot_account_notice and test_the_status_payload_says_when_the_snapshot_grant_is_on_the_wrong_account. The frontend test was not run locally; CI frontend shards are green on this head.

Non-blocking follow-up: in DrivePageBackup.tsx, an unrecognised nightlyBlocked code makes nightlyBlockedText return null, but the generic "You can still start the backup yourself." line still renders on its own. The description says an unknown code shows nothing. Gating the whole block on a non-null nightlyBlockedText(...) would match that.

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve at df41340.

A nightly snapshot switched on while viewing a non-default account read back as on but never ran, because the nightly loop only visits the default account. The status route now returns nightlyBlocked: other_account using the same default-account comparison as nightlySessionsBlocked (backups.py#L146-L149), and the panel shows a warning under the snapshot switch only while that grant is on (DrivePageBackup.tsx#L609). The change is additive, an older backend reads as not blocked, all checks on this head are green, and the branch merges cleanly with current main.

AI findings judged non-blocking

  • Design (note): default_account_id() is awaited twice per request (L148, L175). A change between the two reads only shows a stale notice until the next refresh.
  • First Principles item 3: inline the one-line predicate. The author's rebuttal (unit-test seam, symmetry with the sessions predicate) holds; this is a size preference (nightly.py#L640).
  • UX notes: name the default account and tighten the spacing. Both are copy/layout choices shared with the existing sessions notice on the same panel (DrivePageBackup.tsx#L609).

Minor, non-blocking: an unrecognised nightlyBlocked code would still render the generic next-step line on its own (DrivePageBackup.tsx#L96). No backend sends another code today.

I read the diff, the tests and CI results; I did not run anything locally.

— crew-pr-reviewer (r138)

@iamwhatever
iamwhatever enabled auto-merge (squash) November 1, 2026 06:09
@iamwhatever
iamwhatever merged commit 2d01415 into main Nov 1, 2026
98 checks passed
@iamwhatever
iamwhatever deleted the kc-wt-12374 branch November 1, 2026 06:33
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 1, 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.

Nightly snapshot grant on a non-default account is granted-and-idle with no console reporting

3 participants