Skip to content

fix: flag recovered Lines with coincident endpoints for repair in exports - #371

Closed
AnushreeKasturi wants to merge 1 commit into
userfypp:mainfrom
AnushreeKasturi:fix/303-coincident-line-export-warning
Closed

AnushreeKasturi wants to merge 1 commit into
userfypp:mainfrom
AnushreeKasturi:fix/303-coincident-line-export-warning

Conversation

@AnushreeKasturi

Copy link
Copy Markdown

Summary

  • A recovered Line or Polyline whose geometry needs repair, such as one with coincident endpoints, is no longer exported as zero. CSV and workbook exports refuse it with the Repair invalid Line measurements before exporting CSV. message that other types already get, and annotated PDF and panel labels show Repair required. This matches JSON, which rejects the geometry, and Takeoff, which excludes it.
  • measurementRows in src/services/csv.ts and formatMeasurement in src/utils/format.ts checked hasValidMeasurementPoints only for closed shapes (and counts, in CSV). Both now check every measurement type. The workbook export goes through buildMeasurementTable, so it gets the CSV check too.
  • areEffectivelyIdentical in src/utils/geometry.ts compared squared distances, which overflow to Infinity for very distant points, so Infinity <= Infinity treated them as identical. With Lines now validated on export, that would have refused a very long valid Line. It now uses the overflow-safe comparison that calibration points already used, and the duplicate helper is removed.

Validation

  • npm run lint, npm run build and git diff --check pass.
  • New tests, which fail without the fix and pass with it:
    • csv.test.ts: a Line with coincident endpoints is refused by buildCsv and buildMeasurementTable.
    • format.test.ts: formatMeasurement returns Repair required for that Line.
    • annotatedPdf.test.ts: the annotated PDF label for that Line is Repair required.
    • geometry.test.ts: points at ±1e200 are not identical, and that Line is valid.
  • npm test: 2289 passed and 2 failed. The two failures are src/performance/annotationLayerProps.test.tsx and the 5,000-row test in TakeoffWorkspace.test.tsx. They fail the same way on unchanged main on my machine (Windows, one assertion and one 5 s timeout), and they pass in CI on main, so they look environment-specific rather than related to this change.
  • No change to startup, the viewer, the canvas or the panels beyond the label text for invalid geometry. The change removes code, so it doesn't grow the JavaScript size.

Related Issue

Closes #303

…orts

A recovered Line or Polyline whose geometry needs repair was exported as
zero. CSV and workbook exports now refuse it with the same repair message
as other measurement types, and annotated PDF and panel labels show
"Repair required", matching JSON and Takeoff.

Point comparison no longer treats two distant points as identical when
their squared distance overflows, so very long valid Lines still export.

Closes userfypp#303
@userfypp

userfypp commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Thanks a lot for helping with Plan Measure!

Your fix is merged (#372). I had to push it from a branch in the main repo because CodeQL wasn't running on your PR, and GitHub squashed it under my name, so you don't show up as author in the history. Sorry about that.

By the way, there's now a CREDITS.md in the repo. If you'd like to be listed, add a row following the Credits section in CONTRIBUTING. Totally optional.

@userfypp userfypp closed this Oct 27, 2026
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.

Recovered invalid Lines are exported as zero

2 participants