@adhd/apigen-python-env 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +12 -2
- package/python/apigen_python/flask_server.py +30 -10
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adhd/apigen-python-env",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"module": "./index.mjs",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -12,9 +12,19 @@
|
|
|
12
12
|
"provisioning"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@adhd/apigen-core-client": "^0.3.
|
|
15
|
+
"@adhd/apigen-core-client": "^0.3.1"
|
|
16
16
|
},
|
|
17
17
|
"publishConfig": {
|
|
18
18
|
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/PseudoSky/adhd.git",
|
|
24
|
+
"directory": "packages/apigen/python-env"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/PseudoSky/adhd/tree/main/packages/apigen/python-env#readme",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/PseudoSky/adhd/issues"
|
|
19
29
|
}
|
|
20
30
|
}
|
|
@@ -434,11 +434,12 @@ def _resolve_batch_concurrency(mode: str, requested: Any, item_count: int) -> in
|
|
|
434
434
|
def _dispatch_batch(
|
|
435
435
|
state: _ServerState, body: dict[str, Any], envelope: dict[str, Any]
|
|
436
436
|
) -> list[dict[str, Any]]:
|
|
437
|
-
"""Fan out `body['items']` to the real operation
|
|
438
|
-
the Python host's OWN executor against
|
|
439
|
-
(LEFT column only; this function is
|
|
440
|
-
`invokeBatch`). Implements the
|
|
441
|
-
(`tmp/apigen-batch-python-design.md`
|
|
437
|
+
"""Fan out `body['input']['items']` to the real operation
|
|
438
|
+
`body['input']['operation']` — the Python host's OWN executor against
|
|
439
|
+
BATCH_0.0.1.md §5's wire contract (LEFT column only; this function is
|
|
440
|
+
never a call into the TS `invokeBatch`). Implements the
|
|
441
|
+
architect-reviewed design's binding fixes (`tmp/apigen-batch-python-design.md`
|
|
442
|
+
§3.5):
|
|
442
443
|
|
|
443
444
|
- F2: `mode` branching — `parallel` uses a bounded `ThreadPoolExecutor`;
|
|
444
445
|
`serial`/`chained` use a plain sequential loop; `chained` additionally
|
|
@@ -455,13 +456,32 @@ def _dispatch_batch(
|
|
|
455
456
|
- F5: every rejected result's `reason` is a real `ApiError(...).to_json()`
|
|
456
457
|
using an existing `errors.py` taxonomy code.
|
|
457
458
|
|
|
459
|
+
BUG-APIGEN-CLI-002: every batch control-plane field (`operation`,
|
|
460
|
+
`items`, `concurrency`, `mode`, `onItemError`, `itemTimeoutMs`) now nests
|
|
461
|
+
under one top-level `input` object on the wire — `batch.ts`'s
|
|
462
|
+
`branchInputSchema` matches every other apigen-mounted operation's
|
|
463
|
+
single-JSON-blob convention. `@adhd/apigen-plugin-batch`'s
|
|
464
|
+
`parseBatchRequest` already unwraps this one extra level (its own doc
|
|
465
|
+
comment: "Unwrap that one extra level here — the only call site that
|
|
466
|
+
reads this shape."); this Python host is a SECOND call site reading the
|
|
467
|
+
same wire shape and must unwrap identically, never operate on the raw
|
|
468
|
+
top-level `body`.
|
|
469
|
+
|
|
458
470
|
Raises:
|
|
459
|
-
ApiError: for whole-request-level rejections (
|
|
460
|
-
unsupported `itemTimeoutMs`, malformed
|
|
461
|
-
`onItemError`/`concurrency`) — the caller maps
|
|
462
|
-
HTTP 4xx via `_send_error`, the SAME mechanism
|
|
463
|
-
on this server already uses.
|
|
471
|
+
ApiError: for whole-request-level rejections (missing/malformed
|
|
472
|
+
`input`, bad `operation`, unsupported `itemTimeoutMs`, malformed
|
|
473
|
+
`items`/`mode`/`onItemError`/`concurrency`) — the caller maps
|
|
474
|
+
this to a real HTTP 4xx via `_send_error`, the SAME mechanism
|
|
475
|
+
every other route on this server already uses.
|
|
464
476
|
"""
|
|
477
|
+
input_raw = body.get("input")
|
|
478
|
+
if not isinstance(input_raw, dict):
|
|
479
|
+
raise ApiError(
|
|
480
|
+
"invalid_argument",
|
|
481
|
+
'"input" must be an object containing {operation, items, ...}',
|
|
482
|
+
)
|
|
483
|
+
body = input_raw
|
|
484
|
+
|
|
465
485
|
# F3 — reject the WHOLE batch upfront; never a silently-weaker
|
|
466
486
|
# wait-only guarantee under the same field name TS uses for real
|
|
467
487
|
# cancellation.
|