Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds configuration requests and new observation workflow #4253

Merged
merged 2 commits into from
Oct 28, 2024

Conversation

toddburnside
Copy link
Contributor

Adds configuration requests to Explore. For now, the only place you can request approval is on the summary tab in the validations table. This will change will a future PR. When an approval is requested, we optimistically update the affected observations, but they don't get updated via the API. This will change when the ConfigurationRequest in the API has the affected observations added to it and we can request them as part of the configurationRequestEdit event.

It also incorporates the new observation workflow, which removes obsStatus and obsActiveStatus. A new ObservationWorkflow is present on the Observation in the API, which contains a new calculated ObservationWorkflowState. It also contains a list of the valid states to which the observation can be transitioned, and the observation validations have been moved within the workflow. The ObsBadge has been updated to remove the Active State and change the status dropdown to update the new state where invalid transitions have been disabled. Currently there is no mutation for updating the state via the API, so any changes made locally will be overwritten on reload of the observation.

Copy link

bundlemon bot commented Oct 25, 2024

BundleMon

Files updated (2)
Status Path Size Limits
index-(hash).js
1.74MB (+5.28KB +0.3%) -
index-(hash).css
65.86KB (-61B -0.09%) -
Unchanged files (6)
Status Path Size Limits
exploreworkers-(hash).js
606.06KB -
workbox-window.prod.es5-(hash).js
2.07KB -
plotworker-(hash).js
88B -
agsworker-(hash).js
84B -
itcworker-(hash).js
77B -
catalogworker-(hash).js
76B -

Total files change +5.22KB +0.21%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

instrument
mode
gmosNorthLongSlit {
grating
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we care only about grating?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤷 Apparently that is the only piece of a gmos long slit observation that matters when they are handing out approvals.

ProgramSummaryQueriesGQL
.AllProgramConfigurationRequests[IO]
.query(props.programId, offset.orUnassign),
_.program.fold(List.empty)(_.configurationRequests.matches),
Copy link
Contributor

Choose a reason for hiding this comment

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

foldMap?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah. Good catch.

@@ -132,12 +134,28 @@ object ProgramCacheController
offset =>
ProgramSummaryQueriesGQL
.AllProgramObservations[IO]
.query(props.programId.toWhereObservation, offset.orUnassign),
.query(props.programId.toWhereObservation, offset.orUnassign)(using
ErrorPolicy.IgnoreOnData
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is IgnoreOnData necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm trying to remember. I'll get back to you shortly...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's because we now get some errors with the observations for some things.
image
I guess we could review the ODB and see if that is really necessary. But, that is the way it is now,

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that one at least sounds more like a validation message than a query error.

But I agree that we want the IgnoreOnData in the presence of this. Maybe add a comment?

): ProgramSummaries =
println(s"stati: ${obsList.map(_.workflow.state)}")
Copy link
Contributor

Choose a reason for hiding this comment

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

println

Copy link
Contributor

@cquiroz cquiroz left a comment

Choose a reason for hiding this comment

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

Lots of queries! LGTM

@@ -301,13 +300,9 @@ object ObsList:
props.obsExecutionTimes.getPot(obsId).map(_.programTimeEstimate),
ObsBadge.Layout.ObservationsTab,
selected = selected,
setStatusCB = obsEditStatus(obsId)
setStateCB = obsEditStatus(obsId)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to rename to obsEditState too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Good idea

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll do that after I rebase on your PR. 👅

@@ -85,7 +85,7 @@ object ObsSummaryTable:
private val GroupsColumnId = ColumnId("groups")
private val ObservationIdColumnId = ColumnId("observation_id")
private val ValidationCheckColumnId = ColumnId("validation_check")
private val StatusColumnId = ColumnId("status")
private val StateColumnId = ColumnId("status")
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to rename to "state" too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. I guess I missed this table for that somehow.

@@ -99,6 +99,10 @@ case class KeyedIndexedList[K, A] private (private val list: TreeSeqMap[K, (A, N
def updatedValueWith(key: K, f: A => A): KeyedIndexedList[K, A] =
updatedWith(key, (v, i) => (f(v), i))

// WARNING - Do not use to update the part of the value used as a key
def unsafeMapValues(f: A => A): KeyedIndexedList[K, A] =
Copy link
Contributor

Choose a reason for hiding this comment

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

You could make this safe by passing a lens for the key so that it gets reinstated in case it's modified. In fact, this would be automatic if you use KIListMod(keyLens).mod

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While digging through the KeyedIndexexList stuff to figure out how to make this work, I realized where I'm using this isn't participating in undo. 😢 I'll take care of that, and then figure this out.

Copy link
Contributor Author

@toddburnside toddburnside Oct 25, 2024

Choose a reason for hiding this comment

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

Actually, I'm not sure this should participate in undo. We can't get rid of a ConfigurationRequest via the API. I guess once we get a mutation we could Withdraw the request on undo and set it back to Requested on redo? It's not quite the same as fully undoing it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds like we want to make those actions explicit. Like submit/retract a proposal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. I think you're right. Undo doesn't seem appropriate here. Thanks for the input.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll deal with the unsafeMapValues in a new PR. I want to get this merged so Rob can continue cleaning up the odb/core.

@@ -179,33 +183,76 @@ case class Observation(
lazy val constraintsSummary: String =
s"${constraints.imageQuality.label} ${constraints.cloudExtinction.label} ${constraints.skyBackground.label} ${constraints.waterVapor.label}"

private val executedStates =
Copy link
Contributor

Choose a reason for hiding this comment

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

ExecutedStates? Would it make sense to put it in Constants, or will it only be used here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I know, it's only needed here. I guess that could change in the future?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, anyway we use CamelCase for constants, it's in the new code guidelines ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have guidelines? 😮 Anyway, their just guidelines - kind of like the Pirates Code. 😆

): ProgramSummaries =
println(s"stati: ${obsList.map(_.workflow.state)}")
Copy link
Contributor

Choose a reason for hiding this comment

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

println

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Too late. Carlos already reported that.

Copy link
Contributor

@rpiaggio rpiaggio left a comment

Choose a reason for hiding this comment

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

Looks awesome, thank you.

LGTM, with some comments.

@toddburnside toddburnside merged commit 0de1425 into master Oct 28, 2024
14 checks passed
@toddburnside toddburnside deleted the config-requests branch October 28, 2024 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants