test(BA-7805): add scenario tests for the prometheus query preset adapters - #14508
Closed
jopemachine wants to merge 6 commits into
Closed
test(BA-7805): add scenario tests for the prometheus query preset adapters#14508jopemachine wants to merge 6 commits into
jopemachine wants to merge 6 commits into
Conversation
Replace the TODO stubs in the prometheus_query_preset and prometheus_query_preset_category adapter KNOWLEDGE.md files with the scenarios each adapter guarantees, in the shape the domain and deployment documents set. Every public call carries at least one row: 8 calls / 56 rows for the preset, 5 calls / 19 rows for the category. The rows pin what the code does today: the catalog reads open to every authenticated caller, the superadmin role on create and preview (with the monitor role passing the read), the entity gate on execute, update and purge that no role can reach because both entities are global, the window fallback and the label checks on execute, and the purge of a category emptying the category of the presets pointing at it. The three container-metric wirings of the metric concern have no adapter and are consumed by legacy GraphQL only, so they are named in the preset document and left out of the tables. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sm7zNnhABQq1BSebraixh5
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sm7zNnhABQq1BSebraixh5
…pters Transcribe the rows of the two KNOWLEDGE.md documents into tests/scenario/bai_scenario/manager/prometheus_query_preset/ (45 rows over 8 modules) and .../prometheus_query_preset_category/ (18 rows over 5 modules). Add SeedPreset, SeedPresetIn and SeedCategory, which lay rows through the creators alone so a template the renderer would refuse can still be stored, and FakePrometheusClient, which answers one sample for every query and keeps what it was asked. The rows that read what the stand-in received, or need it to answer an error, wait for the runner to hand fakes to `then` (BA-7830). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sm7zNnhABQq1BSebraixh5
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sm7zNnhABQq1BSebraixh5
Split from the CI run of #14508, where all 45 preset rows and 18 category rows passed. The one call the run leaves alone, batch_load_fields, is the base adapter's field-row read; both documents now say so. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sm7zNnhABQq1BSebraixh5
…nt does Ruff places `bai_scenario` with the third-party block when it lints the changed files alone, which is how CI runs it; a whole-tree run sorts it as first-party instead. The four new modules follow the order CI checks, as the deployment scenario modules do. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sm7zNnhABQq1BSebraixh5
This was referenced Sep 11, 2026
Member
Author
jopemachine
added a commit
that referenced
this pull request
Sep 11, 2026
…pter Replace the TODO stub in the preset adapter's KNOWLEDGE.md with the 55 rows the adapter guarantees (8 calls), transcribe 45 of them into tests/scenario/bai_scenario/manager/prometheus_query_preset/, and add the report.md split from the CI run of #14508, where every row passed. Add SeedPreset and SeedPresetIn, which lay rows through the creator alone so a template the renderer would refuse can still be stored, and FakePrometheusClient, which answers one sample for every query and keeps what it was asked. The rows that read what the stand-in received, or need it to answer an error, wait for the runner to hand fakes to `then` (BA-7830). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sm7zNnhABQq1BSebraixh5
jopemachine
added a commit
that referenced
this pull request
Sep 11, 2026
…pter Replace the TODO stub in the preset adapter's KNOWLEDGE.md with the 55 rows the adapter guarantees (8 calls), transcribe 45 of them into tests/scenario/bai_scenario/manager/prometheus_query_preset/, and add the report.md split from the CI run of #14508, where every row passed. Add SeedPreset and SeedPresetIn, which lay rows through the creator alone so a template the renderer would refuse can still be stored, and FakePrometheusClient, which answers one sample for every query and keeps what it was asked. The rows that read what the stand-in received, or need it to answer an error, wait for the runner to hand fakes to `then` (BA-7830). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sm7zNnhABQq1BSebraixh5
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.
Resolves BA-7805
Summary
api/adapters/prometheus_query_preset/KNOWLEDGE.mdandapi/adapters/prometheus_query_preset_category/KNOWLEDGE.mdwith the scenarios each adapter guarantees — 8 calls / 55 rows for the preset, 5 calls / 19 rows for the category — in the shapeapi/adapters/domain/KNOWLEDGE.mdandapi/adapters/deployment/KNOWLEDGE.md(test(BA-7806): add scenario tests for the deployment adapter's own calls #14501) set.tests/scenario/bai_scenario/manager/prometheus_query_preset/(45 rows over 8 modules) and.../prometheus_query_preset_category/(18 rows over 5 modules). Every public call of both adapters is called by at least one row.SeedPreset/SeedPresetIn/SeedCategory(rows laid through the creators alone, so a template the renderer would refuse can still be stored) andFakePrometheusClient(answers one sample for every query and keeps what it was asked).What the rows pin, worth a reviewer's eye:
global_search_container_metrics,public_search_container_metric_metadata,search_user_container_metrics) have no adapter and are consumed by legacy GraphQL only, so they are named in the preset document and kept out of the tables.Not covered here:
run_scenariodoes not hand fakes tothen(BA-7830)thencannot read the presets back after the callTest plan
python3 scripts/knowledge/check.pypassespants lint/pants checkontests/scenario::report.mdwithscripts/scenario-report.py --splitfrom that run and commit them🤖 Generated with Claude Code
https://claude.ai/code/session_01Sm7zNnhABQq1BSebraixh5