Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The certification build-session and process-record contract files now use file-specific response component names, so they no longer clash with the existing certification contract's components; wire bodies are unchanged.
2 changes: 1 addition & 1 deletion parity/python-js-sdk.json
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@
"sdk032Surface": "Manifest Python pin advanced from d56e4353 to 6e8e4a54 (origin/develop, the SDK 0.32.0 release candidate) to cover two root exports the js-public-parity gate flagged unclassified on Traigent/Traigent#2861. requirement (traigent.runtime.decorator) is the runtime latency requirement decorator; traigent-js origin/main and origin/develop both export requirement from src/runtime/index.ts and list it in tests/integration/fixtures/api-surface.snapshot.json, so it is classified matched and added to requiredRootExports next to require. SnapshotBindingError (traigent.utils.exceptions) is the typed error of the Python opt-in snapshot store (S0 before dispatch, S1 from the terminal result, online G1); traigent-js has no snapshot store and no export of it (zero occurrences in src or its api-surface snapshot), so it is classified deferred-backlog, Python-only for now with no open JS design and no ticket. Owner may re-bucket."
},
"schemaRefresh": {
"lastSchemaFileSha": "a11b5e0ef9452b8e847b70cab387f0172c442b0446a5c4dee2bf504086ee3ffc",
"lastSchemaFileSha": "e1336def76c4e9122fd14a4a4ccd8abb370e7a196a93fabecfabba6e270290c4",
"schemaFileCount": 692,
"note": "Auto-stamped by scripts/refresh_parity.py. Do not hand-edit this block."
}
Expand Down
42 changes: 42 additions & 0 deletions tests/test_component_name_collisions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""No OpenAPI component name is defined twice with different bodies.

