You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A gateway's lease-request resource returns the lease without workerId and worker #253
On a gateway, the lease object in `POST /v1/lease-requests`'s `201` and in a granted `GET /v1/lease-requests/{id}` has no `workerId` and no `worker`. `docs/HTTP-API.md` ("The lease object") says a gateway-issued lease carries both.
Seen in a fake-driver gateway with one worker labelled `worker-a` (`e2e/gateway-smoke.test.ts`). The granted request's lease had exactly these keys:
`buildLeasePayload` (`src/http/tracker.ts:60`) copies neither field from the lease record. The fleet grant's lease does carry `worker` (`FleetLeaseCoordinator#projectRecord`, `src/gateway/fleet-coordinator.ts:1064`) but not `workerId`, so copying alone would still leave `workerId` out.
Defect. A gateway-granted lease on the request resource has neither workerId nor worker; docs/HTTP-API.md ("The lease object") gives it both. Reproduced with a fake-driver gateway and one worker on all three paths: a granted GET, a 201 granted inline, and that request read back.
e2e/gateway-smoke.test.ts, "returns workerId and worker on a gateway-granted lease, in POST /v1/lease-requests' 201 and in GET /v1/lease-requests/{id} (#253)", on bug/253-repro.
src/http/tracker.ts:64-79: buildLeasePayload copies neither field. The grant's lease record carries worker (FleetLeaseCoordinator#projectRecord, src/gateway/fleet-coordinator.ts:1064), but its schema has no workerId (leaseRecordSchema, src/contract/schemas.ts:191); only lease.list's statusLeaseSchema (schemas.ts:884) adds one. So #186's step 3 as written, "copy worker and workerId from the lease record", fixes GET /v1/leases/{id} but leaves workerId off this resource. A prototype of that step still fails this test on workerId alone.
Simplest fix
In buildLeasePayload, when the lease has worker, emit worker and workerId: worker.id; the docs say workerId mirrors worker. Add worker? to HttpLeaseRecord (tracker.ts:381). A prototype passed this test, the other four smoke tests, and the src/http and src/gateway unit suites.
Deliver it with #186, not alone: #186's step 3 edits this same line. Amend that step to the line above, carry this test into #186's PR, and close #253 as a duplicate when it merges.
Activity
V3RON commentedon Oct 2, 2026
Reproduction
Defect. A gateway-granted lease on the request resource has neither
workerIdnorworker;docs/HTTP-API.md("The lease object") gives it both. Reproduced with a fake-driver gateway and one worker on all three paths: a grantedGET, a201granted inline, and that request read back.e2e/gateway-smoke.test.ts, "returns workerId and worker on a gateway-granted lease, in POST /v1/lease-requests' 201 and in GET /v1/lease-requests/{id} (#253)", onbug/253-repro.Root cause
src/http/tracker.ts:64-79:buildLeasePayloadcopies neither field. The grant's lease record carriesworker(FleetLeaseCoordinator#projectRecord,src/gateway/fleet-coordinator.ts:1064), but its schema has noworkerId(leaseRecordSchema,src/contract/schemas.ts:191); onlylease.list'sstatusLeaseSchema(schemas.ts:884) adds one. So #186's step 3 as written, "copyworkerandworkerIdfrom the lease record", fixesGET /v1/leases/{id}but leavesworkerIdoff this resource. A prototype of that step still fails this test onworkerIdalone.Simplest fix
In
buildLeasePayload, when the lease hasworker, emitworkerandworkerId: worker.id; the docs sayworkerIdmirrorsworker. Addworker?toHttpLeaseRecord(tracker.ts:381). A prototype passed this test, the other four smoke tests, and thesrc/httpandsrc/gatewayunit suites.Deliver it with #186, not alone: #186's step 3 edits this same line. Amend that step to the line above, carry this test into #186's PR, and close #253 as a duplicate when it merges.
Alternatives rejected
workerIdfrom the record, as GET /v1/leases/{id} answers 404 on a gateway for a lease it issued #186 step 3 says: the grant's record has none.workerIdtoleaseRecordSchema: a contract change for a field the payload can derive; ADR 0005 §18 gives the lease object onlyworker.Risk
workerIdonly alongsideworker.docs/HTTP-API.mdalready describes the fixed shape; no doc change.Written by an agent.
test: wait for the released device before the #253 inline grant; cove…
fix(http,gateway): serve GET /v1/leases/{id} on a gateway and name th…
V3RON commentedon Oct 2, 2026
Fixed by #285 (merged with #186), which carries this issue's regression test.
fix(gateway): a stale worker view no longer brings back a released le…