Batch: merge invalid into not_run; redact OAuth callback queries in access log (0.1.1-dev.3) #107

Merged
john merged 1 commit from feat/batch-not-run-callback-log into main 2026-11-26 03:00:18 +00:00
Owner

v0.1.1-dev.3

Simpler batch statuses, and OAuth sign-in codes no longer appear in the access log.

  • corn_call_tools: invalid is merged into not_run. Every call now has exactly one of three statuses: ok, error (ran and failed) or not_run (never ran). A not_run call that was itself the problem carries error (unknown tool, recursive call) or errors (field problems); a not_run call without them was valid and only held back because the batch was rejected. The top-level invalid count is removed; not_run counts all calls that did not run. Request validation stays strict: unknown keys and copied response fields still reject the whole batch before anything runs.
  • Access log redaction. uvicorn access-log lines for any /auth/.../callback (Pocket ID sign-in, console sign-in, linked MCP accounts such as PocketSmith and Coder) now show ?<redacted> instead of the one-time authorization code and state. Other request paths and query strings are logged unchanged.

Behaviour change: clients reading results[].status == "invalid" or the top-level invalid count should use not_run (with error/errors) instead.

Verification

  • 548 tests pass (new tests/test_access_log.py: path matcher incl. non-auth callback paths untouched, filter rewrite, dictConfig wiring, idempotent install; tests/test_batch.py updated for the three statuses).
  • Real uvicorn server with the exact run_server log config: GET /auth/upstream/pocketsmith/callback?<redacted>, GET /auth/console/callback?<redacted>, GET /mcp?keep=1 unchanged; 0 occurrences of the test code/state in output.
# v0.1.1-dev.3 Simpler batch statuses, and OAuth sign-in codes no longer appear in the access log. - **`corn_call_tools`: `invalid` is merged into `not_run`.** Every call now has exactly one of three statuses: `ok`, `error` (ran and failed) or `not_run` (never ran). A `not_run` call that was itself the problem carries `error` (unknown tool, recursive call) or `errors` (field problems); a `not_run` call without them was valid and only held back because the batch was rejected. The top-level `invalid` count is removed; `not_run` counts all calls that did not run. Request validation stays strict: unknown keys and copied response fields still reject the whole batch before anything runs. - **Access log redaction.** uvicorn access-log lines for any `/auth/.../callback` (Pocket ID sign-in, console sign-in, linked MCP accounts such as PocketSmith and Coder) now show `?<redacted>` instead of the one-time authorization `code` and `state`. Other request paths and query strings are logged unchanged. **Behaviour change:** clients reading `results[].status == "invalid"` or the top-level `invalid` count should use `not_run` (with `error`/`errors`) instead. ## Verification - 548 tests pass (new `tests/test_access_log.py`: path matcher incl. non-auth `callback` paths untouched, filter rewrite, dictConfig wiring, idempotent install; `tests/test_batch.py` updated for the three statuses). - Real uvicorn server with the exact `run_server` log config: `GET /auth/upstream/pocketsmith/callback?<redacted>`, `GET /auth/console/callback?<redacted>`, `GET /mcp?keep=1` unchanged; 0 occurrences of the test code/state in output.
feat: merge batch 'invalid' into 'not_run'; redact OAuth callback queries in access log (0.1.1-dev.3)
All checks were successful
Corn CI / release-check-1 (pull_request) Successful in 3s
Corn CI / release-check (pull_request) Successful in 0s
Corn CI / host (pull_request) Successful in 12s
Security / scan (pull_request) Successful in 27s
Security / security (pull_request) Successful in 0s
Corn CI / test (pull_request) Successful in 2m39s
Corn CI / release (pull_request) Has been skipped
Review / change impact (pull_request_target) Successful in 3m36s
592325ed82
corn_call_tools: every call is now ok, error (ran and failed) or not_run
(never ran). A not_run call that was itself the problem carries error/errors;
one without them was valid but held back by a rejected batch. The top-level
'invalid' count is removed. Request validation stays strict.

Access log: uvicorn.access records for /auth/.../callback (Pocket ID, console,
linked MCP accounts) log '?<redacted>' instead of the one-time code and state,
via a logging filter declared in uvicorn's dictConfig.

Change review · 7993f8203070 → 592325ed8292

Call paths changed by this PR

Caller → changed symbol → callee. Each edge labels the line in the caller. One detected entry path (up to 3 hops) is included when found. Static evidence, not a runtime stack trace.

After

