Skip to content

feat(advanced): retain entries for one-way no-replace publication - #776

Merged
fuller-stack-dev merged 2 commits into
mainfrom
feat/retained-no-replace-publication
Sep 30, 2026
Merged

fuller-stack-dev merged 2 commits into
mainfrom
feat/retained-no-replace-publication

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Add retainEntryForPublication to @openclaw/fs-safe/advanced for one-way directory and single-link regular-file export. This supplies the no-replace publication primitive needed by managed clone/update staging without exposing destructive reverse or cleanup operations.

  • Retain caller-observed source and parent identities, require canonical physical spelling and synchronous mutation authority, and reject observed substitution.
  • Use the existing native no-replace rename owner, with a narrow local-filesystem admission/transition adapter. Refuse unsupported platforms/filesystems and cross-device moves; no pathname rename/copy fallback.
  • Record committed, not-published, or indeterminate before postchecks/close. Preserve primary and close failures; consume descriptors once. dispose() closes only.
  • Document the deliberate contract: atomic destination absence, source identity observed under a caller-exclusive namespace, retained-object parent binding. Not source CAS, current-path confinement, crash durability, or automatic rollback. Windows is explicitly unsupported here.

Verification

  • Source-built Darwin arm64 addon and compiled public entry point: 28 passing cases; Linux-only actual cross-device case unrun locally.
  • Exact-head hosted native-enabled coverage: Linux C1 29/29 and full suite 16,819 passed; macOS C1 28 passed/1 Linux-only skip and full suite 16,783 passed.
  • Native workspace: 178 tests passed. Native clippy passed on the corrected candidate.
  • npm-installed candidate root/native tarballs: real directory/file commit, collision preservation, and preservation of newer published bytes.
  • Public declaration surface regenerated using the repository command; build and package-contract checks passed.
  • Independent API-direct Astra high/fast review: initial P2 identified Darwin's case-only RENAME_EXCL exception. Real directory/file regressions failed before repair and passed after native destination admission was added. Corrected full candidate is P0–P2 scoped-clean (static review, not independent runtime acceptance).
  • Initial broad local pnpm check found owned documentation omissions (fixed; affected 21 documentation tests now pass) and eight native watch-event failures in unchanged code. The same event-delivery failures reproduced with a same-toolchain native rebuild of pinned main (C1 module registration removed), while published 0.21.3 binary controls passed. This isolates the problem to the local native-build/host lane, not the C1 source delta. No watch assertions, timeouts, retries, or source were changed. The complete required pnpm check now passes in the genuine JS-only CI layout, including package-contract checks. Exact-head CI is required before landing.

Benchmark inventory integration

CI exposed the missing export registration. Added actual public-API admission and one-way lifecycle measurements on owned filesystem fixtures, including native-off refusal and close-only preservation. Native admission (2 cases), native lifecycle (6 cases), and the complete CI-style off-mode smoke (995 measured cases) pass. The full new helper and runner were audited, and the final delta received API-direct P0–P2 scoped-clean review with the complete runner/API context supplied. No inventory exemption or fake consumer was added.

Test audit

Audited the full new test file: private real filesystem fixtures; native calls exercised for collision and substitution; failure seams wrap real publication/close; synchronous resource settlement; no sleeps, detached children, or source-text safety tests. No existing test was pruned or weakened. The declaration manifest is generated, not handwritten. Reviewed the full touched navigation helper and the unchanged tests in the native module-registration file; no dead or duplicate code required removal.

This PR does not adopt the API into OpenClaw or claim a published npm version. Package release and caller integration are separate delivery gates. The current contributor cannot create protected release tags; publication will require an authorized release maintainer.

@fuller-stack-dev
fuller-stack-dev requested a review from a team as a code owner September 30, 2026 13:13
@clawsweeper

clawsweeper Bot commented Sep 30, 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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 30, 2026
@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 30, 2026, 9:36 AM ET / 13:36 UTC (Revision 2).

ClawSweeper review

What this changes

Adds a native backed advanced API for one-way, no-replace publication of retained directories and regular files, with result receipts, documentation, tests, and benchmarks.

Merge readiness

✅ Ready for maintainer review

