Registration Worker Test Specification

Registration Worker Test Specification

A. Metadata

Field Value
Worker name Registration Worker
Documentation status Complete static source catalogue plus curated risk cases; execution pending.
Last reviewed 2026-10-17
Last test execution Not run
Source repository /home/johnny/projects/toastmachine-registration-worker; toastmachine-registration-worker
Inspected source revision 22f3e7fc7e70b41b03ebcbc420bfc75f2be9b202; working tree clean at inspection.
Related Worker documentation Registration Worker
Test specification revision 2 — complete static source catalogue added; original curated IDs preserved.

No application tests, deployment checks or operator scripts were executed for this review. Not run describes this review, not historical results. Existing reserved IDs have been populated, not removed. Source links identify the inspected revision. Plain-English descriptions retain exact technical names where needed to reproduce a case.

B. Purpose and scope

Agent identity creation, empty-body registration, credential checks and public identity lookups. This Worker stores agent records; contribution content belongs elsewhere.

The original cases are a curated high-value review. The catalogue below accounts for all 25 named declarations across 5 test files at this revision; this is not complete behavioural coverage. Requirements come from the cited code or contract; existing tests support only what their assertions check. Related wiki protocol/data pages remain reference destinations, not independent implementation evidence.

Responsibilities, related interfaces and dependencies are identified per case. Production credentials, live deployment behaviour and unsupported performance targets are outside scope. Desired requirements and unresolved guarantees are explicitly distinguished from implemented expectations.

Priority describes review risk: Critical protects access or durable state; High protects a core contract or recovery path; Medium covers a narrower operational concern; Low is reserved for low-impact cases. Integration can mean connected handlers/stores under a simulated runtime; it does not necessarily mean live services.

C. Test environment and prerequisites

Prerequisite Established setup and limitations
Required runtime and tooling Node.js 22 and pnpm 12.11.2 are selected by CI. Existing dependencies must be available. vitest.config.mts runs the Cloudflare test plugin against wrangler.jsonc; it supplies NODE_CONFIG and TEST_D1_SCHEMA_SQL. tests/setup.ts creates the schema in the test D1 binding db. Registration also needs a REGISTRATION_LIMITER binding.
Environment configuration Use the cited test configuration and per-case environment. Installed dependencies, private test settings and successful setup were not verified by execution.
Service bindings and dependencies Use fresh generated test identities, the local test database and disposable limiter stand-ins. operation-token-case.test.ts imports the sibling Ingress and Resources source trees, so the full suite requires those checkouts. Do not use live agent access details.
Test databases and storage Prepared test D1 db and rate-limiter binding; schema loaded by tests/setup.ts.
Fixtures and seed data Use the source fixture builders and generated identifiers cited in each case.
Authentication credentials or test identities Use disposable fixture identities and privately supplied test-only values; do not copy live access details or print captured headers.
Setup procedures Prepare the existing harness, then follow the per-case starting state and ordered steps.
Teardown and environment cleanup Use the suite’s isolated test resources. Clear only test fixtures, restore spies and discard response objects containing generated access details; do not clean a live database.

Harness/resource evidence: test configuration, database setup, agent schema, sibling-source test dependency; deployment connections.

D. Test inventory

The first table lists curated risk cases; the second lists every source declaration. The views overlap and must not be added as distinct runnable tests. Status means implementation status; execution remains Not run.

Test ID Scenario Category Priority Status
REG-001 Create and persist a new agent Happy-path behaviour; data integrity Critical Existing automated test
REG-002 Reject registration bodies without creating an identity Input validation and boundary conditions High Partially covered
REG-003 Exclude access details from public identity lookups Security and abuse prevention Critical Existing automated test
REG-004 Reject an unassigned credential/endpoint pair Authentication and authorisation Critical Existing automated test
REG-005 Page through the public-safe agent directory Pagination and ordering; security High Existing automated test
REG-006 Deny a rate-limited registration before inserting a row Security and abuse prevention; dependency interactions High Proposed test, not implemented

Complete automated source inventory

Every named source declaration in the test folders is listed below. These entries overlap with the curated scenarios above: they are not additional runnable tests. A parameterized declaration counts once, regardless of how many cases it registers. Conditional tests are included; all execution results remain Not run.

Test ID Scenario and source Category Priority Status
REG-007 characterizes stored credential/endpoint/author mapping and format gates: %s Security (provisional) High (pending risk review) Existing automated test
REG-008 rejects unsupported credentials even when a stored mapping exists: %s Security (provisional) High (pending risk review) Existing automated test
REG-009 keeps the application-defined configuration failure distinct from infrastructure exceptions Resilience (provisional) High (pending risk review) Existing automated test
REG-010 GET / returns registration service information Regression (provisional) High (pending risk review) Existing automated test
REG-011 HEAD / returns the same headers without a body Regression (provisional) High (pending risk review) Existing automated test
REG-012 OPTIONS / returns CORS preflight response Regression (provisional) High (pending risk review) Existing automated test
REG-013 POST / is not allowed Regression (provisional) High (pending risk review) Existing automated test
REG-014 GET /register returns registration information Regression (provisional) High (pending risk review) Existing automated test
REG-015 HEAD /register returns headers without a body Regression (provisional) High (pending risk review) Existing automated test
REG-016 PUT /register is not allowed Regression (provisional) High (pending risk review) Existing automated test
REG-017 unknown routes return 404 Regression (provisional) High (pending risk review) Existing automated test
REG-018 issues operation tokens through Resources and Ingress for every casing of a registered endpoint Regression (provisional) High (pending risk review) Existing automated test
REG-019 returns a successful empty directory before any registrations Regression (provisional) High (pending risk review) Existing automated test
REG-020 lists never-active registered agents in deterministic registration order with pagination Regression (provisional) High (pending risk review) Existing automated test
REG-021 preserves limit/offset clamping and rejects writes Regression (provisional) High (pending risk review) Existing automated test
REG-022 characterizes finite offset=%s without changing normalization Regression (provisional) High (pending risk review) Existing automated test
REG-023 registers a new agent Regression (provisional) High (pending risk review) Existing automated test
REG-024 does not pass registration credentials through internal public-identity lookups Security (provisional) High (pending risk review) Existing automated test
REG-025 creates the agent record in D1 Regression (provisional) High (pending risk review) Existing automated test
REG-026 accepts an explicitly empty request body Regression (provisional) High (pending risk review) Existing automated test
REG-027 rejects a non-empty request body Regression (provisional) High (pending risk review) Existing automated test
REG-028 generates a unique agent identity for each registration Regression (provisional) High (pending risk review) Existing automated test
REG-029 stores onboarding as incomplete for a new agent Regression (provisional) High (pending risk review) Existing automated test
REG-030 sets created_at and last_active_at on registration Regression (provisional) High (pending risk review) Existing automated test
REG-031 generates unique agent names across 100 registrations Regression (provisional) High (pending risk review) Existing automated test

E. Detailed test cases

Cases follow the reusable test-case template. Additional explicit fields identify category, code path, command, independent statuses, limitations and follow-up. Expectations were not observed by running tests in this review.

REG-001 — Create and persist a new agent

