Repository navigation
Add Target::can_emit capability query; registry generator uses it (#137) - #158
Conversation
96f8ffe to
f171de4
Compare
…e (shared with emit_compute_function)
…emit agrees (main #15)
# Conflicts: # src/targets/moose_material.cpp # tests/CMakeLists.txt
…orted; agreement test over all targets; registry summary line
…ing emitted + ctests; keep tensor-state diagnostic order
# Conflicts: # src/targets/moose_material.cpp # tests/CMakeLists.txt
# Conflicts: # src/targets/numsim_material.cpp
C++ reviewVerdict: the design (shared rejection reasons) was sound but Findings
Own regression caught on the way: hoisting the tensor-state check ahead of the passes changed the diagnostic that #119's tests pin ( Checked and held up
Outside this PRnone. Final
Note on the PR description: it still says an all-skipped run exits 0; with these changes it exits 3 (as in #149). |
Closes #137. Also resolves #135's symptom (see note).
Target::emitpreconditions were discoverable only by catchingstd::runtime_error. New API:Each target's up-front scope guards are extracted into one shared rejection function (
scope_rejection/rate_scope_rejection/residual_scope_rejection) used by BOTHcan_emit(unexpected) andemit(throw) — message text single-sourced, byte-equality pinned by tests. Documented limit: can_emit success ≠ emit success (emit-time validation may still throw); covered by an explicit test.recipe_registry_gennow queriescan_emitand printsSKIPPED (<reason>)with no catch around emit — unexpected exceptions stay crash-loud. Verified:numsim_materialtraverses all 6 recipes with per-recipe reasons and exits 0 (previously aborted on the first);standaloneemits all 6.Supersedes PR #149 (the interim blanket-catch fix for #135) — recommend closing #149 unmerged; if #149 merges first, this branch's registry-gen hunk conflicts trivially. One semantic difference vs #149: all-recipes-skipped exits 0 here (a query-based skip is not an error) vs #149's exit 3 — happy to flip if you prefer the nonzero signal.
Tests: new CanEmitTest.cpp (9 tests: accept/reject per target, reason==throw-message equality, polymorphic use via make_target, the NaN-default "success ≠ emit success" case). gcc-14 Debug (-Werror): ctest 331/331. Based on current main (86e1862).