Repository navigation
Conversation
ReviewClose to ready: one real problem with the Error log toasts, the rest are nits. CI is green. What I checked and found correct
Issues
Readability suggestions (optional) Writing the positive condition, giving it a name and negating it once makes these checks easier to follow: const ZONE_SIMULATORS = [SimulatorType.SHIELDHIT, SimulatorType.FLUKA];
const usesZones = ZONE_SIMULATORS.includes(simulator);
if (!usesZones) return undefined;const isPositiveNumber = (value: unknown) => Number(value) > 0;
const worldZoneHasSize = worldZoneSize.every(([, value]) => isPositiveNumber(value));
if (!worldZoneHasSize) {
const hasZones = zones.length > 0;
return hasZones
? 'Set the World Zone size: enter its dimensions or use Calculate to fit it to the zones'
: 'Set the World Zone size: enter its dimensions';
}(Keep const hasFigures = (zone: ZoneJSON) => (zone.unionOperations ?? []).flat().length > 0;
const zoneWithoutFigures = zones.find(zone => !hasFigures(zone));
const EMPTY_MATERIAL_ICRUS = [BLACK_HOLE_ICRU, VACUUM_ICRU];
const hasRealMaterial = materials.some(({ icru }) => !EMPTY_MATERIAL_ICRUS.includes(icru));
if (simulator === SimulatorType.SHIELDHIT && !hasRealMaterial) return '…';Verdict: approve once issue 1 is fixed; the rest are optional. |
| if (simulator !== SimulatorType.SHIELDHIT && simulator !== SimulatorType.FLUKA) | ||
| return undefined; |
There was a problem hiding this comment.
such logic conditions are undreadable to humans ....
There was a problem hiding this comment.
Fixed, the double !== is now ZONE_SIMULATORS.includes(simulator)
|
|
||
| if ( | ||
| simulator === SimulatorType.SHIELDHIT && | ||
| materialManager.materials.every( |
There was a problem hiding this comment.
Add good comments explaining the idea of each check. Are you sure that pure vacuum simulations are not possible in shieldhit12a ?
There was a problem hiding this comment.
Fixed, each check now has a comment saying what goes wrong without it.
About vacuum: yes, I'm sure. On the local backend, a pure-vacuum SHIELD-HIT12A simulation stops with Error: mat.dat seems to be empty in the Docker logs of the simulation worker.
|
Fixed:
|
| const { zoneManager, materialManager } = editorJson; | ||
| const zones: ZoneJSON[] = zoneManager.zones; | ||
|
|
||
| // A zone without figures has no shape: the job hangs until the 5-minute backend timeout. |
There was a problem hiding this comment.
this comment seems a bit weird, do you mean that "a project with empty zones (without any figures attached) is not supported by Fluka anD SHIELH-HIT12A, such simulation fails, therefore we detect that early here"
|
|
||
| // mat.dat gets every material except vacuum and black hole. With nothing else | ||
| // it is empty and SHIELD-HIT12A stops with "mat.dat seems to be empty". | ||
| const hasRealMaterial = materialManager.materials.some(isRealMaterial); |
There was a problem hiding this comment.
maybe you should place if SHIELDHIT before that hasRealMaterial, it doesn't make sense to run that check for Fluka
| if (simulator === SimulatorType.SHIELDHIT && !hasRealMaterial) | ||
| return 'SHIELD-HIT12A needs a material other than vacuum: add a zone or change the World Zone material'; | ||
|
|
||
| // A World Zone without size makes the job hang until the backend timeout. |
There was a problem hiding this comment.
again "make job hangs" is useless, say rather what simulators support
There was a problem hiding this comment.
Fixed, the comment now says that both simulators need a World Zone around the geometry, and that SHIELD-HIT12A hangs or stops with an error without one
| if (simulator === SimulatorType.SHIELDHIT && !hasRealMaterial) | ||
| return 'SHIELD-HIT12A needs a material other than vacuum: add a zone or change the World Zone material'; | ||
|
|
||
| // A World Zone without size makes the job hang until the backend timeout. |
There was a problem hiding this comment.
the backend timeout is a bug of backend, it should report immediately of a problem
| // Without outputs there are no result files and the job fails. | ||
| if (outputs.length === 0) return 'Add an output with a quantity in the Scoring tab'; | ||
|
|
||
| // One output without a quantity fails the whole SHIELD-HIT12A job. |
There was a problem hiding this comment.
the comment mentiones SHIELD-HIT12A , while the check seems to run for Fluka as well.
don't say about backend failing, mention how simulator behave
There was a problem hiding this comment.
Fixed, the comment now covers both: SHIELD-HIT12A stops with an error, and FLUKA gives no result for that output
| if (outputWithoutQuantities) | ||
| return `Add a quantity to output "${outputWithoutQuantities.name}" or remove the output`; | ||
|
|
||
| // A missing detector or zone gives a 500 on submit or a job stuck in RUNNING. |
There was a problem hiding this comment.
same here, no comments on the backend
There was a problem hiding this comment.
Fixed, the comment now only says how the simulators react
…andling-when-trying-to-simulate-an-empty-project

Closes #1600. Part of #2444.
Problem
An empty or incomplete project could be sent to the backend. There it failed with no explanation, hung for 5 minutes, or stayed RUNNING forever. Error log did not help either: the backend never stores log files, so it opened an empty tab and showed the same 404 toast three times.
Changes
findEmptyProjectReason: the run form checks the editor project before Start and shows the first missing piece under a disabled Start simulation:Screenshots