fix: gate cached meta overlay on version newer than embedded#1376
fix: gate cached meta overlay on version newer than embedded#1376GeekyMax wants to merge 1 commit into
Conversation
Change-Id: I4117eaef2c24b91745a7b3cf01af314b1ea47a11
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe PR gates cached service registry overlays on version comparison: embedded baseline definitions are now replaced by cached definitions only when the cache version is strictly newer. The change adds an ChangesRegistry overlay version gating
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1376 +/- ##
==========================================
+ Coverage 71.90% 71.96% +0.05%
==========================================
Files 691 695 +4
Lines 65629 65879 +250
==========================================
+ Hits 47191 47410 +219
- Misses 14791 14813 +22
- Partials 3647 3656 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@3a7a5434f1cb03e7a690894188c404ea016a882e🧩 Skill updatenpx skills add GeekyMax/cli#fix/meta-data-cache-version -y -g |
The cached remote meta was overlaid onto the embedded meta_data.json unconditionally, so after a CLI upgrade an equal- or older-version cache kept shadowing the freshly shipped embedded definitions until a later refresh happened to rewrite it. Only overlay when the cache version is strictly newer than the embedded baseline. The bare-module stub baseline is "0.0.0", so plugin builds without compiled metadata still take any real cached version (TestOverlayGate_StubEmbedded_OverlaysRealCache) and the schema runtime fallback keeps working offline from a warm cache. Ports #1376 onto the typed meta model.
…ache overlay by version (#1764) * fix(schema): fall back to runtime catalog when no embedded metadata Binaries built from the bare Go module (plugin builds) embed only the empty meta_data_default.json stub because meta_data.json is gitignored and fetched at build time. The schema command, its completion, and the affordance command-form resolver read the embedded-only catalog, so every schema lookup failed with "Unknown service" even though the runtime registry had already sync-fetched full metadata. Add registry.SchemaCatalog(): embedded when compiled in (official builds unchanged, still deterministic), otherwise the merged runtime catalog seeded from cache or remote fetch. When neither source has data (offline plugin build with a cold cache), schema now returns a failed_precondition error with an actionable hint instead of "Unknown service" with an empty candidate list. * fix(registry): gate cached meta overlay on version newer than embedded The cached remote meta was overlaid onto the embedded meta_data.json unconditionally, so after a CLI upgrade an equal- or older-version cache kept shadowing the freshly shipped embedded definitions until a later refresh happened to rewrite it. Only overlay when the cache version is strictly newer than the embedded baseline. The bare-module stub baseline is "0.0.0", so plugin builds without compiled metadata still take any real cached version (TestOverlayGate_StubEmbedded_OverlaysRealCache) and the schema runtime fallback keeps working offline from a warm cache. Ports #1376 onto the typed meta model. --------- Co-authored-by: liangshuo-1 <266696938+liangshuo-1@users.noreply.github.com>
Summary
Cached remote meta was overlaid onto the embedded
meta_data.jsonunconditionally. Because the embedded data version is not bumped on each CLI release, a cache with the same (or older) version would shadow the freshly shipped embedded command definitions — so after upgrading the CLI, newly bundled commands were never used.Changes
InitWithBrand(internal/registry/loader.go) onupdate.IsNewer(cached.Version, embeddedVersion): only overlay when the cache version is strictly newer than the embedded baselineinternal/registry/loader_test.gowith unit tests for the gate (equal / older / newer / unparseable / empty-embedded)internal/registry/remote_test.gofrom the ambient embedded version (the CI-fetchedmeta_data.json)Test Plan
make unit-testpassed (go test ./internal/registry/, both real and default embedded meta, deterministic)version == embedded) → injected service absent; bumped cache to a newer version → service overlaid; unparseable version → falls back to embedded, exit 0Related Issues
N/A
Summary by CodeRabbit