test(BA-7809): add scenario tests for the resource policy adapter - #14507
Closed
jopemachine wants to merge 6 commits into
Closed
test(BA-7809): add scenario tests for the resource policy adapter#14507jopemachine wants to merge 6 commits into
jopemachine wants to merge 6 commits into
Conversation
Replace the TODO stub in api/adapters/resource_policy/KNOWLEDGE.md with the scenarios the adapter guarantees for the keypair, user and project policies: the superadmin role on create and search, the name lookup that refuses a missing name and an unreachable one the same way, the database constraints that answer for duplicate names, out-of-range priority caps and policies still referenced, and the caller's own scope on reading one's own policy. 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
Rename the search section, say "resolve" for the name lookup, name the constraint-violation refusals as the repository's, and rewrite the sentences that read awkwardly. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019vFCmtPMD6GLPBJxJoFroD
Transcribe api/adapters/resource_policy/KNOWLEDGE.md into tests/scenario/bai_scenario/manager/resource_policy: 83 rows over six modules, every public adapter call reached. One component class per policy family carries what tells the three apart — the seed, the calls, the node's fields — so each row is written once and run against each family it applies to. Seeds: a named project policy nobody's personal project looks for, a keypair laid under an existing user, and the nullable limits the editing rows clear. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019vFCmtPMD6GLPBJxJoFroD
Generated from the CI run with scripts/scenario-report.py --split. Name the type parameters of the policy families after what they carry. 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
Member
Author
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-7809
Summary
api/adapters/resource_policy/KNOWLEDGE.mdfor the keypair, user and project policies and transcribe it intotests/scenario/bai_scenario/manager/resource_policy/— 83 rows over 6 modules, every public adapter call (17 calls, 20 wirings) reached.components/resource_policy.pyholds one class per policy family — the seed that lays one, the calls that read and write one, the places its node has — and each row is written once and run against every family it applies to. Rows a single family owns (unlimited slot, priority cap, keypair-owner filter, reading one's own policy) name it.Behaviours the rows pin, worth a reviewer's eye:
Test plan
python3 scripts/knowledge/check.pypassestest-scenarioon CI: 83 scenarios, 0 failingreport.mdgenerated from the CI run'sscenarios.jsonlwithscripts/scenario-report.py --splitand committed🤖 Generated with Claude Code
https://claude.ai/code/session_019vFCmtPMD6GLPBJxJoFroD