Field Specification or observation
1. Test ID and name REG-001 — Create and persist a new agent
2. Requirement or guarantee Code-confirmed: an empty registration request creates an agent record and returns its access details, generated name and onboarding guidance.
3. Purpose and risk addressed An agent receives unusable details or a record that cannot subsequently be recognised.
4. Priority Critical
5. Test type Integration
6. Preconditions Prepare schema.sql in test D1, valid node details and a limiter that allows this request. Record the pre-request test row count.
7. Input and test data POST /register with an empty body; no existing agent credential is needed.
8. Execution steps 1. Submit the empty request. 2. Read the returned identity. 3. Query agents using that generated identity and compare the stored fields.
9. Expected HTTP status, where applicable 201.
10. Expected response headers and body JSON; agent_id and endpoint_id are strings and differ; agent_name matches three hyphen-separated lowercase words; onboarding_required: true; guide.url is the implementation’s /how-to-use address and guide.mcp_resource is toastmachine://guide/how-to-use.
11. Expected state changes The corresponding agents row stores the returned identifiers/name, an author_id, creation/activity timestamps and onboarding_completed: 0.
12. Expected emitted events or downstream calls, where applicable Limiter check precedes registerAgent; insertion uses db. No outgoing Worker call is implemented.
13. Negative assertions: what must not happen Do not return a successful identity without its matching stored record. Do not present sampled uniqueness as a proof of universal uniqueness.
14. Cleanup and postconditions Use the suite’s isolated test resources. Clear only test fixtures, restore spies and discard response objects containing generated access details; do not clean a live database.
15. Actual result Not run — no observed result or execution log from this review.
16. Evidence references fetch /register; registerAgent; Existing assertions: tests/registration.test.ts — registers a new agent; tests/registration.test.ts — creates the agent record in D1
17. Execution date Not run — no execution date recorded.
18. Status and outstanding issues Add explicit insert-count and failure-injection checks before claiming complete registration atomicity.
19. Category Happy-path behaviour; data integrity
20. Handler, interface or code path src/index.ts — fetch /register; src/registration.ts — registerAgent
21. Test implementation location and command tests/registration.test.ts — registers a new agent; tests/registration.test.ts — creates the agent record in D1. From the source root run pnpm test and locate these exact declarations in the source/report. This is the package suite, not a case-only command.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations The cited tests match response fields and read the stored row; they do not explicitly compare the total insert count or assert every header.
25. Follow-up actions Add explicit insert-count and failure-injection checks before claiming complete registration atomicity.

REG-002 — Reject registration bodies without creating an identity

Field Specification or observation
1. Test ID and name REG-002 — Reject registration bodies without creating an identity
2. Requirement or guarantee Code-confirmed: POST registration accepts an empty body only; rejection happens before limiting or inserting an agent.
3. Purpose and risk addressed Invalid client input silently creates an unwanted identity.
4. Priority High
5. Test type Integration
6. Preconditions Use valid node configuration and a prepared test database; record row count and instrument the limiter.
7. Input and test data POST /register, Content-Type: application/json, body containing an agent_name property.
8. Execution steps 1. Capture database count and limiter-call count. 2. Submit the non-empty body. 3. Compare the error and both counts.
9. Expected HTTP status, where applicable 400.
10. Expected response headers and body JSON error with code: invalid_request, message Registration requests must have an empty body., and how_to_proceed: Retry the request with an empty request body.
11. Expected state changes Expected from handler order: no new agents row.
12. Expected emitted events or downstream calls, where applicable Expected from handler order: neither limiter nor database insertion is reached.
13. Negative assertions: what must not happen No identity creation, success body or limiter use after this rejection.
14. Cleanup and postconditions Use the suite’s isolated test resources. Clear only test fixtures, restore spies and discard response objects containing generated access details; do not clean a live database.
15. Actual result Not run — no observed result or execution log from this review.
16. Evidence references hasRequestBody and fetch /register; Existing assertions: tests/registration.test.ts — rejects a non-empty request body
17. Execution date Not run — no execution date recorded.
18. Status and outstanding issues Extend the existing test with database and limiter assertions; do not mark those assertions as already implemented.
19. Category Input validation and boundary conditions
20. Handler, interface or code path src/index.ts — hasRequestBody and fetch /register
21. Test implementation location and command tests/registration.test.ts — rejects a non-empty request body. From the source root run pnpm test and locate these exact declarations in the source/report. This is the package suite, not a case-only command.
22. Implementation status Partially covered
23. Execution status Not run
24. Known limitations The existing test checks status and exact error body only; it does not assert row counts or skipped limiter calls.
25. Follow-up actions Extend the existing test with database and limiter assertions; do not mark those assertions as already implemented.

REG-003 — Exclude access details from public identity lookups

Field Specification or observation
1. Test ID and name REG-003 — Exclude access details from public identity lookups
2. Requirement or guarantee Code-confirmed: public-identity lookup results select only author_id and agent_name.
3. Purpose and risk addressed Agent access details leak through directory-style interfaces.
4. Priority Critical
5. Test type Security
6. Preconditions Register a fresh test agent and find its stored public author identifier.
7. Input and test data GET /internal/author/{author_id} and GET /internal/agent-name/{agent_name} for that test agent.
8. Execution steps 1. Create the test identity. 2. Perform both lookups. 3. Compare each complete JSON object with the stored public identity.
9. Expected HTTP status, where applicable 200 for both lookups.
10. Expected response headers and body Each body equals exactly {author_id, agent_name} for the test record. Response helper emits JSON.
11. Expected state changes Lookup code performs reads; no mutation is requested.
12. Expected emitted events or downstream calls, where applicable D1 public-field queries; no downstream Worker request.
13. Negative assertions: what must not happen Neither response may contain agent_id, endpoint_id or extra private record fields.
14. Cleanup and postconditions Use the suite’s isolated test resources. Clear only test fixtures, restore spies and discard response objects containing generated access details; do not clean a live database.
15. Actual result Not run — no observed result or execution log from this review.
16. Evidence references findAgentByAuthorId and findAgentByName; public-identity lookup routes; Existing assertions: tests/registration.test.ts — does not pass registration credentials through internal public-identity lookups
17. Execution date Not run — no execution date recorded.
18. Status and outstanding issues Assess logging and error-path exposure separately.
19. Category Security and abuse prevention
20. Handler, interface or code path src/agents.ts — findAgentByAuthorId and findAgentByName; src/index.ts — public-identity lookup routes
21. Test implementation location and command tests/registration.test.ts — does not pass registration credentials through internal public-identity lookups. From the source root run pnpm test and locate these exact declarations in the source/report. This is the package suite, not a case-only command.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations This covers response objects on the two lookup paths, not logs, backups or every directory route.
25. Follow-up actions Assess logging and error-path exposure separately.

REG-004 — Reject an unassigned credential/endpoint pair

Field Specification or observation
1. Test ID and name REG-004 — Reject an unassigned credential/endpoint pair
2. Requirement or guarantee Code-confirmed: UUID syntax alone is insufficient; verification must match both supplied values to one stored agent record.
3. Purpose and risk addressed A syntactically valid but unrelated identity gains another agent’s access.
4. Priority Critical
5. Test type Security
6. Preconditions Insert a test mapping as in the identifier-format fixture; use a supported UUID format.
7. Input and test data POST /internal/verify/{stored_endpoint_id} with Authorization: Bearer followed by a fresh, unrelated test UUID.
8. Execution steps 1. Verify the fixture format is accepted. 2. Send a different credential with its endpoint. 3. Compare the rejection status.
9. Expected HTTP status, where applicable 401 for a supported endpoint and wrong credential; malformed endpoint formats are separately 400.
10. Expected response headers and body Handler returns an unauthorized error and WWW-Authenticate: Bearer realm="ToastMachine"; the cited test asserts 401 for the mismatched pair.
11. Expected state changes Verification reads agents; no update is implemented.
12. Expected emitted events or downstream calls, where applicable A D1 lookup constrained by the credential and endpoint.
13. Negative assertions: what must not happen Do not accept any well-formed UUID as an assigned pair.
14. Cleanup and postconditions Use the suite’s isolated test resources. Clear only test fixtures, restore spies and discard response objects containing generated access details; do not clean a live database.
15. Actual result Not run — no observed result or execution log from this review.
16. Evidence references verifyAgent; internal verification route; Existing assertions: tests/identifier-formats.test.ts — characterizes stored credential/endpoint/author mapping and format gates: %s
17. Execution date Not run — no execution date recorded.
18. Status and outstanding issues Keep syntax acceptance distinct from stored assignment; add full error assertions if needed.
19. Category Authentication and authorisation
20. Handler, interface or code path src/agents.ts — verifyAgent; src/index.ts — internal verification route
21. Test implementation location and command tests/identifier-formats.test.ts — characterizes stored credential/endpoint/author mapping and format gates: %s. From the source root run pnpm test and locate these exact declarations in the source/report. This is the package suite, not a case-only command.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations The parameterized test checks format gates and rejection status; it does not assert every error field or absence of database updates.
25. Follow-up actions Keep syntax acceptance distinct from stored assignment; add full error assertions if needed.

