Repository navigation
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Better solutionProblem. The The PR's approach works, but there is a simpler one. Every JSON error body simlock writes is built by one function, // errors.ts, in errorResponse
c.set("errorCode", mapped.code);
// app.ts, in the request log step
const code = c.get("errorCode");Add
Side effects
ReviewRan the repo's
The review did not consider the gateway relay case above. That case is the main reason I suggest the Written by an agent. |
A gateway's `request` log line had the status but not the error code, so a 404 could be `UNKNOWN_LEASE`, `UNKNOWN_FILE` or `UNKNOWN_LEASE_REQUEST`, and a refusal that never reaches the dispatcher left no code anywhere. `errorResponse`, which writes every JSON error body simlock makes, now records the code on the request context, and the log step adds it as `code`. The log step reads no body, so a mount's own answer and a worker's answer relayed by a gateway log their status alone, and a gateway never waits on a worker's body before answering. Co-authored-by: Cursor <cursoragent@cursor.com>
8b28e1a to
0bbb765
Compare
|
@V3RON Addressed your review comments |
|
@V3RON Switched to recording the code in Three JSON refusals don't go through
Should these be covered too? The 426 is a one-line |
|
Second review, at Better solutionYes, Does the gap of three refusals matter? Not much. My advice: leave them out and merge.
Changing Side effects
ReviewRan the repo's
Looks good to merge as is. The 413 change above is optional. Written by an agent. |
Problem
A gateway's
requestlog line has the HTTP status but not the error code. A 404 could beUNKNOWN_LEASE,UNKNOWN_FILEorUNKNOWN_LEASE_REQUEST, and a refusal that never reaches the dispatcher (validation 400s, auth 401/403, tracker refusals) leaves no code anywhere.Change
Head:
68d02c8a.errorResponse, which writes the JSON error bodies simlock makes, records the code on the request context (errorCodein the app'sVariables).requestline carries it ascode. The log step reads no body: no clone, no parse, no wait on a worker's relayed body.FILE_TOO_LARGE(gateway-lease-files.ts) is thrown as aDispatchError, so it goes througherrorResponseand logs its code. Same body and status.src/http/AGENTS.mddescribes the new field.Not covered, because these answers do not go through
errorResponse: the 426 on a plainGET /v1/session(upgradeRequired) and the lease-files handler's refusals such asUNKNOWN_FILE(lease-files/handler.ts).Verification
src/http/app-request-log.test.tscovers four cases:code: "UNKNOWN_LEASE", and the caller still gets the full body;code: "UNAUTHENTICATED".The first and last fail without the
errorResponsechange.src/daemon/gateway-lease-files.test.ts: an over-limit declared size gets 413FILE_TOO_LARGEwith the same body, relays nothing, and logscode. Fails without the change.pnpm typecheck,oxlint,depcruise,oxfmt --check, comment and test lints,pnpm fallow --ci, and the.repo.test.tsfiles.src/httpandsrc/gatewayunit tests: 1,137 pass.Merge risk
errorResponsestay uncovered (listed above).codefield on refusedrequestlines, on workers and gateways; no new lines.0bbb765d, CodeRabbit with no findings.codeshows in the gateway'srequestlines.Review
Spec review: skipped. Code review: 1 blocking, 1 fixed, 2 notes. Claims review: skipped.
Rounds: 2. Tokens: n/a.
Round 2 (
0bbb765d) and the fix-check (68d02c8a): 0 findings; every round 1 finding resolved. Both were coordinator self-checks, no lens agents.errorResponse(listed under Change). Left out of scope: covering the file refusals needs the lease-files interface to return the code.Rejected:
errorResponse's context breaks five callers, because Hono'sContextis invariant in its env.Written by an agent.