Current main and v0.21.3 do not provide this retained directory and file publication lifecycle. The branch remains useful, and this review found no concrete introduced defect or unresolved merge blocker.

Priority: P2
Reviewed head: 32623e42c4887000c9e19c274ea77ece8dc9c0a5

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The public contract is clear, native behavior has focused coverage, and no blocking defect was identified.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The MEMBER-authored PR is exempt from the contributor proof gate. Its body reports source-built Darwin and installed candidate-package directory and file publication, collision preservation, and preservation of newer destination bytes; the public-entrypoint tests exercise the same production owner. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from the contributor proof gate. Its body reports source-built Darwin and installed candidate-package directory and file publication, collision preservation, and preservation of newer destination bytes; the public-entrypoint tests exercise the same production owner. No stored-data contract changes.
Evidence reviewed 8 items Current main lacks the lifecycle: The advanced export surface on pinned main includes staged and retained-file operations but no retained directory or regular-file publication API.
Release boundary: The latest release, v0.21.3, points at pinned main; no release tag contains the PR head.
Introduced public operation: The new operation admits caller observations, retains three descriptors, requires native support, and records the transition before postchecks and descriptor settlement.
Findings None None.
Security None None.

How this fits together

The advanced filesystem API receives caller-observed entry and parent identities plus a synchronous authority check. It retains descriptors, requests a native no-replace rename, and returns a result that the caller must handle.

flowchart LR
A[Caller observations] --> B[Advanced publication API]
B --> C[Identity and authority checks]
C --> D[Native filesystem admission]
D --> E[No-replace rename]
E --> F[Transition result]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test growth production +406, tests +285 The new public capability accounts for the production growth and has focused behavioral coverage.

Technical review

Best possible solution:

Keep the operation scoped to caller-owned staging, with native no-replace publication, explicit indeterminate results, and no implicit cleanup.

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

Not applicable: this PR adds a capability rather than reporting broken existing behavior. Its tests identify concrete publication and collision scenarios.

Is this the best way to solve the issue?

Yes. Reusing retained parent descriptors and the existing native no-replace rename provides the requested one-way lifecycle without adding a pathname fallback.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against fe6e61d2df3e.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded advanced filesystem capability with limited immediate user impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from the contributor proof gate. Its body reports source-built Darwin and installed candidate-package directory and file publication, collision preservation, and preservation of newer destination bytes; the public-entrypoint tests exercise the same production owner. No stored-data contract changes.

Evidence

What I checked:

  • Current main lacks the lifecycle: The advanced export surface on pinned main includes staged and retained-file operations but no retained directory or regular-file publication API. (src/advanced.ts:187, fe6e61d2df3e)
  • Release boundary: The latest release, v0.21.3, points at pinned main; no release tag contains the PR head. (package.json:3, fe6e61d2df3e)
  • Introduced public operation: The new operation admits caller observations, retains three descriptors, requires native support, and records the transition before postchecks and descriptor settlement. (src/entry-publication.ts:179, 32623e42c488)
  • Native mutation boundary: Native admission checks the retained source, both parent filesystems, device equality, and destination absence before dispatching the existing no-replace rename. (native/src/entry_publication.rs:54, 32623e42c488)
  • Documented safety scope: The contract requires a caller-exclusive source namespace and explicitly disclaims source compare-and-swap, current-path confinement, crash durability, and automatic rollback. (docs/entry-publication.md:13, 32623e42c488)
  • Behavior coverage and reported real use: The public-entrypoint suite covers real native directory and file publication, collisions, substitution, uncertain results, and close failures. The PR body also reports source-built Darwin runs and installed candidate-package runs; this review did not execute them. (test/entry-publication.test.ts:63, 32623e42c488)

Likely related people:

  • Jason (Json): Raw commit 67867d2 adds src/retained-file.ts:21 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 67867d215939; files: src/retained-file.ts)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-30T13:29:00.211Z sha 32623e4 :: needs maintainer review before merge. :: none

@fuller-stack-dev
fuller-stack-dev merged commit fc7bd11 into main Sep 30, 2026
47 of 48 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the feat/retained-no-replace-publication branch September 30, 2026 13:38
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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant