Repository navigation
refactor(deploy): share the registry write and drop a dead branch - #22950
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS No design concerns: the write helper is the two copies moved over unchanged, the removed Windows branch sits behind the function's first-statement return so it can never run, and the comment rewrites change no behaviour. [DESIGN-REVIEWED] b8c91d2 Description read[DESCRIPTION-READ] d03e7d78b323b2e067d1fa2be7b650f5effa69cfd73f3a516e76fa76811d6ff4 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS This PR only subtracts: two copies of the registry write become one, a branch that cannot run is deleted, and two comments that gave the wrong reason are corrected. Notes
What this change shipsInventory (4 items) — 3 justifiedIntent: make the deploy profile registry easier to change safely by keeping one write path and removing dead code. ADDITION (refactor; no behaviour change).
[FIRST-PRINCIPLES-REVIEWED] b8c91d2 Description read[DESCRIPTION-READ] 5c3176934eeebfb9f44e858f3722f58d025c7e2407e0ce2b6964d353638cd8b4 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
|
Real Adapter Contract Tests red on this head is main's, not this diff's.
|
|
Backend Tests (Windows) (7) red on this head is also main's.
|
|
Disposition: rebutted (no change needed): the PASS punchline raises no ask, so nothing follows from it.
|
|
Disposition: rebutted (no change needed): "Nothing blocks" and all three inventory items judged justified raise no ask, so nothing follows from it.
|
ff16be7 to
6af5fdf
Compare
|
Rebased onto |
|
Disposition: rebutted (no change in this PR): routing the registry write through
Corrected: an earlier version of this comment wrongly gave the file mode as the difference. |
|
Disposition: rebutted (no change needed): the PASS punchline raises no ask, so nothing follows from it.
|
deploy/profiles.py wrote the profile registry through two identical temp-file blocks, one in locked_registry and one in save_registry; both now call one private _write_registry_file. create_aws_profile returns for Windows before any AWS call, so its second os.name == "nt" check inside the credential_process branch could never run; it is removed. That guard's comment, and the matching one in handlers_sites._do_list, named subprocess preexec_fn as the reason, but run_limited passes preexec_fn=None off POSIX. Both comments now state the rule the guard implements: deploy features are POSIX-only.
6af5fdf to
b8c91d2
Compare
|
Rebased: main moved in |
|
Disposition: rebutted (no change needed): the PASS punchline raises no ask, so nothing follows from it.
|
|
Disposition: rebutted (no change in this PR): swapping
|
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: refactor (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: code move with no behaviour change; the duplicated fsynced registry write is extracted into one helper, and the removed Windows branch in create_aws_profile was unreachable because the function already returns on Windows at its top.
|
|
Problem / Motivation
Goal: Make
src/kiro_crew/deploy/profiles.pywrite its profile registry through one code path and drop a Windows check that can never run, with no change in what deploy profiles store, accept, refuse or return.The sweep's detector finds no actionable shadowed import or chained ternary in
deploy/: the one chained ternary it reported sits inprofiles.py, which this pass found to be a keystone file, so it stays as written. This pass takes #16523's judgment classes for the module instead: duplicated code, dead code, and comments the code contradicts.Why it matters
Nothing is broken today, but the module is harder to change safely than it needs to be. The registry write (temp file in the same directory, fsync,
replace_with_retry, temp cleanup on any failure) was spelled out twice, inlocked_registryand insave_registry, so a fix to one could miss the other.create_aws_profilecarried a second Windows refusal, with its owncredential_processmessage, that can never run because the function already refuses Windows on its first statement. And two comments gavesubprocess preexec_fn (unsupported on nt)as the reason deploy refuses Windows, which is no longer true:engine.run_awsspawns throughrun_limited, which passespreexec_fn=Noneoff POSIX. A reader who checked that reason would conclude the guard could go.Not a goal
aws configure setkeys are writable, which profile names, regions, accounts or roles are accepted, or any error message that can still be produced._parse_registrydefault ternary:profiles.pyimplements keystone controls (the_WRITABLE_KEYSallowlist, the account and role matchers spliced intocredential_process, the empty-name refusal, the dropped-default clear), so its guard expressions keep their shape._do_recalland_do_destroyinhandlers_sites.py, which have none today; adding one is a behaviour change.What changed (motivation → approach → change)
The module behaves exactly as before: one write path instead of two copies, one Windows refusal instead of a live one plus a dead one, and guard comments that state the rule.
locked_registry,save_registry_write_registry_file(reg), which holds that block once; both still call it under the exclusive registry lock, andlocked_registrystill only on a clean exitcreate_aws_profileos.name == "nt"refusal inside thecredential_processbranchcreate_aws_profileandhandlers_sites._do_listBackwards compatibility
Compatible: no signature, return value, reachable error message, lock or file format changes;
_write_registry_fileis module-private.Reader: src/kiro_crew/deploy/handlers.py:_handle_profiles_post -- app -- the removed refusal sat after
create_aws_profile's own first-statement Windows return, so no caller reached it (test_deploy_profiles_cov80.py::TestCreateAwsProfile::test_windows_is_refused_before_any_aws_call)Tests
os.unlink) reds 2 existing write-failure tests intest_deploy_profiles_cov80.py, so the moved code is still covered.kiro_crew.deploy(test/test_cloud_ssm.pyamong them): 3602 passed, 3 skipped, 0 failed. The scoped runner's 144-file set, withmarkdown-it-pyoverlaid on the venv: every failure also fails, node for node, on a pristineorigin/mainworktree with the same interpreter (21 = 21, none only here): theauto_improvementsandbox-spawn suites andTestDoctor, which need a venv outside the data home andpip.scripts/docs_lint.py --test,scripts/docs-lint.sh), the per-file coverage self-test and the vendor manifest.profiles.pymeets the sweep detector's own "implements a control" keystone criterion and that its keystone list predated thedeploy/handlers_*.pysplit; two independent adjudicators confirmed both, so the_parse_registryternary keeps its shape and the comment-onlyhandlers_sites.pyhunk stays.scripts/scrub-lint.shis absent from the checkout (CI'sinternal-content-scancovers it), semgrep is not installed on this host (CI's SAST job runssemgrep/), and the frontend did not run, as nothing underwebsite/,.github/orscripts/changed.Manual verification
N/A — unit coverage sufficient: a verbatim extraction, an unreachable branch and two comments, each checked against the code.
Screenshots / video
Why no screenshot: backend-only refactor; nothing renders differently.
Related Issues
Part of #16523
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.