Skip to content

docs(core): name the ApiNamespace label parameter and document it - #806

Draft
xyos wants to merge 1 commit into
aws-devtools-labs:mainfrom
xyos:docs/api-namespace-jsdoc
Draft

xyos wants to merge 1 commit into
aws-devtools-labs:mainfrom
xyos:docs/api-namespace-jsdoc

Conversation

@xyos

@xyos xyos commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The second ApiNamespace constructor parameter is named name and has no documentation, so new ApiNamespace(scope, name, handler) reads as the name clients call. Clients call a namespace by the name it is exported under from the backend module: dispatch resolves apiNamespace as an export of the backend module (resolveApiNamespace in rpc-dispatch.ts), the client generator emits one client per export, and the shared gateway keys namespace routes on the export name (resolveNamespaceRoutes in cdk/shared-gateway.ts). The constructor string only marks the handler as an API namespace. For example, the auth Building Blocks' createApi() passes 'auth', and apps export the result as authApi, which is the name clients call.

main already documents the client side: the BlocksRequest.apiNamespace JSDoc says it holds the backend export name, and the template AGENTS.md says the namespace is the exported variable name. This PR covers the constructor parameter.

Issue #, if available: N/A

Changes

  • ApiNamespaceConstructor and the ApiNamespace class: rename the second parameter from name to label, and document it with @param label: clients never send it, so export const api = new ApiNamespace(scope, 'todos', handler) is called as api.list(). This is a parameter rename only; callers pass the same positional argument, and ApiNamespaceConstructor is not exported from the package entry point, so the API report is unchanged.
  • BlocksRequest.apiNamespace and the API_NAMESPACE_COMPUTE docs: "the constructor's name" becomes "the constructor's label". No other wording changes.
  • Codegen comments in generate-spec.ts and extract-ts-types.ts use the same label term.
  • @aws-blocks/core patch changeset. No runtime change.

Validation

No test added: the change is a parameter rename plus documentation, and export-name dispatch is already covered by rpc-dispatch.test.ts. On Node 22.23.1, rebased on main (b16e5b68):

  • npm ci, npm run build, npm run lint, npm run lint:deps and npm run check:api passed, each with exit status 0; the API report is unchanged.
  • npm test: 6150 passed, 0 failed, 7 skipped.
  • npx tsx scripts/changeset-guard.ts verify-coverage: all changed packages covered.

Checklist

  • PR description included
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@changeset-bot

changeset-bot Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8f1239c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@aws-blocks/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@xyos
xyos force-pushed the docs/api-namespace-jsdoc branch from 4aebb03 to f8ae20d Compare October 15, 2026 13:30
@xyos xyos changed the title docs(core): BlocksRequest.apiNamespace is the backend export name docs(core): document BlocksRequest.apiNamespace as the backend export name Oct 15, 2026
@xyos xyos closed this Oct 16, 2026
@xyos xyos reopened this Oct 16, 2026
@xyos
xyos force-pushed the docs/api-namespace-jsdoc branch 2 times, most recently from ac51665 to 3424e1a Compare October 19, 2026 15:25
@xyos xyos changed the title docs(core): document BlocksRequest.apiNamespace as the backend export name docs(core): document that clients call an ApiNamespace by its export name Oct 19, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Harbor agent check — advisory

20 todo-app trajectories per arm. Pass rates carry Wilson 95% intervals; metric differences are candidate − baseline medians over passed phases with a seeded bootstrap 95% interval, shown only when both arms have at least 3 passes. The primary metric is cache-neutral cost; the storage section compares arms within one storage block. Local mock mode only; nothing is deployed.

  • Baseline: d1b49001ae762233584a49cb4c26a610fa115ac2 (merge-base with the PR base).
  • Candidate: 48c23339c087598bcb887fc0dd4eaa48dd21a45b (PR head).
  • Harness: 5231743fa2e279e3064bbc9e057b019d4ca21405 (trusted workflow revision, both arms).
  • Workflow and evidence
  • baseline: 20/20 counted trials passed every phase.
  • candidate: 20/20 counted trials passed every phase.

