Skip to content

Remove duplicate Vimeo DI registration; upgrade NimblePros.Vimeo to 2.3.0 - #1487

Merged
ardalis merged 5 commits into
mainfrom
issue-1486-vimeo-di-cleanup
Nov 15, 2026
Merged

ardalis merged 5 commits into
mainfrom
issue-1486-vimeo-di-cleanup

Conversation

@ardalis

@ardalis ardalis commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This removes the duplicate Vimeo DI registration described in #1486. AddVimeoServices(vimeoSettings.Token) in Program.cs is now the only registration.

  • Deleted src/DevBetterWeb.Infrastructure/VimeoServiceCollectionExtensions.cs. That removes RegisterVimeoServicesDependencies and the unused AuthHeaderHandler.
  • AddInfrastructureServices no longer registers Vimeo services, and its unused vimeoToken parameter is gone.
  • Program.cs: removed the vimeoToken local, which read Vimeo:Token, a key nothing configures. Also removed the commented-out AutofacServiceProviderFactory line.

Behavior notes

  • Each named Vimeo client now sends Accept once, and the Tus client sends Tus-Resumable once. Before, both were sent twice.
  • ClientApiConfigurations was already resolved from AddVimeoServices, which wins as the last registration. The Tus client still sends no bearer token.
  • The Tus client no longer gets a base address or Accept header from devBetter. It only issues PATCHes to the absolute, signed upload link, so this has no functional effect.

Package upgrade

  • NimblePros.Vimeo 2.1.2 → 2.3.0. It is safe because the duplicate registration is removed first; otherwise 2.3.0's duplicate-registration check throws at startup. The functional tests start the full app host and pass, so that check is satisfied.
  • Merged latest main (Aspire AppHost, feat: add .NET Aspire AppHost and ServiceDefaults #1488) and resolved a Program.cs conflict.

Vimeo clients exempted from the ServiceDefaults resilience handler

AddServiceDefaults (#1488) adds AddStandardResilienceHandler to every HttpClient. Its timeouts are 10s per attempt and 30s total. On the Vimeo clients they would override the 60-minute timeout and cut off large chunk uploads.

  • New AddDevBetterVimeoServices (src/DevBetterWeb.Web/VimeoServiceCollectionExtensions.cs) calls AddVimeoServices, then RemoveAllResilienceHandlers() on VimeoApi, VimeoTusApi and VimeoOEmbed. It runs after AddVimeoServices, as 2.3.0 requires, and Program.cs now calls it.
  • RemoveAllResilienceHandlers is marked experimental (EXTEXP0001), so that one call has a scoped #pragma. It is the documented way to opt a client out of ConfigureHttpClientDefaults. The other options rely on the internal "{name}-standard" pipeline naming or mean editing the shared ServiceDefaults.
  • Other HttpClients keep the resilience handler.

Before merging

  • Smoke test of the admin video flows. This needs a real Vimeo token: chunked upload, update description, delete, details and oEmbed. Please run it before merging, with chunked upload of a large file as the priority.

Tests

New tests/DevBetterWeb.UnitTests/Infrastructure/InfrastructureServiceCollectionExtensionsTests.cs:

  • AddInfrastructureServices configures none of the VimeoApi, VimeoOEmbed or VimeoTusApi HttpClients. This is checked through IOptionsMonitor<HttpClientFactoryOptions>.
  • AddInfrastructureServices registers no Vimeo services: no ClientApiConfigurations, and none of the tus or sleep services.
  • AddInfrastructureServices followed by AddVimeoServices registers each of those services exactly once, and the Vimeo services resolve.

New tests/DevBetterWeb.UnitTests/Web/VimeoServiceCollectionExtensionsTests.cs builds the host with AddServiceDefaults, as Program.cs does:

  • No ResilienceHandler in the handler chain of any Vimeo client. These tests fail when the removal is taken out.
  • Each Vimeo client keeps its 60-minute timeout.
  • Other clients keep the resilience handler.

Verification

dotnet BuildTestFormat.cs was run after the last change:

  • The build succeeds.
  • All 322 tests pass (AppHost.Tests 4, FunctionalTests 5, Tests 118, UnitTests 195).
  • The dotnet format step still fails, but main fails it the same way: about 11k repo-wide whitespace, imports and charset issues. Running dotnet format --verify-no-changes on the solution, limited to the new files, exits 0. The full-solution run reports one extra IMPORTS issue at (1,1) of VimeoServiceCollectionExtensions.cs, which I couldn't reproduce in isolation; the file's usings are already sorted.

The change set was also reviewed by an independent agent. There were no blockers, and its test-quality suggestions were applied. Notes are in .claude/plans/2026-11-15-issue-1486-vimeo-di-cleanup.md.

Fixes #1486 (pending the manual smoke test above).

🤖 Generated with Claude Code

ardalis and others added 4 commits November 15, 2026 09:22
Delete the local RegisterVimeoServicesDependencies (and the unused
AuthHeaderHandler); AddVimeoServices in Program.cs already registers
everything. Drop the now-unused vimeoToken parameter and the stale
commented-out Autofac line. Add unit tests guarding against
re-introducing the duplicate registration.

Relates to #1486

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Check named HttpClient options via IOptionsMonitor so any configuration
style is caught, and drop the client-name assertion that depended on
NimblePros.Vimeo internals. Record review outcome in the plan.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merge latest main (Aspire AppHost) and resolve the Program.cs conflict,
then bump NimblePros.Vimeo to 2.3.0. The duplicate registration removed
earlier in this branch would otherwise make 2.3.0 throw at startup.

Fixes #1486

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ardalis ardalis changed the title Remove duplicate Vimeo DI registration; rely on AddVimeoServices Remove duplicate Vimeo DI registration; upgrade NimblePros.Vimeo to 2.3.0 Nov 15, 2026
AddServiceDefaults adds the standard resilience handler to every
HttpClient. Its 10s attempt / 30s total timeouts override the Vimeo
clients' 60-minute timeout and would cut off large chunk uploads.
Wrap AddVimeoServices in AddDevBetterVimeoServices, which removes the
resilience handlers from VimeoApi, VimeoTusApi and VimeoOEmbed after
registration, and add tests against a host built like Program.cs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ardalis
ardalis merged commit 633665e into main Nov 15, 2026
3 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.

Remove duplicate Vimeo DI registration; use NimblePros.Vimeo AddVimeoServices and upgrade package

1 participant