Skip to content

spec: language-neutral conformance runner + TypeScript adapter (#6)#52

Open
awbx wants to merge 2 commits into
mainfrom
feat/conformance-runner
Open

spec: language-neutral conformance runner + TypeScript adapter (#6)#52
awbx wants to merge 2 commits into
mainfrom
feat/conformance-runner

Conversation

@awbx
Copy link
Copy Markdown
Owner

@awbx awbx commented May 25, 2026

Closes #6 (TypeScript side). Go adapter follow-up: #51.

Summary

A portable conformance runner + TS adapter + CI job. Closes the last original rc.1 issue — every one of the 12 issues in the milestone at session-start is now done or has a tracked follow-up.

What ships

File Change
`spec/conformance/README.md` NEW — adapter contract spec: three subcommands, stdin/stdout, JSON I/O. Any future SDK (Rust, Python, Java) ships ~50 LOC of plumbing and gets conformance for free.
`go/cmd/conformance/main.go` NEW — the runner. Reads vectors, dispatches to the adapter, compares output. Per-vector pass/fail + aggregate; exit 1 on any failure.
`ts/packages/sdk/test/conformance-adapter.mjs` NEW — TypeScript adapter wrapping the SDK's built dist. 64 vectors / 64 passed.
`.github/workflows/ci.yml` New `Conformance (TS adapter)` job — builds SDK then runs the runner against the TS adapter. Future Go adapter (#51) joins as a matrix entry.

Why a Go runner (not shell or Python)

  • Shell + jq is fragile for multi-step JSON manipulation.
  • Python is universal but adds a non-toolchain dependency.
  • Go is already required; the runner is a single `main.go` file shipped alongside other `cmd/*` binaries.
  • Adapter authors only need their own language's stdlib to write the adapter — they don't need Go for that. They only need Go to run the runner, which is one `go run` command.

End-to-end demo

```
$ pnpm -C ts/packages/sdk build && \
go run ./go/cmd/conformance --vectors spec \
--adapter "node ts/packages/sdk/test/conformance-adapter.mjs"

PASS manifest minimal-job-single-schedule
PASS manifest multi-schedule-canonicalization
...
PASS auth/verify verify-fail/wrong-secret
PASS auth/verify verify-fail/no-acceptable-secret-among-many

64 total / 64 passed / 0 failed
```

Test plan

  • Local: `go build ./cmd/conformance` clean
  • Local: `golangci-lint run ./cmd/conformance/...` 0 issues
  • Local: end-to-end run against TS adapter — 64/64 pass
  • CI: new `Conformance (TS adapter)` job passes on this PR — first real exercise
  • CI: all 7 required checks still green (no changes to existing jobs)

What's NOT in this PR

  • Go adapter (spec: Go conformance adapter for go/cmd/conformance #51, queued for v1.0.0-rc.1) — would prove cross-language byte-for-byte agreement.
  • Conformance job promoted to a required status check — defer until Go adapter lands and the job proves stable.
  • Adapter contract versioning — implicit at v1 today; if the runner adds new subcommands later, the README will get a version table.

awbx added 2 commits May 25, 2026 22:13
Add a portable conformance runner that drives any SDK's adapter
through stdin/stdout and verifies it agrees with every vector
byte-for-byte. Ships the runner + the reference TypeScript adapter
+ a CI job that exercises both. Go adapter follows as #51.

What ships in this change:

- spec/conformance/README.md: documents the three-subcommand adapter
  contract (manifest-canonicalize, auth-sign, auth-verify) future
  SDKs (Rust, Python, Java, ...) target. The contract is intentionally
  thin — one binary, three subcommands, JSON in and out, exit 0
  unconditionally with errors reported via the JSON payload — so an
  adapter for a new SDK is ~50 LOC of plumbing on top of that SDK's
  library API.

- go/cmd/conformance/main.go: the runner. Reads spec/manifest-
  vectors.json + spec/auth-vectors.json, invokes the configured
  adapter for each vector, compares the result against the vector's
  expected output. Reports per-vector pass/fail and exits 1 if any
  vector fails. Go runner rather than shell because subprocess
  management + JSON parsing in pure shell is error-prone; Go is
  already in the cronix toolchain and adapters only need their own
  language's stdlib.

- ts/packages/sdk/test/conformance-adapter.mjs: the TypeScript
  adapter. ~80 lines wrapping parseManifest / applyDefaults /
  canonicalize / sign / verify from the SDK's built dist. Verified
  end-to-end: 64 vectors / 64 passed.

- .github/workflows/ci.yml: new Conformance (TS adapter) job that
  builds the SDK then runs the runner against the TS adapter.
  Catches regressions in either the SDK or the spec vectors at PR
  time. Future Go adapter (#51) adds a matrix entry to this job.

The conformance check is NOT yet in the required-status list on
the main-branch ruleset. Once the Go adapter lands and the check
proves stable, it's a one-line ruleset update to promote it to
required.

Test:

  pnpm -C ts/packages/sdk build
  go run ./go/cmd/conformance --vectors spec --adapter \\
    "node ts/packages/sdk/test/conformance-adapter.mjs"
  # ...64 vectors enumerated as PASS...
  # 64 total / 64 passed / 0 failed

Signed-off-by: Abdelhadi Sabani <asabani.work@gmail.com>
Matches the existing pattern for go/cronix and go/cronix-* binaries
above. The cmd/conformance build lands at go/conformance when
developers run go build ./cmd/conformance from the go/ directory.

Signed-off-by: Abdelhadi Sabani <asabani.work@gmail.com>
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.

spec: extract spec/conformance/ runner — language-neutral harness

1 participant