Skip to content

fix(python): retain typed fields across file boundaries - #2498

Merged
DeusData merged 2 commits into
mainfrom
fix/issue-1277-py-crossfile-fields-v2
Oct 4, 2026
Merged

DeusData merged 2 commits into
mainfrom
fix/issue-1277-py-crossfile-fields-v2

Conversation

@DeusData

@DeusData DeusData commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

Python receiver resolution loses the declared types of instance fields when the class is imported from another file. Export annotated fields during extraction, preserve them through compacted results, resolve their project types in the cross-file pass, and register them before the shared Python registry is sealed. This covers class-body annotations, annotated self assignments, and assignments from annotated constructor parameters; unannotated assignments stay unresolved.

Refs #1277. Imports inside if TYPE_CHECKING: remain a separate follow-up. Existing indexes need rebuilding. Thanks to @Enferlain for the reproducer and analysis.

Writable per-file registry overlays copy the field-type pointer array before refining an existing field. This preserves the sealed shared registry and prevents it from retaining pointers into a released per-file scratch arena. Coverage checks shared-state preservation before scratch release, resolution from a later overlay, and both sequential and forced-parallel indexing.

Validation: the latest ownership correction is source-reviewed; local builds, tests, and revert checks were waived for this continuation and have not been run on this revision. GitHub CI must validate the new revision. Earlier native green results apply to the preceding revision. Its GitHub run failed the typed-field regression and reported a sanitizer abort; source review found the shared-array ownership defect corrected here.

Carry declared instance-field types through extraction and result
compaction into the shared Python type registry so chained calls through
imported classes resolve their receiver types.

Refs #1277

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Copy inherited field-type pointer arrays into the writable registry arena
before Python refines an existing field. Keep shared type objects intact
and avoid retaining per-file scratch types in the sealed fallback.

Add deterministic shared-state and later-overlay coverage, retaining the
sequential Python field regression and adding a forced-parallel variant.

Refs #1277

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData

DeusData commented Oct 3, 2026

Copy link
Copy Markdown
Owner Author

Checkpoint and handover (2026-10-03 UTC)

Published head: bf2daa36036745b6b4bac5b118cd2ba778efa30c. The remote head was verified.

The latest correction detaches the mutable field_types pointer array when creating a writable overlay, preventing mutation of the shared registry. Added coverage checks shared-element identity and a fresh overlay after scratch release; the three-file fixture remains sequential and the larger fixture explicitly reaches the parallel path. This correction has source review but no new local runtime verification. TYPE_CHECKING imports remain excluded. #2514 depends on this work.

Hosted snapshot at 2026-10-03 21:54:10 UTC: 1 in progress, 14 queued, 3 skipped, 20 success. Confirm the required checks on this exact head before treating it as ready.

No additional local build, test, lint, sanitizer, benchmark or CI runs were performed at this checkpoint, as requested. Earlier executed evidence remains historical; prepared tests and the newer source-reviewed changes must still be validated by the hosted gate.

The campaign is paused at the maintainer’s request. Local monitoring has stopped; hosted jobs remain running. No merge was performed. Thanks for reviewing this change.

@DeusData
DeusData merged commit dffec08 into main Oct 4, 2026
40 checks passed
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