Skip to content

fix(notary): document admin posture and config-apply 503 in OpenAPI#168

Merged
jeremi merged 5 commits into
mainfrom
fix/notary-openapi-posture-config-apply
Jun 28, 2026
Merged

fix(notary): document admin posture and config-apply 503 in OpenAPI#168
jeremi merged 5 commits into
mainfrom
fix/notary-openapi-posture-config-apply

Conversation

@jeremi

@jeremi jeremi commented Jun 28, 2026

Copy link
Copy Markdown
Member

What

Follow-up to the review of #166. The staff-engineer review flagged that the generated OpenAPI document omitted two surfaces the runtime actually serves, so the published contract did not match runtime.

  • GET /admin/v1/posture is now documented: the tier query parameter (enum default/restricted) and the full response set:
    • 200 redacted posture (body is a registry.ops.posture.v1 document)
    • 400 registry.admin.posture.invalid_tier
    • 401 auth.missing_credential
    • 403 auth.scope_denied (registry_notary:ops_read)
    • 500 posture.filter_failed
    • 503 posture.unavailable
  • POST /admin/v1/config/apply now documents the 503 config.apply_unavailable problem response.

Each problem example mirrors the exact runtime body (admin-schema shape via admin_problem_response for posture.unavailable / invalid_tier; plain RFC 9457 shape for filter_failed / config.apply_unavailable) and the application/problem+json media type.

Verification

  • TDD: added failing assertions first (route list, problem-example list, and a focused posture-contract test), confirmed RED, then implemented to GREEN.
  • cargo test -p registry-notary-server: lib 318 passed + all integration binaries, 0 failures.
  • cargo fmt -p registry-notary-server -- --check: clean.
  • Regenerated the committed artifact with cargo run -p registry-notary -- openapi; the artifact diff is exactly the two additions.

Flag: artifact version preserved at 0.6.2

Regenerating the artifact also bumps info.version 0.6.2 -> 0.8.3, because the generator emits the Rust crate version (env!("CARGO_PKG_VERSION") = 0.8.3) while the published product version is 0.6.2 (docsets.yaml, products/notary/CHANGELOG.md, release notes). To keep this PR scoped to the two surface additions and avoid silently re-pinning the published version, I reverted just the two info.version lines back to 0.6.2.

Consequence: re-running the generator will show a version diff until the crate-vs-product version mismatch is resolved. That generator-vs-product version question is pre-existing and out of scope here. Happy to follow up (re-pin to 0.8.3, or change the generator to emit the product version) on your call.

The runtime serves GET /admin/v1/posture and a 503 config.apply_unavailable response on /admin/v1/config/apply, but the generated OpenAPI document omitted both, so the published contract did not match runtime.

Register /admin/v1/posture (tier query parameter; 200 plus the 400/401/403/500/503 problem responses) and add the 503 problem response to /admin/v1/config/apply. Each problem example mirrors the exact runtime body and application/problem+json media type.

Regenerate the committed artifact, preserving the pinned product version 0.6.2 (the generator emits the crate version via CARGO_PKG_VERSION; the published product/docset version is 0.6.2).

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8d213564e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/registry-notary-server/src/openapi.rs
The GET /admin/v1/posture 200 response only had a description, so spec consumers would generate the operation as returning no body even though the handler returns a registry.ops.posture.v1 document. Add an application/json example sourced from registry-platform-ops NOTARY_POSTURE_EXAMPLE_V1 (the committed schema-valid sample), mirroring the admin capabilities pattern. Addresses Codex review feedback on #168.

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
@jeremi

jeremi commented Jun 28, 2026

Copy link
Copy Markdown
Member Author

Addressed in 375ca43. GET /admin/v1/posture 200 now carries an application/json example sourced from registry-platform-ops::NOTARY_POSTURE_EXAMPLE_V1 (the committed schema-valid registry.ops.posture.v1 sample), so codegen/Redoc see the posture document instead of an empty body. Wired via the const rather than a hand-written literal to avoid drift, mirroring the admin-capabilities example pattern.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 31890ce6bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread products/notary/openapi/registry-notary.openapi.json Outdated
The identifier-domain consolidation (id.registrystack.org) landed on main
while this PR was open. Merging it in left the committed OpenAPI artifact
stale: the posture and config-apply problem-type examples added here still
pointed at docs.registry-notary.dev, which the new identifier_domains test
rejects. Regenerate the artifact from the merged generator so the six
problem types resolve under https://id.registrystack.org/problems/registry-notary/.

Version stays pinned at the published product version 0.6.2 (the generator
emits the 0.8.3 crate version).

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
@jeremi jeremi merged commit 31629e7 into main Jun 28, 2026
10 checks passed
jeremi added a commit that referenced this pull request Jun 28, 2026
The GET /admin/v1/posture 200 response only had a description, so spec consumers would generate the operation as returning no body even though the handler returns a registry.ops.posture.v1 document. Add an application/json example sourced from registry-platform-ops NOTARY_POSTURE_EXAMPLE_V1 (the committed schema-valid sample), mirroring the admin capabilities pattern. Addresses Codex review feedback on #168.

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
@jeremi jeremi deleted the fix/notary-openapi-posture-config-apply branch June 28, 2026 11:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ce0f257ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"config_trust.antirollback_state_path is not configured",
),
);
set_json_response(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add a schema for the posture body

Fresh evidence after the earlier comment: this now adds an application/json example, but set_json_response still does not attach any schema for the 200 posture response, so the generated artifact exposes GET /admin/v1/posture as an untyped/free-form body. OpenAPI clients generated from the published spec still cannot deserialize the registry.ops.posture.v1 contract as a typed response even though the runtime always returns that shape; add a schema/ref for the posture document alongside the example.

Useful? React with 👍 / 👎.

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