Skip to content

testing: migrate adapter.test.ts to stub HttpClient; delete live-contract dups (comms-e5vm.3) - #17

Merged
GraemeF merged 1 commit into
mainfrom
comms-e5vm.3
Jun 13, 2026
Merged

GraemeF merged 1 commit into
mainfrom
comms-e5vm.3

Conversation

@GraemeF

@GraemeF GraemeF commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Tier-2 migration following the merged comms-e5vm.2 proof (#12). Moves the
adapter-internal unit tests in packages/zulip/adapter.test.ts off the real
Bun.serve + FetchHttpClient realm onto the owned-fake stub HttpClient
via effectTest — deterministic, socket-free.

What moved

These are the request-shape and error-mapping tests — captured-request
params, narrow JSON, auth headers, call counts, paths, and ZulipApiError → DirectoryError|PublisherError cause preservation — which the substrate-agnostic
live contract (contract.ts) deliberately never asserts. So this is migration,
not deletion:

  • identity acquire/mint/reactivate/sanitise + all release variants + idempotency call-counts
  • directory listAgents/listHumans/listChannels filters + error mapping + presence mapping (incl. agent/human short-circuits, bot-never-writes-presence)
  • publisher post wire-shape, /streams pre-flight ordering, UnknownChannel, PublisherError cause, edit/react/unreact
  • history readChannel/readThread narrow + range filters + sender-kind resolution + recentThreads dedup
  • inbox.replay (since filter, DM-exclusion narrow, mention surfacing) + subscribe/unsubscribe + mentions-narrow register
  • the ass-220u minter-creds routing block + reconcileMinterSubscriptions

The attachmentReference / UserUploadPath brand type-proofs stay as plain
compile-time test (no socket, no runtime).

What was deleted

Three pure-behavioural duplicates of the live contract — return-value-only
assertions with exact contract twins:

  • identity.acquire with a different name on a bound adapter rejects
  • identity.resolve returns Identity for a known full_name
  • identity.resolve returns undefined for an unknown full_name

The human-kind parse stays covered by the migrated listHumans test.

Scope notes

  • No startTestRealm survives in this file. The genuine real-socket
    scope-close/long-poll teardown is the Tier-3 residue tracked separately
    (comms-4lz5); the reconnect/long-poll logic already moved to
    adapter-events.test.ts in .2.
  • 89 → 86 tests (3 deleted, 86 migrated). bun run check green in the nix dev shell.

…ract dups (comms-e5vm.3)

Tier-2 migration following the comms-e5vm.2 proof. Move the adapter-internal
unit tests off the real Bun.serve + FetchHttpClient realm onto the owned-fake
stub HttpClient via effectTest — deterministic, socket-free.

These are the request-shape and error-mapping tests (params, narrow JSON, auth
headers, captured-call counts, paths, ZulipApiError → DirectoryError|Publisher
Error cause preservation) that the substrate-agnostic live contract never
asserts, so this is migration, not deletion: identity acquire/release, the
directory filters + presence mapping, publisher wire-shape + pre-flight, history
narrow/range/sender-kind, inbox.replay + subscribe/unsubscribe, the minter-creds
routing block, and reconcileMinterSubscriptions. The brand type-proofs stay as
plain compile-time `test` (no socket, no runtime).

Delete three pure-behavioural duplicates of the live contract (return-value-only
assertions with exact contract twins): acquire-different-name-rejects and both
resolve known/unknown cases. The human-kind parse stays covered by the migrated
listHumans test.

No startTestRealm survives in this file; the genuine real-socket scope-close
teardown is the Tier-3 residue tracked by comms-4lz5.
@GraemeF
GraemeF merged commit 5a1c4c0 into main Jun 13, 2026
2 checks passed
@GraemeF
GraemeF deleted the comms-e5vm.3 branch June 13, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant