Conversation
Pin the exact (METHOD, path) HTTP calls of the hot read commands (project list/status, config list/detail, job list single + fan-out, job detail, storage tables/table-detail, flow list/detail) end-to-end through CliRunner against pytest-httpx, with 1-vs-10-item cases proving list call counts do not grow per item. Shared recording/assert helpers live in tests/helpers.py; CONTRIBUTING.md asks hot-path command changes to add or update a case.
This branch has not been deployed
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.
What / why
Adds ratcheting API call-count tests for the hot read commands so an N+1 regression (a per-item lookup sneaking into a list loop) or a duplicate call fails CI instead of reaching users as a slow command and rate-limit pressure.
tests/helpers.py:mock_api_routes(route table keyed by(METHOD, path), host/query-agnostic, reusable + optional so zero-call commands do not trip pytest-httpx teardown; unmatched requests get a non-retryable 418 so they fail fast without backoff sleeps),recorded_api_calls, andassert_api_calls(exact count + sequence, optional query string,ordered=Falsesorted-multiset mode for thread-pool fan-out).tests/test_api_call_counts.py: every command runs end-to-end (CliRunner -> command -> service -> real HTTP client -> pytest-httpx). Expected call lists are committed literals; the module docstring states that raising one is a deliberate, reviewed change and that improvements should lower it.CONTRIBUTING.md: checklist item asking new/changed hot-path commands to add or update a call-count case.Commands covered and pinned counts
project listproject status --project XGET /v2/storage/tokens/verify)project status(2 projects)config listcomponents?include=configuration,dev-branches,branch/{default}/search/component-configurations)config detailjob list --project X/search/jobs?limit=50&offset=0&sortBy=startTime&sortOrder=desc, query pinned)job list(2 projects)job detail(flow job)storage tablesstorage table-detailflow listkeboola.flow/configs+ legacykeboola.orchestrator/configscount probe)flow detailAll commands were practical end-to-end; no service-layer fallback was needed.
Follow-ups found
No N+1 or duplicate calls in the covered paths. One minor observation, not fixed here:
config listspends aGET /v2/storage/dev-branchesper project on every run just to find the default branch id for the folder-metadata search (when no branch is active). Constant per project, not per item; could be cached or skipped if the folder lookup were made optional. Low priority.How tested
uv run pytest tests/test_api_call_counts.py-- 18 passedmake check-- lint, format, ty, full suite: 6920 passed, 15 skippedFixes #802