Skip to content

Document 202 Accepted for detectVoiceActivity and detectCredits - #120

Open
hammerlabs wants to merge 2 commits into
LukasParke:mainfrom
hammerlabs:fix/detection-triggers-202-accepted
Open

Document 202 Accepted for detectVoiceActivity and detectCredits#120
hammerlabs wants to merge 2 commits into
LukasParke:mainfrom
hammerlabs:fix/detection-triggers-202-accepted

Conversation

@hammerlabs

@hammerlabs hammerlabs commented Jun 13, 2026

Copy link
Copy Markdown

Problem

PUT /library/metadata/{ids}/voiceActivity and PUT /library/metadata/{ids}/credits return 202 Accepted (async — the detection job is scheduled, not completed inline), but the spec documents only 200. Speakeasy-generated SDKs (e.g. plex-api-client / plexpy) therefore treat the valid 202 as an unexpected response and raise SDKError, even though the request succeeded:

plex_api_client.models.errors.SDKError: Unexpected response received: Status 202 Content-Type text/html

Evidence

Verified live against PMS 1.43.2.10687-563d026ea — the current latest per Plex's own updater (/updater/status), i.e. not an old-version quirk:

Endpoint Observed
PUT …/voiceActivity?force=1&manual=1 202
PUT …/credits?force=1&manual=1 202
PUT …/analyze, …/intro, …/addetect, …/chapterThumbs 200 (unchanged)

Only the two endpoints in this PR return 202; the sibling triggers return 200 and are intentionally left alone.

Change

  • Adds a shared #/components/responses/202 (Accepted, text/html) mirroring the existing 200.
  • References it from detectVoiceActivity and detectCredits alongside the existing 200.

8 lines added, no other operations touched.

Verification

Regenerated the Python SDK from the patched spec with Speakeasy: the generated method changes from match_response(http_res, "200", "*") to match_response(http_res, ["200", "202"], "*") and a live detect_voice_activity() call now returns cleanly instead of raising.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated API documentation to reflect 202 Accepted responses for credit detection and voice activity detection endpoints, indicating these operations are now documented as asynchronous requests.

Greptile Summary

The API specification now documents that credit detection and voice-activity detection may return 202 Accepted while processing continues asynchronously. Both operations retain their existing JSON success response contract.

Confidence Score: 5/5

Safe to merge: the resolved specification exposes the intended asynchronous response contract for both operations.

No blocking failure remains.

T-Rex T-Rex Logs

What T-Rex did

  • The contract validation step parsed the pull request and merged specification snapshots, resolved the local 202 references for both target operations to Accepted with text/html content, while preserving the 200 JSON SuccessResponse contract.
  • Redocly bundling and linting of the resolved specification completed successfully, and the API description was validated as correct.
  • Evidence artifacts were prepared and linked to support the findings, including contract validation captures and Redocly results.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

Plex returns `202 Accepted` (text/html body) for these async detection
triggers, but the spec documents only `200`. Speakeasy-generated SDK clients
(e.g. plex-api-client / plexpy) therefore treat the valid 202 as an unexpected
response and raise SDKError, even though the job was accepted and scheduled.

Verified live against PMS 1.43.2.10687-563d026ea — the current latest per
Plex's own updater as of 2026-06-13 (i.e. not an old-version quirk):
  PUT /library/metadata/{ids}/voiceActivity  -> 202
  PUT /library/metadata/{ids}/credits        -> 202
Sibling triggers (analyze, intro, addetect, chapterThumbs) return 200 and are
left unchanged. developer.plex.tv shows 200 only because those docs are
rendered from this spec, not from observed server behavior.

Adds a shared `#/components/responses/202` (Accepted) and references it from
the two affected operations alongside the existing 200.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The OpenAPI specification gains a new shared components.responses['202'] entry (HTTP Accepted, text/html content). This component is then referenced as a documented 202 response on both the detectCredits (PUT /library/metadata/{ids}/credits) and detectVoiceActivity (PUT /library/metadata/{ids}/voiceActivity) operations.

Changes

202 Accepted Response Documentation

Layer / File(s) Summary
Shared 202 component and operation-level references
plex-api-spec.yaml
Introduces components.responses['202'] with description: Accepted and text/html content, then adds 202 response references to the detectCredits and detectVoiceActivity PUT operations pointing to that shared component.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A most dignified 202, I do declare! 🎩
The butler presents Accepted with impeccable flair,
Credits detected, voice activity too,
Each PUT operation now properly due.
The spec is laid out — quite proper, quite right,
All responses accounted for, tidy and bright. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the two endpoints and the documented 202 Accepted response.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

2 participants