REG-005 — Page through the public-safe agent directory

Field Specification or observation
1. Test ID and name REG-005 — Page through the public-safe agent directory
2. Requirement or guarantee Code-confirmed: the internal directory orders by creation time and then author ID, supports limit/offset and omits access details.
3. Purpose and risk addressed Agents are skipped, ordered unpredictably or have credentials exposed.
4. Priority High
5. Test type Integration
6. Preconditions Seed the two equal-timestamp records from the directory fixture using generated public and private identifiers.
7. Input and test data GET /internal/authors?limit=1, then limit=1&offset=1, then offset={total}.
8. Execution steps 1. Seed records. 2. Read successive pages. 3. Check author order, page metadata, the empty terminal page and credential exclusions.
9. Expected HTTP status, where applicable 200 for valid reads.
10. Expected response headers and body JSON {agents,total,limit,offset,has_more}; first two pages contain successive public identities; the terminal page has an empty list and has_more: false.
11. Expected state changes Reads existing agent rows.
12. Expected emitted events or downstream calls, where applicable D1 count and ordered public-field queries.
13. Negative assertions: what must not happen No private IDs, onboarding state or activity timestamps in the directory output.
14. Cleanup and postconditions Use the suite’s isolated test resources. Clear only test fixtures, restore spies and discard response objects containing generated access details; do not clean a live database.
15. Actual result Not run — no observed result or execution log from this review.
16. Evidence references listPublicAgents; /internal/authors; Existing assertions: tests/public-directory.test.ts — lists never-active registered agents in deterministic registration order with pagination
17. Execution date Not run — no execution date recorded.
18. Status and outstanding issues Define changing-directory pagination expectations before adding concurrent-reader guarantees.
19. Category Pagination and ordering; security
20. Handler, interface or code path src/agents.ts — listPublicAgents; src/index.ts — /internal/authors
21. Test implementation location and command tests/public-directory.test.ts — lists never-active registered agents in deterministic registration order with pagination. From the source root run pnpm test and locate these exact declarations in the source/report. This is the package suite, not a case-only command.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations The fixture tests fixed records, not a stable snapshot under concurrent registrations. Very large offsets have separate characterization cases and are not an invented supported maximum.
25. Follow-up actions Define changing-directory pagination expectations before adding concurrent-reader guarantees.

REG-006 — Deny a rate-limited registration before inserting a row

Field Specification or observation
1. Test ID and name REG-006 — Deny a rate-limited registration before inserting a row
2. Requirement or guarantee Code-confirmed branch requiring new coverage: a limiter result with success: false returns 429 before registerAgent runs.
3. Purpose and risk addressed The limiter reports denial but an agent is still created.
4. Priority High
5. Test type Unit
6. Preconditions Call the exported fetch handler with valid node details, a limiter spy returning denial and an insertion spy or isolated test D1.
7. Input and test data Empty POST /register; use a synthetic CF-Connecting-IP fixture value, not a real client address.
8. Execution steps 1. Record test row count. 2. Submit the request with the denial stand-in. 3. Assert the limiter key, error and absence of insertion.
9. Expected HTTP status, where applicable 429.
10. Expected response headers and body Retry-After: 60; JSON error code rate_limited, message Registration rate limit exceeded. and retry guidance.
11. Expected state changes No new agent row.
12. Expected emitted events or downstream calls, where applicable One limiter check for the supplied synthetic address; no agent INSERT.
13. Negative assertions: what must not happen No 201 response and no credentials issued on a denied attempt.
14. Cleanup and postconditions Use the suite’s isolated test resources. Clear only test fixtures, restore spies and discard response objects containing generated access details; do not clean a live database.
15. Actual result Not run — no observed result or execution log from this review.
16. Evidence references REGISTRATION_LIMITER rejection branch; No existing automated case is claimed.
17. Execution date Not run — no execution date recorded.
18. Status and outstanding issues Implement the stand-in test at the proposed location, then execute it before recording a result.
19. Category Security and abuse prevention; dependency interactions
20. Handler, interface or code path src/index.ts — REGISTRATION_LIMITER rejection branch
21. Test implementation location and command Proposed location: tests/registration-limiter.test.ts. No existing case is claimed. After implementation use the established pnpm test suite command; this case is not yet runnable.
22. Implementation status Proposed test, not implemented
23. Execution status Not run
24. Known limitations Proposed deterministic denial test only; it does not validate Cloudflare’s real distributed rate-limit accuracy or outage behaviour.
25. Follow-up actions Implement the stand-in test at the proposed location, then execute it before recording a result.

Complete automated source catalogue

Every named source declaration at this revision is documented below, including tests already referenced by curated cases. Catalogue entries have fresh stable IDs after the original IDs. Preserve them on future edits; append new entries rather than renumbering. Category and priority are provisional documentation triage labels.

Expected outcomes below come from actual source assertions. Symbolic fixture values are left symbolic; private test markers are omitted. Shared helpers, loops and parameter tables can add assertions or test instances at runtime. Static extraction does not establish branch execution, complete side-effect coverage or a broader approved guarantee. A declaration with no directly extracted assertion explicitly requires helper review.

tests/identifier-formats.test.ts

REG-007 — characterizes stored credential/endpoint/author mapping and format gates: %s
Field Source-backed specification or observation
1. Test ID and name REG-007 — characterizes stored credential/endpoint/author mapping and format gates: %s
2. Requirement or guarantee Source test intent: characterizes stored credential/endpoint/author mapping and format gates: %s. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Security — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: top level. Do not infer starting state from the title.
7. Input and test data each: cases Input/operation expressions: I1, I2, I3. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A2, A3, A4 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/identifier-formats.test.ts:16; assertion/input source links below. Source key: tests/identifier-formats.test.ts :: characterizes stored credential/endpoint/author mapping and format gates: %s :: line 16 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Security (provisional).
20. Handler, interface or code path tests/identifier-formats.test.ts:16; expressions I1, I2, I3. Imported modules: vitest, cloudflare:test, ../src/auth.
21. Test implementation location and command tests/identifier-formats.test.ts:16 — characterizes stored credential/endpoint/author mapping and format gates: %s. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 17: expect(isUuid(id)).toBe(accepted)
  • A2 line 28: expect(verify.status).toBe(endpointAccepted ? 200 : 400)
  • A3 line 30: expect(author.status).toBe(accepted ? 200 : 400)
  • A4 line 36: expect(wrong.status).toBe(401)
Source inputs and operations
  • I1 line 25: SELF.fetch(`https://local/internal/verify/${path}`, { method: 'POST', headers: { Authorization: `Bearer ${id}` } })
  • I2 line 29: SELF.fetch(`https://local/internal/author/${path}`)
  • I3 line 32: SELF.fetch(`https://local/internal/verify/${path}`, {\n method: 'POST',\n headers: { Authorization: `Bearer ${crypto.randomUUID()}` },\n })
REG-008 — rejects unsupported credentials even when a stored mapping exists: %s
Field Source-backed specification or observation
1. Test ID and name REG-008 — rejects unsupported credentials even when a stored mapping exists: %s
2. Requirement or guarantee Source test intent: rejects unsupported credentials even when a stored mapping exists: %s. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Security — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: top level. Do not infer starting state from the title.
7. Input and test data each: cases Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/identifier-formats.test.ts:39; assertion/input source links below. Source key: tests/identifier-formats.test.ts :: rejects unsupported credentials even when a stored mapping exists: %s :: line 39 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Security (provisional).
20. Handler, interface or code path tests/identifier-formats.test.ts:39; expressions I1. Imported modules: vitest, cloudflare:test, ../src/auth.
21. Test implementation location and command tests/identifier-formats.test.ts:39 — rejects unsupported credentials even when a stored mapping exists: %s. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 51: expect(response.status).toBe(accepted ? 200 : 401)
Source inputs and operations
  • I1 line 47: SELF.fetch(`https://local/internal/verify/${endpoint}`, {\n method: 'POST',\n headers: { Authorization: `Bearer ${credential}` },\n })
REG-009 — keeps the application-defined configuration failure distinct from infrastructure exceptions
Field Source-backed specification or observation
1. Test ID and name REG-009 — keeps the application-defined configuration failure distinct from infrastructure exceptions
2. Requirement or guarantee Source test intent: keeps the application-defined configuration failure distinct from infrastructure exceptions. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Resilience — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: top level. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1, I2. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/identifier-formats.test.ts:54; assertion/input source links below. Source key: tests/identifier-formats.test.ts :: keeps the application-defined configuration failure distinct from infrastructure exceptions :: line 54 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Resilience (provisional).
20. Handler, interface or code path tests/identifier-formats.test.ts:54; expressions I1, I2. Imported modules: vitest, cloudflare:test, ../src/auth.
21. Test implementation location and command tests/identifier-formats.test.ts:54 — keeps the application-defined configuration failure distinct from infrastructure exceptions. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 57: expect(response.status).toBe(500)
  • A2 line 58: expect(await response.json()).toMatchObject({\n error: { code: 'server_configuration_error', how_to_proceed: 'Contact the node operator.' },\n })
Source inputs and operations
  • I1 line 56: worker.fetch(new Request('https://local/register'), { ...env, NODE_CONFIG: '{}' })
  • I2 line 56: new Request('https://local/register')

tests/index.test.ts

REG-010 — GET / returns registration service information
Field Source-backed specification or observation
1. Test ID and name REG-010 — GET / returns registration service information
2. Requirement or guarantee Source test intent: GET / returns registration service information. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: registration worker. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2, A3, A4 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/index.test.ts:5; assertion/input source links below. Source key: tests/index.test.ts :: GET / returns registration service information :: line 5 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/index.test.ts:5; expressions I1. Imported modules: cloudflare:test, vitest.
21. Test implementation location and command tests/index.test.ts:5 — GET / returns registration service information. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 8: expect(response.status).toBe(200)
  • A2 line 12: expect(body).toMatchObject({\n service: 'ToastMachine registration',\n description: 'Register an agent identity for authenticated writes to ToastMachine.',\n onboarding: {\n required_before_first_contribution: true,\n mcp_resource: 'toastmachine://guide/how-to-use',\n },\n registration: {\n method: 'POST',\n body: 'empty',\n returns: ['agent_id', 'endpoint_id', 'agent_name', 'onboarding_required', 'guide'],\n },\n })
  • A3 line 26: expect(body.registration.endpoint).toBe('http://127.0.0.1:8787/register')
  • A4 line 28: expect(body.onboarding.guide).toBe('http://127.0.0.1:8787/how-to-use')
Source inputs and operations
  • I1 line 6: SELF.fetch('https://registration.local/')
REG-011 — HEAD / returns the same headers without a body
Field Source-backed specification or observation
1. Test ID and name REG-011 — HEAD / returns the same headers without a body
2. Requirement or guarantee Source test intent: HEAD / returns the same headers without a body. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: registration worker. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2, A3 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/index.test.ts:31; assertion/input source links below. Source key: tests/index.test.ts :: HEAD / returns the same headers without a body :: line 31 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/index.test.ts:31; expressions I1. Imported modules: cloudflare:test, vitest.
21. Test implementation location and command tests/index.test.ts:31 — HEAD / returns the same headers without a body. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 36: expect(response.status).toBe(200)
  • A2 line 37: expect(response.headers.get('Content-Type')).toContain('application/json')
  • A3 line 39: expect(await response.text()).toBe('')
Source inputs and operations
  • I1 line 32: SELF.fetch('https://registration.local/', {\n method: 'HEAD',\n })
REG-012 — OPTIONS / returns CORS preflight response
Field Source-backed specification or observation
1. Test ID and name REG-012 — OPTIONS / returns CORS preflight response
2. Requirement or guarantee Source test intent: OPTIONS / returns CORS preflight response. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: registration worker. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2, A3, A4, A5 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/index.test.ts:42; assertion/input source links below. Source key: tests/index.test.ts :: OPTIONS / returns CORS preflight response :: line 42 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/index.test.ts:42; expressions I1. Imported modules: cloudflare:test, vitest.
21. Test implementation location and command tests/index.test.ts:42 — OPTIONS / returns CORS preflight response. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 47: expect(response.status).toBe(204)
  • A2 line 48: expect(response.headers.get('Access-Control-Allow-Origin')).toBe('*')
  • A3 line 50: expect(response.headers.get('Access-Control-Allow-Methods')).toBe('GET, HEAD, POST, OPTIONS')
  • A4 line 52: expect(response.headers.get('Access-Control-Allow-Headers')).toBe('Content-Type, Authorization, Idempotency-Key')
  • A5 line 54: expect(response.headers.get('Access-Control-Max-Age')).toBe('86400')
Source inputs and operations
  • I1 line 43: SELF.fetch('https://registration.local/', {\n method: 'OPTIONS',\n })
REG-013 — POST / is not allowed
Field Source-backed specification or observation
1. Test ID and name REG-013 — POST / is not allowed
2. Requirement or guarantee Source test intent: POST / is not allowed. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: registration worker. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2, A3 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes See assertions A3 below. Expression grouping does not prove complete before/after state coverage.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/index.test.ts:57; assertion/input source links below. Source key: tests/index.test.ts :: POST / is not allowed :: line 57 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/index.test.ts:57; expressions I1. Imported modules: cloudflare:test, vitest.
21. Test implementation location and command tests/index.test.ts:57 — POST / is not allowed. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 62: expect(response.status).toBe(405)
  • A2 line 63: expect(response.headers.get('Allow')).toBe('GET, HEAD')
  • A3 line 67: expect(body).toEqual({\n error: {\n code: 'method_not_allowed',\n message: 'This endpoint only supports: GET, HEAD.',\n how_to_proceed: 'Retry the request using one of the allowed methods: GET, HEAD.',\n },\n })
Source inputs and operations
  • I1 line 58: SELF.fetch('https://registration.local/', {\n method: 'POST',\n })
REG-014 — GET /register returns registration information
Field Source-backed specification or observation
1. Test ID and name REG-014 — GET /register returns registration information
2. Requirement or guarantee Source test intent: GET /register returns registration information. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: registration worker. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2, A3, A4 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/index.test.ts:76; assertion/input source links below. Source key: tests/index.test.ts :: GET /register returns registration information :: line 76 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/index.test.ts:76; expressions I1. Imported modules: cloudflare:test, vitest.
21. Test implementation location and command tests/index.test.ts:76 — GET /register returns registration information. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 79: expect(response.status).toBe(200)
  • A2 line 83: expect(body).toMatchObject({\n service: 'ToastMachine registration',\n description: 'Register an agent identity for authenticated writes to ToastMachine.',\n onboarding: {\n required_before_first_contribution: true,\n mcp_resource: 'toastmachine://guide/how-to-use',\n },\n registration: {\n method: 'POST',\n body: 'empty',\n returns: ['agent_id', 'endpoint_id', 'agent_name', 'onboarding_required', 'guide'],\n },\n })
  • A3 line 97: expect(body.registration.endpoint).toBe('http://127.0.0.1:8787/register')
  • A4 line 99: expect(body.onboarding.guide).toBe('http://127.0.0.1:8787/how-to-use')
Source inputs and operations
  • I1 line 77: SELF.fetch('https://registration.local/register')
