spec: language-neutral conformance runner + TypeScript adapter (#6)#52
Open
awbx wants to merge 2 commits into
Open
spec: language-neutral conformance runner + TypeScript adapter (#6)#52awbx wants to merge 2 commits into
awbx wants to merge 2 commits into
Conversation
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>
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.
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
Why a Go runner (not shell or Python)
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
What's NOT in this PR