Skip to content
This repository was archived by the owner on Oct 19, 2026. It is now read-only.

Fix origin-dependent AREF vector detection - #334

Merged
heitzmann merged 2 commits into
heitzmann:mainfrom
CAOShurong:fix-aref-origin-vectors
Oct 16, 2026
Merged

heitzmann merged 2 commits into
heitzmann:mainfrom
CAOShurong:fix-aref-origin-vectors

Conversation

@CAOShurong

Copy link
Copy Markdown
Contributor

Follow-up to #299 and ecf9675.

The AREF XY record stores three absolute points. The rectangular-array check
currently compares two cross coordinates with zero, so classification changes
when the same array is translated. For example, translating the file attached
to #299 makes its four instances overlap: offsets (0, 50, 100, 150) become
(0, 0, 0, 0).

Compare those coordinates with the corresponding origin coordinates instead.
This preserves the existing vector calculation and rotation/reflection handling;
raw integer equality also avoids subtraction overflow.

The synthetic regression covers rectangular, swapped, skewed, reversed and
zero vectors, translated origins, transforms, unit conversion and large legal
coordinates. It does not include the reporter's binary file.

Validation on Windows 11, CPython 3.13.1, MSVC:

  • Independently built and non-editably installed unmodified main and the patch.
    The new regression has 14 failures / 52 passes on main and passes all 66
    cases repeatedly with the patch. All 91 original outcomes are unchanged;
    the full suite passes 157 tests.
  • Ran python -m pytest <checkout>/tests/library_test.py -k aref_vectors -q
    and python -m pytest <checkout>/tests -q outside the source package, with
    fresh explicit --basetemp directories.
  • Checked the original attachment and its translated variant through the
    installed API, plus GDS/OAS/streaming/flattened round-trips. KLayout 0.30.12
    independently compares polygon geometry for 68 inputs across four routes.
  • Exercised the native C++ reader/exporters and missing-input handling; built
    the wheel/sdist and checked source/package/installed bytes.
  • Changed-line C++ formatting and the new Python test's formatting pass.
    Whole-file Black retains one pre-existing formatting difference; compiler
    warnings match unmodified main.

Linux/macOS, other Python versions and production EDA signoff were not run
locally. No writer, tolerance or public API changes are included.

@heitzmann

heitzmann commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

@CAOShurong Could you please take a look at the test errors? They seem to be just a matter of fixing the tolerance.

@CAOShurong

Copy link
Copy Markdown
Contributor Author

Updated both vector checks to use the same coordinate-derived absolute tolerance as the offsets (rtol=0). The 157-test suite passes locally, and the 14 baseline regression failures are unchanged.

@heitzmann
heitzmann merged commit e385804 into heitzmann:main Oct 16, 2026
6 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants