Skip to content

Jenny J4

Findings

  1. MEDIUM — src/Forge.Approvals.Notify/Notifications.cs:154 (and src/Forge.Approvals.Notify/Notifications.cs:158)
  2. Problem: new FileStream(marker, FileMode.CreateNew, ...) creates the directory entry for marker on disk immediately upon open (src/Forge.Approvals.Notify/Notifications.cs:154), while stream.WriteByte(1) (src/Forge.Approvals.Notify/Notifications.cs:155), stream.Flush(flushToDisk: true) (src/Forge.Approvals.Notify/Notifications.cs:156), and stream.Dispose() execute inside the same try block. If WriteByte, Flush(flushToDisk: true), or Dispose throws an IOException (e.g., ENOSPC/quota exhaustion or FlushFileBuffers/fsync failure), File.Exists(marker) at src/Forge.Approvals.Notify/Notifications.cs:158 evaluates to true. The catch (IOException) when (File.Exists(marker)) filter misclassifies its own write/flush error as a duplicate reservation and returns early without notifying any channel, logging, or surfacing the failure.
  3. Fix: Scope try / catch (IOException) when (File.Exists(marker)) strictly around new FileStream(marker, FileMode.CreateNew, ...), then execute using (stream) { stream.WriteByte(1); stream.Flush(flushToDisk: true); } outside that catch so post-creation I/O failures are not silently treated as duplicate deliveries.

  4. MEDIUM — src/Forge.Approvals.Notify/Notifications.cs:137 (and src/Forge.Approvals.Notify/Notifications.cs:107, src/Forge.Approvals.Notify/Notifications.cs:131)

  5. Problem: Unlike PavlokNotifier (src/Forge.Approvals.Notify/Notifications.cs:40, src/Forge.Approvals.Notify/Notifications.cs:74), EmailNotifier accepts no Action<string>? log callback and silently swallows its per-channel timeout (10s default) at src/Forge.Approvals.Notify/Notifications.cs:137. When dispatched through FileNotificationOutbox (30s default channelTimeout at src/Forge.Approvals.Notify/Notifications.cs:148), EmailNotifier's 10s inner deadline fires first and returns normally, so FileNotificationOutbox does not reach its catch logger (src/Forge.Approvals.Notify/Notifications.cs:172) even though the at-most-once .notified reservation was permanently consumed and the email was dropped. Additionally, sender.SendAsync(...) at src/Forge.Approvals.Notify/Notifications.cs:131 sits outside the try block at src/Forge.Approvals.Notify/Notifications.cs:136, so a non-async IEmailSender throwing OperationCanceledException synchronously on deadline.Token escapes uncaught instead of being handled as a channel timeout.
  6. Fix: Add Action<string>? log = null to EmailNotifier (src/Forge.Approvals.Notify/Notifications.cs:107), move var delivery = sender.SendAsync(...) inside the try block (src/Forge.Approvals.Notify/Notifications.cs:131), and invoke log?.Invoke("Email notification timed out."); in the timeout catch at src/Forge.Approvals.Notify/Notifications.cs:137.

  7. MEDIUM — .github/workflows/ci.yml:29

  8. Problem: dotnet test ... --logger 'trx;LogFileName=tests.trx' uses a fixed LogFileName rather than LogFilePrefix. In VSTest, whenever more than one test project or target framework runs in the solution, each test run overwrites artifacts/test-results/tests.trx, allowing a subsequent project to mask a zero-discovered-test failure in an earlier project from ci/Assert-TestResults.ps1:3 and clobbering earlier TRX artifacts uploaded at .github/workflows/ci.yml:43.
  9. Fix: Replace --logger 'trx;LogFileName=tests.trx' with --logger 'trx;LogFilePrefix=tests' at .github/workflows/ci.yml:29.

  10. MEDIUM — ci/Assert-TestResults.ps1:12

  11. Problem: The TRX gate checks only [int]$counters.failed -ne 0 -or [int]$counters.executed -le 0 and ignores $result.TestRun.ResultSummary.outcome as well as VSTest's separate error, timeout, aborted, and notRunnable counter attributes. A test run that executes at least one passing test and then aborts or errors (failed="0", aborted="1" or error="1", outcome="Aborted"/"Failed") passes ci/Assert-TestResults.ps1:12.
  12. Fix: At ci/Assert-TestResults.ps1:12, also assert $result.TestRun.ResultSummary.outcome -in @('Passed', 'Completed') and ([int]$counters.error + [int]$counters.timeout + [int]$counters.aborted + [int]$counters.notRunnable) -eq 0.

  13. LOW — src/Forge.Approvals.Notify/Notifications.cs:142 (and src/Forge.Approvals.Notify/Notifications.cs:149)

  14. Problem: PavlokNotifier (src/Forge.Approvals.Notify/Notifications.cs:53) and EmailNotifier (src/Forge.Approvals.Notify/Notifications.cs:111) validate configuration and timeout bounds eagerly at construction so misconfiguration fails fast at startup when enabled, whereas FileNotificationOutbox (src/Forge.Approvals.Notify/Notifications.cs:142) defers channelTimeout (and directory/notifiers null/whitespace) validation until NotifyAsync runs on a live request (src/Forge.Approvals.Notify/Notifications.cs:149).
  15. Fix: Replace the primary constructor at src/Forge.Approvals.Notify/Notifications.cs:142 with an explicit constructor that validates !string.IsNullOrWhiteSpace(directory), ArgumentNullException.ThrowIfNull(notifiers), and channelTimeout in (TimeSpan.Zero, TimeSpan.FromSeconds(30)] at startup.

Diff scope & concurrency-test verification note: The inline diff contains 6 files (.github/workflows/ci.yml:1, ci/Assert-DependencyScan.ps1:1, ci/Assert-TestResults.ps1:1, src/Forge.Approvals.Core/Jcs.cs:1, src/Forge.Approvals.Notify/Forge.Approvals.Notify.csproj:1, src/Forge.Approvals.Notify/Notifications.cs:1). src/Forge.Approvals.Core/Jcs.cs:10 and ci/Assert-DependencyScan.ps1:1 reviewed clean. Because tests/Forge.Approvals.Tests (.github/workflows/ci.yml:61) and the ledger/Twilio/CLI/feature-flag projects are not included in this diff slice, verify in the test shard that parallel FileNotificationOutbox.NotifyAsync calls for the same Jti (src/Forge.Approvals.Notify/Notifications.cs:154) and per-channel cancellation/timeout isolation (src/Forge.Approvals.Notify/Notifications.cs:162) have explicit concurrency tests.

Jira FLT-359 · Vikunja · BOARD.md