Skip to content

test(BA-7835): add scenario tests for the prometheus query preset category adapter - #14514

Draft
jopemachine wants to merge 10 commits into
mainfrom
test/BA-7835-preset-category-scenarios
Draft

test(BA-7835): add scenario tests for the prometheus query preset category adapter#14514
jopemachine wants to merge 10 commits into
mainfrom
test/BA-7835-preset-category-scenarios

Conversation

@jopemachine

@jopemachine jopemachine commented Sep 11, 2026

Copy link
Copy Markdown
Member

Resolves BA-7835

Summary

What the rows pin, worth a reviewer's eye:

  • The category is global, so no role ever reaches one: purge passes only for a superadmin, or for anyone once enforcement is switched off, while create is refused by the role even with enforcement off.
  • Reads are open to every authenticated caller, so an unknown id is refused as not found for anyone.
  • A category name is unique but the violation is not mapped to a domain error, so the row expects the storage-level unique violation.

Not covered here:

Row Why
purging a category empties the category of the presets pointing at it then sees only the answer, and the category adapter cannot read presets; the seeder lays rows through creators only, so a preset table cannot lay a purged category either

Judgment calls

Decisions a reviewer may want to overturn; none of them is settled by a rule I could find.

Where What I decided The alternative
test_reading.py, test_searching.py Two rows call the adapter with no user context and expect the authentication refusal (UserNotFound). No sibling table has such rows. Drop them as a validator concern rather than an adapter guarantee.
test_creating.py The duplicate-name row expects the storage-level UniqueConstraintViolationError, because nothing maps it to a domain error. Map it to a domain error first (a Creator.integrity_error_checks entry) and expect that.
test_retiring.py The enforcement-off row states that any authenticated user may purge a category once enforcement is off. Same shape as the domain and deployment tables. Leave the switch's effect undocumented for a global entity.
components/prometheus_query_preset_category.py lay_someone (a caller in a domain, with no entity of its own) lives in this component's module, duplicated in #14518. components/domain.py, which already owns SomeoneOf, shared by both.
KNOWLEDGE.md, "아직 적지 않은 것" Names batch_load_fields (inherited from BaseAdapter, no field rows here) as the one call the run leaves alone, since the report lists it. The deployment document does not mention it. Leave it out as not this adapter's own call.

Split out of #14508. Independent of #14518 (prometheus_query_preset), which covers the sibling entity.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Sm7zNnhABQq1BSebraixh5

jopemachine and others added 2 commits September 11, 2026 12:28
…egory adapter

Replace the TODO stub in the category adapter's KNOWLEDGE.md with the 19 rows
the adapter guarantees (5 calls), transcribe 18 of them into
tests/scenario/bai_scenario/manager/prometheus_query_preset_category/, and add
the report.md split from the CI run of #14508, where every row passed.

The category seed and the caller helper live here because the preset table,
which lands on top of this, files presets under categories.

The row purging a category that presets point at stays in the document only:
`then` cannot read the presets back after the call.

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
…er tables do

The scenario tables keep their rows in a module-level SCENARIOS list the
parametrize reads; the category modules had them inline in the decorator.

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
The preset table laid its categories and its caller through the category
table's seed and helper, which stacked this branch on #14514. It now carries a
category seed and the caller helper of its own, so the two land independently;
whichever merges second can drop its copy.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sm7zNnhABQq1BSebraixh5
jopemachine and others added 7 commits September 11, 2026 13:15
The preset table now carries its own; the two branches land independently.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sm7zNnhABQq1BSebraixh5
The category has no soft delete, only a purge, so the module the domain and
deployment tables call retiring is purging here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sm7zNnhABQq1BSebraixh5
… user

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
…ng file

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013qjgCzggSejnvDrLt4tG3a
…arios for readability

The knowledge document, the component docstrings and every scenario sentence
used a terse, metaphorical style (문, 줄, 훑기, 심다, 실리다, 배선) that did not
read at a glance. Rewrite them in plain technical Korean: 카테고리 for the
entity, 생성/조회/검색/삭제 for the operations, 권한 검사 for enforcement,
미리 만들어 둔 for seeded data, Arabic numerals for the page sizes, and
역할 부족으로 거부 for the role refusals. report.md follows from the CI run in
the next commit.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NQiEEB2mfJtFWnMnHLDFnT
…ten wording

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013qjgCzggSejnvDrLt4tG3a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500~ LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant