Skip to content

docs(pxq): land design doc for the jq-style query tool - #30

Merged
trendvidia merged 1 commit into
mainfrom
feat/pxq-tool
May 14, 2026
Merged

docs(pxq): land design doc for the jq-style query tool#30
trendvidia merged 1 commit into
mainfrom
feat/pxq-tool

Conversation

@trendvidia

Copy link
Copy Markdown
Owner

Summary

Lands the design doc for pxq, a jq-style command-line query tool
whose core operates on PXF documents. Implementation will follow in a
separate PR — this change is documentation-only.

What's here

  • cmd/pxq/README.md (178 lines) — full design covering the query
    language, strict/loose modes, schema inference workflow, per-format
    input adapters (PXF, JSON, YAML, CSV), @pxf.* extension namespace,
    @proto typed-object constructor, and engine internals.
  • Top-level README — one-paragraph pointer in the existing tool
    list, between the protowire CLI and protoregistry sections, plus
    a cmd/pxq/ entry in the project structure tree.

Key design decisions captured

  • gojq embedded as core engine with @pxf.* reserved namespace for
    query-time operations that have no jq equivalent.
  • Two-mode default — schema present → strict (compile-time AST
    validation against the schema, runtime mismatches abort); schema
    absent → loose (jq-compatible, runtime mismatches degrade to null).
  • @proto(<dotted>) constructor for typed object output, sourcing
    schemas from bundled canonical schemas, -p, or protoregistry.
  • Fail-fast schema inference by default (pxq infer-schema) with
    --full-scan to aggregate every contradiction in one pass.
  • Self-describing PXF input — when the document carries @proto
    directives (draft §3.4.5), the embedded schema is honoured without
    needing -p. Aligns the tool with the v1.0 freeze.

Why design-first

The design surface is broad (four input formats, two modes, schema
resolution chain, gojq integration) and the renames during the v1.0
spec freeze materially affected the document. Landing the design as
a referenceable artifact in the repo prevents future implementation
work from drifting from the original intent.

Test plan

  • cmd/pxq/README.md renders cleanly in GitHub's markdown
  • Top-level README hook links resolve
  • All @dataset / @proto / draft section references align with
    v1.0 spec freeze (§3.4.2-§3.4.6)

`pxq` is a `jq`-style command-line query tool whose core operates on
PXF documents, with transparent input adapters for CSV, JSON, and YAML.
Output is always PXF, so downstream pipeline stages stay format-
agnostic regardless of where the data started.

This commit lands the design doc only — implementation lives in a
follow-up. Key decisions captured:

* gojq embedded as the core engine; `@pxf.*` reserved namespace for
  query-time operations that have no jq equivalent
* `@proto(<dotted>)` constructor for typed object output, with schema
  resolution sourcing from bundled schemas, `-p`, or protoregistry
* Implicit strict/loose mode (schema present → strict, schema absent →
  loose) with `--strict` / `--loose` overrides
* Fail-fast schema inference by default (`pxq infer-schema`); `--full-
  scan` aggregates every contradiction in a single pass
* PXF/JSON/YAML/CSV adapters with explicit disambiguation rules for
  each known cross-format ambiguity (JSON int-vs-float, YAML implicit
  coercions, CSV empty-cell)
* Self-describing PXF inputs (`@proto` directives) are honoured as if
  the embedded schema had been passed via `-p`

Co-locates a one-paragraph pointer in the top-level README so the tool
is discoverable from the project landing page.
@trendvidia
trendvidia merged commit 5106dff into main May 14, 2026
4 checks passed
@trendvidia
trendvidia deleted the feat/pxq-tool branch May 14, 2026 02:04
trendvidia added a commit that referenced this pull request May 14, 2026
Three focused refinements based on the v1.0 spec freeze and review of
the design doc landed in #30:

* Add an up-front terminology note disambiguating the two `@proto`
  forms — the document-level directive (draft §3.4.5, schema flows in)
  and the query-level constructor (typed output, schema flows out).
  They share a name on purpose because they're complementary halves of
  the same protobuf-typing primitive, but a reader who only knows one
  spec layer would otherwise hit them as a name collision.

* Restructure the dense PXF-adapter paragraph into a table of the four
  `@proto` body shapes (anonymous, named, source, descriptor) and add
  an explicit schema-resolution-order rule covering bundled schemas,
  in-document `@proto` directives, `-p`, and protoregistry. The order
  matters because user-supplied `-p` can shadow stale embedded schemas
  while still being overridable by protoregistry.

* Add a "Quick start — self-describing PXF" section to Install with
  an end-to-end example: a `@proto`-headed PXF file that needs no
  flags, contrasted with the schema-external form. Closes the gap
  between "v1.0 introduced @proto" (the design says) and "what does
  the user actually type" (it didn't show).

Also extends the `@pxf.directive` table row with the schema-bound row
semantics introduced by the quick-start example, and clarifies the
`@proto(...)` constructor's resolution chain to include in-document
`@proto` directives as an additional source.
trendvidia added a commit that referenced this pull request Jun 5, 2026
Adds docs/M1-kickoff-protocompile.md — the concrete first-PR plan
for protocompile's M1 work (extended grammar parser) tracked by
RFC-001 issue #30 in the umbrella tracker (#55).

Scope:
- Splits issue #30 into 5 sequential PRs (lexer keywords, type
  decls, function decls, annotation decls, @annotation use sites)
- PR 1 is a minimal-footprint change: 5 keywords reserved at the
  lexer level, no grammar productions yet — ~5 lines plus tests
- Acceptance criteria, soft-break audit grep commands, branch
  strategy, and follow-ups for the maintainer
- PRs 2-5 sketched with file pointers and estimates

Doc is implementation-specific but lands here for consistency
with the rest of the RFC-001 planning corpus.
trendvidia added a commit that referenced this pull request Jul 17, 2026
…README layout (#115)

- Umbrella #30#35 ticked: M1 shipped June + the spec-#91/#35
  catch-up landed 2026-07-17 (protocompile#66/#67/#69 closed, PRs
  #70#72 + follow-ups #77#80).
- #4 round-trip box ticked: annotations.proto verified against
  protocompile @ 03ef9d8 (GH #58 closed) — parses clean, all 9
  declarations lower into FileAnnotationDecls; fixtures 01–06, 09,
  10, 12 all compile with zero diagnostics.
- #5 boxes ticked; README repository-layout now lists
  proto/schema/v1/{annotations,descriptor,report}.proto,
  proto/schema/config/v1/config.proto, and the draft -01 artifacts —
  the missing README listing was the one genuinely unmet box.
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