Skip to content

UTS: correct stale and inconsistent UTS docs and proxy specs - #561

Open
sacOO7 wants to merge 3 commits into
mainfrom
uts/docs-corrections
Open

sacOO7 wants to merge 3 commits into
mainfrom
uts/docs-corrections

Conversation

@sacOO7

@sacOO7 sacOO7 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes stale and inconsistent text in the existing UTS docs, and two proxy specs that don't match proxy.md. These problems turned up while writing the translator-skill docs in #558.

The PR is independent of that one and targets main. It changes 4 files (+26 / −5) and adds no new tests or spec points.

Changes

1. Define CLOSE_CLIENT — uts/docs/writing-test-specs.md:661–672

CLOSE_CLIENT(client) appears on 464 lines across 55 spec files. Until now its meaning was recorded only in the message of the commit that added it (3745335). This adds a short "Closing Clients (CLOSE_CLIENT)" subsection under Pseudocode Conventions. It says that:

  • the call closes the client so its internal timers stop;
  • it is a cleanup step, not an assertion, so it doesn't wait for or assert CLOSED;
  • derived tests should close the client even when the test fails, pointing to "Cleanup with afterEach" in writing-derived-tests.md.

Other undocumented pseudocode constructs (AWAIT_ERROR, AWAIT UNTIL, IS SAME AS, …) are deliberately left out. Picking canonical spellings for them is for the spec owner to decide.

2. Add the objects Test ID categories — uts/docs/writing-test-specs.md:38

The category field said "One of:" followed by the rest and realtime categories only. The corpus has 339 Test IDs under objects/unit, objects/integration and objects/proxy, which follow the same <module>/<tier> convention. This adds those three categories to the list.

3. Use endpoint: in the proxy test template — uts/docs/writing-test-specs.md:346

The "Proxy Test Structure" template called create_proxy_session(target: TargetConfig(realtimeHost: …, restHost: …), …). That conflicts with the signature in proxy.md (create_proxy_session(endpoint: String, …)) and with every call in the corpus. The template now uses endpoint: "nonprod:sandbox", so spec authors who copy it get the documented form.

4. List objects_gc_test.md under Protocol Variants — uts/docs/integration-testing.md:305

objects/integration/objects_gc_test.md has a ## Protocol Variants section (added in 61b5afd), but the "Annotated specs" list didn't include it. The list now matches all 13 annotated specs.

5. Pass endpoint to create_proxy_session — uts/realtime/integration/proxy/presence_reentry.md:74–77, 197

proxy.md declares endpoint as a required argument, but both calls in this spec passed only rules:, which left each SDK harness to invent a default. Both now pass endpoint: "nonprod:sandbox", formatted like the other calls. All 43 create_proxy_session calls in the corpus now pass the same endpoint.

6. Replace __PASSTHROUGH__ with a fixed fake key — uts/realtime/integration/proxy/connection_resume.md:782–785, 796, 798 (Test 22, RTN14h; separate commit)

The test's replace rule set connectionKey (top level and in connectionDetails) to "__PASSTHROUGH__". Neither proxy.md nor uts-proxy defines any such placeholder. uts-proxy's replace action sends the message verbatim (ws_proxy.go, case "replace": dst.WriteMessage(…, rule.Action.Message), at v0.3.0 and on main), so the client has always received that literal string. The name implied that the proxy preserves the server's real key, which could lead harness authors to build a substitution that doesn't exist.

The key is now "proxy-ttl-test-key", in the style of the file's other fake keys (proxy-injected-new-key, recovery-failed-new-key), with a comment explaining that the message is sent verbatim. Because the client always received a literal value, its behaviour is unchanged, and none of the test's assertions depend on the key.

Needs acknowledgement

Item 6 (Test 22 in connection_resume.md) needs an acknowledgement from the test's author. It assumes the intent was "any key; the resume is expected to fail server-side", as the test's prose and its assertion connection.id != "proxy-ttl-test-id" suggest. If the intent was for the client to resume with the server's real key, uts-proxy would need a field-preserving replace, documented in proxy.md, instead of this change. Item 6 is its own commit, so it can be dropped without affecting the rest.

Not in this PR

  • The translator-skill docs themselves: UTS: add translator-skill guide and uts-to-lang-skill-creator skill #558. That PR's description lists these follow-ups. Some guide text in it (the notes on rules:-only sessions, target: and __PASSTHROUGH__) can be simplified once this PR merges.
  • A separate follow-up PR, stacked on PR 558, will align three existing rules with the guide so its "Divergence from …" labels can go:
    • AWAIT_STATE subscribes, then checks;
    • work is drained before negative assertions;
    • the features spec is read at the same revision as the UTS spec.
  • A GitHub issue will raise two decisions for the spec owner:
    • which deviation category covers SDK APIs that are missing (spec-correct tests that can't compile);
    • canonical spellings for the other undocumented pseudocode constructs.

How verified

  • Each claim was rechecked against current main with git grep: 464 CLOSE_CLIENT lines, 339 objects Test IDs, 13 ## Protocol Variants files, and 43 of 43 create_proxy_session calls passing endpoint: "nonprod:sandbox" after the change. The uts-proxy replace behaviour was read at tag v0.3.0 and on main.
  • git diff --check is clean. editorconfig-checker shows no new errors on the changed files: the 3 indentation warnings in writing-test-specs.md exist on main and moved down 12 lines. The repo lint (build/scripts/find-duplicate-spec-items) passes. The changed lines add no Markdown links, so no links or anchors are affected.
  • An independent read-only reviewer re-derived every claim from the sources and the uts-proxy code, and confirmed each change is correct and minimal, with no out-of-scope edits.

sacOO7 added 3 commits October 8, 2026 22:58
- writing-test-specs.md: define CLOSE_CLIENT, which 464 lines of the
  corpus use but no doc defined (it was described only in the commit
  that added it).
- writing-test-specs.md: add the objects/unit, objects/integration and
  objects/proxy Test ID categories that 339 objects Test IDs already use.
- writing-test-specs.md: use `endpoint:` in the proxy test template, as
  proxy.md's create_proxy_session signature and every corpus call do,
  instead of `target: TargetConfig(...)`.
- integration-testing.md: list objects_gc_test.md among the specs
  annotated with `## Protocol Variants`.
proxy.md declares `endpoint` as a required argument of
create_proxy_session, and every other corpus call passes
`endpoint: "nonprod:sandbox"`. The two calls in presence_reentry.md
passed only `rules:`, leaving each SDK harness to guess a default.
…me Test 22

The RTN14h test replaced the first CONNECTED with a message whose
connectionKey was "__PASSTHROUGH__". uts-proxy has no such placeholder:
its replace action (v0.3.0 and main) sends the message verbatim, so the
client always received that literal string. Use an explicit fake key,
matching the other replace rules in this file, and say in a comment that
the test only checks that the client attempts the resume.

The test's assertions are unchanged.

This branch was successfully deployed

1 active deployment
staging/pull/561 — 958f61f3 Deployed Oct 8, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant