Repository navigation
refactor(ssp): extract SSP creation and profile attachment into a service - #523
Open
ccf-lisa[bot] wants to merge 1 commit into
Open
ccf-lisa[bot] wants to merge 1 commit into
ccf-lisa[bot] wants to merge 1 commit into
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
…vice Move the bodies of SystemSecurityPlanHandler.Create and AddProfile into sspservice.Service, which takes the *gorm.DB to run on so SSP template discovery can call it inside a transaction. The handlers call it; responses and status codes are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ccf-lisa
Bot
force-pushed
the
feat/ssp-templates-2-ssp-service
branch
from
October 19, 2026 14:22
3015148 to
b7158f5
Compare
This was referenced Oct 19, 2026
This branch has not been deployed
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.
Place in the stack
SSP templates (feature 2 of
ssp-templates.md), PR B2 of 5. Base: B1 (#522,feat/ssp-templates-1-model), on top of the SSP scope stack (#516–#520).What it adds
A pure refactor, with no behaviour change. SSP creation and profile attachment move out of
SystemSecurityPlanHandler.CreateandAddProfileinto a newinternal/service/relational/sspservice.Service. B4's discovery needs the same code to create SSPs inside its own transaction.Create(db, oscalSSP)unmarshals the SSP, stamps last-modified and the OSCAL version, and stores it. Callers validate the SSP first; the handler still runsvalidateSSPInput.AttachProfile(db, sspID, profileID)takes the same steps as before:ON CONFLICT DO NOTHING;The writes run in
db.Transaction, which becomes a savepoint whendbis already a transaction. It returnsErrSSPNotFound,ErrProfileNotFound,ErrProfileAlreadyBoundorErrNoResolvedControls, and the handler maps them to the same status codes and messages as before (404/404/409/400).Profile control resolution stays in the oscal handler: the cache, the pivot table and the full-resolution fallback. It is injected as a
ControlResolverfunc, because services cannot importinternal/api.How it was tested
internal/api/handler/oscalintegration package, includingsystem_security_plans*andsystem_security_plan_profiles_integration_test.sspservice/service_integration_test.gocovers:make swag(no doc change),make lint(only the existing SA1019 ininternal/api/metrics.go),make test,go vet -tags integration ./...;internal/api/handler/oscalandsspservice;make check-diff.Changed lines excluding generated swagger: 385.
Deviations from design
None. The control resolver is injected rather than moved into the service; see the
lisa-designnote. B4 wires the same resolver into the discovery worker.Open questions for reviewers
getControlIDsForProfile,extractControlIDsFromProfile, the process-wide cache) move out of the oscal handler package into a service? This PR injects it to stay a pure refactor. B4 passes the handler's resolver to the worker from where both are built.🤖 Generated with Claude Code