Architecture remediation: P1 tier (process & hardening) #121
Reference in New Issue
Block a user
Delete Branch "fix/archreview-p1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Architecture-remediation P1 tier (process & hardening), stacked on
fix/archreview-p0(PR #120). Executes the P1 findings inarchreview/remediation/00-tracking.md; each fix updates the tracker Status and affected docs in the same change.What's in this PR
Wave 1 — CI + codegen freshness + Rust buildability
Wave 2 — security & authz hardening
ZB.MOM.WW.Auth 0.1.4bump (commit197731a, authored by the concurrent HistorianGateway-remediation session) — API-key expiry enforcement.Wave 3 — size/backpressure topology + write ordering + event decoupling
GatewayHello.max_frame_bytesnegotiation (gateway sends, worker adopts; regenGenerated/+clients/protodescriptor with pinned protoc 34.1).Worker.MaxMessageBytes→ 16 MiB + 64 KiB, cross-validated at startup) + per-commandMessageTooLarge→ResourceExhaustedinstead of faulting the whole session.DrainEventsbounded (gateway validator ≤ 10 000, worker per-reply cap 10 000,max_events = 0→ cap not "drain all").Sequencestamped at write time under the write lock.WorkerFrameWriteris now a cooperative priority scheduler — control frames drain ahead of events.Testing / reliability
.tmpname + per-process cert path +DisableParallelizationon the env-var-mutating test + SqliteClearAllPools).Verification
NonWindows.slnxbuilds clean; targeted validator/event/security suites green (the ~42 named-pipe-harness failures are the pre-existing macOS Unix-socket-path limitation, not regressions).Worker.Tests352 passed / 0 failed / 11 skipped; gatewayTests802 passed / 1 failed — the single failure is the pre-existing environmentalSelfSignedCertificateProviderTests…HasExpectedSansEkuAndValidity(machine-name/FQDN SAN); the 2EventStreamServiceTestsqueue-depth timing tests are parallel-load flakes that pass in isolation.Not in this PR (remaining P1)
apikey create --expiresCLI flag + dashboard staleness badge (core already delivered).https://claude.ai/code/session_01DMXXvNuPekkkrTEyPNxEkW
Full-host tests passed in isolation but failed 2-4/run under parallel execution on Windows with 'the process cannot access the file ... because it is being used by another process' (macOS never sees it — Unix deletes open files). Two shared-state parallel collisions, discovered while verifying TST-08: 1. Self-signed cert generation. GatewayTlsBootstrapTests sets process-global Kestrel/TLS env vars that GatewayApplication.Build reads; a parallel host-building test inherits them mid-run and both generate a cert at the same path, racing on the fixed-name '<path>.tmp'. Fixes: - SelfSignedCertificateProvider: stage the PFX in a unique '<path>.<guid>.tmp' instead of a fixed name, so concurrent/interrupted writers never collide on the temp file (real robustness: two instances or a restart-during-write no longer clash). The final atomic Move (last-writer-wins) still yields an equivalent cert. - TestHostEnvironmentInitializer: default MxGateway__Tls__SelfSignedCertPath to a per-process temp path so the suite never writes the shared ProgramData default or fights the deployed service; first host-building test generates, the rest load it. - GatewayTlsBootstrapTests: [Collection] with DisableParallelization so its global env-var mutation cannot bleed into parallel tests (new GlobalEnvironmentCollection). 2. AuthStoreHealthCheckTests opened a real SQLite file; Microsoft.Data.Sqlite's connection pool keeps the .db handle open after 'await using', so the finally File.Delete threw. Reuse the existing TempDatabaseDirectory helper, which calls SqliteConnection.ClearAllPools() before deleting. Server build clean; affected classes 17/17 on macOS. Windows full-suite verified separately.