Repository navigation
fix(registry): run the consumer check once per module set (FR-52); pin PyJWT[crypto] - #814
Merged
Merged
Conversation
… (FR-52); pin PyJWT[crypto] load_plugins() ended unconditionally in check_consumer_requirements, and the registry's getters call load_plugins() lazily -- 26 times in one warm `GET /memory/nodes`. Each check read every installed distribution's metadata (packages_distributions + the shadow scan): ~3 s on every app request since 2.25.0 (app: p50 3,780 ms as shipped, 820 ms with the check stubbed). The check now runs when the plugin module set differs from the last one checked; its answer cannot change while the process lives. The latch is in both registry-reset dicts. Tests count metadata scans: 5 loads -> 1 scan; a different module set is checked again; one warm request through the real route -> 0 scans (26 before). Always-check and never-check mutations each fail them. PyJWT is pinned with its crypto extra: its HMAC guard against asymmetric key material returns early when cryptography is absent (found by nodus-auth, def3ef8). We had cryptography by a separate pin; now the guard does not depend on that, and a test asserts has_crypto. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…is FR-53 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Answers the app's FR-52 (P1) and hardens #810's PyJWT pin.
FR-52 — ~3 s on every request
load_plugins()ended unconditionally in DEBT-COMPAT-1'scheck_consumer_requirements, which callspackages_distributions()and scans every distribution for shadowing metadata. The registry's getters (emit_event,get_route_guard,get_response_adapter,get_memory_policy, … 14 sites) callload_plugins()lazily — 26 times in one warmGET /memory/nodes. The app measured p50 3,780 ms as shipped vs 820 ms with the check stubbed out, on 2.25.0 and 2.26.0.Fix: run the check when the plugin module set differs from the last one checked (
registry._consumer_check_modules, added to both registry-reset dicts). The answer cannot change while the process lives; a different manifest/profile is still checked./api/versionserves the same records.Why our suites never saw it: runtime-only boot's manifest lists no plugins, so
load_plugins()returns before the check. The app has 16 plugins.Tests (
test_debt_compat1_consumer_range.py), counting metadata scans:load_plugins()calls → 1 scan, and the record is still written;AINDY_PLUGIN_MANIFEST→ 0 scans (26 before), with a liveness check that the request went throughload_plugins().Mutations: always-check fails all three; never-check fails the existing check test plus two new ones.
PyJWT[crypto]
nodus-auth (def3ef8) found PyJWT's HMAC guard against asymmetric key material opens with
if not has_crypto: return False. We hadcryptographythrough its own pin, so the guard was live, but only by coincidence. NowPyJWT[crypto]==2.15.1, plus a test assertinghas_crypto.Ledger
TECH_DEBT.md: FR-51 (#810) and FR-52 (#814) entries, both CLOSED / UNRELEASED. CLAUDE.md: next app FR is FR-53 (39,720 chars). Changelog:changelog.d/814-fr52-consumer-check-once.md.ruffclean. Localtest_dependency_pin_agreementfails only on this host's otel 1.44 drift (pre-existing, unrelated).🤖 Generated with Claude Code