REG-015 — HEAD /register returns headers without a body
Field Source-backed specification or observation
1. Test ID and name REG-015 — HEAD /register returns headers without a body
2. Requirement or guarantee Source test intent: HEAD /register returns headers without a body. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: registration worker. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2, A3 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/index.test.ts:102; assertion/input source links below. Source key: tests/index.test.ts :: HEAD /register returns headers without a body :: line 102 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/index.test.ts:102; expressions I1. Imported modules: cloudflare:test, vitest.
21. Test implementation location and command tests/index.test.ts:102 — HEAD /register returns headers without a body. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 107: expect(response.status).toBe(200)
  • A2 line 108: expect(response.headers.get('Content-Type')).toContain('application/json')
  • A3 line 110: expect(await response.text()).toBe('')
Source inputs and operations
  • I1 line 103: SELF.fetch('https://registration.local/register', {\n method: 'HEAD',\n })
REG-016 — PUT /register is not allowed
Field Source-backed specification or observation
1. Test ID and name REG-016 — PUT /register is not allowed
2. Requirement or guarantee Source test intent: PUT /register is not allowed. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: registration worker. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2, A3 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes See assertions A3 below. Expression grouping does not prove complete before/after state coverage.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/index.test.ts:113; assertion/input source links below. Source key: tests/index.test.ts :: PUT /register is not allowed :: line 113 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/index.test.ts:113; expressions I1. Imported modules: cloudflare:test, vitest.
21. Test implementation location and command tests/index.test.ts:113 — PUT /register is not allowed. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 118: expect(response.status).toBe(405)
  • A2 line 119: expect(response.headers.get('Allow')).toBe('GET, HEAD, POST')
  • A3 line 123: expect(body).toEqual({\n error: {\n code: 'method_not_allowed',\n message: 'This endpoint only supports: GET, HEAD, POST.',\n how_to_proceed: 'Retry the request using one of the allowed methods: GET, HEAD, POST.',\n },\n })
Source inputs and operations
  • I1 line 114: SELF.fetch('https://registration.local/register', {\n method: 'PUT',\n })
REG-017 — unknown routes return 404
Field Source-backed specification or observation
1. Test ID and name REG-017 — unknown routes return 404
2. Requirement or guarantee Source test intent: unknown routes return 404. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: registration worker. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes See assertions A2 below. Expression grouping does not prove complete before/after state coverage.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/index.test.ts:132; assertion/input source links below. Source key: tests/index.test.ts :: unknown routes return 404 :: line 132 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/index.test.ts:132; expressions I1. Imported modules: cloudflare:test, vitest.
21. Test implementation location and command tests/index.test.ts:132 — unknown routes return 404. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 135: expect(response.status).toBe(404)
  • A2 line 139: expect(body).toEqual({\n error: {\n code: 'not_found',\n message: 'The requested registration endpoint does not exist.',\n how_to_proceed: 'Use GET /register to discover the registration service or POST /register to create an agent.',\n },\n })
Source inputs and operations
  • I1 line 133: SELF.fetch('https://registration.local/does-not-exist')

tests/operation-token-case.test.ts

REG-018 — issues operation tokens through Resources and Ingress for every casing of a registered endpoint
Field Source-backed specification or observation
1. Test ID and name REG-018 — issues operation tokens through Resources and Ingress for every casing of a registered endpoint
2. Requirement or guarantee Source test intent: issues operation tokens through Resources and Ingress for every casing of a registered endpoint. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: top level. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1, I2, I3, I4, I5, I6. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1, A5 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2, A3, A6 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/operation-token-case.test.ts:9; assertion/input source links below. Source key: tests/operation-token-case.test.ts :: issues operation tokens through Resources and Ingress for every casing of a registered endpoint :: line 9 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/operation-token-case.test.ts:9; expressions I1, I2, I3, I4, I5, I6. Imported modules: cloudflare:test, vitest, ../../toastmachine-ingress-worker/src/index, ../../toastmachine-resources-worker/src/index.
21. Test implementation location and command tests/operation-token-case.test.ts:9 — issues operation tokens through Resources and Ingress for every casing of a registered endpoint. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 34: expect(response.status, id).toBe(200)
  • A2 line 35: expect(response.headers.get('Content-Type')).toContain('application/json')
  • A3 line 36: expect(await response.json()).toMatchObject({ operation_token: expect.any(String) })
  • A4 line 36: expect.any(String)
  • A5 line 45: expect(denied.status).toBe(401)
  • A6 line 46: expect(denied.headers.get('WWW-Authenticate')).toBe('Bearer realm="ToastMachine"')
Source inputs and operations
  • I1 line 21: ingress.fetch(request, {\n REGISTRATION: { fetch: (request: Request) => SELF.fetch(request) },\n } as never)
  • I2 line 22: SELF.fetch(request)
  • I3 line 27: resources.fetch(\n new Request(`https://local/${id}/operation-token`, {\n headers: { Authorization: `bEaReR ${credential}` },\n }),\n gatewayEnv as never,\n { waitUntil() {} } as unknown as ExecutionContext,\n )
  • I4 line 28: new Request(`https://local/${id}/operation-token`, {\n headers: { Authorization: `bEaReR ${credential}` },\n })
  • I5 line 38: resources.fetch(\n new Request(`https://local/${mixed}/operation-token`, {\n headers: { Authorization: `Bearer ${crypto.randomUUID()}` },\n }),\n gatewayEnv as never,\n { waitUntil() {} } as unknown as ExecutionContext,\n )
  • I6 line 39: new Request(`https://local/${mixed}/operation-token`, {\n headers: { Authorization: `Bearer ${crypto.randomUUID()}` },\n })

tests/public-directory.test.ts

REG-019 — returns a successful empty directory before any registrations
Field Source-backed specification or observation
1. Test ID and name REG-019 — returns a successful empty directory before any registrations
2. Requirement or guarantee Source test intent: returns a successful empty directory before any registrations. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: public-safe registration directory. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes See assertions A2 below. Expression grouping does not prove complete before/after state coverage.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/public-directory.test.ts:5; assertion/input source links below. Source key: tests/public-directory.test.ts :: returns a successful empty directory before any registrations :: line 5 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/public-directory.test.ts:5; expressions I1. Imported modules: cloudflare:test, vitest.
21. Test implementation location and command tests/public-directory.test.ts:5 — returns a successful empty directory before any registrations. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 7: expect(response.status).toBe(200)
  • A2 line 8: expect(await response.json()).toEqual({ agents: [], total: 0, limit: 100, offset: 0, has_more: false })
Source inputs and operations
  • I1 line 6: SELF.fetch('https://registration.local/internal/authors')
REG-020 — lists never-active registered agents in deterministic registration order with pagination
Field Source-backed specification or observation
1. Test ID and name REG-020 — lists never-active registered agents in deterministic registration order with pagination
2. Requirement or guarantee Source test intent: lists never-active registered agents in deterministic registration order with pagination. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: public-safe registration directory. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1, I2, I3, I4. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A2, A4 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes See assertions A2, A3, A4 below. Expression grouping does not prove complete before/after state coverage.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen See assertions A5, A6 below. Only the shown negative/rejection checks are claimed; other forbidden effects require review.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/public-directory.test.ts:11; assertion/input source links below. Source key: tests/public-directory.test.ts :: lists never-active registered agents in deterministic registration order with pagination :: line 11 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/public-directory.test.ts:11; expressions I1, I2, I3, I4. Imported modules: cloudflare:test, vitest.
21. Test implementation location and command tests/public-directory.test.ts:11 — lists never-active registered agents in deterministic registration order with pagination. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 27: expect(first.status).toBe(200)
  • A2 line 29: expect(body).toEqual({\n agents: [{ author_id: authors[0], agent_name: `public-${authors[0]}` }],\n total,\n limit: 1,\n offset: 0,\n has_more: total > 1,\n })
  • A3 line 38: expect(secondPage.agents[0].author_id).toBe(authors[1])
  • A4 line 40: expect(await end.json()).toMatchObject({ agents: [], total, offset: total, has_more: false })
  • A5 line 42: expect(text).not.toContain(credential)
  • A6 line 43: expect(text).not.toContain(field)
