feat(policies): add control catalogue tab#4265
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
Looking for one thing? Review this PR in Change Stack to search files, summaries, diffs, and code without losing your place. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (13)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (9)
📝 WalkthroughWalkthroughAdds a policy control-catalogue endpoint plus backend queryset helpers, frontend reverse-FK configuration and UI wiring, a CLI/MCP tool and resolver, SvelteKit proxy route, i18n label, and tests covering API and MCP behaviors. ChangesControl Catalogue Feature
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I have read the CLA Document and I hereby sign the CLA |
|
recheck |
What & why
This PR adds a policy-level Control catalogue tab that lists Applied Controls linked through the policy's requirement assessments.
The business problem is policy review and governance traceability. When a policy is backed by assessed requirements, reviewers often need to answer: which implemented controls support this policy? Today that answer is not visible from the policy detail page, even though the relationship already exists in the data model.
Without this change, users have to leave the policy, inspect its requirement assessments, then manually pivot to Applied Controls or recreate equivalent filters in the action plan. That workflow is slow, easy to get wrong, and awkward during management review, audit preparation, or evidence collection because the reviewer loses policy context while chasing related controls.
This PR exposes the existing relationship directly from the policy page. It does not create duplicate controls or introduce a new control-writing workflow; it provides a derived view over Applied Controls that are already linked through the policy's requirement assessments.
Related to #2946. This does not fully close #2946 because it does not add a generic "source" column/filter to the global Applied Controls list; it improves source/context visibility for controls when reviewing a policy.
Implementation notes
GET /api/policies/{id}/control-catalogue/.category="policy"rows from the derived catalogue.linked_models, owners, folder, assets, and labels serialize consistently with the main Applied Controls list.Control cataloguetab on policy detail pages.get_policy_control_catalogue(policy), withsearch,ordering, and boundedlimitpassthrough.How tested
python3 -m py_compile backend/core/views.py cli/ca_mcp/server.py cli/ca_mcp/resolvers.py cli/ca_mcp/tools/read_tools.pydocker exec ciso-backend-local sh -lc 'cd /src && /code/.venv/bin/python -m pytest app_tests/api/test_api_policies.py -k control_catalogue'2 passed, 102 deselectedcd cli && uv run --with pytest --with pytest-asyncio pytest tests/test_mcp.py -k "policy_control_catalogue or resolve_policy_id"5 passed, 11 deselectedpnpm --dir frontend checksvelte-check found 0 errors and 0 warningspnpm --dir frontend exec prettier --check src/lib/utils/crud.ts src/lib/utils/load.ts src/lib/components/DetailView/DetailView.svelte 'src/routes/(app)/(internal)/policies/[id=uuid]/control-catalogue/+server.ts'All matched files use Prettier code stylegit diff --checkControl cataloguetab selected, generic Applied Control columns visible, and no create/delete controls in the derived tab.Checklist
feat(policies): add control catalogue tabmainSummary by CodeRabbit
New Features
Improvements
Documentation
Localization