Skip to content

docs(uts): spec-first handling of UTS spec errors (fail-fast test pattern)#498

Open
sacOO7 wants to merge 1 commit into
mainfrom
docs/uts-derived-tests-spec-first-fail-fast
Open

docs(uts): spec-first handling of UTS spec errors (fail-fast test pattern)#498
sacOO7 wants to merge 1 commit into
mainfrom
docs/uts-derived-tests-spec-first-fail-fast

Conversation

@sacOO7

@sacOO7 sacOO7 commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Makes uts/docs/writing-derived-tests.md treat a wrong UTS spec as a spec problem, not a test problem.

Today, when a derived test fails because the UTS spec itself is wrong, the manual says to "fix the test to match the features spec." That quietly buries the spec bug: the test goes green, the spec stays wrong, and every other SDK re-hits it — defeating the point of a single source of truth. This PR flips that to spec-first: the spec is the source of truth, so a spec error is fixed there, surfaced by a loud, self-describing test rather than papered over in translation.

It also closes a practical gap — the manual told you to "compare against the features spec" but never gave you a fetchable link to one.

What changed

section 2a — Is the UTS spec wrong?

  • Evaluation-only callout. Fetching a features spec and cross-validating is an evaluation activity (off a real failure). A translate-only pass stays a faithful, mechanical translator — it copies the UTS spec verbatim, mistakes and all, and must not fetch the features spec or "correct" anything.
  • Fetchable features-spec links. All specs live under the repo's specifications/ directory; added the raw, fetchable base URL plus per-module links (features.md, objects-features.md, chat-features.md) and the related authorities (protocol.md, encryption.md).
  • Two failure modes named. A UTS spec can be wrong by contradicting the features spec or by being internally inconsistent (e.g. a replayed serial that doesn't match the value its own harness produces; a test title that names a state its body never injects).
  • Spec-first action. Record in UTS Spec Errors + emit a fail-fast test — instead of rewriting the test to match the broken spec.

section 3 — renamed Deviation test patternsTest patterns for a diagnosed failure

The section now honestly covers all three diagnosed-failure outcomes:

  • Env-gated skip and adapted assertion — for an SDK deviation (unchanged).
  • Spec-error fail-fast (new) — for a UTS spec error: a placeholder that fails immediately, names the spec id, and points at deviations.md. There are no spec-correct assertions to write (the spec is the thing that's wrong), so failing loud is the forcing function.
  • Resolution note: the fail-fast test stays red until the spec is corrected; then you re-translate from the fixed spec (becoming a normal pass, or an SDK deviation if the SDK then diverges). Explicitly not resolved by editing the test to match the broken spec or the SDK.

section 4 Decision tree + Recording deviations

  • Decision tree NO-branch is now the spec-first fail-fast, and asks "(and is it internally consistent?)".
  • Added the UTS Spec Errors section to the deviations file (four sections total), distinct from the SDK-deviation categories.

Why it matters

  • Single source of truth is enforced. Spec bugs get fixed at the spec, once, for all SDKs — not worked around N times.
  • No silent false-greens. A spec error is impossible to miss: the test fails up front with the spec id and a pointer to the fix.
  • Keeps the translator dumb. Translation does pure, faithful conversion; cross-validation and spec-correctness judgement live only in the evaluation step, driven by this manual.

Scope

Documentation only — no spec rule (RTL*/RTN*/RTO*/…) is changed. Affects how SDK teams write derived tests from the UTS specs.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the UTS “writing derived tests” guide to treat UTS spec mistakes as spec bugs (to be fixed at the source) and to enforce a fail-fast test pattern that keeps spec errors visible during evaluation, while keeping translation a purely mechanical process.

Changes:

  • Clarifies that cross-validating UTS specs against features specs is evaluation-only, not part of translation.
  • Adds fetchable links to the relevant feature/spec authority documents and explains two spec-error modes (contradiction vs internal inconsistency).
  • Renames and expands the test-patterns section to include a spec-error fail-fast placeholder pattern, and updates the decision tree + deviations categorization accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread uts/docs/writing-derived-tests.md
Comment thread uts/docs/writing-derived-tests.md
@sacOO7 sacOO7 force-pushed the docs/uts-derived-tests-spec-first-fail-fast branch from 74359f6 to b611f8c Compare June 30, 2026 15:17
@github-actions github-actions Bot temporarily deployed to staging/pull/498 June 30, 2026 15:17 Inactive
sacOO7 added a commit to ably/ably-java that referenced this pull request Jun 30, 2026
Align the skill's Step 6 with the spec manual (ably/specification#498) so a
diagnosed UTS spec error is handled spec-first instead of being quietly
adapted to green:

- Step 6 intro now names three acceptable end-states (spec-correct pass,
  SDK deviation stays green, UTS spec error fails fast) — removes the
  earlier "a red test is never acceptable" contradiction.
- Decision tree NO-branch: fix the spec at source + record under
  deviations.md "UTS Spec Errors" + emit a fail-fast test.
- Add the "spec-error fail-fast" Kotlin pattern (mirrors the manual's JS
  example) and retitle the section to "Test patterns for a diagnosed
  failure" since fail-fast is not a deviation.
- Defer the deviations-file entry format to the manual's "Recording
  deviations" sections (removes the divergent inline field list).
@sacOO7 sacOO7 force-pushed the docs/uts-derived-tests-spec-first-fail-fast branch from b611f8c to cb7e8a4 Compare June 30, 2026 16:06
@github-actions github-actions Bot temporarily deployed to staging/pull/498 June 30, 2026 16:07 Inactive
@sacOO7 sacOO7 force-pushed the docs/uts-derived-tests-spec-first-fail-fast branch from cb7e8a4 to 162e42e Compare June 30, 2026 16:07
@github-actions github-actions Bot temporarily deployed to staging/pull/498 June 30, 2026 16:07 Inactive
@sacOO7 sacOO7 force-pushed the docs/uts-derived-tests-spec-first-fail-fast branch from 162e42e to 1781ebd Compare June 30, 2026 16:10
@github-actions github-actions Bot temporarily deployed to staging/pull/498 June 30, 2026 16:10 Inactive
…st pattern

When a derived test fails because the UTS spec itself is wrong, the manual
previously said to "fix the test to match the features spec" — which quietly
buries the spec bug and leaves it for every other SDK to re-hit. Make the
guidance spec-first: the UTS spec is the source of truth, so a spec error must
be fixed there, surfaced by a loud, self-describing test rather than papered
over in the translation.

- 2a (Is the UTS spec wrong?): mark this an evaluation-only step (translation
  never validates the spec); link the features specs as fetchable raw URLs
  (all live under specifications/); cover both failure modes (contradicts the
  features spec, or internally inconsistent); and require recording in
  UTS Spec Errors + emitting a fail-fast test instead of rewriting the test.
- 3 (renamed "Test patterns for a diagnosed failure"): add the third pattern,
  Spec-error fail-fast — a placeholder that fails immediately, names the spec id
  and points at deviations.md — alongside the two SDK-deviation patterns, plus a
  Resolution note (fix the spec, then re-translate; don't resolve by editing the
  test).
- Decision tree + Recording deviations: NO-branch is now a spec-first fail-fast;
  add the UTS Spec Errors section (four sections total).
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.

2 participants