3.9 KiB
Tech fixture ingestion adapter contract
Separate fixed pilot, never application QA, deployment evidence, Gate2 or release authorization.
Frozen HTTP contract
Authenticated worker Bearer credential (same guard/config as existing transport):
POST /internal/prepare-worker/tech-claimbody{taskId: UUID}->{lease:null | {...existingLease,pilotKind:"tech-dev-clamp-quantity-v1"}}.POST /internal/prepare-worker/heartbeatbody{taskId,runId,leaseToken}unchanged.POST /internal/prepare-worker/tech-completebody only{taskId:UUID,runId:UUID,leaseToken:UUID,source:string}. Source max2048 characters AND UTF-8 bytes. Returns{taskId,runId,state:"VERIFYING",artifactSha256,costStatus:"upper-bound-reserved"}.GET /internal/prepare-worker/artifacts/<artifactSha256>authenticated own-worker or independent Stage CI. Returns canonical JSON containing actual source, run/commit binding, server QA9, sourceSha256,applicationQa:false,retainedReservationCents:20, and costStatus. Hash is over canonical stored JSON, not source bytes; source digest is inqa.sourceSha256.
Stored task admission requires exact key AND metadata.scope tech-dev-clamp-quantity-v1, department TECH, PREPARE, budget20, workflowScope STAGE_PREPARE, environment staging and immutable40hex commit. Existing Gate1/READY workflow must be used. No body pilotKind/scope/pass/cost/URI/identity accepted. Task IDs never authorize themselves. Generic tracer completion refuses Tech key or scope so it cannot reconcile unknown provider cost as zero.
Parent adapter wiring
After independent Gate1/READY and provider cap approval, call tech-claim, require pilotKind and existing lease bounds, and pass only the original executor lease fields to infra/hermes-pilot/executor.py (strip pilotKind because executor uses strict fields). Reuse authenticated heartbeat with <=5s network deadline/no retry and ongoing executor fencing. On successful local executor result, read actual quantity.py (not a report/QA claim) bounded2048 and submit exact source with original binding to tech-complete. Backend independently parses/interprets a fixed expression grammar without executing Python or any subprocess. It accepts only one clamp_quantity(quantity) function with a single nested min/max/0..99/quantity return. Depth32/nodes128/source2048 bound computation; nine boundary cases must pass. This intentionally narrower grammar can reject Python that local AST QA accepts; fail closed, do not rewrite model source.
Retain the existing20-cent RESERVE unchanged: no RECONCILE row, actualCents or measured-cost claim. Server creates TECH_PILOT_SOURCE artifact and TECH_PILOT_FIXTURE_QA attestation signed server-bounded-minmax-v1. No generic QA/TEST attestation. State VERIFYING is fixture completion, not application acceptance. Independent CI remains separate and must not infer application QA from this artifact.
Descriptor-relative O_EXCL/O_NOFOLLOW immutable content storage and bounded authenticated digest/binding checks are reused. Source max2048, artifact JSON read max8192 for escaping/envelope. Same-UID/root storage attackers remain outside boundary. File-before-transaction can leave an unregistered unreadable orphan on cancellation/races; no automatic overwrite/retry. Exact stored task mutation is rechecked at commit, but operational task metadata/key mutation must remain forbidden after review.
Verification
Run existing WORKER_EVIDENCE_DIR=/opt/services/canina/validation/v4-tech-ingestion bash infra/hermes-worker/test-isolated.sh green-final from this worktree. Disposable PostgreSQL16/no published ports/no live volumes, real Nest TCP HTTP, existing child executor regression and backend build. Evidence includes red.log (missing route404), tracer-bypass-red.log (old endpoint201 instead of403), green-final.log and build.log. No model/provider call, live database/runtime edit, push, deployment or RELEASE_AUTHORIZE was performed.