Repository navigation
Fix record-index misuse in generic runtime conformance - #131
Conversation
ip332
left a comment
There was a problem hiding this comment.
Independent technical review — GO / approved for squash merge at exact head 87d7f78a20ca1095c78f1c10a66ede8d9acee6c2.
Inspected all three changed files and the tested runtime metadata API. Root cause verified: the old ValidFixture test passed a wire record_id to a QBS find_field overload that expects a record-table index and dereferenced a disengaged std::optional. The fix resolves field 11 through validated parent field_metadata, asserts engagement before dereference, preserves the absent-field assertion and adds wrong-index and absence controls. Production sources, wire fixtures, public API/epochs and identity formats are unchanged. CI now runs Clang 18 Debug plus ASan/UBSan with checked libstdc++ and installs the required compiler-rt package.
Exact-head workflow 44986124280 completed successfully: Linux build/test (73/73), coverage (68/68), clang-tidy, Cortex-M; Clang18 Debug and ASan/UBSan each pass 2/2 conformance CTests. Benchmarks skipped by established PR policy. No merge-blocking technical defect found.
Administrative note: GitHub currently reports issue #85 as closed while PR #131 is still open. Verify issue closure is tied to delivered code only after merge, and confirm post-merge CI. #88 remains a separate release gate. No merge or publication performed. This is a technical-review COMMENT, not formal GitHub APPROVE, because the connected GitHub account is the PR author.
Closes #85
The generic conformance test passed Parent's BRF wire record ID to a QBS API that expects a zero-based record-table index. In the retained fixture, Parent has wire ID 1 but table index 2; table index 1 is Item, which has no field 11. The old test dereferenced the resulting empty
std::optional<QbsFieldView>: undefined behavior, not a parser/fixture/lifetime defect or a Clang miscompile. GCC's passing result masked the invalid access.The test now resolves field 11 through the validated parent view's existing
field_metadata()API, checks metadata engagement, and retains the originalEXPECT_FALSE(is_present(...)). It also verifies the absent value and pins the fixture's wrong-index negative control. Existing positive field assertions remain unchanged.CI now explicitly executes the complete generic conformance binary and fixture check under Linux Clang 18 Debug, then ASan/UBSan with
_GLIBCXX_ASSERTIONS. The Docker test image addslibclang-rt-18-devbecause its previous Clang installation lacked sanitizer runtimes. No assertions are weakened, tests disabled, or diagnostics suppressed. No runtime/compiler API or behavior, fixture bytes, BRF/QBS/IR formats, record allocation, schema_id, gid format/algorithm or epochs change.Reproduction and regression evidence
Unchanged baseline:
afac21be0c39a8ca799582cca2ad02f37f1c7b70(A6 squash merge). Ubuntu 24.04.4 LTS x86-64, Clang 18.1.3 (1ubuntu1), GCC 13.3.0, CMake 3.28.3, Protobuf 3.21.12, libstdc++ headers from GCC13 (runtime package 14.2.0). The initial local image isquarry-dev:latest, image IDfc38baf5e580. Installing compiler-rt in the disposable sanitizer lab upgraded glibc 2.39's package from ubuntu8.9 to ubuntu8.12; compiler/Protobuf/libstdc++ versions remained unchanged.Original Debug command (inside the repository Docker environment at the baseline):
ValidFixtureactual true / expected false; other 5 cases and fixture check passoptional:479: this->_M_is_engaged(); fixture check passesA checked diagnostic probe reports the three table-index/wire-ID pairs and confirms actual field 11 is absent while field 0 is present. A wrong-lookup mutation of the guarded correction also fails on GCC at the intended
absent_field.has_value()assertion (normal test exit 1), proving detection no longer depends on Clang's empty-optional storage contents.Retained fixture SHA-256:
043d9b3ad9f6bd8c0e7c58228fe3a2a1344fd1b7873613d7f1f11d733ab44fc4d3c570f6e2043032d9c4367e8dc3e6cba35f78516f03c6928dd19a1bfe9424d6Final head:
87d7f78a20ca1095c78f1c10a66ede8d9acee6c2.scripts/quarry-validate validate HEADpassed 73/73 native CTests (622.31 s; total validation 652.6 s, two build/test slots) on this exact head. Receipt fingerprint:b7f585657bf5daa66bdab10be82e525d12d64a6102147de836fa5292a6dbbd39. Configured clang-format/YAML/whitespace hooks andgit diff --checkpassed. Delivery usesscripts/quarry-validate pushwith hooks enabled. Native SDK/duplicate-library warnings are existing host-toolchain messages; no production sources changed.Exact-head CI passed all applicable jobs: Linux GCC Build and test (73/73 CTests, 384.91 s), clang-tidy, Coverage baseline (68/68 CTests, 305.34 s, baseline guard passed), and Cortex-M Cross Build. Benchmarks retained its existing PR-policy skip. The Linux Clang 18 interoperability matrix passed; the new generic conformance step passed 2/2 CTests in Debug and 2/2 under ASan/UBSan with checked libstdc++, without sanitizer diagnostics. GCC LTO validation also passed. Earlier A6 CI is not substituted for this fix.
A6 completion is separate: PR #128 squash-merged as
afac21be0c39a8ca799582cca2ad02f37f1c7b70, #104 automatically closed, local main synchronized, and all five post-merge CI jobs passed before repository changes began.#88 is intentionally not implemented; it must follow independent review and merge of this PR. #90/#119 and follow-ups #129/#130 remain unchanged. No release/tag publication, #105 execution or Stage B work. Do not merge automatically.