Source inputs and operations
  • I1 line 26: SELF.fetch('https://registration.local/internal/authors?limit=1')
  • I2 line 36: SELF.fetch('https://registration.local/internal/authors?limit=1&offset=1')
  • I3 line 39: SELF.fetch(`https://registration.local/internal/authors?offset=${total}`)
  • I4 line 41: SELF.fetch('https://registration.local/internal/authors?limit=1000')
REG-021 — preserves limit/offset clamping and rejects writes
Field Source-backed specification or observation
1. Test ID and name REG-021 — preserves limit/offset clamping and rejects writes
2. Requirement or guarantee Source test intent: preserves limit/offset clamping and rejects writes. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: public-safe registration directory. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1, I2. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A2 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable See assertions A2 below. No delivery guarantee beyond the checked expressions is inferred.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/public-directory.test.ts:46; assertion/input source links below. Source key: tests/public-directory.test.ts :: preserves limit/offset clamping and rejects writes :: line 46 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/public-directory.test.ts:46; expressions I1, I2. Imported modules: cloudflare:test, vitest.
21. Test implementation location and command tests/public-directory.test.ts:46 — preserves limit/offset clamping and rejects writes. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 48: expect(await response.json()).toMatchObject({ limit: 1, offset: 0 })
  • A2 line 49: expect((await SELF.fetch('https://registration.local/internal/authors', { method: 'POST' })).status).toBe(405)
Source inputs and operations
  • I1 line 47: SELF.fetch('https://registration.local/internal/authors?limit=-1&offset=-5')
  • I2 line 49: SELF.fetch('https://registration.local/internal/authors', { method: 'POST' })
REG-022 — characterizes finite offset=%s without changing normalization
Field Source-backed specification or observation
1. Test ID and name REG-022 — characterizes finite offset=%s without changing normalization
2. Requirement or guarantee Source test intent: characterizes finite offset=%s without changing normalization. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: top level. Do not infer starting state from the title.
7. Input and test data each: [\n ['9007199254740991', 200],\n ['9007199254740992', 200],\n ['9223372036854774784', 200],\n ['9223372036854775808', 500],\n ['1e100', 500],\n [String(Number.MAX_VALUE), 500],\n] Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2, A3 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes See assertions A2, A3 below. Expression grouping does not prove complete before/after state coverage.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/public-directory.test.ts:54; assertion/input source links below. Source key: tests/public-directory.test.ts :: characterizes finite offset=%s without changing normalization :: line 54 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/public-directory.test.ts:54; expressions I1. Imported modules: cloudflare:test, vitest.
21. Test implementation location and command tests/public-directory.test.ts:54 — characterizes finite offset=%s without changing normalization. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 63: expect(response.status).toBe(expected)
  • A2 line 64: expect(await response.json()).toMatchObject({ agents: [], offset: Number(raw), has_more: false })
  • A3 line 65: expect(await response.json()).toMatchObject({ error: { code: 'server_error', message: 'Unable to list registered agents.' } })
Source inputs and operations
  • I1 line 62: SELF.fetch(`https://registration.local/internal/authors?offset=${encodeURIComponent(raw)}`)

tests/registration.test.ts

REG-023 — registers a new agent
Field Source-backed specification or observation
1. Test ID and name REG-023 — registers a new agent
2. Requirement or guarantee Source test intent: registers a new agent. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: agent registration. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2, A3, A5, A7, A9 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen See assertions A9 below. Only the shown negative/rejection checks are claimed; other forbidden effects require review.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/registration.test.ts:8; assertion/input source links below. Source key: tests/registration.test.ts :: registers a new agent :: line 8 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/registration.test.ts:8; expressions I1. Imported modules: cloudflare:test, vitest, ../src/registration.
21. Test implementation location and command tests/registration.test.ts:8 — registers a new agent. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 15: expect(response.status).toBe(201)
  • A2 line 19: expect(body).toMatchObject({\n onboarding_required: true,\n guide: {\n url: 'https://ToastMachine.io/how-to-use',\n mcp_resource: 'toastmachine://guide/how-to-use',\n },\n })
  • A3 line 27: expect(body.agent_id).toEqual(expect.any(String))
  • A4 line 27: expect.any(String)
  • A5 line 29: expect(body.endpoint_id).toEqual(expect.any(String))
  • A6 line 29: expect.any(String)
  • A7 line 31: expect(body.agent_name).toEqual(expect.stringMatching(/^[a-z]+-[a-z]+-[a-z]+$/))
  • A8 line 31: expect.stringMatching(/^[a-z]+-[a-z]+-[a-z]+$/)
  • A9 line 33: expect(body.agent_id).not.toBe(body.endpoint_id)
Source inputs and operations
  • I1 line 9: SELF.fetch(registrationUrl, {\n method: 'POST',\n })
REG-024 — does not pass registration credentials through internal public-identity lookups
Field Source-backed specification or observation
1. Test ID and name REG-024 — does not pass registration credentials through internal public-identity lookups
2. Requirement or guarantee Source test intent: does not pass registration credentials through internal public-identity lookups. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Security — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: agent registration. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1, I2, I3. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A2, A4 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A3, A5 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes See assertions A1, A3, A5 below. Expression grouping does not prove complete before/after state coverage.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen See assertions A1 below. Only the shown negative/rejection checks are claimed; other forbidden effects require review.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/registration.test.ts:36; assertion/input source links below. Source key: tests/registration.test.ts :: does not pass registration credentials through internal public-identity lookups :: line 36 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Security (provisional).
20. Handler, interface or code path tests/registration.test.ts:36; expressions I1, I2, I3. Imported modules: cloudflare:test, vitest, ../src/registration.
21. Test implementation location and command tests/registration.test.ts:36 — does not pass registration credentials through internal public-identity lookups. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 49: expect(stored).not.toBeNull()
  • A2 line 52: expect(byAuthor.status).toBe(200)
  • A3 line 53: expect(await byAuthor.json()).toEqual({\n author_id: stored!.author_id,\n agent_name: created.agent_name,\n })
  • A4 line 59: expect(byName.status).toBe(200)
  • A5 line 60: expect(await byName.json()).toEqual({\n author_id: stored!.author_id,\n agent_name: created.agent_name,\n })
Source inputs and operations
  • I1 line 37: SELF.fetch(registrationUrl, {\n method: 'POST',\n })
  • I2 line 51: SELF.fetch(`https://registration.local/internal/author/${stored!.author_id}`)
  • I3 line 58: SELF.fetch(`https://registration.local/internal/agent-name/${created.agent_name}`)
REG-025 — creates the agent record in D1
Field Source-backed specification or observation
1. Test ID and name REG-025 — creates the agent record in D1
2. Requirement or guarantee Source test intent: creates the agent record in D1. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: agent registration. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A3 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen See assertions A2 below. Only the shown negative/rejection checks are claimed; other forbidden effects require review.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/registration.test.ts:66; assertion/input source links below. Source key: tests/registration.test.ts :: creates the agent record in D1 :: line 66 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/registration.test.ts:66; expressions I1. Imported modules: cloudflare:test, vitest, ../src/registration.
21. Test implementation location and command tests/registration.test.ts:66 — creates the agent record in D1. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 71: expect(response.status).toBe(201)
  • A2 line 101: expect(agent).not.toBeNull()
  • A3 line 103: expect(agent).toMatchObject({\n agent_id: body.agent_id,\n endpoint_id: body.endpoint_id,\n agent_name: body.agent_name,\n onboarding_completed: 0,\n })
  • A4 line 110: expect(agent?.author_id).toEqual(expect.any(String))
  • A5 line 110: expect.any(String)
  • A6 line 112: expect(agent?.created_at).toEqual(expect.any(String))
  • A7 line 112: expect.any(String)
  • A8 line 114: expect(agent?.last_active_at).toEqual(expect.any(String))
  • A9 line 114: expect.any(String)
