Skip to content

feat(mcpx): enforce cacheScope at the disk boundary - #1705

Merged
dezren39 merged 1 commit into
mainfrom
queue/1852-1603-cachescope
Oct 28, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/1852-1603-cachescope

Conversation

@dezren39

@dezren39 dezren39 commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Implements #1603 — Phase 2 of #1601, per the triage pins on #1603 (gate: Phase 1 #1602 / PR #1608 merged).

Changes

  • Cache file shape (internal/daemon/registry.go): cachedEntry gains Deadline (absolute time.Time, json:"deadline,omitempty") and Scope (cacheScope wire value, json:"scope,omitempty"; empty = public). cacheVersion bumps 5 → 6 so older files are ignored.
  • SaveCache never persists a private catalogue; public entries are written carrying their absolute deadline and scope.
  • loadCache never seeds a private entry — even from a foreign or hand-written file — and seeds deadlines through the extended SetSchemas plumbing, so a past-deadline seed starts expired and the first Schemas() re-reads. CachedAll now returns deadline + scope too.
  • Stale-on-error (internal/pool/pool.go, new refreshFailed): a failed re-read of an expired cache generation serves the stale catalogue, records the error in schemaErr (surfaced via Status), returns nil, and leaves schemaAt/deadline untouched so the next call retries. A failed first fetch is unchanged (error returned, timestamp unset).
  • Conformance: gap caching-private-no-cross-auth retired as covered, naming the new tests; matrix regenerated (MCPX_UPDATE_MATRIX=1).

Tests

New: pool — seeded-past-deadline refetch, seeded private scope stored, stale served on refetch error (incl. timestamp untouched + retry), first-fetch failure still errors. Daemon — SaveCache skips private pools (public entry carries deadline + scope, version 6), loadCache refuses a private entry and seeds a public past deadline.
Laptop: go test ./internal/pool/ ./internal/daemon/ ./internal/conformance/ all pass. A full go test ./... run hit one e2e timeout (TestAPoolSettingChangeDoesNotCutACallInFlight) while the laptop was at load average ~42 from parallel fleet builds; that test passes alone in 32s — reported here rather than hidden. CI is the verification of record for the full suite.

Queue task 1852 (repo-health-code-pilot), follow-up from triage task 1690.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner October 28, 2026 15:23
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 45054822-76dc-40b2-9c39-9620c23dc4db
Commits

Reviewing files that changed from the base of the PR and between 5ac81ca and 257e658.

Files selected for processing: 7
  • pkgs/mcpx/docs/spec/conformance-matrix.md
  • pkgs/mcpx/internal/conformance/coverage_stateful.go
  • pkgs/mcpx/internal/daemon/cachescope_test.go
  • pkgs/mcpx/internal/daemon/callerr_test.go
  • pkgs/mcpx/internal/daemon/registry.go
  • pkgs/mcpx/internal/pool/cachescope_test.go
  • pkgs/mcpx/internal/pool/pool.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 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
📝 Code Review ✅ Completed 2026-10-28T17:41:33.209116Z 257e658 New commits
ℹ️ 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.

@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: 672e485604

ℹ️ 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".

Comment on lines +293 to +294
if private {
continue

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 Remove the previous cache when all catalogues become private

If a server previously persisted a public catalogue and a later refresh returns a private catalogue, skipping this entry can leave cf.Servers empty. The existing empty-map guard then returns without replacing or removing the previous cache file. On restart, loadCache restores that superseded public catalogue and, if its original deadline is still in the future, serves it as fresh instead of fetching the current catalogue. Persist an empty cache or remove the existing file when no entries remain eligible.

Useful? React with 👍 / 👎.

Phase 2 of #1601, per the triage pins on #1603. cachedEntry gains Deadline (absolute time.Time) and Scope (cacheScope wire value); cacheVersion bumps 5 -> 6 so older files are ignored.

SaveCache never persists a private catalogue and writes public entries with their deadline and scope. loadCache never seeds a private entry (even from a foreign or hand-written file) and seeds deadlines through the extended SetSchemas plumbing, so a past-deadline seed starts expired. CachedAll now returns deadline and scope alongside the catalogue.

Stale-on-error: a failed re-read of an expired cache generation (refreshFailed) serves the stale catalogue, records the error in schemaErr/Status, and leaves schemaAt and the deadline untouched so the next read retries. A failed first fetch keeps the existing discipline exactly (error returned, timestamp unset).

Gap caching-private-no-cross-auth retired as covered, naming the new tests; conformance matrix regenerated. Tests: pool seeded-past-deadline refetch, seeded private scope, stale-on-refetch-error, first-fetch failure; daemon SaveCache private skip and loadCache private refusal + deadline seeding.
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