#1 [high] Should fix: project-package prefix allowlist duplicated in forward_metadata and rebuild_manifest, and only one copy extended
PR #574 changes _uses_custom_object_state (ignition/preparation/forward_metadata.py:39-45) from
type(value).__module__.startswith(('ignition.', 'b12x.')) to
... ('ignition.', 'b12x.', 'hyperflare_recipes.').
Closest precedent / duplicate: ignition/preparation/rebuild_manifest.py:365 in weight_views:
elif type(value).__module__.startswith(('b12x.', 'ignition.')) and hasattr(value, '__dict__'):
— same construct (hasattr dict + module-prefix allowlist) encoding the same "our packages" policy, and it was NOT updated. There is no shared helper or constant: grep for the prefixes returns exactly these two sites (startswith(('ignition. / "'b12x.")).
Why it matters: weight_views feeds rebuild_weights_metadata (rebuild_manifest.py:441-459) for the legacy (non-WeightDeclaration) roots path used by runtime_core.py:130 and :368. A hyperflare_recipes.* container holding tensors reached through plain __dict__ is still not traversed there, so its tensors are silently reported in unavailable — the same class of "core doesn't know external recipe objects" defect the PR fixes for guard pickling, left unfixed on the sibling path. (The declared declare_weights/WeightDeclaration path at rebuild_manifest.py:118-215 is unaffected, which is why it isn't blocking.)
Fix: one module-level constant/predicate, e.g. PROJECT_MODULE_PREFIXES = ('ignition.', 'b12x.', 'hyperflare_recipes.') plus def is_project_object(value), in one place (forward_metadata or a small shared module), consumed by both sites. Then a new external package prefix is added once, and a test can assert both paths agree (the new test only covers the guard pickler).
#2 [high] Should fix: hardcoded recipe-package name departs from the repo's registered-source-roots mechanism for external recipe packages
Established pattern for external recipe packages in core ignition is declarative registration, not a name allowlist:
- ignition/registry.py:24-41
_ACTIVE_RECIPESContextVar +active_recipes();current_recipes(). - ignition/preparation/source_identity.py:12-25
_EXTRA_ROOTSContextVar +source_roots(roots=()), explicit "so multi-host ranks verify identical recipe code" for any external recipe package. - ignition/cli/init.py:367-373
main(..., recipes=(), source_roots=())binds both. - AGENTS.md:379-393: "external recipe repositories can pass their own
Recipetuples directly toignition.cli.main(...)" and "Coreignitionmust never importhyperflare_recipesor introduce a plugin discovery framework."
PR #574 instead hardcodes the literal string 'hyperflare_recipes.' in core ignition (forward_metadata.py:42). Consequence: any other external recipe package — which the project explicitly supports via recipes=/source_roots= — hits the identical PicklingError: Can't pickle ... CompiledKernel that this PR fixes for hyperflare_recipes. The fix generalizes one package, not the mechanism, and there is no documented reason hyperflare_recipes is privileged over another registered package.
Fix options, cheapest first: (a) derive the treated-as-project module roots from the active recipes (e.g. the __module__ roots of current_recipes() / registered source_roots) instead of a literal, keeping the string check so core still imports nothing; (b) if a literal is kept, put it in one named constant with a docstring stating the rule and update docs/preparation-development.md. Either way, note that the new test hardcodes the same literal (tests/preparation/test_guard_code.py:281), so the test cannot notice a second external package.
#5 [high] Verification addendum: refinements to findings 1–3 from second read
Re-read of PR #574 head 16ffc6f (diff = forward_metadata.py:42 one-token change + 53-line test). Refinements to notes #1–#3.
A. Finding #1 (rebuild_manifest.py:365) — better fix, new precedent cited.
The repo already has a declarative mechanism for external weight-container types in exactly this traversal: CONTAINER_FIELDS / CONTAINER_TUNED (rebuild_manifest.py:29-38) with declare_container_fields (:41-46) and the @weight_container class decorator (:49-64), keyed by exact __module__.__qualname__ type key. rebuild_manifest.py:10-15 states the intent: "Recipes declare semantic weight groups explicitly with declare_weights… Object traversal only enumerates the resulting views". So weight_views's module-prefix branch (:365) is the legacy/undeclared path, and the intended answer for an external container is a declaration, not a longer prefix tuple. Therefore my earlier fix ("one shared constant consumed by both sites") is only correct if maintainers keep the prefix heuristic at all; the honest recommendation is: (i) at minimum, do not leave the two copies divergent — hoist one constant/predicate; (ii) preferably, state that the hyperflare_recipes container should arrive as declare_weights(...)/weight_container(...) (rebuild_manifest.py:86-106) and note the legacy path is the only one affected.
Confirmed in code that nothing is "reported unavailable" there: weight_views hits else: return (rebuild_manifest.py:368-369), so such a container is neither in tensors nor in unavailable, i.e. silently dropped (contrast the module docstring at :13-15). Not blocking: isinstance(roots, WeightDeclaration) early-returns to _declared_metadata (rebuild_manifest.py:445-446), and the only in-repo legacy caller passes a plain dict of tensors (helios/tests/runtime_core_fixture.py:186).
B. Finding #2 (hardcoded 'hyperflare_recipes.' at forward_metadata.py:42) — extra evidence from the boundary test.
tests/preparation/test_core_boundary.py:43-46 forbids only imports of hyperflare_recipes in ignition/**.py, but :66-84 forbids the bare text hyperflare_recipes anywhere in helios/src, helios/tests, heliopause/src and its Cargo/pyproject. The new literal is now the only occurrence of the string in ignition/ (search over ignition/ returns just forward_metadata.py:42) — first textual mention of the recipe package inside core Python. Consistent with AGENTS.md:392-393 ("Core ignition must never import hyperflare_recipes…"), but a maintainer who later applies the same textual standard to Python would trip on this line; that is an argument for schema-free derivation or a named constant, not for a bare literal inside a boolean.
Also, note AGENTS.md:188-193 rejects "frameworks, extension points, speculative compatibility" — so the low-churn fix is (b) one named constant with a docstring, not (a) a new registration mechanism. Present (a) as a maintainer design question only.
C. Nit added to note #3: the new test is a third copy of the compile→serialize→deserialize boilerplate.
Copies of torch.compile(_execute, backend=lambda graph, inputs: GraphModuleSerializableCallable(graph), fullgraph=True, dynamic=False).aot_compile(((forward,), {})) + type(compiled).serialize(...).serialized_data + type(compiled).deserialize(data) exist at tests/preparation/test_guard_code.py:37-44, :237-244, and now :289-296 (plus the same idiom in tests/preparation/test_runtime_dynamo.py:37-40). Extracting _serialized(_execute, forward) and using it in the two _guard_serialization tests would have been the smaller diff and matches the file's own habit of factoring _roundtrip_guard (:91-100).
D. Note (verified, not a finding): the changed predicate has two consumers, and the PR tests one.
_uses_custom_object_state is called by the guard pickler (aot.py:155-166) and by the forward-metadata pickler (forward_metadata.py:277, gated on hasattr(type(value),'__getattr__')). The one-line change therefore also widens _ForwardPickler (forward_metadata.py:172-279) for hyperflare_recipes types that define __getattr__; CompiledKernel already has its own _Unavailable branch at :248-257, so the blast radius is small, but the new test only covers the guard path. A one-line addition to tests/preparation/test_unavailable_resources.py (which already tests forward_metadata.dumps/loads) would cover the second consumer.
E. Test is discriminating (verified): without the new prefix _GuardPickler would fall through to default pickling of _RecipeKernelOwner and raise on _UnpicklableHandle.__reduce__ (test_guard_code.py:252-254), so the test genuinely fails pre-change. Nothing to flag.
F. Confirmed still clean: no __getstate__ requirement added (only pre-existing ignition/runtime_patches/static_triton.py:45,143 use it); no duplicate helper added; the predicate stays import-free so tests/preparation/test_core_boundary.py:39-47 passes.
#6 [high] Report of 2026-11-28 (final, supersedes #1–#4): should-fix duplication + hardcoded recipe package literal
Review of PR #574 — Conventions and duplication lens (final, supersedes notes #1–#4)
Scope read at head 16ffc6f: full diff (2 files, +54/−1); ignition/preparation/forward_metadata.py in full context (1-20, 20-60, 160-303); ignition/preparation/aot.py:90-175 (_GuardPickler, _guard_object); ignition/preparation/rebuild_manifest.py:1-120, 118-220, 320-380, 420-492; ignition/preparation/runtime_core.py:100-145, 340-378; ignition/registry.py:1-50; ignition/preparation/source_identity.py:1-111; ignition/cli/__init__.py:360-385; ignition/declaration.py fields; tests/preparation/test_guard_code.py in full; tests/preparation/test_core_boundary.py in full; tests/preparation/test_aot_guards.py; tests/preparation/test_unavailable_resources.py; helios/tests/runtime_core_fixture.py:170-200; tests/preparation/test_runtime_core.py:290-335; tests/preparation/test_compile_pool.py:200-310; AGENTS.md (1-40, 60-155, 155-215, 330-400); docs/design-review.md:30-80; docs/preparation-development.md (125-160, 368-400).
Verdict: should-fix issues only. No blocking defect in this lens: the one-line predicate change is correct and stays inside the "no hyperflare_recipes import" boundary (tests/preparation/test_core_boundary.py:39-47; AGENTS.md:392-393), and the new test is discriminating (without the prefix, _GuardPickler falls through to default pickling of _RecipeKernelOwner and _UnpicklableHandle.__reduce__ raises, test_guard_code.py:252-254).
Should fix
1. The "project module prefix" policy is written twice; the PR extends one copy, leaving them divergent
ignition/preparation/rebuild_manifest.py:365 (weight_views) still reads
elif type(value).__module__.startswith(('b12x.', 'ignition.')) and hasattr(value, '__dict__'):
while the PR changed only ignition/preparation/forward_metadata.py:39-45 to
startswith(('ignition.', 'b12x.', 'hyperflare_recipes.')).
A repo-wide search for this construct returns exactly these two sites, and there is no shared constant or predicate (searches for PROJECT|_OWN_MODULES|is_project|startswith(('ignition. return nothing else). The tuples even order their entries differently, which shows they are independently maintained copies.
Why it matters: weight_views is the undeclared-roots path feeding rebuild_weights_metadata (rebuild_manifest.py:441-459), called at runtime_core.py:130 and :368. A hyperflare_recipes.* container reached through plain __dict__ hits else: return (rebuild_manifest.py:368-369), so it is neither traversed nor listed in unavailable — silently dropped, contrary to the module docstring's promise (rebuild_manifest.py:13-15). Non-blocking because the declared path early-returns to _declared_metadata (rebuild_manifest.py:445-446) and the only in-repo legacy caller passes a plain tensor mapping (helios/tests/runtime_core_fixture.py:186).
Fix: hoist one constant/predicate used by both sites (e.g. PROJECT_MODULE_PREFIXES + is_project_object(value) in forward_metadata.py, imported by rebuild_manifest.py — no cycle: rebuild_manifest already imports only runtime_core_pb2, aot.py already imports from forward_metadata at :135,:155). Worth stating in review that the declarative alternative already exists in the same file — CONTAINER_FIELDS/declare_container_fields/@weight_container (rebuild_manifest.py:29-64) keyed by __module__.__qualname__ — so the long-term answer for an external container is declare_weights(...), not a longer prefix tuple (rebuild_manifest.py:10-15).
2. The literal 'hyperflare_recipes.' hardcoded in core ignition departs from the repo's declarative handling of external recipe packages
forward_metadata.py:42 is now the only occurrence of the string hyperflare_recipes anywhere under ignition/ (verified). Everywhere else external recipe packages are handled by registration, never by name: ignition/registry.py:24-41 (_ACTIVE_RECIPES, current_recipes(), active_recipes), ignition/preparation/source_identity.py:12-25,28-34 (_EXTRA_ROOTS, bind_source_roots; docstring: extra roots "for external recipe packages so multi-host ranks verify identical recipe code"), ignition/cli/__init__.py:367-375 (main(..., recipes=(), source_roots=())), and AGENTS.md:379-384 ("external recipe repositories can pass their own Recipe tuples directly to ignition.cli.main(...)").
Why it matters: any other registered external package holding an unguarded triton.compiler.compiler.CompiledKernel hits the identical PicklingError this PR fixes, because membership is decided by a literal rather than by what was registered. The new test hardcodes the same literal (test_guard_code.py:258, 281), so the suite cannot notice a second package. Not a boundary violation (no import), and AGENTS.md:188-193 rejects new extension points, so the low-churn remedy is a single named constant with a docstring stating the rule; deriving roots from current_recipes()/_EXTRA_ROOTS (both are ContextVars, and forward_metadata.py:25-27 already reads ContextVars) is the general fix but is a maintainer design call.
Nits
3a. tests/preparation/test_guard_code.py:277 — named test_guard_pickler_* but uses the serialize/deserialize pipeline of its sibling test_guard_serialization_roundtrips_tensor_user_attributes (:232-249), not the _GuardPickler unit helper _roundtrip_guard (:91-100) that the other four test_guard_pickler_* tests use. Rename to ..._test_guard_serialization_... or drive it through _roundtrip_guard.
3b. tests/preparation/test_guard_code.py:283 — mutates _RecipeKernelOwner.__module__ globally and never restores it, while the file's precedents use monkeypatch.setitem(sys.modules, ...) (:214; test_compile_pool.py:231,298) and monkeypatch.setattr for class attributes (test_compile_pool.py:232). monkeypatch.setattr(_RecipeKernelOwner, '__module__', module_name) auto-restores; then the class-level literal at :258 is redundant.
3c. tests/preparation/test_guard_code.py:289-296 — third verbatim copy of the compile→serialize→deserialize boilerplate (:37-44, :237-244, plus test_runtime_dynamo.py:37-40). Factoring a _serialized(...) helper (the file already factors _roundtrip_guard) would have been a smaller diff.
Verified clean
- No new helper duplicates an existing one;
_GuardPickler(aot.py:102-166) and_uses_custom_object_stateare reused unchanged apart from the prefix tuple, and no__getstate__workaround is introduced (only pre-existing runtime_patches/static_triton.py:45,143 use__getstate__). - Boundary convention respected: no import; the synthetic
types.ModuleTypeavoids importinghyperflare_recipesin tests too (test_core_boundary.py:50-58). Note the string is now the first textual mention of the package in core Python; test_core_boundary.py:66-84 only forbids the text in Rust/Heliopause trees, so nothing breaks. - PR description follows AGENTS.md:72-113's four-question order and carries the required
Discord: wooofletline (AGENTS.md:142-153); the caveat about rebuild_manifest.py:365 is disclosed honestly.
Settled only by a test / outside this repo
- Whether the second consumer of the widened predicate needs coverage:
_uses_custom_object_stateis also used by_ForwardPickler(forward_metadata.py:277, gated onhasattr(type(value),'__getattr__')), so the change silently widens forward-metadata pickling forhyperflare_recipestypes defining__getattr__; the new test covers only the guard path. A two-line case in tests/preparation/test_unavailable_resources.py (which already round-tripsforward_metadata.dumps/loads) would settle it. - Whether a
hyperflare_recipes.*container with tensors ever reaches the legacyweight_viewspath (finding 1) depends on recipe code outside this repo; a round-trip throughrebuild_weights_metadatawould settle it. - The PR's own request stands: run
tests/preparation/test_guard_code.pyandtest_core_boundary.pyon16ffc6f(no checks recorded on the head commit).
#7 [high] Research summary
Reviewed PR #574 at head 16ffc6f through the conventions-and-duplication lens. Every changed file was read in context (forward_metadata.py in full, aot.py:90-175, rebuild_manifest.py traversals, runtime_core.py callers, registry.py, source_identity.py, cli/__init__.py:360-385, the whole of test_guard_code.py and test_core_boundary.py, AGENTS.md, docs/design-review.md, docs/preparation-development.md). The full report is scratchpad entry #6 (refinements and extra evidence in #5).
Verdict: should-fix issues only; nothing blocking in this lens. The one-token predicate change is correct, keeps core ignition free of any hyperflare_recipes import (so test_core_boundary.py:39-47 stays green), and the new test is genuinely discriminating — without the added prefix, _GuardPickler falls through to default pickling and _UnpicklableHandle.__reduce__ raises.
Should fix (2):
- The "which
__module__prefixes are project code" policy is written twice and the PR extends only one copy:rebuild_manifest.py:365still checks('b12x.', 'ignition.')whileforward_metadata.py:42now checks three prefixes (the tuples even order their entries differently). No shared constant or predicate exists anywhere. On the undeclaredweight_viewspath ahyperflare_recipes.*container hitselse: return, so it is neither traversed nor listed inunavailable— silently dropped. Non-blocking because the declaredWeightDeclarationpath early-returns (:445-446). Also worth noting in review that the declarative mechanism already exists in that same file (CONTAINER_FIELDS/declare_container_fields/@weight_container,:29-64), so a longer prefix tuple is not the intended answer for an external container. forward_metadata.py:42is now the only occurrence of the stringhyperflare_recipesunderignition/, where the repo otherwise handles external recipe packages declaratively (registry.py:24-41,source_identity.py:12-34,cli/__init__.py:367-375, AGENTS.md:379-384). Any other registered external package hits the samePicklingError, and the new test hardcodes the same literal (test_guard_code.py:258, 281). Cheapest remedy: one named constant with a docstring, since AGENTS.md:188-193 rules out new extension points.
Nits (3): the new test is named test_guard_pickler_* yet uses the serialize/deserialize pipeline of its sibling rather than the _roundtrip_guard unit path; it mutates _RecipeKernelOwner.__module__ globally instead of monkeypatch.setattr and leaves a redundant class-level literal; and its compile→serialize boilerplate is a third verbatim copy in the file.
Noted but not raised as findings: the predicate has a second consumer (forward_metadata.py:277, _ForwardPickler, gated on __getattr__) that the new test does not cover; and the PR's request to record test_guard_code.py / test_core_boundary.py runs on 16ffc6f still stands, since the head commit has no checks.
#3 [medium] Nit: new test name and monkeypatch style diverge from the sibling test's precedent
Nit-level convention notes for PR #574, verified in code (the previous attempt to save this was rejected because only finish was then available):
-
Nit — new test name diverges from its closest precedent.
tests/preparation/test_guard_code.py:232hastest_guard_serialization_roundtrips_tensor_user_attributes, which uses_guard_serialization()+torch.compile(...).aot_compile+serialize/deserialize. The new test (test_guard_code.py:277) is namedtest_guard_pickler_strips_unguarded_attributes_from_recipe_objectsbut exercises exactly the same serialization pipeline, not the direct_GuardPicklerunit path used by_roundtrip_guard(test_guard_code.py:91-100, used by thetest_guard_pickler_*tests at 104/146/178/204). Fix: rename totest_guard_serialization_strips_unguarded_attributes_from_recipe_objects, or drive it through_roundtrip_guardif the pickler unit level is what is meant. -
Nit — the new test mutates a class attribute globally rather than through
monkeypatch. test_guard_code.py:283 does_RecipeKernelOwner.__module__ = module_nameand never restores it; the file's other tests usemonkeypatch.setitem(sys.modules, ...)(line 214) andmonkeypatch.setattrelsewhere in the suite (test_compile_pool.py:232), andmonkeypatch.setattr(_RecipeKernelOwner, '__module__', module_name)would auto-restore. Also note the class already carries a stale class-level default__module__ = "hyperflare_recipes.components.synthetic"(line 258) that is immediately overwritten by the test, so one of the two is redundant. -
Verified clean (no finding) in this lens:
- No new duplication of existing helpers: the PR adds no helper; it reuses
_GuardPickler(aot.py:102-166) and_uses_custom_object_state(forward_metadata.py:39), whose_Missingstripping at aot.py:157-165 is unchanged. - No import of
hyperflare_recipesis introduced, so tests/preparation/test_core_boundary.py:39-58 stays satisfied; only a string comparison changes (forward_metadata.py:42). Consistent with AGENTS.md:392-393 ("Coreignitionmust never importhyperflare_recipes"). - PR description follows AGENTS.md:72-153's four-part scheme and carries the required
Discord: wooofletline (AGENTS.md:142-153).
- No new duplication of existing helpers: the PR adds no helper; it reuses
Scratchpad entries: 1 (Should fix: prefix allowlist duplicated in forward_metadata.py:42 vs rebuild_manifest.py:365), 2 (Should fix: hardcoded hyperflare_recipes. literal vs the repo's registered recipes=/source_roots= mechanism), 3 (this nit note).
#8 [medium] Context facts for the report: PR conversation state and absent CI pytest coverage
Two context facts the final report should carry, both verified:
-
No maintainer/human input on the PR yet.
pr_commentsfor #574 returns only two bot messages: the case-file opening (2026-11-28 19:31) and the prior Autobot review (20:29, "Recommendation: Changes Requested", 1 blocker = tests never run on the rebased head16ffc6f, 0 should-fix, 1 nit). So no maintainer has yet ruled on (a) whether therebuild_manifest.py:365copy should be unified, or (b) whether a literal'hyperflare_recipes.'in core ignition is acceptable versus deriving prefixes from registration. Both of my should-fix findings are therefore design questions the PR author explicitly deferred ("intentionally left out of this 1-line PR unless maintainers want it included or replaced by a declared-root mechanism" — PR description caveat namingignition/preparation/rebuild_manifest.py:365). Worth saying plainly in the report: the author already flagged finding 1's site themselves; my findings add which other copy is stale and what data is lost there, plus the precedent for the declarative fix. -
Repository CI does not run
pytestfortests/preparation/. Searching.github/forpytestreturns no matches; the only workflows are.github/workflows/helios-lifecycle.yml,native-serving.yml, andrelease.yml. So the PR's caveat ("please run CI ontest_guard_code.pyandtest_core_boundary.py") cannot be satisfied by CI — the runs must be recorded manually on the head commit. This is the prior Autobot review's single blocker, and it is outside my lens (Conventions and duplication); I only note it so the report does not imply CI covers the new test.
Scope/metadata for the report header: PR #574, "Strip unguarded attributes from hyperflare_recipes objects in AOT guard serialization", author fordbmorris (association NONE, 3 open PRs, 0 merged), base main, head commit 16ffc6f, 2 files, +54/−1, no labels, no reviews, no checks on head. Changed files: ignition/preparation/forward_metadata.py (+1/−1), tests/preparation/test_guard_code.py (+53/−0).