flowchart LR
    n0["redact_path - added"]
    n1["test_redact_path"]
    n2["CallbackQueryFilter.filter - added"]
    n3["install - added"]
    n4["test_install_is_idempotent"]
    n5["_summary - modified"]
    n6["rejected_batch - modified"]
    n7["register._locals_.corn_batch"]
    n8["_BatchArgumentErrors.on_call_tool"]
    n9["_field_message"]
    n10["register - modified"]
    n11["_rejecting_server"]
    n12["test_batch_accepts_corn_prefix_blocks_recursion_and_isolates_errors"]
    n13["test_batch_concurrent_upstream_proxy_calls"]
    n2 -->|L32| n0
    n8 -->|L165| n6
    n7 -->|L424| n5
    n6 -->|L118| n9
    n6 -->|L144| n5
    n4 -->|L68| n3
    n1 -->|L25| n0
    n11 -->|L167| n10
    n12 -->|L59| n10
    n13 -->|L366| n10

Changed symbols:

  • added redact_path — src/corn/access_log.py:21
  • added CallbackQueryFilter.filter — src/corn/access_log.py:29
  • added install — src/corn/access_log.py:38
  • modified _summary — src/corn/batch.py:89
  • modified rejected_batch — src/corn/batch.py:104
  • modified register — src/corn/batch.py:245
    Bounded view: 16 more changed symbols and 7 neighbour references omitted.
Overall architecture after this change

Source: 592325ed8292 · code-review 0.1.0-dev.1.

Generated from resolved static calls between reviewed code areas. Numbers are call sites, not request counts.
Framework registration, dynamic dispatch, and unresolved calls are not shown. This is not a deployment map.
Showing 6 of 6 inter-area edges. Edit the reviewed source instead of this generated page.

flowchart LR
    n1["Console"]
    n2["Identity"]
    n3["NSW integrations"]
    n4["Persistence"]
    n5["REST handlers"]
    n6["Server composition"]
    n7["Shared contracts"]
    n8["Shopping"]
    n4 -->|"9"| n2
    n6 -->|"5"| n5
    n6 -->|"2"| n7
    n1 -->|"1"| n3
    n1 -->|"1"| n8
    n6 -->|"1"| n2

This diagram is for the linked commit. It refreshes after required checks pass for a new head.

<!-- john/release:architecture-review:v1 --> # Change review · `7993f8203070` → [`592325ed8292`](https://code.yawn.dev/john/corn/commit/592325ed829286b890c249e6f833627fc8b385e3) ## Call paths changed by this PR Caller → changed symbol → callee. Each edge labels the line in the caller. One detected entry path (up to 3 hops) is included when found. Static evidence, not a runtime stack trace. ### After ```mermaid flowchart LR n0["redact_path - added"] n1["test_redact_path"] n2["CallbackQueryFilter.filter - added"] n3["install - added"] n4["test_install_is_idempotent"] n5["_summary - modified"] n6["rejected_batch - modified"] n7["register._locals_.corn_batch"] n8["_BatchArgumentErrors.on_call_tool"] n9["_field_message"] n10["register - modified"] n11["_rejecting_server"] n12["test_batch_accepts_corn_prefix_blocks_recursion_and_isolates_errors"] n13["test_batch_concurrent_upstream_proxy_calls"] n2 -->|L32| n0 n8 -->|L165| n6 n7 -->|L424| n5 n6 -->|L118| n9 n6 -->|L144| n5 n4 -->|L68| n3 n1 -->|L25| n0 n11 -->|L167| n10 n12 -->|L59| n10 n13 -->|L366| n10 ``` Changed symbols: - **added** `redact_path` — `src/corn/access_log.py:21` - **added** `CallbackQueryFilter.filter` — `src/corn/access_log.py:29` - **added** `install` — `src/corn/access_log.py:38` - **modified** `_summary` — `src/corn/batch.py:89` - **modified** `rejected_batch` — `src/corn/batch.py:104` - **modified** `register` — `src/corn/batch.py:245` Bounded view: 16 more changed symbols and 7 neighbour references omitted. <details><summary>Overall architecture after this change</summary> Source: [592325ed8292](https://code.yawn.dev/john/corn/commit/592325ed829286b890c249e6f833627fc8b385e3) · `code-review 0.1.0-dev.1`. Generated from resolved static calls between reviewed code areas. Numbers are call sites, not request counts. Framework registration, dynamic dispatch, and unresolved calls are not shown. This is not a deployment map. Showing 6 of 6 inter-area edges. Edit the reviewed source instead of this generated page. ```mermaid flowchart LR n1["Console"] n2["Identity"] n3["NSW integrations"] n4["Persistence"] n5["REST handlers"] n6["Server composition"] n7["Shared contracts"] n8["Shopping"] n4 -->|"9"| n2 n6 -->|"5"| n5 n6 -->|"2"| n7 n1 -->|"1"| n3 n1 -->|"1"| n8 n6 -->|"1"| n2 ``` </details> This diagram is for the linked commit. It refreshes after required checks pass for a new head.
john merged commit efa7e98775 into main 2026-11-26 03:00:18 +00:00
john deleted branch feat/batch-not-run-callback-log 2026-11-26 03:00:19 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
john/corn!107
No description provided.