refactor: promote fd_real_path to pinned_fs and document dev-mode grant - #7224
refactor: promote fd_real_path to pinned_fs and document dev-mode grant#7224aniruddhaadak80 wants to merge 1 commit into
Conversation
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsFINDING -- src/kiro_crew/pinned_fs.py:353 -- function-local |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed |
Design Review (Fable 5, fork) — 🟡 CONCERNSDesign-level review of Verification complete. The helper promotion is sound ( Design-Verdict: CONCERNS Sound refactor shape, but the new contract docs promise a Watch
[DESIGN-REVIEWED] dd950e9 |
First Principles Review (Fable 5, fork) — 🟡 CONCERNSPremise-level review of All counts are verified. I have everything needed to write the review. First-Principles-Verdict: CONCERNS The docs half promises a What this change shipsIntent: finish PR #6854's deferred follow-ups — make the dev-mode docs describe the shipped grant behavior and give
Watch
Subtractions
[FIRST-PRINCIPLES-REVIEWED] dd950e9 |
Move the Windows fail-closed descriptor-path helper out of hooks.py into pinned_fs as public `fd_real_path` (its containment belongs with the pinning helpers). Re-export it from hooks for existing importers and repoint spec_builder to the new location. Document the out-of-install `ui` grant contract in docs/app-kit/api-reference.md: `.dev-grants.json`, sensitive-root refusal, and the re-toggle after repointing workflow. Part of kirodotdev#6907
dd950e9 to
a9a0632
Compare
Closing — the same two follow-ups as #7169, done less completelyVerified relationship: Both PRs are open (verified live: 7169 head d28aa15, 7224 head a9a0632, neither merged, both mergeable_state=dirty) and both implement the same two deferred items of open issue #6907 off the identical base blobs. Verified in the diffs: both add the same Carry this over firstThis closure is about redundancy, and these items are the exception: they are not on Two items from #7224, both small and both style/robustness tier: (1) src/kiro_crew/pinned_fs.py — the module-scope platform guards for the promoted helper instead of #7169's verbatim function-local imports: top-level Current stateNeither side has merged, so no supersession applies. Parent PR #6854 is merged and landed the grant machinery (.dev-grants.json, _read/_write_dev_grants, the sensitive-root refusal, dev_mode_granted_root) but nothing either PR adds; #6907 is an ISSUE and covers nothing. Main has, however, moved under both of them: the spec_builder fd_real_path guard migrated from backend/routes.py to backend/repository.py, and sandbox.py gained a SECOND lazy From a repository-wide duplicate/overlap audit of every pull request open against |
Open PR relationship auditThis is a consolidated, point-in-time code-level audit note. It compares complete merge-base diffs and current/merged code; it does not treat a shared topic as duplication or partial coverage as completion. Relationship findings
No PR, Issue, label, branch, or review state was changed by the relationship-note portion of this audit. |
Problem / Motivation
PR #6854 landed the dev-mode operator grant (
.dev-grants.json, sensitive-rootrefusal, re-toggle workflow) but deferred three follow-ups: the
docs/app-kit/api-reference.mdcontract still describedinstalled.json:devas the only source of truth and recommended a per-file symlink, and the
private helper
_fd_real_pathhad a third cross-module import.Why it matters
api-reference.mdwould still treatinstalled.json:devas sufficient for an out-of-install
ui/and would try a per-file symlinkthat now answers
404(pinnedO_NOFOLLOWopen). A sensitiveuirootwould look grantable.
_fd_real_path's Windows fail-closed containment belongs with the pinninghelpers, not in
hooks.py; three importers reaching into a private symbolis the drift the issue flags.
What changed (motivation → approach → change)
docs/app-kit/api-reference.md: replace the "symlink your sourcetree" paragraph and the four-bullet contract with a directory-symlink
recommendation and six bullets:
installed.json:dev, the new operatorgrant (
.dev-grants.jsonmappingapp -> realpath(ui)written only bythe toggle, bound to the specific resolved directory, self-invalidating on
repoint,
400 dev_grant_mismatchuntil re-toggle, prune-only reconcile),the sensitive-root refusal, plus endpoint / websocket / CLI. Clarify that
.dev-apps.jsonremains an internal cache while.dev-grants.jsonis theauthorization half for out-of-install roots (re-toggle after repointing
workflow included).
src/kiro_crew/pinned_fs.py: add publicfd_real_path(fd)(same Windows
GetFinalPathNameByHandleW/ Linux/proc/self/fd/ macOSF_GETPATHimplementation) and export it in__all__.src/kiro_crew/hooks.py: delete the private definition,re-export
from kiro_crew.pinned_fs import fd_real_path as _fd_real_pathat top (keeps
hooks._fd_real_pathimportable for existing callers/tests).src/kiro_crew/apps/builtins/spec_builder/backend/routes.py:import
_fd_real_pathfrompinned_fs(split from thesafe_read_fileimport) with the same
Nonefallback.No new behavior for in-install
ui/roots; no change to the toggle'sgateway-auth model (explicit operator confirmation for escaping grants is the
remaining item from #6907 and is left for a follow-up).
Tests
pytest test/test_app_dev_mode.py— 31 passedpytest test/test_app_ui_file_route.py— 40 passed, 4 skippedisort/flake8on the three touched Python files — PASSfd_real_pathre-export:pinned_fs.fd_real_path is hooks._fd_real_pathand
spec_builder.routes._fd_real_path is pinned_fs.fd_real_pathManual verification
api-reference.mdsection renders the grant, sensitiverefusal, and re-toggle workflow as described in docs+hardening follow-ups from #6854: app-kit dev-mode grant doc, toggle operator confirmation, promote _fd_real_path #6907.
mypyon the moved helper still has the same platform branches(Windows / Linux / macOS) and that the two repointed importers still
guard
Nonethe same way.Screenshots / video
N/A — docs + internal refactor, no UI.
Related Issues
Part of #6907 (docs +
_fd_real_pathpromotion; operator-confirmationhardening remains as a follow-up).
Checklist