Repository navigation
fix: update a source checkout by git when no project dir is set - #35607
Conversation
0063e62 to
2fe8abd
Compare
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Narrow fallback to the existing checkout resolver; Notes
[DESIGN-REVIEWED] d77c5ff Description read[DESCRIPTION-READ] e48e0566823f28070806b3183450236b48aee1776b0d052a4bb8f4a5503c0fd4 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 Nothing blocks. The fix reuses the existing checkout resolver, and the six sibling readers it leaves alone are declared and deferred to #35472. Notes
What this change shipsInventory (5 items) — 4 justifiedIntent: a person on a source install runs
[FIRST-PRINCIPLES-REVIEWED] d77c5ff Description read[DESCRIPTION-READ] 6930d18b5a17739bfd53a9b68679ecca21464b4f9f19ddc53cbe24380715b93f 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: |
|
[operator: bolichen97] The red Backend Tests shards (3.12, 5), (3.12, 6), (Windows) (2), (Windows) (4) and the Coverage Gate on 2fe8abd are
Tracked in #35660; fixes in flight: #35625 and #35614. This PR waits for them, then re-syncs onto the |
buluoray
left a comment
There was a problem hiding this comment.
Approve on 2fe8abd. With no project directory set, kirocrew update on a source checkout now updates the checkout that the running code loads from, instead of checking the release feed and wrongly saying it is current. The fallback path is the same one that running_from_checkout already compares against, so the capability check still decides who owns the update: desktop and container installs still defer, and a wheel install has no such checkout and keeps the feed path. Every existing guard on the git path still runs before the hard reset. These guards refuse a diverged checkout, ask before discarding tracked edits, refuse when untracked files would be overwritten, and check the source pin and the repo's exec config. The new test fails when the fallback is removed. The only red backend shards fail on two tests that already fail on main. Decisive lines: src/kiro_crew/cli_server_update.py:256, src/kiro_crew/platform/update_capability.py:451, src/kiro_crew/platform/update_capability.py:295, src/kiro_crew/cli_server.py:837, test/test_update_wheel_dispatch.py:658
Run outside its clone with no saved project dir, a source install has no KIROCREW_PROJECT_DIR, so `kirocrew update` treated it as a release install, compared its version with the stable feed and reported "Already on the latest version" while the clone was far behind origin. The update now falls back to the checkout the running package loads from; derive_capability still decides who owns the update. Closes #34953
2fe8abd to
d77c5ff
Compare
|
Rebased: main moved in test/test_update_boot_apply.py and src/kiro_crew/dashboard/handlers/updates.py, which carry the fix (#35625) for the red Backend Tests and Coverage Gate on the previous head, and in test/test_cloud_launch_customize.py, which carries the fix (#35746) for a red main gained after this head ran (bb7048c -> 2f7e9f2); CI re-running. [operator: bolichen97] |
Problem / Motivation
Goal:
kirocrew updateon a source checkout updates that checkout from git, even when it is run outside the clone and no project directory was saved.Run from another directory on a source checkout,
kirocrew updateprintedInstall type: source (channel: stable), compared0.13.0with the stable feed's0.12.1and saidAlready on the latest version!, whilegit statusin the clone showed## main...origin/main [behind 2847].Why it matters
A person running a source install is told they are up to date while their clone is thousands of commits behind, so they never get fixes and have no reason to look. It hits every source install whose shell has no
KIROCREW_PROJECT_DIRand whose data home has no savedproject_dirfile (an install not made byinstall.sh, or one run under a differentKIROCREW_HOME), wheneverkirocrew updateis run outside the clone.Not a goal
kirocrew doctor'sgit:row. The check and the apply have to change together, so they are tracked in On a source install, the gateway's update check and Update read only KIROCREW_PROJECT_DIR to find the checkout #35472.KIROCREW_PROJECT_DIRis detected for any other command.derive_capabilityalready decides.What changed (motivation → approach → change)
A source checkout updated from outside its clone was checked against the stable release feed and reported as current.
_updatepicks its path withderive_capability(install_root=KIROCREW_PROJECT_DIR). That variable comes from the shell, the savedproject_dirfile, or a walk up from the current directory. With none of them it is empty, so the checkout was never probed and the update fell to the release-feed path.When the variable is unset,
kirocrew updatenow uses the checkout the running package loads from (_bootstrap._source_checkout_root(), the rootrunning_from_checkoutalready compares against).derive_capabilitystill makes the call: a desktop or container stamp still defers, and a wheel install has no such checkout, so it keeps the feed path. Thecli_server.pyfacade gains the matchingTYPE_CHECKINGbinding, and the CLI spec's Update Command section names the fallback.Backwards compatibility
Compatible: a set
KIROCREW_PROJECT_DIRis used exactly as before; only an unset one on a source checkout now reaches the git path, and a wheel, desktop or container install takes the path it took before.Removes nothing: the change only adds a fallback for an empty variable.
Tests
test_update_wheel_dispatch.py::TestUpdateDispatch::test_a_source_checkout_with_no_project_dir_takes_the_git_path: withKIROCREW_PROJECT_DIRunset and the package's checkout a git tree,_updatefetches in that checkout and never calls_update_wheel.test_cli_server_more_coverage.py::TestUpdateWheelDispatch: both tests now state their precondition (no source checkout), because the suite itself runs from one.Proof: PROVEN test/test_update_wheel_dispatch.py::TestUpdateDispatch::test_a_source_checkout_with_no_project_dir_takes_the_git_path (head d77c5ff)
Manual verification
Ran this branch's
kirocrew updatefrom a directory outside the clone, withKIROCREW_PROJECT_DIRunset and an empty isolatedKIROCREW_HOME: it printed the checkout's path and startedgit fetch(which then failed on purpose, because the branch has no upstream yet), where the base printedInstall type: source (channel: stable)and checked the feed.Related Issues
Closes #34953
Sibling sweep
Swept: git grep -nE 'environ.get("KIROCREW_PROJECT_DIR"|derive_capability)|derive_capability()' -- src/kiro_crew/cli_server_update.py src/kiro_crew/cli_doctor.py src/kiro_crew/dashboard/handlers src/kiro_crew/platform src/kiro_crew/doctor_checks
Sibling: src/kiro_crew/cli_server_update.py:256 -- changed here
Sibling: src/kiro_crew/dashboard/handlers/updates_check.py:468 -- tracked in #35472
Sibling: src/kiro_crew/dashboard/handlers/updates_apply.py:393 -- tracked in #35472
Sibling: src/kiro_crew/dashboard/handlers/updates_step_up.py:230 -- tracked in #35472
Sibling: src/kiro_crew/platform/update_layout.py:271 -- tracked in #35472
Sibling: src/kiro_crew/platform/update_capability.py:415 -- tracked in #35472
Sibling: src/kiro_crew/cli_doctor.py:731 -- tracked in #35472
Sibling: src/kiro_crew/doctor_checks/install.py:622 -- not affected -- the Project row only displays a directory; it chooses no update path
Sibling: src/kiro_crew/dashboard/handlers/updates_channel.py:200 -- not affected -- it only looks for CHANGELOG.md and falls back to the bundled copy
Sibling: src/kiro_crew/dashboard/handlers/core_stt_settings.py:593 -- not affected -- it only looks for the ffmpeg build script
Pattern harvest
Not generalizable: one dispatch read an optional environment variable as the only way to find its own checkout, and the checkout already has a single resolver it now falls back to.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)