Skip to content

fix(byteplus): restore the docs content class and stop capturing a malformed status - #429

Merged
jpr5 merged 1 commit into
mainfrom
fix/424-post-merge-defects
Sep 10, 2026
Merged

jpr5 merged 1 commit into
mainfrom
fix/424-post-merge-defects

Conversation

@jpr5

@jpr5 jpr5 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Three defects an independent review found on main after PR #424 merged. All three were reproduced on origin/main @ 7040a2d before any change was made.

1. P2 — the docs page is visually broken

docs/byteplus-video/index.html used <main class="content">. Every other page in docs/ uses docs-content — a sweep of all 40+ pages found this one as the sole exception, so it is template drift, not an alternate layout.

docs/style.css puts the content margin, padding, sizing, max/min width and word-wrapping on .docs-content, and docs/sidebar.js:151 selects .docs-content and returns early when it is absent, before assigning heading ids or building the TOC. One root cause, two visible effects.

Verified by Playwright screenshots on a locally served docs/ tree at 1440x900, 375x667 and 430x932, with docs/video/ as the control, and the images inspected directly rather than trusting measurements.

Before — 1440x900: the fixed sidebar overlays the content; the title renders as "…eedance) Video" with its left half hidden, and every paragraph and code block is clipped on the left. 375x667 and 430x932: content has no gutter at all, starting flush at x=0, and every line runs off the right edge.

After — 1440x900: full title, padded content column clear of the sidebar, and the "ON THIS PAGE" TOC rendered on the right, matching the control. 375x667 and 430x932: proper gutters, title and prose wrap, nothing clipped.

before after control (/video/)
TOC links 0 6 8
populated h2 ids 0 / 6 6 / 6 6 / 6
.docs-content found no yes yes

Residual horizontal overflow from long <pre> lines at mobile widths is pre-existing and site-wide (grok-video 527px, veo-video 905px, fal-ai 726px against a 375px viewport), unrelated to this class, and left alone.

2. P2 — a malformed poll status persists an unusable fixture

src/byteplus-video.ts coerced the upstream status with String(upstreamBody.status ?? ""), so an absent status became "" and a numeric 123 became "123". Terminal is derived as the complement of the non-terminal pair, so both coerced values read as terminal. Record mode then persisted an envelope that serializeBytePlusVideoTask rejects and swapped the job to replay — so every later poll 502s on that same envelope and a corrected upstream response is never fetched for that job, with the unusable fixture left on disk.

The status now has to clear the same predicate replay applies — a non-empty string — before it can be terminal. Otherwise it is relayed verbatim and the job stays upstream-backed.

Scope, stated honestly: this is malformed-upstream robustness only. There is no evidence Ark emits such a body. 4xx/5xx, non-JSON and non-object bodies are out of scope and are already rejected upstream of this check.

The reviewer's own repro, before and after

Run with the repo's tsx against a real aimock server, a real HTTP upstream, the real recorder and real filesystem persistence.

Before:

missing: submit 200; poll 1 200; poll 2 502   upstreamPolls 1   persisted {"json":{}}
numeric: submit 200; poll 1 200; poll 2 502   upstreamPolls 1   persisted {"json":{"status":123}}
valid:   submit 200; poll 1 200; poll 2 200   upstreamPolls 1   persisted {"json":{"status":"cancelled"}}

After:

missing: submit 200; poll 1 200; poll 2 200   upstreamPolls 2   persisted (nothing)
numeric: submit 200; poll 1 200; poll 2 200   upstreamPolls 2   persisted (nothing)
valid:   submit 200; poll 1 200; poll 2 200   upstreamPolls 1   persisted {"json":{"status":"cancelled"}}

upstreamPolls going 1 -> 2 is the job staying upstream-backed. The valid control is unchanged.

Regression test, observed red before the fix

Three tests added to src/__tests__/byteplus-video-record.test.ts, run against the unmodified handler first:

× a absent status keeps the job upstream-backed instead of persisting an unusable fixture
  → expected 502 to be 200
× a numeric status keeps the job upstream-backed instead of persisting an unusable fixture
  → expected 502 to be 200
× a corrected upstream status on a LATER poll still records normally
  → expected [ { match: {…}, response: {…} } ] to deeply equal []
Tests  3 failed | 28 skipped (31)

After the fix, on the same tests:

✓ src/__tests__/byteplus-video-record.test.ts (31 tests | 28 skipped)
Tests  3 passed | 28 skipped (31)

3. P3 — two inaccurate descriptions

Neither is a runtime change.

The docs said aimock "warns once per job" on an expired URL. The implementation latches per shared fixture envelope object, and the existing test named "the staleness warn latches per FIXTURE" submits four jobs and asserts exactly one warning — the test contradicts the doc. Corrected to "once per fixture envelope", noting a new envelope object can warn again.

The buildBytePlusMatchText docblock promised "ALWAYS a newline and [media: …]", but the code is return text ? \${text}\n${suffix}` : suffix` — a text-free key is the bare suffix with no newline. Corrected to say the separator is present only when there is text.

Gates

Raw exit codes, all from the worktree root:

gate exit
prettier --check . 0
npx eslint . 0
pnpm typecheck 0
npx vitest run 0 — 188 files passed, 5782 tests passed, 46 skipped

…lformed status

Three post-merge defects from PR #424.

