Skip to content

[raft/scd] Extract update and create constraint - #1650

Open
MariemBaccari wants to merge 9 commits into
interuss:masterfrom
Orbitalize:scd_extract_update_create_constraint
Open

[raft/scd] Extract update and create constraint#1650
MariemBaccari wants to merge 9 commits into
interuss:masterfrom
Orbitalize:scd_extract_update_create_constraint

Conversation

@MariemBaccari

@MariemBaccari MariemBaccari commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Chained PR: #1627 -> #1642 -> #1643 -> #1644 -> #1645 -> #1646 -> #1649 -> #1650 -> #1651 -> #1653 -> #1654 -> #1656 -> #1657 -> #1655 -> #1666 -> #1667 -> #1668 -> #1669

Extract update and create constraint business logic.

@mickmis mickmis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo clarification.
But what this shows is that we may want to come up with something better for deduplicating validation/parsing of those parameters.
LMK if you agree and have any idea. But in any case for after this PR train is merged
Maybe a Validate field on the OperationHandler?

Comment on lines -300 to -314
// Start and end times are required for each volume
// The end time may not be in the past
valid.uExtent, err = scdmodels.UnionVolumes4DFromSCDRest(
params.Extents,
scdmodels.WithRequireTimeBounds(),
scdmodels.WithRequireEndTimeAfter(now),
)
if err != nil {
return nil, stacktrace.Propagate(err, "Invalid extents")
}

valid.cells, err = valid.uExtent.CalculateSpatialCovering()
if err != nil {
return nil, stacktrace.Propagate(err, "Invalid area")
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the rationale for not validating here with UnionVolumes4DFromSCDRest and CalculateSpatialCovering anymore?

IIUC the strategy for validation is:

  • keep in REST handlers whatever validation there is, even if it is a side effect of the parsing
  • duplicate in ExecuteXXX functions what is needed for parsing

Is this correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the strategy, I aim to do as much validation as possible on the handler side, especially for bad request cases to avoid doing a consensus round just to end up rejecting the request for such a reason. Indeed, duplication occurs in the operation because the validation also comes with parsing (ID etc.).
For this specific case, not validating the volumes was a mistake on my part (fixed in latest push) as I kept these checks for the subscription side as well. I also merged the validation between the handler and the action / operation and kept the handler specific part (AllowHTTPBaseUrls check) there. 



I just opened issue #1676 to track this duplication issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dss-raft Relating to the application-layer consensus implemenation based on raft

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants