Skip to content

fix(import): refuse native 3-D files on different vertical axes (SP5 item 3) - #159

Merged
mbel-tech merged 2 commits into
mainfrom
fatina-del-codice/sp5-item3-vertical-axis
Oct 11, 2026
Merged

mbel-tech merged 2 commits into
mainfrom
fatina-del-codice/sp5-item3-vertical-axis

Conversation

@mbel-tech

Copy link
Copy Markdown
Owner

What and why

Item 3 of SP5 (finding 7), per the design note (merged in #156, section 4). Independent of #157 and #158.

A native project has one water column (surface_z, floor_z), entered "on the file's own vertical axis", with a per-session flip compensation. vertical_axis was only recorded in provenance, so two files read with different vertical_axis shared a surface and floor that meant different things for each.

  • The native import rule (_native_rule), which already refuses mixed units, now also refuses a file whose vertical_axis differs from the project's: NATIVE_3D_AXIS_MISMATCH, naming both sessions and both axes, with a remedy ("Add it again with vertical_axis = ..., or add the files to projects of their own"). It applies to a batch with two axes, a file added to a project on another axis, and a session that was just read.
  • _ImportFact carries the axis (from the saved reader options for an entry, from the session's native_3d attributes for a read session); readers.native3d.ref_vertical_axis and DEFAULT_VERTICAL_AXIS = "z" give the default for a missing option. flip may still differ.
  • The user guide's native-3D section mentions the rule.

Behaviour to be aware of: the rule runs whenever a session is read, as the unit rule does. An existing project whose files already disagree on the axis is therefore refused with the same message when it is next run, until the files are re-added on one axis. I think that is the right outcome (the alternative is a water column silently meaning two things), but it is a change for any such project; the CHANGELOG says so.

Not detectable: different origins on the same axis (two files calibrated in separate sessions). The Calibration page text for that is part of item 6.

Test plan

New tests/test_native3d/test_vertical_axis_rule.py (9 tests; 5 failed first, the accept cases already passed): batch with two axes, file vs the project, the default z, same axis with different flip accepted, read session on another axis refused and on the same axis accepted, no attributes counts as z, the remedy text, and an existing mixed project.

  • Full suite, Qt included: 4453 passed, 24 skipped, 0 failed.
  • ruff check passes.

Checklist

  • Tests added or updated (written before the fix)
  • ruff check passes
  • Docs updated if behaviour changed: user guide native-3D section
  • CHANGELOG.md entry under [Unreleased]

🤖 Generated with Claude Code

https://claude.ai/code/session_012btUjvTQTf6i51Rpr3t8Hc


Generated by Claude Code

The project has one water column, entered on the file's own vertical axis, but vertical_axis was
only recorded in provenance, so two files read with different axes shared a surface and floor that
meant different things for each. The native import rule that already refuses mixed units now also
refuses a file whose vertical_axis differs from the project's (NATIVE_3D_AXIS_MISMATCH, naming both
axes and the fix); a missing option counts as z, and flip may still differ.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012btUjvTQTf6i51Rpr3t8Hc
Keeps both CHANGELOG bullets (water column bounds every 3-D metric; refuse mixed vertical axes).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012btUjvTQTf6i51Rpr3t8Hc
@mbel-tech
mbel-tech merged commit 731e6cd into main Oct 11, 2026
7 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.

2 participants