Skip to content

Optionally Disable Expansion if Constraints Violated#1837

Open
pranav-super wants to merge 3 commits into
developfrom
feature/disable-expansion-on-constraint-viol
Open

Optionally Disable Expansion if Constraints Violated#1837
pranav-super wants to merge 3 commits into
developfrom
feature/disable-expansion-on-constraint-viol

Conversation

@pranav-super

Copy link
Copy Markdown
Contributor
  • Tickets addressed: N/A; LRO MOT Request
  • Review: By commit
  • Merge strategy: Merge (no squash)

Description

The issue in question involves adding a warning to the UI to notify planners when there are violations on their plan before expansion.

Here, a 'headless' analogue was added, which throws an error when there are constraint violations during a call to expandAllTemplates if they are not explicitly bypassed.

The default is to bypass this check, so as to avoid interference with past behavior.

Currently, erroring is only thrown when there are violations for a given simulation ID. Checks that are made on the UI side, like the simulation being up to date, unchecked constraints, and the like, are not done here as erroring for those other issues is not considered necessary.

Verification

They were tested locally, both with and without the UI updates (where removal of the UI update and explicitly setting bypassConstraints to false activated this feature).

Documentation

None.

Future work

None anticipated.

Comment thread sequencing-server/src/routes/command-expansion.ts Fixed
@pranav-super pranav-super added the publish Tells GH to publish docker images for this PR label Jun 26, 2026
Comment thread deployment/hasura/metadata/actions.graphql Outdated
Comment thread sequencing-server/src/routes/command-expansion.ts Outdated
@AaronPlave

Copy link
Copy Markdown
Contributor

Any reason not to also have this gating on non-template expansion?

Comment thread sequencing-server/src/routes/command-expansion.ts Outdated
Comment thread sequencing-server/src/routes/command-expansion.ts Outdated
Comment thread sequencing-server/src/routes/command-expansion.ts Outdated

@pranav-super pranav-super left a comment

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.

(Responded)

Comment thread sequencing-server/src/routes/command-expansion.ts Outdated
Comment thread deployment/hasura/metadata/actions.graphql Outdated
Comment thread sequencing-server/src/routes/command-expansion.ts Outdated
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
92.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

throw new Error(
`POST /command-expansion/expand-all-sequence-templates: Expansion for simulation dataset ${simulationDatasetId} failed, as there ${
(numViolations > 1) ? 'are' : 'is'
} still ${numViolations} violation${(numViolations > 1) ? 's' : ''}.`,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Extremely minor wording nitpick: why the still here? Assuming you don't change your constraints to fit your sim results (which seems like bad practice), you'd need a separate sim run for those violations to not apply, wouldn't you?

Suggested change
} still ${numViolations} violation${(numViolations > 1) ? 's' : ''}.`,
} ${numViolations} violation${(numViolations > 1) ? 's' : ''}.`,

Comment on lines 349 to 356
/**
* ARGUMENTS
* {
* modelId: Int!,
* simulationDatasetId: Int!,
* seqIds: [Int!]!
* }
*/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please update this comment to include the added argument

Suggested change
/**
* ARGUMENTS
* {
* modelId: Int!,
* simulationDatasetId: Int!,
* seqIds: [Int!]!,
* bypassConstraints: Boolean
* }
*/


// 0. Extract stuff from request
// needed to uniquely identify sequence templates, along with activity type
const bypassConstraints = req.body.input.bypassConstraints !== undefined ? (req.body.input.bypassConstraints as boolean) : true;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Given that the default behavior is to bypass constraints, it makes more sense logically for this argument to be inverted. That is, it's called something like referenceConstraints and defaults to false. As a user, it'd be very weird to have to input variable = false to activate new behavior.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd like to request six e2e tests, which are each of these updated endpoints run under the following conditions:

  1. there is a constraint run with violations on the sim dataset
  2. there is a constraint run without violations on the sim dataset
  3. there are no constraints run on the sim dataset

In all three cases, the endpoint is set to be checking that there are no constraint violations.

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

Labels

publish Tells GH to publish docker images for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants