Skip to content

spec(v1.0): rename @table → @dataset, add @proto, expand reserved names#16

Merged
trendvidia merged 1 commit into
mainfrom
v1.0-spec-rename
May 13, 2026
Merged

spec(v1.0): rename @table → @dataset, add @proto, expand reserved names#16
trendvidia merged 1 commit into
mainfrom
v1.0-spec-rename

Conversation

@trendvidia

Copy link
Copy Markdown
Owner

Summary

Implements the three one-time spec changes from the protowire v1.0 freeze line (STABILITY.md):

  • @table@dataset (draft §3.4.4). Hard cutover, no alias period.
  • @proto directive added (draft §3.4.5). Four body shapes lexically distinguished: anonymous, named, source, descriptor. Descriptor form is the MUST-support shape; this port supports all four.
  • Reserved directive names expanded from 5 to 13 (draft §3.4.6). Parser + decoder reject @table, @datasource, @view, @procedure, @function, @permissions.

Public API rename surface

Before After
TableDirective DatasetDirective
TableRow DatasetRow
TableReader DatasetReader
Document.tables Document.datasets
Result.tables() Result.datasets()
TokenKind.AT_TABLE AT_DATASET
ProtoDirective + ProtoShape (new)
Document.protos + Result.protos() (new)
TokenKind.AT_PROTO (new)
FUTURE_RESERVED_DIRECTIVES export from schema.ts (new)

Source files table_reader.ts / table_reader.test.ts renamed to dataset_reader.*. `DatasetReader`'s internal byte-scanner updated for the new keyword length (@dataset is 8 chars vs @table's 6).

@dataset's row message type is now optional in the AST — binding to an anonymous @proto per draft §3.4.4 Anonymous binding. Lexer.repositionTo(target) added so the parser can skip past an @proto brace-body whose interior is protobuf source rather than PXF.

Test plan

  • `npx tsc --noEmit` passes
  • `npm test` passes — 395 tests, 0 failures
  • New `proto-directive.test.ts` with 17 cases covering all four body shapes, anonymous binding, multi-`@proto`, nested-brace bodies, reserved-name rejection (per name), `@type` coexistence
  • Cross-port verification — protowire-go release: cut v1.1.0 #19 and protowire-java #42 are merged; this completes the three load-bearing ports

Companion PRs:

Next: editor grammar updates (VS Code + JetBrains both embed parsers from this port and protowire-java).

Implements the three one-time spec changes from the protowire v1.0
freeze line (STABILITY.md in the spec repo):

- @table directive renamed to @dataset (draft §3.4.4). Same
  semantics; v1 reserves @table for a future storage-definition
  meaning. Hard cutover — no alias period.

- @proto directive added (draft §3.4.5). Four body shapes lexically
  distinguished: anonymous { ... }, named pkg.Type { ... }, source
  """...""", descriptor b"...". Descriptor form is mandatory per
  spec; the other three are QoI (all four supported). Anonymous
  @proto is consumed one-shot by the next typed-binding directive.

- Reserved directive name list expanded from 5 to 13 (draft §3.4.6).
  Parser + decoder reject @table, @Datasource, @view, @procedure,
  @function, @permissions as spec-reserved.

Public API rename surface:
  TableDirective    → DatasetDirective
  TableRow          → DatasetRow
  TableReader       → DatasetReader
  Document.tables   → Document.datasets
  Result.tables()   → Result.datasets()
  TokenKind.AT_TABLE → AT_DATASET; + AT_PROTO              (new)
  ProtoDirective + ProtoShape                              (new)
  Document.protos / Result.protos()                        (new)
  FUTURE_RESERVED_DIRECTIVES export from schema.ts         (new)

Source files renamed:
  src/pxf/table_reader.ts       → dataset_reader.ts
  src/pxf/table_reader.test.ts  → dataset_reader.test.ts
New: src/pxf/proto-directive.test.ts with 17 cases covering all
four body shapes, anonymous binding, multi-@proto, nested-brace
bodies, reserved-name rejection (per name), @type coexistence.

@dataset's row message type is now optional in the AST (binding to
an anonymous @proto). Lexer.repositionTo(target) added so the
parser can skip past an @proto brace-body whose interior is
protobuf source rather than PXF. findMatchingBrace and decodeBase64
exported from parser.ts for reuse by the decoder.

DatasetReader's internal byte-scanner updated for the new keyword
length (@dataset is 8 chars, was 6 for @table).

395 tests, 0 failures.
@trendvidia trendvidia merged commit 756b043 into main May 13, 2026
5 checks passed
@trendvidia trendvidia deleted the v1.0-spec-rename branch May 13, 2026 08:57
@trendvidia trendvidia mentioned this pull request May 13, 2026
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