Skip to content

fix: bound path GET receipt storage - #137

Closed
LIghtJUNction wants to merge 1 commit into
mainfrom
codex/fix-path-get-receipts-for-storage-limits
Closed

LIghtJUNction wants to merge 1 commit into
mainfrom
codex/fix-path-get-receipts-for-storage-limits

Conversation

@LIghtJUNction

Copy link
Copy Markdown
Member

Motivation

  • The unauthenticated /g/v1 path-GET flow created a durable path_get_receipts row for every fresh rid without any aggregate quota or reclamation, allowing unbounded SQLite growth and potential disk exhaustion. The intent is to limit durable receipt growth while preserving idempotent replay semantics.

Description

  • Add a configurable hard cap max_path_get_receipts (default 100_000) to Config and expose it in the production msg.conf as max_path_get_receipts.
  • Change Store.claim_path_get to atomically insert a new receipt only while the total receipt count is below the configured cap using an INSERT ... SELECT ... WHERE (SELECT COUNT(*) FROM path_get_receipts) < ? pattern and to return an HTTP 507-style StoreError when capacity is exhausted.
  • Preserve existing replay behavior by returning existing receipts when a previously-used request_id is replayed and by keeping the existing conflict checks for payload reuse.
  • Add an HTTP regression test test_receipt_capacity_rejects_new_mutations_but_allows_replays to verify that once the cap is reached new mutation requests are rejected with a capacity error while replays of existing rids still succeed.

Testing

  • Ran git diff --check with no issues.
  • Ran uv run ruff check src/msgd/config.py src/msgd/store.py tests/test_path_get.py which passed.
  • Ran PYTHONPATH=src uv run pytest tests/test_path_get.py and observed 8 passed.
  • Ran PYTHONPATH=src uv run python -m unittest discover -s tests -q and observed 146 tests passing (1 skipped).

Codex Task

Copilot AI lite review requested due to automatic review settings September 28, 2026 11:43

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-28T11:51:06.854267Z 118c904 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@LIghtJUNction

Copy link
Copy Markdown
Member Author

已被 #143 取代,关闭。旧补丁打在已删除的 src/msgd 上;现行 src/msg 的对应容量上限在分支 fix/capacity-recovery-20260928(head e77b53b),该分支已包含合并后的 #142。

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants