Skip to content

UTS: flatten the RSC6a stats fixture to the current TS12 Stats shape - #508

Open
paddybyers wants to merge 2 commits into
mainfrom
uts/flatten-stats-fixture
Open

UTS: flatten the RSC6a stats fixture to the current TS12 Stats shape#508
paddybyers wants to merge 2 commits into
mainfrom
uts/flatten-stats-fixture

Conversation

@paddybyers

Copy link
Copy Markdown
Member

uts/rest/unit/stats.md's RSC6a/returns-paginated-stats-0 fixture still uses the deep per-type Stats structure (allmessages/allcount/data) that was deprecated and removed as of specification version 2.2. In features.md the deep clauses (TS12d–TS12o) and TS2–TS14 are all deleted; the current Stats (TS12) is flat: intervalId (TS12a), intervalTime (TS12p, parsed from the id), unit (TS12c), inProgress (TS12q), entries — a Dict<String, int> (TS12r) — schema (TS12s), and appId (TS12t).

The test's assertions only checked intervalId/unit, so the stale fixture wasn't caught — but any SDK implementing the current flattened Stats type (as ably-rust now does) would model entries, not the nested objects, so the fixture misrepresents the API.

Change

  • Replace the nested all: { messages: {...}, all: {...} } fixture with the flattened shape: a flat entries map keyed by dotted metric path ("messages.all.all.count", …), plus schema/appId.
  • Add assertions covering entries (TS12r), unit (TS12c) and intervalTime (TS12p) so the test exercises the flattened API rather than only intervalId/unit.
  • Add the TS12 spec points to the file header.

The pagination-link-headers fixture already used only intervalId/unit, which is flattened-compatible, so it's unchanged.

Found while implementing the flattened Stats type in ably-rust.

🤖 Generated with Claude Code

uts/rest/unit/stats.md's returns-paginated-stats-0 fixture used the deep
per-type Stats structure (all → messages/all → count/data) that was
deprecated and removed as of specification version 2.2 (features.md TS12d-o
deleted). Replace it with the current flattened TS12 shape — a flat `entries`
map keyed by dotted metric path, plus schema/appId — and add assertions
covering entries (TS12r), unit (TS12c) and intervalTime (TS12p) so the test
actually exercises the flattened API rather than only intervalId/unit.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Adds rest/integration/RSC6/stats-flattened-entries-2: inject known datapoints
via the sandbox stats endpoint (G3), read them back, and assert the flattened
`entries` API (TS12r) alongside intervalId/unit/schema/appId.
Documents the ingestion-vs-flattened shape distinction and the
`X-Ably-Version: 6` requirement to receive the flattened API, guarding against
a client silently falling back to the deprecated deeply-nested Stats structure.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for freeto 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

@paddybyers