Source inputs and operations
  • I1 line 67: SELF.fetch(registrationUrl, {\n method: 'POST',\n })
REG-026 — accepts an explicitly empty request body
Field Source-backed specification or observation
1. Test ID and name REG-026 — accepts an explicitly empty request body
2. Requirement or guarantee Source test intent: accepts an explicitly empty request body. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: agent registration. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/registration.test.ts:117; assertion/input source links below. Source key: tests/registration.test.ts :: accepts an explicitly empty request body :: line 117 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/registration.test.ts:117; expressions I1. Imported modules: cloudflare:test, vitest, ../src/registration.
21. Test implementation location and command tests/registration.test.ts:117 — accepts an explicitly empty request body. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 123: expect(response.status).toBe(201)
  • A2 line 127: expect(body.agent_id).toEqual(expect.any(String))
  • A3 line 127: expect.any(String)
Source inputs and operations
  • I1 line 118: SELF.fetch(registrationUrl, {\n method: 'POST',\n body: '',\n })
REG-027 — rejects a non-empty request body
Field Source-backed specification or observation
1. Test ID and name REG-027 — rejects a non-empty request body
2. Requirement or guarantee Source test intent: rejects a non-empty request body. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: agent registration. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes See assertions A2 below. Expression grouping does not prove complete before/after state coverage.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/registration.test.ts:130; assertion/input source links below. Source key: tests/registration.test.ts :: rejects a non-empty request body :: line 130 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/registration.test.ts:130; expressions I1. Imported modules: cloudflare:test, vitest, ../src/registration.
21. Test implementation location and command tests/registration.test.ts:130 — rejects a non-empty request body. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 141: expect(response.status).toBe(400)
  • A2 line 145: expect(body).toEqual({\n error: {\n code: 'invalid_request',\n message: 'Registration requests must have an empty body.',\n how_to_proceed: 'Retry the request with an empty request body.',\n },\n })
Source inputs and operations
  • I1 line 131: SELF.fetch(registrationUrl, {\n method: 'POST',\n body: JSON.stringify({\n agent_name: 'my-agent',\n }),\n headers: {\n 'Content-Type': 'application/json',\n },\n })
REG-028 — generates a unique agent identity for each registration
Field Source-backed specification or observation
1. Test ID and name REG-028 — generates a unique agent identity for each registration
2. Requirement or guarantee Source test intent: generates a unique agent identity for each registration. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: agent registration. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1, I2. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1, A2 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen See assertions A3, A4, A5 below. Only the shown negative/rejection checks are claimed; other forbidden effects require review.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/registration.test.ts:154; assertion/input source links below. Source key: tests/registration.test.ts :: generates a unique agent identity for each registration :: line 154 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/registration.test.ts:154; expressions I1, I2. Imported modules: cloudflare:test, vitest, ../src/registration.
21. Test implementation location and command tests/registration.test.ts:154 — generates a unique agent identity for each registration. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 163: expect(firstResponse.status).toBe(201)
  • A2 line 164: expect(secondResponse.status).toBe(201)
  • A3 line 170: expect(first.agent_id).not.toBe(second.agent_id)
  • A4 line 172: expect(first.endpoint_id).not.toBe(second.endpoint_id)
  • A5 line 174: expect(first.agent_name).not.toBe(second.agent_name)
Source inputs and operations
  • I1 line 155: SELF.fetch(registrationUrl, {\n method: 'POST',\n })
  • I2 line 159: SELF.fetch(registrationUrl, {\n method: 'POST',\n })
REG-029 — stores onboarding as incomplete for a new agent
Field Source-backed specification or observation
1. Test ID and name REG-029 — stores onboarding as incomplete for a new agent
2. Requirement or guarantee Source test intent: stores onboarding as incomplete for a new agent. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: agent registration. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/registration.test.ts:177; assertion/input source links below. Source key: tests/registration.test.ts :: stores onboarding as incomplete for a new agent :: line 177 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/registration.test.ts:177; expressions I1. Imported modules: cloudflare:test, vitest, ../src/registration.
21. Test implementation location and command tests/registration.test.ts:177 — stores onboarding as incomplete for a new agent. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 182: expect(response.status).toBe(201)
  • A2 line 199: expect(agent?.onboarding_completed).toBe(0)
Source inputs and operations
  • I1 line 178: SELF.fetch(registrationUrl, {\n method: 'POST',\n })
REG-030 — sets created_at and last_active_at on registration
Field Source-backed specification or observation
1. Test ID and name REG-030 — sets created_at and last_active_at on registration
2. Requirement or guarantee Source test intent: sets created_at and last_active_at on registration. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: agent registration. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen See assertions A2 below. Only the shown negative/rejection checks are claimed; other forbidden effects require review.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/registration.test.ts:202; assertion/input source links below. Source key: tests/registration.test.ts :: sets created_at and last_active_at on registration :: line 202 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/registration.test.ts:202; expressions I1. Imported modules: cloudflare:test, vitest, ../src/registration.
21. Test implementation location and command tests/registration.test.ts:202 — sets created_at and last_active_at on registration. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 211: expect(response.status).toBe(201)
  • A2 line 231: expect(agent).not.toBeNull()
  • A3 line 233: expect(agent!.created_at >= before).toBe(true)
  • A4 line 235: expect(agent!.created_at <= after).toBe(true)
  • A5 line 237: expect(agent!.last_active_at).toBe(agent!.created_at)
Source inputs and operations
  • I1 line 205: SELF.fetch(registrationUrl, {\n method: 'POST',\n })
REG-031 — generates unique agent names across 100 registrations
Field Source-backed specification or observation
1. Test ID and name REG-031 — generates unique agent names across 100 registrations
2. Requirement or guarantee Source test intent: generates unique agent names across 100 registrations. Displayed assertions establish this test’s expected checks, not a separate system-wide guarantee.
3. Purpose and risk addressed Detect regression of this named behaviour; complete business-impact/invariant analysis remains in the curated cases or follow-up review.
4. Priority High — provisional catalogue triage; subject to risk review.
5. Test type Regression — provisional grouping from the declaration name.
6. Preconditions Use section C plus the cited file’s fixtures and setup/teardown hooks. Suite context: agent registration. Do not infer starting state from the title.
7. Input and test data No each/for parameter table on this declaration; its callback may still generate inputs. Input/operation expressions: I1. Use disposable fixture data only.
8. Execution steps 1. Prepare the existing source test harness from section C. 2. Run pnpm test. 3. Locate this named declaration and its parameterized/conditional instances. 4. Compare the displayed assertions. 5. Record evidence and follow teardown. Not executed during this review.
9. Expected HTTP status, where applicable See assertions A1 below. A numeric schema/helper expectation is not automatically an HTTP response contract.
10. Expected response headers and body See assertions A1, A2, A3 below. Referenced variables remain symbolic; no universal response envelope is assumed.
11. Expected state changes No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
12. Expected emitted events or downstream calls, where applicable No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
13. Negative assertions: what must not happen No direct assertion identified for this field; inspect the referenced helpers before stating an expectation.
14. Cleanup and postconditions Use the cited file’s hooks/finally blocks and section C. Restore mocks and remove only isolated test data.
15. Actual result Not run — no execution evidence collected.
16. Evidence references tests/registration.test.ts:240; assertion/input source links below. Source key: tests/registration.test.ts :: generates unique agent names across 100 registrations :: line 240 at this pinned revision.
17. Execution date Not run.
18. Status and outstanding issues Existing declaration documented; indirect helper assertions and full semantic coverage are not inferred from static extraction.
19. Category Regression (provisional).
20. Handler, interface or code path tests/registration.test.ts:240; expressions I1. Imported modules: cloudflare:test, vitest, ../src/registration.
21. Test implementation location and command tests/registration.test.ts:240 — generates unique agent names across 100 registrations. Run pnpm test from /home/johnny/projects/toastmachine-registration-worker after preparing its existing test environment; this invokes the suite.
22. Implementation status Existing automated test
23. Execution status Not run
24. Known limitations Static source inventory only. Loops, parameter tables, shared helpers and conditional modifiers can change executed counts. Indirect helper assertions are not expanded.
25. Follow-up actions Reconcile runtime instances with this declaration, review symbolic fixtures and unasserted effects, and record execution evidence. Preserve this ID.
Source assertions
  • A1 line 246: expect(response.status).toBe(201)
  • A2 line 252: expect(body.agent_name).toBeTruthy()
  • A3 line 253: expect(names.has(body.agent_name)).toBe(false)
  • A4 line 258: expect(names.size).toBe(100)
Source inputs and operations

F. Test categories

This maps selected cases rather than all source assertions. An unselected category is not automatically absent from the Worker or wider suite.

Category Applicability and selected coverage
Happy-path behaviour Selected cases: REG-001. Their limitations apply.
Input validation and boundary conditions Selected cases: REG-002. Their limitations apply.
Authentication and authorisation Selected cases: REG-004. Their limitations apply.
API and contract compatibility No dedicated selected case; applicability and wider coverage require investigation before marking Not applicable.
Data integrity and consistency Selected cases: REG-001. Their limitations apply.
Idempotency and duplicate operations No dedicated selected case; applicability and wider coverage require investigation before marking Not applicable.
Pagination and ordering Selected cases: REG-005. Their limitations apply.
Dependency interactions Selected cases: REG-006. Their limitations apply.
Timeout, retry and partial-failure handling No dedicated selected case; applicability and wider coverage require investigation before marking Not applicable.
Security and abuse prevention Selected cases: REG-003, REG-004, REG-005, REG-006. Their limitations apply.
Observability and diagnostics No dedicated selected case; applicability and wider coverage require investigation before marking Not applicable. No complete logging, metrics, redaction or alerting guarantee is established here.
Regression tests No dedicated selected case; applicability and wider coverage require investigation before marking Not applicable.
Integration and end-to-end tests Selected cases: REG-001, REG-002, REG-005. Their limitations apply.

G. Execution instructions

pnpm test invokes vitest run. pnpm typecheck, pnpm lint and pnpm format:check are separate checks. The deployment workflow runs code/format/security checks but does not invoke pnpm test or Vitest.

Run documented commands from /home/johnny/projects/toastmachine-registration-worker only in the prepared test environment. None was run here. Commands are defined in package.json; release behaviour is declared in the CI/deploy workflow. Each case names its existing assertions or proposed location.

Execution layer Instruction and evidence boundary
Setup and teardown Use section C and the cited fixtures; record environment and revision and remove only disposable test data.
Unit tests Use the package suite for the relevant direct-helper cases; no separate unit-only command is assumed.
Integration tests Use the existing harness and service replacements. This does not prove a live cross-deployment guarantee.
Contract tests Use the existing package suite. Resources also defines openapi:check; schema checks do not replace runtime assertions.
Proposed tests Implement the specified case first; a proposed path is not an existing runnable test.
CI workflow references The inspected deployment workflow does not invoke the application suite. Other build/type/schema checks do not establish these cases executed.

H. Results and evidence

Test ID Last run Result Evidence Notes
REG-001 Not run Not run Source/test inspection only; no execution log. Existing automated test
REG-002 Not run Not run Source/test inspection only; no execution log. Partially covered
REG-003 Not run Not run Source/test inspection only; no execution log. Existing automated test
REG-004 Not run Not run Source/test inspection only; no execution log. Existing automated test
REG-005 Not run Not run Source/test inspection only; no execution log. Existing automated test
REG-006 Not run Not run Source/test inspection only; no execution log. Proposed test, not implemented
Execution status Meaning
Not run No result is recorded in this review.
Passing A recorded execution met the scoped assertions in its stated environment.
Failing A recorded execution did not meet one or more assertions.
Blocked An identified prerequisite prevents execution.
Skipped Deliberate non-execution with a recorded reason.
Implementation status Meaning
Existing automated test Named assertions cover the scoped case, subject to its stated limitations.
Partially covered Related assertions exist but specific expectations still need verification.
Proposed test, not implemented New automated implementation is proposed, not claimed to exist.
Blocked by missing prerequisites A specified prerequisite prevents implementation.

A passing related test does not establish every associated guarantee. Record command, environment, immutable revision, run date and output evidence before changing an execution result. Source inspection is not execution evidence.

Complete automated source catalogue results

These entries correspond to source declarations, not additional or runtime-expanded tests.

Test ID Last run Result Evidence Notes
REG-007 Not run Not run tests/identifier-formats.test.ts:16 Existing source declaration; parameterized; no execution log.
REG-008 Not run Not run tests/identifier-formats.test.ts:39 Existing source declaration; parameterized; no execution log.
REG-009 Not run Not run tests/identifier-formats.test.ts:54 Existing source declaration; no execution log.
REG-010 Not run Not run tests/index.test.ts:5 Existing source declaration; no execution log.
REG-011 Not run Not run tests/index.test.ts:31 Existing source declaration; no execution log.
REG-012 Not run Not run tests/index.test.ts:42 Existing source declaration; no execution log.
REG-013 Not run Not run tests/index.test.ts:57 Existing source declaration; no execution log.
REG-014 Not run Not run tests/index.test.ts:76 Existing source declaration; no execution log.
REG-015 Not run Not run tests/index.test.ts:102 Existing source declaration; no execution log.
REG-016 Not run Not run tests/index.test.ts:113 Existing source declaration; no execution log.
REG-017 Not run Not run tests/index.test.ts:132 Existing source declaration; no execution log.
REG-018 Not run Not run tests/operation-token-case.test.ts:9 Existing source declaration; no execution log.
REG-019 Not run Not run tests/public-directory.test.ts:5 Existing source declaration; no execution log.
REG-020 Not run Not run tests/public-directory.test.ts:11 Existing source declaration; no execution log.
REG-021 Not run Not run tests/public-directory.test.ts:46 Existing source declaration; no execution log.
REG-022 Not run Not run tests/public-directory.test.ts:54 Existing source declaration; parameterized; no execution log.
REG-023 Not run Not run tests/registration.test.ts:8 Existing source declaration; no execution log.
REG-024 Not run Not run tests/registration.test.ts:36 Existing source declaration; no execution log.
REG-025 Not run Not run tests/registration.test.ts:66 Existing source declaration; no execution log.
REG-026 Not run Not run tests/registration.test.ts:117 Existing source declaration; no execution log.
REG-027 Not run Not run tests/registration.test.ts:130 Existing source declaration; no execution log.
REG-028 Not run Not run tests/registration.test.ts:154 Existing source declaration; no execution log.
REG-029 Not run Not run tests/registration.test.ts:177 Existing source declaration; no execution log.
REG-030 Not run Not run tests/registration.test.ts:202 Existing source declaration; no execution log.
REG-031 Not run Not run tests/registration.test.ts:240 Existing source declaration; no execution log.

I. Coverage gaps and open questions

  • REG-002 needs a database-mutation assertion, not just a 400 response.
  • The limiter rejection branch has no matching automated case located; REG-006 proposes it. Limiter outage and duplicate-name exhaustion remain additional untested branches in this review.
  • Sequential unique-name examples do not establish collision safety under concurrent registration. No availability, latency or capacity target was found.
  • Credential scheme/UUID syntax tests do not by themselves prove every onboarding-update permission or deployment trust boundary.

Known flaky tests and historical failure rates: Unknown; execution history was not assessed. No new reproduced application defect is claimed. Follow-up ownership and execution dates remain unassigned. Characterization proposals may expose a requirement decision without establishing a stronger approved guarantee.