Skip to content

Pin the 3D polyline closed-flag round trip with a test (W4-2) - #657

Merged
HakanSeven12 merged 1 commit into
hakanaktt:mainfrom
schoeller:surfparcel-w4-2
Nov 24, 2026
Merged

HakanSeven12 merged 1 commit into
hakanaktt:mainfrom
schoeller:surfparcel-w4-2

Conversation

@schoeller

Copy link
Copy Markdown
Contributor

Cites the D016 packet-4 finding W4-2: "the writer dropped a 3d polyline's closed flag" (tutorials' Surface-1A.dwg, _EG-BNDY boundary, 192 vertices — closed in the oracle, open in the rebuilt file, the only RAW diff).

Root cause (investigated to the wire)

The 3D-polyline writer does carry the typed flag: write_polyline3d writes byte 2 from e.flags.closed, and the builder maps it back (dwg_document_builder.rs, closed_flag & 1). A synthetic closed-polyline DWG round trip already kept closed=true with bit-exact vertices. The loss was in the corpus builder (examples/corpus_roundtrip.rs on the parity/corpus-roundtrip branch), which constructed Polyline3D from the manifest without setting p.flags.closed — the lwpolyline builder already sets its flag. That fix went to the corpus branch (schoeller/cadcodec branch parity/w4-2-plines-closed, off dd184638); the rebuilt Surface-1A now matches: closed flags [false, false, true] and compare_verify all BIT-EXACT.

This PR

No behavior change — it pins the behavior the packet depends on with a DWG round-trip test: a closed 3D polyline reads back closed, still 3D, with its vertices bit-exact. Full suite green on this tip (3302 passed / 0 failed).

The D016 packet-4 census of the tutorials' Surface-1A.dwg reported the
built _EG-BNDY 3D polyline (192 vertices, the EG surface boundary) as
open while the oracle's is closed. The writer carries the flag: the
loss was in the corpus builder, which never set the typed field (fixed
on the parity/corpus-roundtrip branch). Pin the behavior the packet
depends on with a DWG round-trip test: a closed 3D polyline reads back
closed with its vertices bit-exact.
@HakanSeven12
HakanSeven12 merged commit 61d9e85 into hakanaktt:main Nov 24, 2026
5 of 6 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