Skip to content

Fix Python XML nullable result declarations - #209

Open
leileizhang (lei9444) wants to merge 3 commits into
mainfrom
lei9444-fix-python-xml-nullability
Open

leileizhang (lei9444) wants to merge 3 commits into
mainfrom
lei9444-fix-python-xml-nullability

Conversation

@lei9444

@lei9444 leileizhang (lei9444) commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Some Windows.Data.Xml.Dom Python stubs promise non-null values that native APIs return as None. Both strict checkers accept XmlDocument().document_element.tag_name, but an empty document raises AttributeError.

Fix

Add nine exact reviewed XML null-result facts and seven documented-class → declaring-interface aliases through the unchanged MicrosoftDocs pin 8448d5eecfbc2ed903f659f350841dcb4888bc8b. Preserve class facts; validate exact CLR signatures, SDK declaring owners and ExclusiveTo relationships. Cover document root/DTD, node ownership/navigation, and attribute lookup/previous-attribute results, including namespace-aware variants.

No global nullable policy, native/runtime, JSON, JS projection, or release/version changes. Separate CI-only/test-harness commits fix the authorized unchanged audio-fixture formatting and isolate native SDK/source-stub checks; native signatures and bodies remain unchanged.

Verification

Independent base: de91e9b3889aafdda44098d5ea1b731f9976a3c6; head: 8da77328c86a9725047cf95365e05c6932c656c2.

Exact-head Build, coverage, and Python artifacts pass, including the enforced x64 XML native + strict mypy/Pyright step and full hosted codegen suite. Strict consumers reject exactly 20 unsafe accesses and accept guarded reads/nonnullable controls. Independently main-built CPython 3.13 ARM64 and x64 wheels cover empty/loaded/internal-DTD documents, detached/attached nodes, sibling boundaries, and missing/present/added/replaced attributes with explicitly boxed namespace URIs. Pinned extraction reproduces byte-identically twice.

Local Python: 631 passed, 14 known WinUI fixture skips; CI/extraction: 25 passed. All 296 generated JS/ESM/TypeScript declaration files and 372 Python runtime/--no-pyi modules are byte-identical; only 13 XML .pyi modules change.

Limitations

The local full codegen attempt reaches 1,025 passes/one ignore, then hits an existing non-XML deep-path import with LongPathsEnabled=0; this local attempt is not claimed green, although the full hosted suite passes. Exclusive-interface coverage uses actual parsed metadata and standalone renderer/QI views, not public --class-name IXmlDocument/IXmlElement root support. Local x64 native execution is emulated on ARM64; no UI dependencies are introduced.

leileizhang (lei9444) and others added 2 commits October 1, 2026 22:25
Record exact reviewed Windows XML null results and declaring-interface aliases in the pinned documentation extraction flow. Cover SDK owner/signature matching, strict consumers, and scoped native XML states without changing runtime or JS output.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CI-only compatibility: accept optional trailing commas and format the two existing audio stub macro calls required by hosted Rust 1.99. Apply only the explicitly reviewed fixture delta; native signatures, function bodies, and XML product changes are unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Mixed-language test coverage

Workflow status: ✅ Passed

Layer Lines Functions Branches/regions
Rust, including native .pyd/.node 86.92% 82.48% 86.65% regions
Python aggregate 72.34% n/a 39.42% branches
Python runtime 98.17% n/a 94.57% branches
Generated Python WinRT projections 71.07% n/a 33.5% branches
Generated Python WinRT implementations 71.97% n/a 46.3% branches
JavaScript aggregate 21.91% 25.18% 57.61% branches
JavaScript runtime 44.27% 45.76% 78.99% branches
Generated WinRT projections 22.8% 18.7% 54.84% branches
Generated WinRT implementations 45.99% 59.19% 60.97% branches
Generated Classic COM projections 11.88% 23.97% 53.4% branches

View workflow run and download full HTML/LCOV/XML reports

Use the native SDK contract shared by null-fact tests instead of the unrelated CLR Facade override used by TypeScript jobs, and reuse existing sibling expansion. Exercise source stubs in pre-wheel static phases, preserve extra source paths, and additionally typecheck installed runtime stubs when present. Keep native XML and strict checker requirements enforced in the production E2E lane.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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