Ip025 — OBJ face record forward-referencing vertices declared later in the file

§12.15 import-format parser robustness (sub-class: index-resolution-ordering)

P3 — cosmetic / metadata-only

topology

Sources

Description

A `f` statement appears in the file before the `v` records it references, relying on the loader resolving indices against the complete, final vertex table rather than an in-progress running list. A single-pass, streaming-style loader that resolves each face's indices against only the vertices seen so far cannot resolve a forward reference at all (index 1 doesn't exist yet when the `f` line is read) — the independent Open3D loader was observed to bind faces to the wrong vertices under this kind of ordering/disorder.

Reproducer recipe

a face record `f 1 2 3` placed as the first content line, followed by the three `v` lines it references.

Expected kernel behavior

resolve every OBJ index against the final, complete 1-based global vertex table after a full pass over the file; forward references are legal OBJ and must resolve correctly regardless of physical line order.

Notes

Cross-oracle: trimesh 4.12.2 resolves the forward reference correctly — `trimesh.load()` returns `vertices.shape==(3,3)`, `faces==[[0,1,2]]`, exactly the intended triangle — verified 2026-07-17. Positive/reference result: trimesh's OBJ loader extracts all `v`/`vn`/`vt`/`f` records via a two-pass, regex-based approach (`_parse_vertices` runs over the whole text before face resolution) rather than a single streaming pass, so forward references are immune to the disorder Open3D's issue tracker reports; a naive streaming single-pass reader would fail or mis-bind on this exact construct. Synonyms: "OBJ forward vertex reference", "face before vertex declaration", "vertex index disorder", "two-pass vs streaming OBJ resolution". Provenance tier: bytes-only.

Expected validation

Provenance tier

bytes-only — defect not fully embodied in fixture bytes.

Byte assertions

Live oracle output

No live oracle data — run _run_corpus to populate.

Fixture content

Show fixture bytes (with defect highlighting)
1f 1 2 3
2v 0.0 0.0 0.0
3v 1.0 0.0 0.0
4v 0.0 1.0 0.0