Skip to content

fix: preserve strong references when grouping duplicate imports - #6432

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
MrMha:fix/import-reference-strength-20261015
Oct 17, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
MrMha:fix/import-reference-strength-20261015

Conversation

@MrMha

@MrMha MrMha commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

What

Duplicate references to the same NID/library currently inherit the last reference's weak flag. A strong reference followed by a weak one is therefore reported as weak, including in the current-stop record. Mark a grouped import weak only when every reference is weak. The regression verifies both mixed-reference orders, all-strong/all-weak cases, reference conservation, and stop consistency.

Tested

macOS 27.0.1 arm64, Python 3.12.14; tooling fixtures only, no title.

The new regression failed on main ff23657 before the fix. This branch was tested independently from that base.

python3 -m unittest tools.tests.test_import_audit
Ran 85 tests in 1.134s
OK (skipped=1)
python3 tools/check_conventions.py --base ff23657f3437427fc5421857a6f9545e41806f2c --head HEAD
All conventions checks passed.

The combined local validation checkout containing all ten independent tooling fixes also built with ANYPS5_RELINKER_ONLY=ON, BUILD_TESTING=ON and passed all 172 CTest tests. Full Windows/Linux runtime and GPU tests were not run.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; silent stubs are listed in technical debt (not applicable to this tooling change)
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@Dextroid17

Copy link
Copy Markdown
Contributor

I ran the test this PR adds, on Linux.

Setup: head 8f89496 merged into main at 92e5041 (no conflicts; the PR's base is 53 commits behind), Linux, Python 3.14.8, clean environment (env -i, only HOME and PATH set). python3 -m unittest -v test_import_audit from tools/tests, 3 runs each.

  • with this PR: 3 of 3 runs pass (85 tests, 1 Windows-only test skipped).
  • with tools/import_audit.py put back to main's version (the PR's test changes kept): 3 of 3 runs fail, each time only at test_duplicate_import_strength_is_order_independent.

With the change, a strong import is kept whichever order the duplicates come in. This PR and #6113 both edit tools/import_audit.py; I checked that they merge together without conflicts.
I did not check Windows or macOS.

AI-assisted: yes

@oneandonlydean oneandonlydean self-assigned this Oct 17, 2026
@oneandonlydean
oneandonlydean merged commit 2201c8e into boykopovar:main Oct 17, 2026
10 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.

3 participants