Repository navigation
L6: code generation owned by pycodify and objectstate.codegen - #1198
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OpenHCS deletes its copies of generic source-generation mechanisms: - openhcs/core/python_source_literal.py: FunctionReference subclasses pycodify.PythonSourceLiteral (one source_fragment method). - openhcs/serialization/source_path_factoring.py: path factoring is built into pycodify.generate_python_source; the six document renderers call it. - EnumMemberFormatter, AxisDeclarationFormatter, OpenHCSImportableTypeFormatter, NameMappingLookup: pycodify.imported_name and TypeFormatter. - The LazyDataclass formatter and FunctionStepCleanModeFieldPolicy: objectstate.codegen. - OpenHCSCallableFormatter no longer writes repr() for a callable it cannot reference; it raises. tests/unit/test_source_round_trip.py writes every registered config dataclass (lazy and base) with every field set, and a pipeline document with every function-pattern shape, then loads the source back and compares raw values. It found base configs losing inheritance in full mode (fixed in ObjectState). Submodules point at the pycodify 0.2.0 and ObjectState 2.1.0 branch heads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Submodule pycodify at the branch head with native-path factoring tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Surface L6 (receipt). Pipelines persist as pycodify-generated
.pyfiles, so code generation is the persistence format.Library PRs to release first, in this order:
Pins are raised here:
pycodify>=0.2.0,<0.3,objectstate>=2.1,<3. The submodules point at the two branch heads.Deleted from OpenHCS (now owned by the libraries)
openhcs/core/python_source_literal.py:FunctionReferencenow subclassespycodify.PythonSourceLiteral, which has onesource_fragmentmethod.openhcs/serialization/source_path_factoring.py: path factoring is built intogenerate_python_source, and the six document renderers call it directly.EnumMemberFormatter,AxisDeclarationFormatter,OpenHCSImportableTypeFormatterandNameMappingLookup: replaced bypycodify.imported_nameandTypeFormatter.FunctionStepCleanModeFieldPolicy: replaced byobjectstate.codegen.repr()catch inOpenHCSCallableFormatter: an unreferenceable callable now raises instead of saving<function f at 0x…>.Round-trip test (
tests/unit/test_source_round_trip.py) runs four checks:StreamingConfig), with every field set to a non-default value derived from its annotation. This covers axis classes, thePartitionFilterModefamily, partition filters, nested source-binding records and paths.(callable, kwargs), a declared path kwarg, nested-enum kwargs (CropModule.Shape), hidden runtime kwargs, chain, and a dict by group. It asserts thepath_rootfactoring.Each check loads the source back and compares raw values.
It found one real bug: base configs that inherit through
None(StepPartitionFilterConfig,PathPlanningConfig, the streaming configs and others) were written with their resolved values in full mode, so a savedGlobalPipelineConfigstopped inheriting. The fix is in ObjectState#28. I checked that the test fails without it.Guards (
tests/unit/test_l6_codegen_guards.py):can_formatclaimsEnum,Path, classes,PythonSourceLiteralor lazy dataclasses.__qualname__.partitionor_explicitly_set_fieldsappears underopenhcs/.well_filterappears in ObjectState sources.Deletion certificates
imported_name,PythonSourceLiteral,PathFactoringandobjectstate.codegen.FormatContext.extensionsandgenerate_python_source(context=). Their only user was OpenHCS path factoring, which moved into the library.repr()outputs, which never loaded back.Checks run locally
openhcs,scriptsandbenchmark: no increases (5 counts decreased).nra-r1:increased: [].L6 · PR #1198 · guards 4/4 · production −591 +43 · tests −215 +419
🤖 Generated with Claude Code