Repository navigation
refactor(toplevel): bind _WIN_FILE_SHARE_READ once in platform_compat - #19860
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] b18b564 Description read[DESCRIPTION-READ] aa6878606eb2fbcbf32c0830a0b297e8731f554ba37cd5bc902b068359eefe42 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 |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing to check. What this change shipsInventory (2 items) — 2 justifiedIntent: keep one binding of a Windows share-mode constant so that editing the documented assignment actually takes effect. This is a FIX (refactor, no behaviour change).
[FIRST-PRINCIPLES-REVIEWED] b18b564 Description read[DESCRIPTION-READ] 81600a71d456287dbf3a1da6d2621d18eed4e6c9e8a42f64354529ae5dbba72d That sha256 names the PR description this verdict read. Recompute it with |
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: |
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: |
platform_compat.py assigned _WIN_FILE_SHARE_READ = 0x00000001 at module scope twice. The first assignment sits among pin_directory's CreateFileW arguments, under its own comment on what the read-only share mode buys a deny_write open. The second sat in the block headed "CreateFileW arguments only win_open_no_reparse uses", re-binding the same value under a heading that was not true of it: _win_open_without_following reads it too. Drop the second assignment and point that block's comment at the definition above. Both readers are function bodies that resolve the name at call time, so each still sees 0x00000001.
f6ede9c to
b18b564
Compare
|
Rebased: main moved in The overlap is import-only: |
|
Green age on Not re-pushing for it: the top-level package gains commits faster than a CI round finishes, so a re-sync on every |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: refactor (1 file). 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: removes a duplicate _WIN_FILE_SHARE_READ definition in platform_compat.py; the earlier definition in the same module has the same value (0x00000001), so behaviour does not change.
Problem / Motivation
Goal: Make
platform_compat.pybind the read-only Windows share-mode constant once, at its documented first assignment, and take it out from under a heading that says onlywin_open_no_reparseuses it, with no change to any Windows open.src/kiro_crew/platform_compat.pyassigns_WIN_FILE_SHARE_READ = 0x00000001at module scope twice. The first assignment sits amongpin_directory'sCreateFileWarguments, under its own comment on what the read-only share mode buys adeny_writeopen. The second sits in a block headed "CreateFileWarguments onlywin_open_no_reparseuses", which is not true of it:_win_open_without_followingreads it too.Why it matters
Nothing is broken today: both assignments carry the same value. But the later one is the binding that wins at import, so an edit to the first, documented assignment would be silently overridden, and the heading over the second tells a reader the constant has one caller when it has two.
Not a goal
CreateFileWaccess mask, share mode, disposition or flag.deny_writerationale and stays as it is.pin_directory'sCreateFileWarguments, which already covers constantspin_directoryitself never passes (_WIN_GENERIC_WRITE,_WIN_FILE_SHARE_READ)._WIN_FILE_SHARE_READ_WRITE_DELETE.What changed (motivation → approach → change)
No Windows open gets a different argument.
_WIN_FILE_SHARE_READ = 0x00000001assigned twice inplatform_compat.pywin_open_no_reparseblock's comment says "read-only sharing" under an "onlywin_open_no_reparseuses" heading that also covered_WIN_FILE_SHARE_READ_WIN_FILE_LIST_DIRECTORYand_WIN_OPEN_ALWAYS, which onlywin_open_no_reparsereads, and its comment points at the definition above for the share modeBoth readers,
_win_open_without_followingandwin_open_no_reparse, are function bodies that look the name up at call time, so each still gets0x00000001.Backwards compatibility
Compatible: the module still binds
_WIN_FILE_SHARE_READto the same value before any function that reads it can run.Removes nothing: the name stays bound, only its duplicate assignment goes; no test, doc or script names the constant.
Tests
No new tests: no value, branch or call changes.
check_black_formatting.py,check_subprocess_encoding.py,check_sync_io_in_async.py,check_agent_sdk_boundary.py(these four scopeorigin/main...HEADand each saw the one changed file),check_comment_history.py,check_brand_name.pyandcheck_harness_parity.py(base ref set to the merge-base),docs_lint.py --test,docs-lint.sh,check_per_file_coverage.py --testandverify_vendor_manifest.py.test/andsrc/kiro_crew/apps/builtins) that names a reader of the constant or a function that reaches one (_win_open_without_following,win_open_no_reparse,open_file_no_reparse,open_create_no_reparse,pin_directory), plus everytest_platform_compat*.py: 4846 passed, 0 failed. This host's parity venv lacksmarkdown-it-py, so that run added it onPYTHONPATH. Both readers are Windows-only, so these runs show the module imports and the code around the change is untouched, not the Windows opens themselves; the review below covers those.scripts/scrub-lint.shis not in the checkout; that scan is CI'sinternal-content-scanjob. semgrep is not installed here, so CI's SAST job is the only run ofsemgrep/. The diff touches nothing underwebsite/,.github/orscripts/, so CI reportsonly_backend=true.code-review.ymlgreps, behaviour preservation, binding semantics, the security keystone and boot path, comment and claim accuracy, and local mirrors of the GPT and Opus CI lane contracts. The GPT mirror ran on a Claude model, because no GPT model is available locally. None found a defect in the changed code. The behaviour reviewer deleted the one assignment from the base AST and got the head AST exactly, and found every nested code object byte-identical. The security reviewer captured theCreateFileWarguments of both readers on all four branches (deny_writeon and off, file and directory) under a stubbedkernel32: identical before and after, withFILE_SHARE_DELETEabsent from every share mode. Independent refuters then checked every remaining point. Taken: four wording fixes to this description (the Goal, the test-file count and set, which gates ran on the commit, and what an import can show). Dropped: a proposal to fenceplatform_compat.pyas a keystone security file (its no-follow helpers carry no policy; the callers make the decision, and no detector site there would be excluded), and a claim that the edited block's heading also covers_WIN_FILE_ATTRIBUTE_TAG_INFO(that constant carries its own#:comment).Manual verification
N/A — unit coverage sufficient: the change deletes an assignment that re-bound a module constant to the value it already had. An AST parse of the changed module finds one module-scope assignment to
_WIN_FILE_SHARE_READwhere the base has two, and importing it still binds the name to0x1.Screenshots / video
Why no screenshot: backend-only removal of a duplicate constant assignment; nothing renders differently.
Related Issues
Part of #16523
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)