fix(python): retain typed fields across file boundaries - #2498
Conversation
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>
|
Checkpoint and handover (2026-10-03 UTC) Published head: 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. |
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
selfassignments, 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.