Fixes 2 critical, 2 important, and 5 minor findings from review of 069edcb:
- C1: add a happy-path test that reaches postOcrEscrow.ts's escrowLockFloor
call and asserts the locked amount; verified it fails against a bare
economicTotal and passes against the real code.
- C2: gate /v1/ocr/extract (auth + rate limits) before the 16mb body parser
so an unauthenticated caller can no longer force a full buffer/JSON.parse.
- I2: hoist result/used/escrowRef in the OCR one-shot handler so the failure
path records escrow_ref/supplier/cost when an escrow was actually posted,
and emit an ocr_failed structured log line mirroring ocr_settled.
- I3: export venueAttribution and cover its sanitization directly; add a
stubbed happy-path route test asserting the first-party-brokered
disclosure label reaches the response.
- Minor: drop unused hfWeightsSource end to end, rename a misleading test,
make the OCR capability template's pinning language conditional on the
self-hosted upstream, tighten the /v1/ocr path-prefix guard, and make
preflight's required_lovelace use the same escrowLockFloor the builder
locks (exported from the shared tx barrel for gateway use).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
22 lines
1.3 KiB
JSON
22 lines
1.3 KiB
JSON
{
|
|
"capability_id": "ocr.page.extract.chandra-ocr-2.v1",
|
|
"weights_source": "hf:datalab-to/chandra-ocr-2",
|
|
"model_revision": "<40-hex commit SHA; self-hosted (OCR_UPSTREAM=openai-vision) deployments only — the Datalab-hosted default (OCR_UPSTREAM=datalab) is a third-party API with no pinnable checkpoint, so this is unset there>",
|
|
"license": "modified OpenRAIL-M (weights); Apache-2.0 (code)",
|
|
"request_shape": {
|
|
"route": "POST /v1/ocr/extract",
|
|
"body": { "image_b64": "plain base64, no data: prefix", "mime": "image/png | image/jpeg | image/webp", "output_format": "markdown | html | json" },
|
|
"one_page_per_job": true
|
|
},
|
|
"receipt": {
|
|
"schema": "v1 (8 fields, Ed25519-signed)",
|
|
"response_hash": "sha256(canonical({content, output_format}))",
|
|
"verify": "GET /capability → pub_key_hex; verify signature over canonical(receipt)"
|
|
},
|
|
"revision_probe": {
|
|
"route": "<runtime info route reporting the loaded checkpoint; self-hosted (openai-vision) upstream only>",
|
|
"policy": "self-hosted (OCR_UPSTREAM=openai-vision) upstream: probe before every Claim, mismatch refuses the job. Datalab-hosted default (OCR_UPSTREAM=datalab): per-job liveness probe only, no checkpoint pin."
|
|
},
|
|
"operator_disclosure": "first-party (HAL8-operated supplier)"
|
|
}
|