Repository navigation
fix(protocol): document the §9.2 federation headers and responses in openapi.json - #15
Merged
Merged
Conversation
…openapi.json POST /api/v1/federate/announce and /federate/offer declared neither the X-Node-ID, X-Node-Signature and X-Timestamp headers SPECIFICATION.md §9.2 makes mandatory nor the 400/401 responses the reference backend returns, so a client generated from the contract always got an undocumented 401. - openapi.json: shared required header parameters under components.parameters, referenced by both operations, plus 400 and 401. - SPECIFICATION.md §8.2: the federate examples show all three headers; the Core-DP normative manifest is re-pinned for the shifted lines. - Backend test: every header the contract declares is enforced by the route, and every rejection status is documented. - Site mirror re-synced.
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.
Summary
SPECIFICATION.md §9.2 says node-to-node requests MUST send
X-Node-ID,X-Node-SignatureandX-Timestamp, and the reference backend enforces this (apps/backend/src/routes/federate.ts). Butprotocol/openapi.jsondeclared none of these headers onPOST /api/v1/federate/announceor/federate/offer, and listed only202. A client generated from the reference contract therefore always got an undocumented401.openapi.jsoncomponents.parameters(XNodeId,XNodeSignature,XTimestamp, the last typeddate-timewith the ±5 minute rule). Both federate operations reference them.400(invalid body, or a missing or malformedX-Timestamp) and401(missing node headers or credentials, or a stale timestamp), matching what the route returns.BearerAuth, which the backend accepts alongsideX-API-Key.X-Node-Signature. No normative text changed.profiles/core-dp/requirements/spec-v0.2.0-normative-manifest.jsonis re-pinned. Onlysource_linevalues change; ids and statement hashes are untouched.apps/backend/tests/openapi.federate.test.ts: checks that every header the contract declares is actually enforced by the route, and that every rejection status the route returns is documented. All 4 cases fail against the old contract.CHANGELOG.mdis updated.Not in this PR:
@apidevtools/swagger-parserrejectsservers[0].variables.nodeonmainas well ("unevaluated properties"). Without theserversblock, bothmainand this branch validate. That pre-existing issue looks like a validator quirk with OpenAPI 3.1 server variables, and it isn't touched here.Tree(s) touched
apps/backend(test only)apps/site(mirror re-sync only)protocolops/org-profileops/ledger,scripts/,.github/or root filesHow was this tested?
bash scripts/ci-local.sh(all targets): pass. This includesnpm run testinprotocol/, which checks the re-pinned manifest against the spec, and the conformance gate.bun testagainst a scratchlocalloop_testDB: 382 pass, 0 fail.bun run buildandbun run test: 53 pass, including the internal link and anchor check. The rendered spec shows the new headers.@apidevtools/swagger-parser10.1.1: withserversremoved, bothmainand this branch validate as OpenAPI 3.1 with 14 paths.Checklist
bash scripts/ci-local.shpasses locally.protocol/changed: the site mirror was re-synced,check:conformancepasses,git status --shortshows no deletions, and the normative manifest was re-pinned.protocol/CHANGELOG.md## [Unreleased]updated..envfiles, dumps orapps/backend/data/content included.Generated by Claude Code