A cancelled request stops the e-mail two-factor code send #294

Merged
claude merged 2 commits from feature/30-email-code-cancellation into develop 2026-11-05 07:37:27 -05:00
Owner

Cancelling the request that asks for an e-mailed two-factor code now stops the e-mail send.

  • TwoFactorController.SendEmailCode takes CancellationToken stoppingToken and passes it to IEmailSender.SendAsync.
  • The cooldown is still taken before the send, by design, so a cancelled or failed send still uses it; a comment says so.
  • The summary is re-wrapped with its wording unchanged. The snapshot keeps line breaks, so it changed in one line; the generated client did not change.

Tests:

  • New TwoFactorEmailCodeCancellationTests, on a second host. A fake sender blocks until its token is cancelled, the client cancels, and the test asserts the sender saw it.
  • It was red as an assertion before the change, and passed 5 runs in a row.
  • Whole Ninlil.Web.Tests 2070. The verifier passed the change.

Note on the issue's premise: SendEmailCode was not the only action without a token. The verifier scanned all 280 async actions: 65 take none, and none of those awaits anything that accepts a token.

  • The settings PATCH actions end in PresetConfigurationFileApplier.ApplyAsync, which takes none, and cancelling a configuration-file write halfway would be undesirable anyway.
  • The user and role actions use UserManager and RoleManager, which take none.
    No follow-up is filed for them.

Closes #30

🤖 Generated with Claude Code

https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK

Cancelling the request that asks for an e-mailed two-factor code now stops the e-mail send. - `TwoFactorController.SendEmailCode` takes `CancellationToken stoppingToken` and passes it to `IEmailSender.SendAsync`. - The cooldown is still taken before the send, by design, so a cancelled or failed send still uses it; a comment says so. - The summary is re-wrapped with its wording unchanged. The snapshot keeps line breaks, so it changed in one line; the generated client did not change. Tests: - New `TwoFactorEmailCodeCancellationTests`, on a second host. A fake sender blocks until its token is cancelled, the client cancels, and the test asserts the sender saw it. - It was red as an assertion before the change, and passed 5 runs in a row. - Whole `Ninlil.Web.Tests` 2070. The verifier passed the change. Note on the issue's premise: `SendEmailCode` was not the only action without a token. The verifier scanned all 280 async actions: 65 take none, and none of those awaits anything that accepts a token. - The settings PATCH actions end in `PresetConfigurationFileApplier.ApplyAsync`, which takes none, and cancelling a configuration-file write halfway would be undesirable anyway. - The user and role actions use `UserManager` and `RoleManager`, which take none. No follow-up is filed for them. Closes #30 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Closes #30

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
The OpenAPI snapshot and Angular API client carry the re-wrapped two-factor e-mail code summary
Some checks failed
Build / Build Binary (linux-amd64) (pull_request) Has been skipped
Build / Build Binary (linux-arm64) (pull_request) Has been skipped
Build / Build Binary (windows-amd64) (pull_request) Has been skipped
Build / Build Binary (macos-amd64) (pull_request) Has been skipped
Build / Build Binary (macos-arm64) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (pull_request) Has been skipped
Build / Build and Push Image (pull_request) Has been skipped
Build / Build and Test Deb and RPM Packages (pull_request) Has been skipped
Build / Test .NET (push) Successful in 9m34s
Build / Pack and Push NuGet Packages (dns-core) (pull_request) Has been skipped
Build / Build Arch Linux Packages (pull_request) Has been skipped
Build / Smoke Test the Windows Binary (pull_request) Has been skipped
Build / Publish Release (pull_request) Has been skipped
Build / Pipeline (pull_request) Failing after 0s
Build / Stage Draft Release (push) Successful in 3s
Build / Pack and Push NuGet Packages (common) (push) Successful in 38s
Build / Pack and Push NuGet Packages (dns-server) (push) Successful in -1m47s
Build / Pack and Push NuGet Packages (dhcp) (push) Successful in 1m29s
Build / Pack and Push NuGet Packages (dns-core) (push) Successful in 1m58s
Build / Build Binary (macos-arm64) (push) Successful in 21s
Build / Build Binary (windows-amd64) (push) Successful in 26s
Build / Build Binary (macos-amd64) (push) Successful in 5m8s
Build / Build Binary (linux-amd64) (push) Successful in 7m46s
Build / Build Binary (linux-arm64) (push) Successful in 7m53s
Build / Build and Push Image (push) Successful in 10s
Build / Smoke Test the Windows Binary (push) Successful in 16s
Build / Build Arch Linux Packages (push) Successful in 25s
Build / Build and Test Deb and RPM Packages (push) Successful in 2m38s
Build / Publish Release (push) Successful in 4s
Build / Pipeline (push) Successful in 0s
848775ce3c
Refs #30

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
claude merged commit eacabc904c into develop 2026-11-05 07:37:27 -05:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lantea-one/ninlil!294
No description provided.