The docs page used `<main class="content">` where every one of the 40+ sibling
pages uses `docs-content`. That class owns the content margin, padding, sizing
and word-wrapping, and `sidebar.js` selects `.docs-content` to build the page
TOC, returning early when it is absent. One root cause, two visible effects: the
fixed sidebar overlaid the title, prose and code examples at 1440x900 and
content lost its gutter at 375x667 and 430x932, and the page generated zero TOC
links with all six h2 ids left empty. Verified by screenshot at all three
viewports against `docs/video/` as the control; TOC links go 0 -> 6 and every
heading id populates. No other page in `docs/` carries the wrong class.

The poll handler coerced the upstream status with `String(status ?? "")`, so an
absent status became `""` and a numeric `123` became `"123"`. Terminal is the
complement of the non-terminal pair, so both read as terminal: record mode
persisted an envelope replay cannot serve and swapped the job to replay, after
which every later poll 502s on that same envelope and a corrected upstream
response is never fetched for that job. The status now has to clear the same
predicate replay applies — a non-empty string — before it can be terminal.

This is malformed-upstream robustness only. Ark is not known to emit such a
body, and 4xx/5xx, non-JSON and non-object bodies are out of scope, already
rejected upstream of this check.

Also corrects two inaccurate descriptions, neither a runtime change: the docs
promised the stale-URL warning fires once per job when it latches once per
shared fixture envelope, and the match-key docblock promised an unconditional
newline when a text-free key is the bare `[media: ...]` suffix.
@pkg-pr-new

pkg-pr-new Bot commented Sep 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@copilotkit/aimock@429

commit: aae26ac

@jpr5
jpr5 merged commit 1c80565 into main Sep 10, 2026
30 checks passed
@jpr5
jpr5 deleted the fix/424-post-merge-defects branch September 10, 2026 23:54
@jpr5 jpr5 mentioned this pull request Sep 11, 2026
jpr5 added a commit that referenced this pull request Sep 11, 2026
Cuts the accumulated `[Unreleased]` work. **MINOR** — a new provider
surface (BytePlus Ark video) and new endpoints, no breaking changes.

**Prepared, not merged.** `publish-release.yml` fires on push-to-main,
so merging this publishes to npm, tags `v1.41.0`, cuts the GitHub
Release, dispatches the Docker build, and posts to Slack. Merge when you
want it live.

## What ships

Only **#424** (plus its follow-up **#429**, which fixes the same
never-released BytePlus code) touches the published package. Verified
against `package.json` `files` + `tsconfig` include/exclude:

```
git log v1.40.0..origin/main --oneline -- src/ ':(exclude)src/__tests__/' fixtures/ .claude-plugin/ skills/ CHANGELOG.md
```

…returns byteplus commits only. #422, #423, #425, #426, #427, #428 touch
scripts/, .github/ and docs/ exclusively and are deliberately **not** in
the CHANGELOG.

### Added
- BytePlus Ark (Seedance) video record/replay — submit, poll and
retrieve, stored as the raw Ark task envelope
- `--provider-byteplus` flag

### Changed
- `/api/v3` chat and image requests are attributed to the `byteplus`
provider
- `aimock-pytest` pin moves to 1.41.0

### Fixed
- Startup error when a BytePlus provider base already ends in `/api/v3`

## Version surfaces — seven, all bumped

Found by grepping the tree for `1.40.0`, not from a checklist. **Zero
occurrences of the old string remain** (excluding `CHANGELOG.md`
history, `fixtures/` and `pnpm-lock.yaml`):

| File | Field | 1.40.0 → 1.41.0 |
| --- | --- | --- |
| `package.json` | `version` | ✔ |
| `charts/aimock/Chart.yaml` | `appVersion` (chart `version` stays
`0.1.0`) | ✔ |
| `.claude-plugin/plugin.json` | `version` | ✔ |
| `.claude-plugin/marketplace.json` | `plugins[0].source.version`
(`^1.41.0`) | ✔ |
| `docs/index.html` | demo banner `aimock v…` | ✔ |
| `packages/aimock-pytest/src/aimock_pytest/_version.py` |
`AIMOCK_VERSION` npm pin | ✔ |
| `packages/aimock-pytest/README.md` | `--aimock-version` default | ✔ |

`AIMOCK_VERSION` **must** move this release:
`/api/v3/contents/generations/tasks` is a new server route, so a
default-download pytest user on the 1.40.0 pin would run a server
without it. `packages/aimock-pytest/pyproject.toml` is deliberately
untouched — that package versions on its own PyPI cadence.

There is **no version constant in `src/cli.ts`** and **no
`metadata.version` in `marketplace.json`** in this tree; both surfaces
exist only in the release checklist, not in the repo.

## Drive-by: the npm description has been `<div align="center">` since
the README got a centered header

`npm view @copilotkit/[email protected] description` returns the literal
string `<div align="center">`.

Both README-subtitle extractors — the inline `node -e` in
`publish-release.yml` and `syncDescriptionFromReadme()` in
`scripts/drift-sync.ts` — skip `#`, `[`, `![` and `http` lines but not
raw HTML, so they latch onto the README's opening `<div>` wrapper
instead of the bold subtitle two lines below. Both now also skip `<`,
and `package.json.description` is synced to what the fixed extractor
yields:

> Mock infrastructure for AI application testing — point your SDK at one
local port and every provider, protocol, and service answers
deterministically.

Without this the v1.41.0 npm page ships the same broken description.

## Gates (raw exit codes, local)

| Gate | Exit |
| --- | --- |
| `prettier --check .` | 0 |
| `npx eslint .` | 0 |
| `pnpm typecheck` | 0 |
| `npx vitest run` (5794 passed, 46 skipped, 189 files) | 0 |
| `pnpm build` | 0 |
| `npx commitlint --from origin/main --to HEAD` | 0 |

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01AvkmhXVLqSSEW6FvPQHSu5
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