Skip to content

Keep a pinned version's resolution for the life of the process - #177

Merged
AhmadRAbuhussein merged 1 commit into
mainfrom
muhannad/cache-pinned-metadata
Oct 18, 2026
Merged

AhmadRAbuhussein merged 1 commit into
mainfrom
muhannad/cache-pinned-metadata

Conversation

@mmalkhatib

@mmalkhatib mmalkhatib commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

AdapterInstaller.GetMetadataAsync cached every resolution for AdapterMetadataCacheDuration (5 min), including pinned refs ({id}/{version}). A published version never changes, so re-reading it is a storage round trip for nothing.

  • Change: a pinned ref's resolution is cached with no expiry. A plain id still expires as before, so a promoted current package is still picked up.
  • Test: PinnedMetadataCacheTests publishes a current package and a version, rewrites both, and advances the cache clock past the duration. The current package is read again; the pinned version keeps its first resolution. It fails without the change.
  • Suite: SW.Serverless.Installer.UnitTests 137/137.
  • Docs: docs/hosting.md updated (the option's description).

Folder pruning needs no change: the installer's owner marker holds the full ref, so versions never prune each other, and old version folders go with the pod.

A published version never changes, yet GetMetadataAsync re-read it from storage
every AdapterMetadataCacheDuration, like a current package that can move. A host
whose adapters are all pinned (Traxis Gateway since 2026-10-18) made a storage
round trip per adapter every five minutes for nothing. Only plain ids now expire.
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: simplify9/coderabbit/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: bbda171d-1119-43d7-9834-d824f2233e0a
📥 Commits

Reviewing files that changed from the base of the PR and between f1623e2 and c29ae56.

📒 Files selected for processing: 3
  • SW.Serverless.Installer.UnitTests/PinnedMetadataCacheTests.cs
  • SW.Serverless/Services/AdapterInstaller.cs
  • docs/hosting.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 1
  • GitHub Check: build-and-test
🔇 Additional comments: 1
SW.Serverless/Services/AdapterInstaller.cs: 1

393-394: 🎯 Functional Correctness

Pinned-version metadata is immutable by contract.

PublishVersionAsync rejects an existing version before upload, and the catalog contract defines one immutable package per version. The indefinite cache therefore matches the supported publication workflow. The general ApplyManifestAsync note about mutable storage metadata does not override the stronger pinned-version contract.

📝 Summary

Summary

  • Pinned refs ({id}/{version}) now keep resolved metadata in memory for the life of the process. Plain adapter IDs still expire after AdapterMetadataCacheDuration.
  • Hosting documentation describes the different cache behavior.

Risk

risk:low. Hosts will not observe changes to a pinned version during the process lifetime. This relies on published versions remaining immutable.

Security-sensitive areas

The change affects adapter package metadata resolution and installation. It does not change package validation or extraction controls.

Test coverage impact

Adds a test that rewrites current and pinned metadata, advances the cache clock past the configured duration, and checks that only the current package is resolved again. The PR reports 137/137 installer unit tests passing; this result was not independently verified.

Deployment and operations

No migration is indicated. Restart the process to resolve pinned metadata again. No folder-pruning change is reported.

Pinned adapter metadata now remains cached for the process lifetime. Current-package metadata continues to use the configured cache duration. A test verifies both behaviors, and the hosting documentation describes them.

Changes: Adapter Metadata Cache

Layer / File(s) Summary
Cache behavior and validation
SW.Serverless/Services/AdapterInstaller.cs, SW.Serverless.Installer.UnitTests/PinnedMetadataCacheTests.cs, docs/hosting.md
Pinned-version metadata is cached without an expiration. Current-package metadata retains its configured duration. The test checks both behaviors, and the hosting documentation describes them.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested labels: risk:medium

Suggested reviewers: samerzughul

Merge Risk: ⚪ Minimal · up to c29ae

Pinned versions retain their resolution as intended, while current-package metadata still expires. No issue identified here prevents merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely identifies the main change: pinned version resolutions remain cached for the process lifetime.
Description check Passed The description directly explains the caching change, preserved current-package expiry, tests, documentation, and pruning behavior.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
  • 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.

@AhmadRAbuhussein
AhmadRAbuhussein merged commit 14b9e91 into main Oct 18, 2026
6 checks passed
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.

2 participants