Packed packages differ between arms.

Trials
Trial Baseline Candidate
1 passed passed
2 passed passed
3 passed passed
4 passed passed
5 passed passed
6 passed passed
7 passed passed
8 passed passed
9 passed passed
10 passed passed
11 passed passed
12 passed passed
13 passed passed
14 passed passed
15 passed passed
16 passed passed
17 passed passed
18 passed passed
19 passed passed
20 passed passed

Pass rate

Phase Baseline Candidate Baseline skill Candidate skill
create 20/20 (100%; 84–100%) 20/20 (100%; 84–100%) skill_tool 20 skill_tool 20
due-dates 20/20 (100%; 84–100%) 20/20 (100%; 84–100%) none 20 none 20
labels 20/20 (100%; 84–100%) 20/20 (100%; 84–100%) none 20 none 20
total 20/20 (100%; 84–100%) 20/20 (100%; 84–100%) — —

Passed-phase medians (IQR)

Phase Arm Cache-neutral cost (primary) Input processed Output Turns Tools Seconds List-price cost New input† Cache read†
create baseline $0.5633 ($0.5323–$0.6156) 803,398 (734,578–942,792) 9,346 (8,703–10,169) 24 (22.8–28) 22 (20.8–26) 366 (324–404) $0.4850 ($0.4547–$0.5373) 28,714 (27,489–31,314) 773,654 (706,541–915,169)
create candidate $0.5578 ($0.5198–$0.6455) 799,058 (684,120–960,378) 9,242 (8,602–10,562) 24 (21.8–27) 22 (19.8–25) 340 (301–394) $0.4844 ($0.4595–$0.5660) 30,162 (28,305–34,905) 770,388 (657,485–927,037)
due-dates baseline $0.1800 ($0.1753–$0.1903) 293,659 (278,462–309,714) 4,666 (4,360–4,801) 6 (5.8–6.2) 5 (4.8–5.2) 92.9 (81.8–99.9) $0.1801 ($0.1753–$0.1904) 6,274 (6,026–6,639) 286,306 (272,842–302,791)
due-dates candidate $0.1761 ($0.1590–$0.1982) 291,906 (244,263–334,248) 4,380 (4,168–4,916) 6 (5–6) 5 (4–5) 89.7 (79.7–104) $0.1762 ($0.1590–$0.1983) 6,686 (5,940–7,226) 283,584 (238,128–326,796)
labels baseline $0.1619 ($0.1554–$0.1748) 229,328 (220,490–256,486) 4,399 (4,132–4,673) 4 (4–5) 3 (3–4) 83.6 (76.0–88.7) $0.1620 ($0.1554–$0.1749) 6,023 (5,638–6,371) 223,305 (214,105–250,666)
labels candidate $0.1556 ($0.1459–$0.1704) 219,532 (214,401–239,323) 4,292 (4,031–4,508) 4 (4–4) 3 (3–3) 75.9 (66.8–80.7) $0.1556 ($0.1459–$0.1704) 5,626 (5,146–6,583) 214,444 (208,510–233,208)
total baseline $0.9163 ($0.8843–$0.9847) 1,329,466 (1,268,874–1,440,220) 18,650 (17,516–19,643) 34.5 (33–37) 30.5 (29–33) 553 (499–624) $0.8389 ($0.8068–$0.9065) 42,150 (40,434–43,613) 1,286,654 (1,228,921–1,395,943)
total candidate $0.9116 ($0.8419–$0.9790) 1,363,689 (1,167,596–1,487,984) 18,020 (16,855–19,694) 35.5 (30.8–37) 31.5 (26.8–33) 513 (464–589) $0.8330 ($0.7720–$0.9016) 42,090 (40,069–48,353) 1,321,720 (1,125,208–1,444,502)

