feat(parser): optional pj.parser_runtime.v1 diagnostics service - #165
Merged
Conversation
The pinned offsets encode libstdc++'s 32-byte std::string; libc++ (macOS) uses 24 bytes, shifting every subsequent member and failing the asserts. One pinned platform is a sufficient insertion tripwire. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Companion G1 of the dialog-tree / SDK-compatibility plan (SDK 0.21.0 train). Independent of #164; trivial CHANGELOG conflict expected with sibling PRs.
What
Message parsers previously had no non-fatal diagnostics channel — a parser could fail a whole
parse()viaStatusbut had no way to report recoverable/aggregated conditions (field overflow in N of M messages, invalid optional fields, partial schema mismatch).pj.parser_runtime.v1following the established optional-service pattern: ABI-APPENDABLEPJ_parser_runtime_host_vtable_t(one slot:report_diagnostic(level, stable_code, message, occurrences)), width-pinned level enum, frozen fat pointer, service trait. No existing C struct, vtable, protocol version, or min-vtable size changed.ParserRuntimeHostView::reportDiagnostic(...)—noexcept; unbound view is a safe no-op.MessageParserPluginBase::bind()acquires it optionally;parserRuntimeHost()/parserRuntimeHostBound()accessors.stable_codeis a machine-stable dedup key, never localized prose; the host aggregates by (parser ID, bound schema/type, level, code); fatal parse failure still usesStatus;classifySchema()stays side-effect free. Host-side aggregation/rate-limiting lands with the PJ4 change.ABI hardening (found by review)
MessageParserPluginBase's member layout is cross-DSO ABI: PJ4 casts the context pointer and calls the finalclassifySchema/parseScalars/parseObjectdirectly. The new member is therefore appended LAST (all pre-0.21 offsets DWARF-verified unchanged), the class documents the append-only contract, and a new compile-time sentinel test pins every pre-0.21 member offset (numeric pins gated to libstdc++;sizeofdeliberately unpinned — the host never allocates or copies the object).Verification
56/56 ctest, warnings-as-errors, pre-commit clean; independent adversarial review passed after the layout fix; rebind-reset covered by test.
🤖 Generated with Claude Code