Consumers merge the ``components`` sections of every schema file into one
document; the same name with two different bodies makes that merge fail.
"""

from __future__ import annotations

import json
from collections import defaultdict

from traigent_schema.utils import get_schemas_dir


def _canonical(body: object) -> str:
return json.dumps(body, sort_keys=True, separators=(",", ":"))


def test_same_named_components_have_identical_bodies():
root = get_schemas_dir()
seen: dict[tuple[str, str], dict[str, set[str]]] = defaultdict(
lambda: defaultdict(set)
)
for path in sorted(root.rglob("*.json")):
data = json.loads(path.read_text(encoding="utf-8"))
components = data.get("components") if isinstance(data, dict) else None
if not isinstance(components, dict):
continue
rel = path.relative_to(root).as_posix()
for section, entries in components.items():
if not isinstance(entries, dict):
continue
for name, body in entries.items():
seen[(section, name)][_canonical(body)].add(rel)

conflicts = [
f"{section}/{name}: "
+ " vs ".join(sorted("+".join(sorted(f)) for f in bodies.values()))
for (section, name), bodies in sorted(seen.items())
if len(bodies) > 1
]
assert not conflicts, "component name collisions:\n" + "\n".join(conflicts)
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
}
}
},
"400": {"$ref": "#/components/responses/BadRequest"},
"401": {"$ref": "#/components/responses/Unauthorized"},
"403": {"$ref": "#/components/responses/Forbidden"},
"404": {"$ref": "#/components/responses/NotFound"},
"409": {"$ref": "#/components/responses/Conflict"},
"413": {"$ref": "#/components/responses/PayloadTooLarge"},
"400": {"$ref": "#/components/responses/CertificateBuildSessionBadRequest"},
"401": {"$ref": "#/components/responses/CertificateBuildSessionUnauthorized"},
"403": {"$ref": "#/components/responses/CertificateBuildSessionForbidden"},
"404": {"$ref": "#/components/responses/CertificateBuildSessionNotFound"},
"409": {"$ref": "#/components/responses/CertificateBuildSessionConflict"},
"413": {"$ref": "#/components/responses/CertificateBuildSessionPayloadTooLarge"},
"422": {"$ref": "#/components/responses/Unprocessable"},
"429": {"$ref": "#/components/responses/RateLimited"},
"500": {"$ref": "#/components/responses/AuthenticationError"},
Expand Down Expand Up @@ -99,10 +99,10 @@
}
},
"400": {"$ref": "#/components/responses/ProviderCredentialRejected"},
"401": {"$ref": "#/components/responses/Unauthorized"},
"403": {"$ref": "#/components/responses/Forbidden"},
"404": {"$ref": "#/components/responses/NotFound"},
"413": {"$ref": "#/components/responses/PayloadTooLarge"},
"401": {"$ref": "#/components/responses/CertificateBuildSessionUnauthorized"},
"403": {"$ref": "#/components/responses/CertificateBuildSessionForbidden"},
"404": {"$ref": "#/components/responses/CertificateBuildSessionNotFound"},
"413": {"$ref": "#/components/responses/CertificateBuildSessionPayloadTooLarge"},
"422": {"$ref": "#/components/responses/Unprocessable"},
"429": {"$ref": "#/components/responses/RateLimited"},
"500": {"$ref": "#/components/responses/AuthenticationError"},
Expand All @@ -116,7 +116,7 @@
},
"components": {
"responses": {
"PayloadTooLarge": {
"CertificateBuildSessionPayloadTooLarge": {
"description": "The request exceeds the size limit.",
"content": {
"application/json": {
Expand All @@ -141,7 +141,7 @@
"application/json": {"schema": {"$ref": "../closed_request_error_schema.json#/definitions/Unprocessable"}}
}
},
"BadRequest": {
"CertificateBuildSessionBadRequest": {
"description": "Invalid build-session reference, unsupported content type, or provider credential rejected.",
"content": {
"application/json": {
Expand All @@ -161,7 +161,7 @@
"application/problem+json": {"schema": {"$ref": "../closed_request_error_schema.json#/definitions/ProviderCredentialRejected"}}
}
},
"Unauthorized": {
"CertificateBuildSessionUnauthorized": {
"description": "Authentication required.",
"content": {
"application/json": {
Expand All @@ -174,7 +174,7 @@
}
}
},
"Forbidden": {
"CertificateBuildSessionForbidden": {
"description": "Authorization denied.",
"content": {
"application/json": {
Expand All @@ -188,7 +188,7 @@
}
}
},
"NotFound": {
"CertificateBuildSessionNotFound": {
"description": "The project or build session was not found, or the route is unavailable.",
"content": {"application/json": {"schema": {
"anyOf": [
Expand All @@ -199,7 +199,7 @@
]
}}}
},
"Conflict": {
"CertificateBuildSessionConflict": {
"description": "The issuance state conflicts with abandonment.",
"content": {"application/json": {"schema": {"$ref": "./certificate_error_v0_schema.json#/definitions/StateConflictV0"}}}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@
"application/problem+json": {"schema": {"$ref": "../closed_request_error_schema.json#/definitions/ProviderCredentialRejected"}}
}
},
"401": {"$ref": "#/components/responses/Unauthorized"},
"401": {"$ref": "#/components/responses/ProcessRecordUnauthorized"},
"403": {"$ref": "#/components/responses/WriteForbidden"},
"404": {"$ref": "#/components/responses/NotFound"},
"404": {"$ref": "#/components/responses/ProcessRecordNotFound"},
"422": {"$ref": "#/components/responses/Unprocessable"},
"409": {
"description": "The requested receipt snapshot conflicts with current state.",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProcessRecordConflict"}}}
},
"413": {"$ref": "#/components/responses/PayloadTooLarge"},
"413": {"$ref": "#/components/responses/ProcessRecordPayloadTooLarge"},
"429": {"$ref": "#/components/responses/RateLimited"},
"500": {"$ref": "#/components/responses/InternalError"},
"500": {"$ref": "#/components/responses/ProcessRecordInternalError"},
"503": {
"description": "Receipt or authentication data is temporarily unavailable.",
"content": {
Expand Down Expand Up @@ -193,7 +193,7 @@
"application/problem+json": {"schema": {"$ref": "../closed_request_error_schema.json#/definitions/ProviderCredentialRejected"}}
}
},
"401": {"$ref": "#/components/responses/Unauthorized"},
"401": {"$ref": "#/components/responses/ProcessRecordUnauthorized"},
"403": {
"description": "The caller lacks read access to the project.",
"content": {
Expand Down Expand Up @@ -323,9 +323,9 @@
}
}
},
"413": {"$ref": "#/components/responses/PayloadTooLarge"},
"413": {"$ref": "#/components/responses/ProcessRecordPayloadTooLarge"},
"429": {"$ref": "#/components/responses/RateLimited"},
"500": {"$ref": "#/components/responses/InternalError"},
"500": {"$ref": "#/components/responses/ProcessRecordInternalError"},
"503": {
"description": "The stored issuance could not be read or reconciled.",
"content": {
Expand Down Expand Up @@ -507,9 +507,9 @@
"application/problem+json": {"schema": {"$ref": "../closed_request_error_schema.json#/definitions/ProviderCredentialRejected"}}
}
},
"401": {"$ref": "#/components/responses/Unauthorized"},
"401": {"$ref": "#/components/responses/ProcessRecordUnauthorized"},
"403": {"$ref": "#/components/responses/WriteForbidden"},
"404": {"$ref": "#/components/responses/NotFound"},
"404": {"$ref": "#/components/responses/ProcessRecordNotFound"},
"409": {
"description": "Issuance conflicts with current state. A retry delay is returned when issuance is already in progress.",
"headers": {
Expand Down Expand Up @@ -646,9 +646,9 @@
}
}
},
"413": {"$ref": "#/components/responses/PayloadTooLarge"},
"413": {"$ref": "#/components/responses/ProcessRecordPayloadTooLarge"},
"429": {"$ref": "#/components/responses/RateLimited"},
"500": {"$ref": "#/components/responses/InternalError"},
"500": {"$ref": "#/components/responses/ProcessRecordInternalError"},
"503": {
"description": "Issuance could not be completed or confirmed.",
"content": {
Expand Down Expand Up @@ -774,7 +774,7 @@
"application/problem+json": {"schema": {"$ref": "../closed_request_error_schema.json#/definitions/ProviderCredentialRejected"}}
}
},
"401": {"$ref": "#/components/responses/Unauthorized"},
"401": {"$ref": "#/components/responses/ProcessRecordUnauthorized"},
"403": {
"description": "The caller lacks read access.",
"content": {
Expand Down Expand Up @@ -853,9 +853,9 @@
}
}
},
"413": {"$ref": "#/components/responses/PayloadTooLarge"},
"413": {"$ref": "#/components/responses/ProcessRecordPayloadTooLarge"},
"429": {"$ref": "#/components/responses/RateLimited"},
"500": {"$ref": "#/components/responses/InternalError"},
"500": {"$ref": "#/components/responses/ProcessRecordInternalError"},
"503": {
"description": "Authentication is temporarily unavailable.",
"content": {
Expand Down Expand Up @@ -885,7 +885,7 @@
},
"components": {
"responses": {
"PayloadTooLarge": {
"ProcessRecordPayloadTooLarge": {
"description": "The request exceeds the size limit.",
"content": {
"application/json": {"schema": {"$ref": "../closed_request_error_schema.json#/definitions/RequestTooLarge"}}
Expand All @@ -903,7 +903,7 @@
"application/json": {"schema": {"$ref": "../closed_request_error_schema.json#/definitions/Unprocessable"}}
}
},
"Unauthorized": {
"ProcessRecordUnauthorized": {
"description": "Authentication required.",
"content": {
"application/json": {"schema": {"$ref": "../closed_request_error_schema.json#/definitions/Unauthorized"}}
Expand All @@ -913,11 +913,11 @@
"description": "The caller lacks write access to the project.",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProcessRecordWriteForbidden"}}}
},
"NotFound": {
"ProcessRecordNotFound": {
"description": "No accessible matching scope was found. The code LINEAGE_UNMAPPED means the build session reference is valid but the build session is not yet finalized, so it does not resolve to an issuance; finalize the build session and retry.",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProcessRecordScopeNotFound"}}}
},
"InternalError": {
"ProcessRecordInternalError": {
"description": "An unexpected server error occurred.",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProcessRecordInternal"}}}
}
Expand Down
Loading