Repository navigation
Conversation
grzanka
left a comment
There was a problem hiding this comment.
Converter submodule: src/libs/converter points to 0854002b, which is not on converter master (2 commits ahead and 1 behind). As the description says, it needs a bump to a master commit once yaptide/converter#282 is merged. Otherwise, if that branch is squash-merged or deleted, the pinned commit can become unreachable and git submodule update would fail on fresh clones and in CI.
The inline comments below cover the rest.
| detectorUuid: this.detector?.uuid, | ||
| trace: this._trace[0], | ||
| ...(this.trace[1] && { traceFilter: this.trace[1] }) | ||
| ...(this.traceFilter && { traceFilter: this.traceFilter.uuid }) |
There was a problem hiding this comment.
When trace is on and the trace filter was deleted, traceFilter is now left out of the JSON with no warning, so the converter traces all particles. findScoringProblems doesn't check traceFilter either. This is the same silent fallback this PR fixes for quantity filters.
Could the trace filter be handled like quantity filters, by keeping a marker and reporting it in findScoringProblems? If trace can't be set yet (I found no UI for it), a short note would do.
There was a problem hiding this comment.
No change needed. Trace can't be turned on in the UI, and the converter doesn't read trace or traceFilter at all, so nothing is traced, with or without a filter. If trace gets a UI later, its filter should be checked in findScoringProblems like quantity filters.
| this.set(json.filter ? this.editor.scoringManager.getFilterByUuid(json.filter) : null); | ||
| const filter = json.filter ? this.editor.scoringManager.getFilterByUuid(json.filter) : null; | ||
| this.value = filter?.uuid ?? null; | ||
| this.hasFilter = 'filter' in json; |
There was a problem hiding this comment.
The old applySerialize wrote { filter: null } when Filter was ticked without picking a filter, and the old load treated that as unchecked. With 'filter' in json, those saved projects now load with Filter checked, and findScoringProblems blocks them. A project that used to run now refuses to start or convert.
If that is intended, maybe mention it in the description. If not, older null/'' values could load as unchecked, while dangling uuids are still flagged.
There was a problem hiding this comment.
Intended, updated in the description. Old projects with Filter checked and no filter picked used to run without a filter, which is the silent fallback this PR removes. They now show which quantity to fix, and unchecking Filter fixes it. Loading null as unchecked wouldn't be enough, because master also saved '' for the same case, and '' is now the marker for a deleted filter.
| batchOptions: BatchOptionsType, | ||
| geant4DatasetType: Geant4DatasetsType | ||
| ) => { | ||
| if ( |
There was a problem hiding this comment.
The problems only show in a 10 s snackbar after clicking Run, and the button stays enabled. RunSimulationForm already has findBlockReason, which disables the button and keeps the reason visible. Adding findScoringProblems(editorJson) there for the editor source would cover both run hooks in one place. It would also remove the duplicated check here and in UseRunGeant4LocalWorkerSimulation.tsx.
There was a problem hiding this comment.
Fixed. The check moved from both run hooks into findBlockReason. Start simulation is now disabled and the problems are listed under it, one per line, at most five
| batchOptions: BatchOptionsType, | ||
| geant4DatasetType: Geant4DatasetsType | ||
| ) => { | ||
| if ( |
There was a problem hiding this comment.
handleRunSimulationClick calls setSource('local' | 'remote') before runSimulation. When this early return fires, the simulation list has already switched to local or remote jobs, even though nothing was submitted. Moving the check into findBlockReason would avoid this too.
There was a problem hiding this comment.
Fixed by the change above
| ?.split('\n') | ||
| .map(line => line.trim()) | ||
| .filter(Boolean) | ||
| .at(-1); |
There was a problem hiding this comment.
Only the last non-empty line is kept. If the converter ever raises an exception whose message spans several lines (for example, a list of problems joined with \n), only the last problem is shown. Taking everything after the last SomeError: line would keep the whole message. Alternatively, make sure yaptide/converter#282 always puts each error on one line.
There was a problem hiding this comment.
No change needed. Every error the converter raises in yaptide/converter#282 · Explain missing detectors and… is one line, and the converter stops at the first one. When there are several problems, the UI check lists all of them before the converter runs.
| ...super.toSerialized(), | ||
| detectorUuid: this._detector, | ||
| zoneUuid: this._zone, | ||
| detectorUuid: this.detector?.uuid, |
There was a problem hiding this comment.
Minor: serialization now uses this.detector?.uuid, but ScoringOutput.getTakenDetector() still returns the raw _detector. So ScoringManager.getTakenDetectors() keeps listing deleted detector uuids. It's harmless today, but the two views now differ. Consider this.detector?.uuid ?? null there, unless the raw uuid is kept on purpose for undo.
There was a problem hiding this comment.
Fixed. getTakenDetector() now returns this.detector?.uuid ?? null. The raw _detector is still kept for undo
…g-detectors-and-filters
…g-detectors-and-filters # Conflicts: # src/ThreeEditor/Simulation/Scoring/ScoringOutput.ts
…g-detectors-and-filters # Conflicts: # src/WrapperApp/components/InputEditor/InputEditorPanel.tsx

Closes #2316, closes #2027, closes #320. Part of #2542.
A missing or deleted detector, zone or filter made the converter crash with a generic "Error while converting input files". FLUKA and Geant4 silently dropped the output or the quantity instead.
UI
trace/traceFilteris not touched: no UI sets it and the converter ignores it.Converter (yaptide/converter#282)
Tested: 25 new UI unit tests and 26 converter tests. All examples generate the same files as on master. Undo works. E2E tests pass.