Add Target::can_emit capability query; registry generator uses it (#137) - #158
Open
petlenz wants to merge 1 commit into
Open
Add Target::can_emit capability query; registry generator uses it (#137)#158petlenz wants to merge 1 commit into
petlenz wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).