Repository navigation
Make OS lease guards prove process-bound release across inherited descriptors #718
Copy link
Copy link
Open
Labels
backlogBacklog (not current milestone)Backlog (not current milestone)cool-ideasCool Idea™ — captured inspiration, not yet scheduledCool Idea™ — captured inspiration, not yet scheduledcoreEcho Core TechnologiesEcho Core Technologieslane:cool-ideasMethod lane cool-ideas.Method lane cool-ideas.legend:testMethod legend test.Method legend test.needs-designMethod closeout state needs-design.Method closeout state needs-design.priority:lowMethod priority low.Method priority low.runtimeRuntime coreRuntime corespecSpec/Design documentSpec/Design documenttype:enhancementMethod work type enhancement.Method work type enhancement.
Description
Idea
Treat an operating-system file lease as an explicit process-bound authority guard rather than an owned File whose close is assumed to release authority.
Rust's Unix file-lock contract maps File::try_lock to flock and retains the lock until every duplicated or inherited descriptor is closed, unless File::unlock is called. O_CLOEXEC still leaves a fork-to-exec inheritance window. The writer-epoch lease exposed this distinction when a musl test attempted immediate takeover while another test spawned a child process.
A reusable internal lease guard could make the contract executable:
- acquisition owns the exact OS lock capability;
- an explicit fallible release path unlocks before close when the caller needs a typed outcome;
Dropperforms a best-effort unlock fallback;- duplicated/inherited-descriptor tests prove release does not depend on the last descriptor closing;
- platform-specific posture is explicit rather than inferred from an empty error set.
Acceptance
- Specify whether lease authority is bound to a process, an open-file description, or another named owner.
- Add a deterministic duplicated-descriptor conformance witness.
- Add a bounded fork-to-exec witness on supported Unix targets without timing sleeps.
- Distinguish explicit release success, fallback-on-drop, and release obstruction where that distinction is authoritative.
- Keep the guard internal until a second real lease consumer establishes a reusable public shape.
- The abstraction must not weaken live-writer exclusion or permit a forked child to continue writing without fresh admission.
This is a design follow-up, not a blocker for the narrow PR #716 CI repair.
Reacted by coderabbitai
Metadata
Metadata
Assignees
Labels
backlogBacklog (not current milestone)Backlog (not current milestone)cool-ideasCool Idea™ — captured inspiration, not yet scheduledCool Idea™ — captured inspiration, not yet scheduledcoreEcho Core TechnologiesEcho Core Technologieslane:cool-ideasMethod lane cool-ideas.Method lane cool-ideas.legend:testMethod legend test.Method legend test.needs-designMethod closeout state needs-design.Method closeout state needs-design.priority:lowMethod priority low.Method priority low.runtimeRuntime coreRuntime corespecSpec/Design documentSpec/Design documenttype:enhancementMethod work type enhancement.Method work type enhancement.
Activity
coderabbitai commentedon Aug 4, 2026
🔗 Related PRs
#715 - Persist filesystem WAL writer epochs [merged]
📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!