refactor: dataclasses cleanup — off-wire @dataclass removals, NamedTuple upgrades, frozen DispatchOptions#949
Conversation
…le upgrades (Phases 1-4) - Phase 2: bare-tuple returns -> NamedTuple (StructureNameAndRefine, CrossPackageRef) - Phase 3: off-wire stdlib dataclasses -> per-site forms: _EventLogContext (NamedTuple), ErrorPagesReport + VariableReference (pydantic dataclass), CustomClassInfo (frozen BaseModel) - Phase 4: RegistrationFailure -> frozen BaseModel (type-distinct from its tuple union arm) - Only DispatchOptions (Phase 5) remains a stdlib dataclass - Ledger: form-selection guide rewritten (pydantic dataclass first-class off-wire); perf phase dropped Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…old-start handoff Phases 1-4 landed in 72e1800; record that and keep NEXT ACTION = Phase 5. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…Phases 5-6) Convert the last stdlib @DataClass in pipelex/ (DispatchOptions in config_temporal.py) to a frozen pydantic dataclass, completing HARD RULE 1 of the data-class refactor (zero stdlib @DataClass remain in pipelex/). An `else: RetryPolicy = Any` runtime binding on the TYPE_CHECKING guard keeps the module importable and constructible without the optional `temporal` extra (the retry_policy field annotation resolves to Any at runtime); type checkers still see the real temporalio RetryPolicy. Add a subprocess regression test that blocks temporalio, then imports config_temporal and constructs a DispatchOptions -- complementing the existing AST optional-dep scan, which would not catch a revert to a bare forward ref. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…old-start handoff Reflect that the Phase 5/6 work landed as 326d323 (committed + pushed), and record the post-implementation code-review doc fixes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Resolves one conflict in pipelex/reporting/reporting_manager.py: combines dev's runtime pathlib.Path import + Path() call-site wrapping (#948) with this branch's _EventLogContext NamedTuple conversion, dropping the now-unused TYPE_CHECKING guard. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR cleans up internal data holder types and broadens Temporal payload conversion. The main changes are:
Confidence Score: 4/5This is close, but the dependency wiring should be fixed before merging.
Important Files Changed
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
pyproject.toml:58
**Avoid local dependency source** This PR adds Temporal support that depends on kajson 0.6.0 behavior, but the committed project metadata still declares `kajson==0.5.0` while overriding it with an editable `../kajson` checkout. A normal checkout of this repo without that sibling directory can fail to sync from the lockfile, and installs that follow the declared dependency can still get kajson 0.5.0, so the new dataclass payload path can run against the old serializer behavior. Please publish/bump the runtime dependency to the required kajson version and avoid committing the repo-local editable source as the way this feature is enabled.
Reviews (1): Last reviewed commit: "Merge branch 'dev' into refactor/Datacla..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5c690f49ce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
1 issue found across 16 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
The [tool.uv.sources] git rev already resolves to kajson 0.6.0, but the declared constraint still said ==0.5.0. Brings the metadata in line with reality so the version mismatch can't bite a pip/PyPI consumer once 0.6.0 ships to PyPI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…d refactor doc kajson 0.6.0 is now published to PyPI, so remove the [tool.uv.sources] git pin and resolve kajson==0.6.0 from the registry — closing the release gate that the dataclass refactor depended on. Also adds wip/dataclass-refactor-story.html, a co-developer walkthrough of the data-class best-practices refactor: the per-site form-selection guide and the Temporal payload converter widening (pydantic dataclasses now wire-legal, BaseModel path byte-identical). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
@dataclassusage on off-wire data shapes with the lowest-churn correct form per site: plainNamedTupleupgrades for simple value tuples, and a frozen pydantic dataclass forDispatchOptions.@dataclassdecorators (Phases 1-4) and converts simple internal contexts (e.g.ReportingManager._EventLogContext) toNamedTuple.DispatchOptionsto a frozen pydantic dataclass (Phases 5-6).dev(pathlib.Path refactor refactor: use pathlib.Path for filesystem path handling #948); the single conflict inpipelex/reporting/reporting_manager.pywas resolved to combine the runtimePathimport +Path(...)call-site wrapping with the_EventLogContextNamedTupleconversion.Test plan
make agent-check— ruff, Pyright (0 errors), Mypy (clean)make tb— boot/config sanitymake agent-test— full unit suite passes🤖 Generated with Claude Code
Summary by cubic
Cleans up off‑wire data shapes by removing stdlib
@dataclassand making types explicit, and widens Temporal serialization so Pydantic dataclasses round‑trip with type preservation. Also pinskajsonto 0.6.0 from PyPI.New Features
BaseModelPayloadConverterthroughkajsonwith type preservation.Refactors
NamedTuple(StructureNameAndRefine,CrossPackageRef) and converted simple internal contexts toNamedTuple.DispatchOptionsto a frozen Pydantic dataclass; kepttemporaliooptional by bindingRetryPolicy = Anyat runtime.ErrorPagesReportandVariableReferenceto Pydantic dataclasses;CustomClassInfoandRegistrationFailureto frozenBaseModel.kajson==0.6.0from PyPI (dropped git source). Addedwip/dataclass-refactor-story.htmlwith context on form selection and the converter change.Written for commit e724a17. Summary will update on new commits.