Jenny J4
Findings¶
- MEDIUM —
src/Forge.Approvals.Notify/Notifications.cs:154(andsrc/Forge.Approvals.Notify/Notifications.cs:158) - Problem:
new FileStream(marker, FileMode.CreateNew, ...)creates the directory entry formarkeron disk immediately upon open (src/Forge.Approvals.Notify/Notifications.cs:154), whilestream.WriteByte(1)(src/Forge.Approvals.Notify/Notifications.cs:155),stream.Flush(flushToDisk: true)(src/Forge.Approvals.Notify/Notifications.cs:156), andstream.Dispose()execute inside the sametryblock. IfWriteByte,Flush(flushToDisk: true), orDisposethrows anIOException(e.g.,ENOSPC/quota exhaustion orFlushFileBuffers/fsyncfailure),File.Exists(marker)atsrc/Forge.Approvals.Notify/Notifications.cs:158evaluates totrue. Thecatch (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. -
Fix: Scope
try / catch (IOException) when (File.Exists(marker))strictly aroundnew FileStream(marker, FileMode.CreateNew, ...), then executeusing (stream) { stream.WriteByte(1); stream.Flush(flushToDisk: true); }outside thatcatchso post-creation I/O failures are not silently treated as duplicate deliveries. -
MEDIUM —
src/Forge.Approvals.Notify/Notifications.cs:137(andsrc/Forge.Approvals.Notify/Notifications.cs:107,src/Forge.Approvals.Notify/Notifications.cs:131) - Problem: Unlike
PavlokNotifier(src/Forge.Approvals.Notify/Notifications.cs:40,src/Forge.Approvals.Notify/Notifications.cs:74),EmailNotifieraccepts noAction<string>? logcallback and silently swallows its per-channel timeout (10sdefault) atsrc/Forge.Approvals.Notify/Notifications.cs:137. When dispatched throughFileNotificationOutbox(30sdefaultchannelTimeoutatsrc/Forge.Approvals.Notify/Notifications.cs:148),EmailNotifier's10sinner deadline fires first and returns normally, soFileNotificationOutboxdoes not reach itscatchlogger (src/Forge.Approvals.Notify/Notifications.cs:172) even though the at-most-once.notifiedreservation was permanently consumed and the email was dropped. Additionally,sender.SendAsync(...)atsrc/Forge.Approvals.Notify/Notifications.cs:131sits outside thetryblock atsrc/Forge.Approvals.Notify/Notifications.cs:136, so a non-asyncIEmailSenderthrowingOperationCanceledExceptionsynchronously ondeadline.Tokenescapes uncaught instead of being handled as a channel timeout. -
Fix: Add
Action<string>? log = nulltoEmailNotifier(src/Forge.Approvals.Notify/Notifications.cs:107), movevar delivery = sender.SendAsync(...)inside thetryblock (src/Forge.Approvals.Notify/Notifications.cs:131), and invokelog?.Invoke("Email notification timed out.");in the timeoutcatchatsrc/Forge.Approvals.Notify/Notifications.cs:137. -
MEDIUM —
.github/workflows/ci.yml:29 - Problem:
dotnet test ... --logger 'trx;LogFileName=tests.trx'uses a fixedLogFileNamerather thanLogFilePrefix. In VSTest, whenever more than one test project or target framework runs in the solution, each test run overwritesartifacts/test-results/tests.trx, allowing a subsequent project to mask a zero-discovered-test failure in an earlier project fromci/Assert-TestResults.ps1:3and clobbering earlier TRX artifacts uploaded at.github/workflows/ci.yml:43. -
Fix: Replace
--logger 'trx;LogFileName=tests.trx'with--logger 'trx;LogFilePrefix=tests'at.github/workflows/ci.yml:29. -
MEDIUM —
ci/Assert-TestResults.ps1:12 - Problem: The TRX gate checks only
[int]$counters.failed -ne 0 -or [int]$counters.executed -le 0and ignores$result.TestRun.ResultSummary.outcomeas well as VSTest's separateerror,timeout,aborted, andnotRunnablecounter attributes. A test run that executes at least one passing test and then aborts or errors (failed="0",aborted="1"orerror="1",outcome="Aborted"/"Failed") passesci/Assert-TestResults.ps1: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. -
LOW —
src/Forge.Approvals.Notify/Notifications.cs:142(andsrc/Forge.Approvals.Notify/Notifications.cs:149) - Problem:
PavlokNotifier(src/Forge.Approvals.Notify/Notifications.cs:53) andEmailNotifier(src/Forge.Approvals.Notify/Notifications.cs:111) validate configuration and timeout bounds eagerly at construction so misconfiguration fails fast at startup when enabled, whereasFileNotificationOutbox(src/Forge.Approvals.Notify/Notifications.cs:142) deferschannelTimeout(anddirectory/notifiersnull/whitespace) validation untilNotifyAsyncruns on a live request (src/Forge.Approvals.Notify/Notifications.cs:149). - Fix: Replace the primary constructor at
src/Forge.Approvals.Notify/Notifications.cs:142with an explicit constructor that validates!string.IsNullOrWhiteSpace(directory),ArgumentNullException.ThrowIfNull(notifiers), andchannelTimeoutin(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.