Skip to content

fix(webdav): publish circuit state before failure - #56

Merged
ModerRAS merged 1 commit into
masterfrom
fix/webdav-circuit-notification-order
Jul 28, 2026
Merged

fix(webdav): publish circuit state before failure#56
ModerRAS merged 1 commit into
masterfrom
fix/webdav-circuit-notification-order

Conversation

@ModerRAS

@ModerRAS ModerRAS commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • complete the WebDAV 405 circuit transition and queued-work failure before completing the current caller future
  • remove a race where the caller could submit a half-open probe while the worker was still publishing the previous circuit transition

Release context

Master run 30343087558 failed in media-source:testReleaseUnitTest at WebDavRequestCoordinatorTest.kt:150. Lint passed; build-release was skipped. This one-file fix unblocks the pending Android 2.4 release without changing baseAppVersionName.

Validation

  • targeted debug and release variants of the failing WebDavRequestCoordinatorTest with --rerun-tasks
  • ./gradlew test assembleDebug lint --no-daemon --stacktrace
  • git diff --check

The unrelated untracked Windows NUL entry remains excluded.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of WebDAV “Method Not Allowed” errors.
    • Queued requests now receive failure responses consistently when the connection circuit opens, reducing the chance of requests remaining unresolved.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The HTTP 405 path now drains queued WebDAV requests before failing the current request, ensuring circuit-transition failures are published before caller completion.

Changes

WebDAV circuit transition

Layer / File(s) Summary
Order circuit-open failures
media-source/src/main/kotlin/com/miruplay/tv/mediasource/WebDavRequestCoordinator.kt
The HTTP 405 branch calls failQueuedForOpenCircuit() before failing the current TypedWork, with a comment documenting the ordering.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the WebDAV circuit-state publication ordering change.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/webdav-circuit-notification-order

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.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
media-source/src/main/kotlin/com/miruplay/tv/mediasource/WebDavRequestCoordinator.kt (1)

207-208: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add a regression test for the completion ordering.

The implementation matches the intended ordering, but the existing 405 test only submits requests sequentially and does not prove that queued work has failed before the current caller future completes. Add a deterministic concurrent test using latches/barriers to enqueue work during the 405 request, then assert the queued future is already failed when the current future completes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@media-source/src/main/kotlin/com/miruplay/tv/mediasource/WebDavRequestCoordinator.kt`
around lines 207 - 208, Add a deterministic concurrent regression test for the
405 handling in WebDavRequestCoordinator, using latches or barriers to enqueue a
request while the 405 transition is in progress. Assert that the queued
request’s future has failed before the current caller’s future completes, while
preserving the existing sequential 405 coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@media-source/src/main/kotlin/com/miruplay/tv/mediasource/WebDavRequestCoordinator.kt`:
- Around line 207-208: Add a deterministic concurrent regression test for the
405 handling in WebDavRequestCoordinator, using latches or barriers to enqueue a
request while the 405 transition is in progress. Assert that the queued
request’s future has failed before the current caller’s future completes, while
preserving the existing sequential 405 coverage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d5952dd3-4ef0-41f2-9cc8-dd7d6b75dcec

📥 Commits

Reviewing files that changed from the base of the PR and between 4de31c8 and ffaf58f.

📒 Files selected for processing (1)
  • media-source/src/main/kotlin/com/miruplay/tv/mediasource/WebDavRequestCoordinator.kt

@ModerRAS

Copy link
Copy Markdown
Owner Author

CodeRabbit nitpick reviewed: I am not adding a second internal-completion-order test. WebDavEndpointConsumer exposes only synchronous submit(), so precisely observing queued-work CompletableFuture completion before the current internal future would require a production-only test hook or exposing private queue/work futures. The existing 405 opens endpoint circuit and failed half open probe extends cooldown test is the exact immediate-caller regression that failed on master and now passes in both debug/release variants with --rerun-tasks; the full matrix also passes. Keeping the one-line happens-before fix scoped.

@ModerRAS
ModerRAS merged commit 7e66bdd into master Jul 28, 2026
12 of 13 checks passed
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