† Descriptive, not comparable across arms: new input (uncached input + cache writes) and cache read depend on prompt-cache warm-up order, so no difference is reported for them.

Candidate − baseline

Phase Cache-neutral cost (primary) Δ Input processed Δ Output Δ Turns Δ Tools Δ Seconds Δ List-price cost Δ
create -$0.0056 (-1.0%) [-$0.0494, +$0.0745] -4,340 (-0.5%) [-131,237, +166,584] -104 (-1.1%) [-1,096, +1,250] +0 (+0.0%) [-3.5, +3] +0 (+0.0%) [-3.5, +3] -25.7 (-7.0%) [-78.6, +38.2] -$0.0006 (-0.1%) [-$0.0402, +$0.0734]
due-dates -$0.0039 (-2.2%) [-$0.0214, +$0.0155] -1,754 (-0.6%) [-50,452, +25,450] -286 (-6.1%) [-488, +246] +0 (+0.0%) [-1, +0] +0 (+0.0%) [-1, +0] -3.2 (-3.4%) [-14.2, +11.2] -$0.0039 (-2.2%) [-$0.0214, +$0.0155]
labels -$0.0064 (-3.9%) [-$0.0211, +$0.0039] -9,796 (-4.3%) [-30,126, +6,118] -107 (-2.4%) [-426, +167] +0 (+0.0%) [-0.5, +0] +0 (+0.0%) [-0.5, +0] -7.7 (-9.2%) [-17.0, +1.6] -$0.0064 (-3.9%) [-$0.0211, +$0.0039]
total -$0.0047 (-0.5%) [-$0.0841, +$0.0708] +34,222 (+2.6%) [-163,055, +167,470] -630 (-3.4%) [-2,008, +1,359] +1 (+2.9%) [-4, +3] +1 (+3.3%) [-4, +3] -40.5 (-7.3%) [-103, +31.2] -$0.0058 (-0.7%) [-$0.0747, +$0.0708]

Δ is the difference of medians (percent of the baseline median) [bootstrap 95% interval]. A phase passes when it and every earlier phase passed with complete accounting in one session. Trials without a result or with an infrastructure error are excluded from rates. Cache-neutral cost is the primary metric: each phase at the pinned model’s list prices as if its own session wrote every context token to the prompt cache once (context growth at the cache-write rate, the rest of the input processed at the cache-read rate, output at the output rate), so it does not depend on which concurrent session warmed the cache. Input processed = uncached input + cache writes + cache reads. List-price cost is Claude Code’s estimate, not AWS billing, and is secondary: it moves with cache hits from other sessions. Failed or incomplete work is excluded from metrics: less usage there is not an efficiency win. skill shows how the agent reached the installed aws-blocks skill.

Storage block

Storage Baseline trials Candidate trials Baseline cache-neutral cost Candidate cache-neutral cost Candidate − baseline
kv_store 6 4 $0.9139 (6 passed) $0.7733 (4 passed) -$0.1406 (-15.4%) [-$0.2217, -$0.0022]
distributed_table 14 16 $0.9163 (14 passed) $0.9374 (16 passed) +$0.0211 (+2.3%) [-$0.0615, +$0.0904]

The storage block the create phase constructed, read from its snapshot. It moves cost by itself, so a different storage mix between arms shifts the pooled medians above. Costs here are whole-run medians over trials that passed every phase; a difference is shown only when both arms have at least 3 such passes in that storage.

Rename the second ApiNamespace constructor parameter from `name` to
`label` and document it: clients never send it, they call a namespace by
the name it is exported under from the backend module. Update the
BlocksRequest.apiNamespace JSDoc and two codegen comments to use the
same term. No runtime change.
@xyos xyos changed the title docs(core): document that clients call an ApiNamespace by its export name docs(core): name the ApiNamespace label parameter and document it Oct 23, 2026
@xyos
xyos force-pushed the docs/api-namespace-jsdoc branch from 48c2333 to 8f1239c Compare October 23, 2026 15:18

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant