Repository navigation
feat: budget threshold notification tests (#470) and marketplace catalog TTL cache (#377) - #570
Merged
Ayinkx merged 2 commits intoOct 24, 2026
Conversation
Cover warning and blocked notifications, opt-out via the budget_alerts preference, and workspace-owner delivery. Closes AyinkxLab#470 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add PLUGIN_MARKETPLACE_CACHE_TTL (default 60s, 0 disables) and a process-local cache keyed by source for the lenient loader. Only ok/empty loads are cached; stale and unavailable results always retry the source. reset_marketplace_cache() busts the cache for tests and operators. Closes AyinkxLab#377 Co-Authored-By: Claude Sonnet 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.
Summary
Covers two assigned issues in one PR.
#470 Budget threshold notifications
Most of this already existed (
budgets.notify_decision/after_usage_recorded, preference-awarenotifications.notify). This PR adds the missing coverage intests/test_budget_threshold_notifications.py:budget_alertsreceives neither;No production code changed for #470. Jumping straight past the limit reports only the more severe "blocked" level, which is existing behaviour and unchanged.
#377 Marketplace catalog caching with TTL
PLUGIN_MARKETPLACE_CACHE_TTLsetting (default 60 seconds,0disables), documented inREADME.mdand.env.example.load_marketplace_catalog, the one the routes use) serves a successfully parsed catalog from an in-process cache keyed by source until the TTL expires.ok/emptyresults are cached;staleandunavailableresults always retry the source, so the existing last-known-good fallback still works.reset_marketplace_cache()is the explicit cache-bust path and now clears both the TTL cache and the last-good fallbacks.tests/test_marketplace_cache_ttl.pycover hit, miss, expiry, per-source keys, TTL 0, cache-bust, uncached failures and TTL parsing.tests/test_marketplace_fallbacks.pynow sets the TTL to 0, because those tests delete the catalog file and expect the last-good fallback, which needs a re-read.Closes #470
Closes #377
Validation
ruff check .andblack --check .: clean.pytestrun: 10 failed, 3179 passed, 21 skipped. Two of the 10 were caused by this change (the marketplace fallback tests above) and are fixed; I re-ran the marketplace tests afterwards but did not re-run the whole suite. The other 8 fail identically on an untouched checkout ofmain, so they are pre-existing and unrelated:tests/test_budget_e2e.py(2)tests/test_budget_enforcement_paths.py::TestBlockedPaths(2)tests/test_migrations.py::TestMigrationHead::test_usage_records_table_upgradedtests/test_usage_export_csv.py(2)tests/test_workspaces_api.py::TestWorkspaceCRUD::test_list_own_workspaces🤖 Generated with Claude Code