Skip to content

Fix Python codegen long paths and static-only projections - #108

Merged
leileizhang (lei9444) merged 1 commit into
mainfrom
fix/python-long-path-static-projection
Sep 1, 2026
Merged

leileizhang (lei9444) merged 1 commit into
mainfrom
fix/python-long-path-static-projection

Conversation

@lei9444

@lei9444 leileizhang (lei9444) commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Define the initial supported Python code-generation format and fix long-path, projection, and package-isolation issues found by full Windows App SDK + WebView2 generation.

  • deterministically shorten Python module components longer than 120 characters using a readable prefix and stable 64-bit hash suffix
  • apply the same mapping to implementation modules, namespace facades, imports, inventories, and package manifests while retaining collision detection
  • support incremental generation within the current hashed-name format; pre-release long-name outputs are intentionally not migrated and should be regenerated
  • classify concrete RuntimeClass values from loaded WinRT method signatures, including return values, parameters, parameterized delegates, and event arguments
  • support metadata-erased Object/IInspectable projection through a separate QI-only class marker; every such projection casts the concrete default-interface IID and fails closed on unrelated objects
  • keep static-only declarations free of instance APIs while allowing QI verification when metadata provides a concrete default IID
  • preserve all user directories during transactions; generated-file discovery, cleanup, and namespace packaging only traverse generator-owned package trees
  • isolate setuptools build caches by normalized package identity plus generated file-layout hash and declare stub package data per generated namespace, avoiding recursive globs into build, dist, virtual environments, tox/nox, caches, or other user directories

Windows long-path regression

The workflow generates current-format DeviceInformationCustomPairing bindings under a fixed 104-character root path, creates stale copies under default/scoped build caches, dist, venv, .venv, env, .tox, .nox, __pycache__, and egg-info, then incrementally generates the unrelated Windows.Foundation.Uri. It verifies every user artifact remains unchanged, current hashed modules remain available, and the build-cache key rotates with the generated layout. It then renames the output package without changing its generated layout and verifies the package identity rotates the cache key and the wheel contains only the renamed package.

Validation

  • cargo fmt --all -- --check: passed
  • cargo test -p dynwinrt-codegen: passed
  • full native-projection audit: 1,081 referenced RuntimeClass modules, zero missing _from_native
  • QI-only audit: 57 classes, all cast a concrete default IID and expose no instance API marker
  • current-format incremental wheel: 319/319 generated files installed; 159/159 modules imported; all simulated user directories preserved
  • output-package rename: cache key rotated with an unchanged generated layout; old cache remained preserved and the wheel installed only the renamed package
  • full Windows App SDK + WebView2 wheel: 17,461/17,461 generated files installed; 8,730/8,730 modules imported
  • full strict mypy: 8,731 source files, zero errors
  • full compileall: passed
  • QI-only project_as: strict mypy inferred the concrete class; unrelated-object projection failed closed
  • Python binding tests and stubtest: passed
  • Python E2E: 42/42 passed
  • Python WinUI E2E: passed

@github-actions

github-actions Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Mixed-language test coverage

Workflow status: ✅ Passed

Layer Lines Functions Branches/regions
Rust, including native .pyd/.node 82.44% 78.68% 82.35% regions
Generated Python projections 70.48% n/a 21.71% branches
JavaScript aggregate 21.24% 20.56% 53.98% branches
JavaScript runtime 19.91% 14.28% 7.14% branches
Generated WinRT projections 25.74% 19.25% 54.66% branches
Generated Classic COM projections 14.65% 24.46% 53.75% branches

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

leileizhang (lei9444) added a commit that referenced this pull request Sep 1, 2026
Resolve the codegen transaction type rename after PR #109 while preserving the Python projection changes.

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

Copilot-Session: 7dd76e84-9e06-45b9-a8d1-c09f8a157550
Preserve the resolved PR #109 integration while replacing the merge-based
history with one reviewable commit on current main.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@lei9444
leileizhang (lei9444) force-pushed the fix/python-long-path-static-projection branch from 9323b24 to 18ee4d2 Compare September 1, 2026 02:52
@lei9444

Copy link
Copy Markdown
Contributor Author

shisan (@qiutongMS) Shawn Yuan (@shuaiyuanxx) PR #108 has been linearized onto current main without changing its tree (new head: \18ee4d241452b6395d3ed7fa4c9cac5a76f0bb0b). Could one of you please provide one fresh approval after the history rewrite?

@lei9444
leileizhang (lei9444) merged commit e297cfd into main Sep 1, 2026
26 checks passed
@lei9444
leileizhang (lei9444) deleted the fix/python-long-path-static-projection branch September 1, 2026 03:09
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.

3 participants