Skip to content

test(BA-7852): add scenario tests for the keypair resource policy - #14549

Draft
jopemachine wants to merge 4 commits into
mainfrom
test/BA-7852-keypair-policy-scenarios
Draft

test(BA-7852): add scenario tests for the keypair resource policy#14549
jopemachine wants to merge 4 commits into
mainfrom
test/BA-7852-keypair-policy-scenarios

Conversation

@jopemachine

@jopemachine jopemachine commented Sep 11, 2026

Copy link
Copy Markdown
Member

Resolves BA-7852

Summary

  • Replace the TODO stub in api/adapters/resource_policy/KNOWLEDGE.md with the intro every policy shares and the keypair policy's chapter, and transcribe that chapter into tests/scenario/bai_scenario/manager/resource_policy: 34 rows over 6 modules, every one of its 6 adapter calls reached. Beside the rows every policy has, this one owns the optional values left out, the unlimited slot, the priority cap the session range bounds on create and update, the search filtered by the user whose keypair holds the policy, and reading one's own policy.
  • components/resource_policy.py holds the frame the three policies share and the keypair family; OwnFamily extends the frame for a policy the caller can read as their own and whose nullable limits can be cleared. The project (BA-7851) and user (BA-7853) PRs carry the same frame so each runs on its own; whichever merges first keeps it. Nothing under runner/, seeder.py, components/answers.py or an existing seed changes.
  • Seed added: a keypair laid under an existing user, never marked default.

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

  • Reading one's own keypair policy is guarded by READ at the caller's own scope, not merely narrowed to it.
  • Among several keys the default-marked one names the policy; an inactive default key yields to an active one; no active key finds nothing. The two inactive-key situations are laid with an inactive user, whose key is made inactive with them — the seeds have no way to deactivate a key on its own.
  • An out-of-range priority cap and a duplicate name are stopped by database constraints, so the refusal is the repository's (BA-7839); a name nobody has is cannot resolve for everyone (BA-7841).

Test plan

  • python3 scripts/knowledge/check.py passes
  • test-scenario on CI: 34 scenarios, 0 failing
  • report.md generated from the CI run's scenarios.jsonl with scripts/scenario-report.py --split; the project and user calls are listed as not exercised until their PRs land

🤖 Generated with Claude Code

https://claude.ai/code/session_019vFCmtPMD6GLPBJxJoFroD

Write the intro every policy shares and the keypair policy chapter of
api/adapters/resource_policy/KNOWLEDGE.md, and transcribe the chapter into
tests/scenario/bai_scenario/manager/resource_policy: 34 rows over six modules,
every one of its six adapter calls reached. Beside the rows every policy has,
this one owns the optional values left out, the unlimited slot, the priority
cap the session range bounds, the search filtered by the user whose keypair
holds the policy, and reading one's own policy through the default-marked key.
The report.md is what the CI run produced.

The component holds the frame the three policies share and this policy's
family; the project and user policies land the same frame in PRs of their own.

Seed added: a keypair laid under an existing user, never marked default.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019vFCmtPMD6GLPBJxJoFroD
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019vFCmtPMD6GLPBJxJoFroD
jopemachine and others added 2 commits September 11, 2026 13:48
…rios 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 operations, 권한 검사 for enforcement, 할당된 for a policy a keypair
holds, and particles no longer attached to English identifiers. 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
…en 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