ci: enforce endpoint inventory independently
This commit is contained in:
@@ -389,6 +389,13 @@
|
||||
"rationale": "Campaign delivery diagnostic/status API is retained for bounded support and automation consumers.",
|
||||
"repository": "govoplan-campaign"
|
||||
},
|
||||
{
|
||||
"category": "worker_internal",
|
||||
"method": "POST",
|
||||
"path": "/campaigns/operations/artifacts/reconcile",
|
||||
"rationale": "Privileged, bounded artifact recovery operation used by operators and recovery automation rather than an end-user surface.",
|
||||
"repository": "govoplan-campaign"
|
||||
},
|
||||
{
|
||||
"category": "ui_reachable",
|
||||
"method": "PUT",
|
||||
|
||||
@@ -45,6 +45,11 @@ def main() -> int:
|
||||
action="store_true",
|
||||
help="Fail on missing translations or incomplete endpoint-surface declarations.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--strict-endpoints",
|
||||
action="store_true",
|
||||
help="Fail only on incomplete or stale endpoint-surface declarations.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--endpoint-declarations",
|
||||
type=Path,
|
||||
@@ -80,20 +85,12 @@ def main() -> int:
|
||||
print(f"Platform inventory JSON: {json_path}")
|
||||
print(f"Platform inventory summary: {markdown_path}")
|
||||
|
||||
if args.strict:
|
||||
failures: list[str] = []
|
||||
if inventory["translation_health"]["missing_catalog_entries"]:
|
||||
failures.append("used translation keys are missing from generated catalogs")
|
||||
if inventory["api"]["unclassified_endpoints"]:
|
||||
failures.append(
|
||||
f"{len(inventory['api']['unclassified_endpoints'])} backend "
|
||||
"endpoints have no WebUI evidence or surface declaration"
|
||||
)
|
||||
if inventory["api"]["stale_endpoint_declarations"]:
|
||||
failures.append(
|
||||
f"{len(inventory['api']['stale_endpoint_declarations'])} "
|
||||
"endpoint declarations do not match a backend endpoint"
|
||||
)
|
||||
if args.strict or args.strict_endpoints:
|
||||
failures = _strict_failures(
|
||||
inventory,
|
||||
check_translations=args.strict,
|
||||
check_endpoints=True,
|
||||
)
|
||||
if failures:
|
||||
print(
|
||||
"Strict platform inventory failed: " + "; ".join(failures) + ".",
|
||||
@@ -103,6 +100,31 @@ def main() -> int:
|
||||
return 0
|
||||
|
||||
|
||||
def _strict_failures(
|
||||
inventory: dict[str, Any],
|
||||
*,
|
||||
check_translations: bool,
|
||||
check_endpoints: bool,
|
||||
) -> list[str]:
|
||||
failures: list[str] = []
|
||||
if (
|
||||
check_translations
|
||||
and inventory["translation_health"]["missing_catalog_entries"]
|
||||
):
|
||||
failures.append("used translation keys are missing from generated catalogs")
|
||||
if check_endpoints and inventory["api"]["unclassified_endpoints"]:
|
||||
failures.append(
|
||||
f"{len(inventory['api']['unclassified_endpoints'])} backend "
|
||||
"endpoints have no WebUI evidence or surface declaration"
|
||||
)
|
||||
if check_endpoints and inventory["api"]["stale_endpoint_declarations"]:
|
||||
failures.append(
|
||||
f"{len(inventory['api']['stale_endpoint_declarations'])} "
|
||||
"endpoint declarations do not match a backend endpoint"
|
||||
)
|
||||
return failures
|
||||
|
||||
|
||||
def _resolve_workspace_root(catalog: dict[str, Any]) -> Path:
|
||||
sibling_root = META_ROOT.parent.resolve()
|
||||
configured_root = Path(str(catalog["default_parent"])).expanduser().resolve()
|
||||
|
||||
Reference in New Issue
Block a user