Skip to content

chore: land campaign batch (#948) - #952

Merged
steipete merged 1 commit into
mainfrom
campaign2/batch-202610111338
Oct 11, 2026
Merged

steipete merged 1 commit into
mainfrom
campaign2/batch-202610111338

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Campaign batch: lands each PR below as its own commit on main via a SHA-pinned rebase merge, so one CI run proves the combination instead of one strict-up-to-date cycle per PR. Each original PR already had green exact-head CI and a clean autoreview.

The originals are closed with a link once this lands.

@steipete
steipete requested a review from a team as a code owner October 11, 2026 13:39
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR reduces native staged-publication overhead through synchronous descriptor ownership, bounded buffer writes, and combined filesystem observations.

Example: Native Root.create("state.txt", "data", { durable: false }) without an authority callback.

  • Before: Root descriptor ownership and the four-byte staged write use asynchronous filesystem dispatch.
  • After: Descriptor ownership and the staged write use synchronous dispatch while retaining atomic publication and identity checks.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Reported runtime comparisons and focused safety coverage support useful work, but the independently verified allocation regression and changelog omission remain.
Proof confidence 🦐 gold shrimp (3/6) The ordinary contributor proof gate is waived by the supplied maintainer-authored status; the original PR reports real ext4/NTFS Root-operation comparisons, and the identical batch preserves those changes without introducing a new authorization boundary.
Patch quality 🦐 gold shrimp (3/6) 2 actionable review findings remain.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Small native file creations and replacement writes incur unnecessary descriptor, observation, and scheduling overhead.
Reason: The supplied maintainer-authored direction and original PR's Linux/Windows comparisons establish useful value while preserving public options and defaults.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep this PR open: the performance work remains distinct from main, but duplicate large-string encoding and a missing performance changelog entry need repair.

Priority: P2
Reviewed head: d0889091a4a3c7eb1d9474c84043d66e0c59ac4a

Before merge

  • Reuse encoded bytes when the small-buffer path is ineligible (P2) - For a callback-free native staged write of "x".repeat(1048576), this Buffer.from encodes and allocates 1 MiB before the size check rejects synchronous dispatch. The asynchronous branch at line 65 then encodes the same string again, whereas main encodes it once. Carry the encoded bytes into asynchronous dispatch to avoid the extra allocation and encoding work. This concern was already visible in perf(native): streamline retained staged publication #948 (comment).
  • Record the measured performance improvement under Unreleased (P3) - The native creation and replacement-write improvement is release-relevant, but CHANGELOG.md has no corresponding entry. The complete root AGENTS.md explicitly requires measured performance improvements under Unreleased. Add a concise Performance entry; wording only in perf(native): streamline retained staged publication #948 does not reach the package changelog. This concern was already reported on that identical tree.

Findings

  • [P2] Reuse encoded bytes when the small-buffer path is ineligible — src/pinned-write-input.ts:48-49
  • [P3] Record the measured performance improvement under Unreleased — CHANGELOG.md:11

Tests

  • Missing end-to-end proof: The supplied evidence does not show base-fail/head-pass execution for the added small-buffer tests.
Agent review details

How this fits together

Root and secret-file writers pass admitted paths and payloads to retained-directory staging, which publishes files and verifies identity, permissions, and cleanup ownership.

flowchart TD
A[Root or secret writer] --> B[Root and parent admission]
B --> C[Retained directory]
C --> D[Owned staged file]
D --> E[Buffered or streamed write]
E --> F[Atomic publication]
F --> G[Identity and permission checks]
Loading

Technical review

Best possible solution:

Retain the optimization, reuse encoded bytes for asynchronous writes, and record the measured improvement under Unreleased.

Do we have a high-confidence way to reproduce the issue?

Source establishes duplicate encoding for a callback-free native staged write of "x".repeat(1048576); no target code was executed during this review.

Is this the best way to solve the issue?

The optimization fits the existing staging owners and inspected safety contracts, but asynchronous fallthrough should reuse the first encoding.

Full review comments:

  • [P2] Reuse encoded bytes when the small-buffer path is ineligible — src/pinned-write-input.ts:48-49
    For a callback-free native staged write of "x".repeat(1048576), this Buffer.from encodes and allocates 1 MiB before the size check rejects synchronous dispatch. The asynchronous branch at line 65 then encodes the same string again, whereas main encodes it once. Carry the encoded bytes into asynchronous dispatch to avoid the extra allocation and encoding work. This concern was already visible in perf(native): streamline retained staged publication #948 (comment).
    Confidence: 1
    Late finding: first raised on code an earlier review cycle already covered.
  • [P3] Record the measured performance improvement under Unreleased — CHANGELOG.md:11
    The native creation and replacement-write improvement is release-relevant, but CHANGELOG.md has no corresponding entry. The complete root AGENTS.md explicitly requires measured performance improvements under Unreleased. Add a concise Performance entry; wording only in perf(native): streamline retained staged publication #948 does not reach the package changelog. This concern was already reported on that identical tree.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e26eff537588.

Provenance checked

  • Root descriptor ownership changes intended behavior with a stated reason (5fe53dd: Retain and verify Root authority for confined native operations; the original PR explains replacing asynchronous ownership with equivalent synchronous ownership to reduce overhead.)
  • Retained-directory and staged-file verification keeps the original intent (d733275: Keep cleanup attached to the admitted directory and staged contents private until publication identity checks pass.)
  • Shared write loop and mutation authority keeps the original intent (7274d7e: Check current caller authority immediately before mutation dispatch, including partial-write retries.)
  • Windows publication verification reopen changes intended behavior with a stated reason (d733275: Fence the published file before applying final permissions; the original PR explains that eligible verification needs metadata access rather than payload reads.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test test/pinned-write-input-views.test.ts test/native-write-mode-ownership.test.ts test/native-windows-publication-metadata.test.ts
  • pnpm check
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 03df65d adds src/write-file-handle.ts:16 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 03df65d76684; files: src/write-file-handle.ts)

Root-cause cluster

Relationship: canonical
Canonical: #952
Summary: This PR is the designated landing batch for the identical work in the original open PR.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P2: Useful performance work introduces extra payload-sized allocation and encoding for large staged strings.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: Useful performance work introduces extra payload-sized allocation and encoding for large staged strings.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

Reviewed October 11, 2026, 9:42 AM ET / 13:42 UTC.

@steipete
steipete merged commit 70aa9f5 into main Oct 11, 2026
59 checks passed
@steipete
steipete deleted the campaign2/batch-202610111338 branch October 11, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant