Skip to content

Detect variants for stand-alone port frozen stubs instead of collapsing to GENERIC#740

Open
Josverl with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-standalone-ports-bug
Open

Detect variants for stand-alone port frozen stubs instead of collapsing to GENERIC#740
Josverl with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-standalone-ports-bug

Conversation

Copilot AI commented May 3, 2026

Copy link
Copy Markdown
Contributor

For stand-alone ports (webassembly, unix, windows), every variant manifest was being written to a single <port>/GENERIC/ folder, overwriting earlier variants and not matching the path that combo_sources() / default_board() expect (e.g. webassembly/PYSCRIPT, unix/STANDARD). Reproducer: stubber build --port webassembly --version v1.26.1.

Root cause

get_portboard() only matched ports/<port>/boards/<board>/. Stand-alone ports use ports/<port>/variants/<variant>/manifest.py (or a port-level manifest.py for the implicit standard variant), so board came back empty for every variant and get_freeze_path() defaulted them all to legacy GENERIC.

Changes

  • publish/defaults.py — add STAND_ALONE_PORTS = {"unix", "windows", "webassembly"} and STANDARD_VARIANT = "standard".
  • freeze/common.py
    • get_portboard() regex now also captures variants/<variant>; returns (port, board, variant).
    • get_freeze_path(stub_path, port, board, variant="") uses variant (or "standard" for stand-alone ports) when no board is given. Non-stand-alone ports keep the GENERIC fallback for backward compatibility.
  • freeze/freeze_manifest_2.py
    • make_path_vars() resolves BOARD_DIR to ports/<port>/variants/<variant> when a variant is provided so manifests execute in the correct working directory.
    • freeze_one_manifest_2() / copy_frozen_to_stubs() thread variant through.
  • freeze/freeze_folder.py — consume the new 3-tuple.
  • Tests — update test_get_portboard for the 3-tuple, add variant-path cases, add test_get_freeze_path covering board / variant / stand-alone-default-to-STANDARD resolution.
  • .gitignore — exclude repos/ to keep generated DBs out of the tree.

Resulting freeze folders

Manifest path Before After
ports/webassembly/manifest.py webassembly/GENERIC webassembly/STANDARD
ports/webassembly/variants/pyscript/manifest.py webassembly/GENERIC (collision) webassembly/PYSCRIPT
ports/unix/variants/standard/manifest.py unix/GENERIC unix/STANDARD
ports/unix/variants/minimal/manifest.py unix/GENERIC (collision) unix/MINIMAL
ports/esp32/boards/manifest.py esp32/GENERIC esp32/GENERIC (unchanged)
ports/stm32/boards/PYBV11/... stm32/PYBV11 stm32/PYBV11 (unchanged)

Notes / follow-ups

  • get_portboard() is now a 3-tuple; only in-tree callers and one test consume it, all updated.
  • The CLI default of GENERIC for --board still resolves correctly for stand-alone ports via default_board() (which already returns pyscript/standard), so no CLI default change was needed in this PR — flagged in the issue as a separate follow-up to revisit alongside per-port build defaults.

Copilot AI linked an issue May 3, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix bug in standalone ports frozen modules Detect variants for stand-alone port frozen stubs instead of collapsing to GENERIC May 3, 2026
Copilot AI requested a review from Josverl May 3, 2026 21:22
Copilot finished work on behalf of Josverl May 3, 2026 21:22
@Josverl
Josverl marked this pull request as ready for review May 3, 2026 21:48
@codecov

codecov Bot commented May 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.10%. Comparing base (ad9e411) to head (e1e7375).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #740      +/-   ##
==========================================
+ Coverage   72.06%   72.10%   +0.03%     
==========================================
  Files          71       71              
  Lines        8399     8410      +11     
  Branches     1541     1544       +3     
==========================================
+ Hits         6053     6064      +11     
  Misses       1837     1837              
  Partials      509      509              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Josverl
Josverl force-pushed the copilot/fix-standalone-ports-bug branch from f3c1a21 to c8ee00c Compare May 3, 2026 22:13
@Josverl
Josverl force-pushed the copilot/fix-standalone-ports-bug branch from c8ee00c to 6e3e623 Compare May 4, 2026 23:05
Josverl and others added 3 commits May 5, 2026 01:20
…GENERIC)

Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
@Josverl
Josverl force-pushed the copilot/fix-standalone-ports-bug branch from 6e3e623 to 26efd35 Compare May 4, 2026 23:20
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.

bug in stand alone ports frozen modules

2 participants