Skip to content

Expose declared type resolution and use init capability for fields - #25

Draft
trissim wants to merge 3 commits into
mainfrom
fix/public-declaration-types
Draft

trissim wants to merge 3 commits into
mainfrom
fix/public-declaration-types

Conversation

@trissim

@trissim trissim commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

The registered resolver is now the public normalization owner. Dataclass constructor discovery uses field.init instead of name spelling. ObjectState declaration compilation depends on this public API. Local verification: 64 targeted annotation, declaration-error, analyzer and public resolver tests passed. No install performed.

Production consumer — board review by alarm-shape, 2026-10-29

ObjectState #62 at 9c7f05a88108f23951a4953a43f43c738f221db0 imports this PR’s public resolve_declared_type in src/objectstate/declarations.py:12 (used at line247) and context_manager.py:31 (used at line195), with further declaration consumers in that same head. Its docs/declared-field-state.md:37 explicitly names this normalization owner. Fresh python-introspect main f2876b9 does not export it; all three commits here remain unique against that main.

This is a real provider for that consumer, not superseded work. Qualify the matched provider/consumer before the consumer lands. This board pass ran no tests or installs and grants no source or application approval.

@trissim

trissim commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Checkpoint c4e015d: annotation validation now reads declared values through their getters, without a default or annotation fallback. This fixes validation of effective inherited values without accepting literal null for nonnullable fields. 78 focused validation/analyzer tests pass, including original getter-exception identity. The real source-paired OpenHCS PipelineConfig constructor now succeeds. P44 remains unfinished; cooperative post-init composition is the next change in this same batch.

@trissim

trissim commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Fresh direct-task checkpoint addressing the source-plan roster/C3 review; this does not resume the blocked P44 goal or claim final P44 acceptance.

Published source pairing:

Ownership and deletions:

  • _SourceBindingPlanBase iterates dataclasses.fields(self), indexes each resolved annotation, admits its raw member through ValueDeclaration, normalizes data through that declaration and validates the result. Inherit/Unset remain directives via member behavior, not flag tests.
  • SequenceDeclaration owns declared list/tuple shape conversion; NullableDeclaration composes it without interpreting payload shape. Object-annotated sequence payloads remain opaque.
  • Only actual extra behavior is field-declared under SourceFieldTransform: bindings uniqueness/coercion, grouping cleanup, metadata schema merge and stack components. Validated transforms consume validated input; coercing transforms validate their output. No string-name normalization roster remains.
  • Both normalization and annotation-validation mixins call super().__post_init__(). DataclassPostInit is their shared cooperative endpoint. Deleted SourceBindingsConfig.__post_init__, CompiledSourceBindingPlan.__post_init__, _normalize_field, _tuple_values, _validate_field_value, and obsolete forwarding helpers/imports.

NRA source evidence: 54 relevant production modules across ObjectState, FormBridge, PyQt, python-introspect and OpenHCS parsed; zero parse errors. Before/after source-plan roster calls: source_bindings.py 5→0, config.py 5→0. Explicit named-parent post-init calls: 2→0. Declaration, inheritance, write/check/call and consumer sites are retained at /home/ts/.cache/agent-scratch/objectstate-declared-fields/declared-source-plan-nra.json. Syntax is not proof of dynamic alias resolution; actual C3 is separately exercised below.

Verification:

  • 79 python-introspect focused tests passed, including getter-owned validation/error identity and a cooperative trailing preparation capability.
  • 57 ObjectState focused tests passed, including declaration shape normalization and opaque scalar payloads.
  • Seven direct source-paired application API checks passed: raw directives, both source-plan owners' normalization/rejection, compiled directive rejection, shared declarations and real PipelineConfig construction with inherited Napari colormap gray.
  • Additional real application API checks passed: a new declared field normalizes/validates with no roster edit, a field-declared transform executes, an additional C3 capability executes once after normalization, and compiled annotation validation still rejects directives. Actual MRO: CooperativePlan → CompiledSourceBindingPlan → SourceBindingDeclarationsMixin → _SourceBindingPlanBase → AnnotatedDataclassValidationMixin → TrailingInit → DataclassPostInit → ABC → object.
  • Added corresponding OpenHCS unit regressions; OpenHCS pytest itself remains gated by this checkout's previously reported unbuilt native extensions. No skip, gate bypass, installation, full-suite or full P44 claim. All three PRs remain drafts.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant