Repository navigation
fix: open members through the held descriptor at the by-name sites - #40258
Conversation
Red on main: the notes writer resolves the members link by name (1 failed, 3 passed in test/test_members_root_by_name_sites.py).
write_member_notes now writes through the held members descriptor; the legacy activity cleanup, briefing read and member_dir helper are declared by-name sites.
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. This is a backend-only change to member-notes file handling; it changes no [UX-REVIEWED] 71a71d1 Description read[DESCRIPTION-READ] 19abbbcbf5202b124dd24a1bd6ed2ccd5a6ba32e330c3bd75cfa1eb958370105 That sha256 names everything this verdict read: the PR description, plus the 3 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 |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the one site that writes now goes through the folder that was opened and held, and the other three are read-only, which the tests check. Notes
[DESIGN-REVIEWED] 71a71d1 Description read[DESCRIPTION-READ] db5bbc7afdef2023ee81ea2a9009c97645ad4476497b476f1dc828b0f08c9541 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 The notes writer now writes through the folder it opened and checked. Nothing blocks. The fix leaves writers that still go through Notes
What this change shipsInventory (6 items) — 4 justifiedIntent: notes for a crewmate land in the folder that was checked, even if the
[FIRST-PRINCIPLES-REVIEWED] 71a71d1 Description read[DESCRIPTION-READ] 52a3c3b158bc39b4b6aa952f766cc628bd7c0bf57819ba8b4ec509321bcae5e1 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: |
Comment-only: the module docstring names the four sites in the present tense.
Code change approver recommendation: A person should decideWhy: the decider estimates a 10% chance that this change introduces a defect, within the 12% limit for approving on its own, but it is held at tier pending: being reviewed. write_member_notes now writes through the folder that open_member_folder opened and holds, instead of resolving Tier: pending: being reviewed. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Reviewed on head 71a71d1. The only runtime change is in write_member_notes. It now writes the briefing by descriptor inside open_member_folder(slug) and no longer resolves members by name. Every failure before the folder opens maps to the same notes_unwritable error as before. The 0o700 folders, the owner-only fsync'd atomic write and the refusal of a non-plain briefing file are unchanged. The one caller still runs the save off the event loop and catches only NotesError. The new spy test fails on main and passes at the head. All existing test_member_notes.py cases pass at the head. The other three files change only comments.
Security: this narrows a write path and does not widen one. Some members link setups that main followed are now refused. No sandbox, governance or auth code changes.
Done well: the fix deletes the hand-rolled resolve, makedirs and pin sequence and its manual os.close bookkeeping, and reuses the existing open_member_folder instead of adding a third pinning routine.
Optional:
- The new
member_dirdocstring and the test module docstring say every writer undermembersusesopen_member_folder. That is not true yet:mate_upgrade_notice.py,dashboard/mate_welcome.py:250andeventlog/service.py:541(_retire_legacy_activity) still write by name. Saying that they are follow-ups would be accurate. The eventlog site is also missing from the follow-up list in the body. - No test checks the result of the declared behaviour change. A test that makes
membersa symlink to the data home and expectsNotesError("notes_unwritable")with nothing created behind the link would catch a revert that does the path lookup withos.path.realpath. The current spy only catchesPath.resolve. - A dangling
memberslink is now refused too. One line under Backwards compatibility would record it.
R17 landing round 2, L4 of 2, from feature/member-folder-hardening (#40203)
Problem / Motivation
Goal: A crewmate's notes are written into the member folder that was opened and checked, not into whatever the name
memberspoints at a moment later.The member folder is opened once and held (
open_member_folder), so a link atmembersis read once and nothing looks the name up again. Four places outside it still namedmembersas a string (members_root().resolve()ormembers_root() / slug). The notes writer was the one that also wrote behind that name: it resolved the link, then made and pinned folders by name.Why it matters
A
memberslink that is re-pointed between the lookup and the write sends a member's notes into a folder that was never checked. The other three places write nothing behind the name, so they are marked as such where they sit, with tests that show it.Not a goal
open_member_folderaccepts or refuses.member_dirpath helper (see Sibling sweep).memberslink that leads into a folder inside the data home (a separate follow-up).What changed (motivation -> approach -> change)
Symptom:
write_member_notescalledmembers_root().resolve(), thenmakedirs,mkdirand a pinned open of the resolved path. Cause: the name was resolved to a path and every later step used that path. Change: it opens the member folder throughopen_member_folder(slug)and writes the briefing by descriptor in that held folder. The refusal of a non-plain file at the briefing name and the owner-only atomic write with fsync are kept.This is the same content as squash commit 6b4fbd5 (#40203) for its 5 files, as two commits: the test first (red on main), then the source.
Decision per site:
member_notes.write_member_notesopen_member_folder(code change)eventlog/service.py_remove_legacy_activitymembersfirst and refuses a link there; marked, testedmembers_parts/member_space.pymember_dirmembers_parts/prompt_layers.py_briefing_pinned_target1 routed site, 3 declared sites.
Backwards compatibility
Compatible: a normal
membersfolder, and amemberslink to a folder outside the data home, still take notes as before. A link to the data home or a folder above it is now refused withnotes_unwritable, asopen_member_folderalready refuses it for the other member files.Reader: src/kiro_crew/dashboard/handlers/member_goals.py:805
write_member_notes-- dashboard notes save -- unchanged signature and error codes; covered by test/test_member_notes.py and test/test_member_message_notes.py.Tests
New test/test_members_root_by_name_sites.py: the notes writer never resolves the
memberslink by name and writes into the folder it opened; the legacy activity cleanup removes nothing behind a linkedmembers;member_dirand the briefing read leave the tree unchanged under a linkedmembers.Red on main (test commit 50cb8f7 on origin/main c356f78, only this file): 1 failed, 3 passed.
Green at the head (d829dbb): test_members_root_by_name_sites.py, test_member_notes.py, test_member_message_notes.py: 43 passed. black --check on the 5 files: unchanged.
Proof: PROVEN test_the_notes_writer_does_not_resolve_the_members_link_by_name (head d829dbb)
Manual verification
N/A -- unit coverage sufficient: every changed path is a file operation the tests drive.
Real-machine verification
N/A -- no installer, service or platform behaviour changes; the change is file operations under a temporary data home.
Sibling sweep
Swept: git grep -n "members_root()" -- src/
Sibling: src/kiro_crew/member_notes.py -- changed here
Sibling: src/kiro_crew/eventlog/service.py -- not affected -- it pins members first and refuses a link
Sibling: src/kiro_crew/members_parts/member_space.py -- not affected -- member_dir only builds a path
Sibling: src/kiro_crew/members_parts/prompt_layers.py -- not affected -- the briefing path feeds a read
Follow-up, not changed here: mate_upgrade_notice.py (
_claim) and dashboard/mate_welcome.py:250 still write under the pathmember_dirreturns, so they still reachmembersby name.Pattern harvest
Not generalizable: the defect is a name used after it was checked at one write site; a lint cannot tell a writer from a reader of the same helper.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commits