Skip to content

2316, 2027, 320 Explain missing detectors, zones and filters before conversion - #2573

Open
martastn wants to merge 9 commits into
masterfrom
2027-explain-missing-detectors-and-filters
Open

martastn wants to merge 9 commits into
masterfrom
2027-explain-missing-detectors-and-filters

Conversation

@martastn

@martastn martastn commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Generate from Editor and Start simulation now check the project first and list what to fix.
  • Other converter errors show their message in the snackbar.
  • Only references that still exist are saved. Undo of a deletion still restores them.
  • A quantity whose filter is missing keeps Filter checked after reload. Before, it silently scored all particles.
  • Start simulation is disabled and lists the problems under the button. Generate from Editor lists them in a snackbar.
  • Saved projects with Filter checked and no filter picked now load with Filter still checked and must be fixed before running. Before, they ran without a filter.
  • trace/traceFilter is not touched: no UI sets it and the converter ignores it.

Converter (yaptide/converter#282)

  • Errors name the output and the quantity instead of a bare uuid, in SHIELD-HIT12A, FLUKA and Geant4.
  • FLUKA and Geant4 no longer drop outputs or quantities whose detector or filter was deleted or that have no detector selected.
  • FLUKA zone outputs now fail with a clear message instead of being skipped (FLUKA conversion has no zone scoring).
Output without a detector 1-output-without-detector
Deleted detector (Snowman) 2-deleted-detector-snowman
Deleted filter 3-deleted-filter
Geant4 dropped the output silently 5-geant4-deleted-detector
Zone output in SHIELD-HIT12A (converter message) 8-zone-output-shieldhit

Tested: 25 new UI unit tests and 26 converter tests. All examples generate the same files as on master. Undo works. E2E tests pass.

@martastn martastn self-assigned this Nov 28, 2026
@martastn
martastn marked this pull request as ready for review December 3, 2026 10:30

@grzanka grzanka 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.

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 })

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.

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.

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.

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;

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.

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.

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.

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 (

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.

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.

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.

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 (

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.

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.

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.

Fixed by the change above

?.split('\n')
.map(line => line.trim())
.filter(Boolean)
.at(-1);

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.

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.

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.

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,

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.

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.

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.

Fixed. getTakenDetector() now returns this.detector?.uuid ?? null. The raw _detector is still kept for undo

@grzanka

grzanka commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

why do you modify converter here ?

image

This branch has not been deployed

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

Labels

None yet

Projects

None yet

2 participants