Skip to content

synq: fix stale body_call_length==0 doc for arg-internal sentinel#155

Merged
LalitMaganti merged 1 commit intomainfrom
fix-body-call-sentinel-doc
Apr 16, 2026
Merged

synq: fix stale body_call_length==0 doc for arg-internal sentinel#155
LalitMaganti merged 1 commit intomainfrom
fix-body-call-sentinel-doc

Conversation

@LalitMaganti
Copy link
Copy Markdown
Owner

Motivation

The public header, internal header, and a session.rs test comment all said the arg-internal case for a nested macro call was signalled by body_call_length == 0. That contradicts the implementation: parser_macros.c:530-535 sets both body_call_offset and body_call_length to SYNTAQLITE_MACRO_BODY_CALL_ARG_INTERNAL (= UINT32_MAX), matching the sentinel defined at parser.h:236 and the Rust docs at types.rs:274-277.

Downstream consumers that trusted the stale comment can crash. Concrete example: google/perfetto#5472 filtered with if (c.body_call_length == 0) continue;, which never trips for arg-internal calls, so a RewriteItem{start = UINT32_MAX, end = UINT32_MAX + UINT32_MAX} ended up in SqlSource::Rewriter and tripped its start <= end check.

Changes

Pure documentation fix — no behavior change:

  • syntaqlite-syntax/include/syntaqlite/parser.h — refer to SYNTAQLITE_MACRO_BODY_CALL_ARG_INTERNAL (UINT32_MAX) as the arg-internal sentinel on both fields.
  • syntaqlite-syntax/csrc/parser_internal.h — same fix on the SynqExpansionLayer fields.
  • syntaqlite-syntax/src/parser/session.rs — update the test comment that still said body_call_length == 0.

The public header, internal header, and session.rs test comment all
claimed the arg-internal case was signalled by `body_call_length == 0`,
but the implementation sets both `body_call_offset` and `body_call_length`
to `SYNTAQLITE_MACRO_BODY_CALL_ARG_INTERNAL` (UINT32_MAX) — and that is
what the public sentinel macro documents at parser.h:236.

Downstream consumers (e.g. google/perfetto#5472) that trusted the stale
comment ended up pushing UINT32_MAX offsets into their rewriter and
crashing on overflow. Pure doc fix — no behavior change.
@github-actions
Copy link
Copy Markdown

Playwright Reports

commit time link
fc091fd 2026-04-16 23:41:29 UTC report

@LalitMaganti LalitMaganti merged commit f596b5d into main Apr 16, 2026
17 checks passed
@LalitMaganti LalitMaganti deleted the fix-body-call-sentinel-doc branch April 16, 2026 23:55
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.

1 participant