Repository navigation
feat(mcpx): enforce cacheScope at the disk boundary - #1705
Conversation
|
Warning Review limit reachedYou'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. View limit details
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. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
| if private { | ||
| continue |
There was a problem hiding this comment.
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 👍 / 👎.
672e485 to
93c0507
Compare
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.
93c0507 to
257e658
Compare
Implements #1603 — Phase 2 of #1601, per the triage pins on #1603 (gate: Phase 1 #1602 / PR #1608 merged).
Changes
internal/daemon/registry.go):cachedEntrygainsDeadline(absolutetime.Time,json:"deadline,omitempty") andScope(cacheScope wire value,json:"scope,omitempty"; empty = public).cacheVersionbumps 5 → 6 so older files are ignored.SetSchemasplumbing, so a past-deadline seed starts expired and the firstSchemas()re-reads.CachedAllnow returns deadline + scope too.internal/pool/pool.go, newrefreshFailed): a failed re-read of an expired cache generation serves the stale catalogue, records the error inschemaErr(surfaced viaStatus), returns nil, and leavesschemaAt/deadline untouched so the next call retries. A failed first fetch is unchanged (error returned, timestamp unset).caching-private-no-cross-authretired 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 fullgo 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.
Need help on this PR? Tag
@codesmith-botwith what you need.