Skip to content

docs(fspy): document shared-memory facade ownership semantics#521

Merged
wan9chi merged 8 commits into
mainfrom
fspy-shm-lifecycle
Jul 10, 2026
Merged

docs(fspy): document shared-memory facade ownership semantics#521
wan9chi merged 8 commits into
mainfrom
fspy-shm-lifecycle

Conversation

@wan9chi

@wan9chi wan9chi commented Jul 9, 2026

Copy link
Copy Markdown
Member

Motivation

Define how shared-memory owners and opened views behave before replacing the platform backends.

Changes

  • Documents the behavior of create, open, owner drop, and opened-view lifetime.
  • Changes open to take only the identifier and derive the mapped size from the operating-system object.
  • Removes the redundant shared-memory size from ChannelConf.
  • Explains that Windows may keep a section name openable after owner drop.
  • Explains how the channel lock file prevents late sender creation on every platform.

wan9chi commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

Comment thread crates/fspy_shm/src/lib.rs Outdated
@wan9chi wan9chi force-pushed the fspy-shm-facade branch from 89d699a to 4f7087d Compare July 9, 2026 07:57
@wan9chi wan9chi force-pushed the fspy-shm-lifecycle branch from 67ee808 to 669ab52 Compare July 9, 2026 07:57
@wan9chi wan9chi changed the base branch from fspy-shm-facade to graphite-base/521 July 9, 2026 14:10
@wan9chi wan9chi force-pushed the graphite-base/521 branch from 4f7087d to cb580c2 Compare July 9, 2026 14:15
@wan9chi wan9chi force-pushed the fspy-shm-lifecycle branch from 669ab52 to 70822fb Compare July 9, 2026 14:15
@graphite-app graphite-app Bot changed the base branch from graphite-base/521 to main July 9, 2026 14:16
@wan9chi wan9chi force-pushed the fspy-shm-lifecycle branch from 70822fb to 8716c77 Compare July 9, 2026 14:16
@wan9chi wan9chi marked this pull request as draft July 10, 2026 01:16
Document the cross-platform create/open contract of the fspy_shm facade:
owner lifetime gates new opens, already-open views survive owner teardown,
and Windows may keep the name resolvable while other handles hold the
section object alive.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@wan9chi wan9chi force-pushed the fspy-shm-lifecycle branch from 8716c77 to 4e0e749 Compare July 10, 2026 06:02
@wan9chi wan9chi changed the title refactor(fspy): add shared-memory service lifecycle docs(fspy): document shared-memory facade ownership semantics Jul 10, 2026
@wan9chi wan9chi marked this pull request as ready for review July 10, 2026 07:36
Co-authored-by: GPT-5 Codex <codex@openai.com>
@wan9chi wan9chi marked this pull request as draft July 10, 2026 15:00
Co-authored-by: GPT-5 Codex <codex@openai.com>
wan9chi and others added 5 commits July 10, 2026 23:52
Co-authored-by: GPT-5 Codex <codex@openai.com>
Co-authored-by: GPT-5 Codex <codex@openai.com>
Co-authored-by: GPT-5 Codex <codex@openai.com>
Co-authored-by: GPT-5 Codex <codex@openai.com>
Co-authored-by: GPT-5 Codex <codex@openai.com>
@wan9chi wan9chi marked this pull request as ready for review July 10, 2026 23:32
@wan9chi wan9chi merged commit 53345ce into main Jul 10, 2026
16 checks passed

wan9chi commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

Merge activity

@wan9chi wan9chi deleted the fspy-shm-lifecycle branch July 10, 2026 23:36

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2b0d301fbe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

lock_file.try_lock_shared()?;

let shm = fspy_shm::open(&self.shm_id, self.shm_size)?;
let shm = fspy_shm::open(&self.shm_id)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the original channel capacity when opening senders

On Windows, opening without the original capacity lets shared_memory recompute the opened view length from the OS mapping, which is page-rounded, while the receiver's owner still reports the requested channel(capacity) length. For non-page-aligned capacities, a sender can therefore use a larger shm.len() for ShmWriter bounds checks and advance the shared header past the receiver's slice, so ReceiverLockGuard::iter_frames can panic when it slices content[..content_size] after enough writes. Keep the configured size in ChannelConf or clamp opened views to the requested capacity.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant