From ebbbb54a34428ad55c4e577f26b88c042081e0ed Mon Sep 17 00:00:00 2001 From: Jumpstile Date: Tue, 17 Nov 2026 02:42:39 -0500 Subject: [PATCH] Test the single-source Guided Setup acceptance audit (#184) Adds one web test for a schemaVersion 1 (single playlist plus guide) acceptance: Audit = RECORDED, one record that reads back AUDIT_OK, thin v1 shape, and no fixture text or paths in the record. Test only; no product change. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01NzHAcjThVoUGWWfXrYWsNh --- tests/unit/WebServer.Tests.ps1 | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/unit/WebServer.Tests.ps1 b/tests/unit/WebServer.Tests.ps1 index 5ea9fd5..ececaf8 100644 --- a/tests/unit/WebServer.Tests.ps1 +++ b/tests/unit/WebServer.Tests.ps1 @@ -1765,4 +1765,43 @@ Describe 'ChannelForge web server foundation' { Test-Path -LiteralPath (Join-Path $noAckRoot 'state\guided-setup-audit') | Should -BeFalse (& (Get-Module ChannelForge) { param($Root) Get-ChannelForgeWebCurrentAcceptedSnapshot -RepositoryRoot $Root } $noAckRoot) | Should -BeNullOrEmpty } + + It 'records a thin private audit record for a single-source v1 acceptance' { + $root = Join-Path $TestDrive 'v1-audit' + Initialize-TestCandidateData -Root $root + $guideText = 'OneOne' + $body = New-TestProposalBody -WithGuide -GuideText $guideText + $proposal = (Get-TestWebResponse -Method POST -Path '/api/guided-setup/proposal' -RepositoryRoot $root -BodyBytes $body -ContentType 'application/json' -ContentLength $body.Length).Body | ConvertFrom-Json + $acceptBody = [Text.Encoding]::UTF8.GetBytes((@{ schemaVersion = 1; proposalId = $proposal.Proposal.ProposalId; acknowledged = $true } | ConvertTo-Json -Compress)) + $accepted = Get-TestWebResponse -Method POST -Path '/api/guided-setup/accept' -RepositoryRoot $root -BodyBytes $acceptBody -ContentType 'application/json' -ContentLength $acceptBody.Length + $accepted.StatusCode | Should -Be 200 + $payload = $accepted.Body | ConvertFrom-Json + $payload.Status | Should -Be 'ACCEPTED' + $payload.Audit | Should -Be 'RECORDED' + $files = @(Get-ChildItem -LiteralPath (Join-Path $root 'state\guided-setup-audit') -File) + $files.Count | Should -Be 1 + $read = & (Get-Module ChannelForge) { + param($Root) + $snapshot = Get-ChannelForgeWebCurrentAcceptedSnapshot -RepositoryRoot $Root + [pscustomobject]@{ + Audit = Read-ChannelForgeGuidedSetupAuditRecord -RepositoryRoot $Root -GenerationManifestHash ([string]$snapshot.Manifest.Object.GenerationManifestHash) -Snapshot $snapshot + Manifest = [string]$snapshot.Manifest.Object.GenerationManifestHash + State = [string]$snapshot.State.Object.AcceptedStateHash + Output = [string]$snapshot.Output.Object.OutputManifestHash + } + } $root + $read.Audit.Status | Should -Be 'AUDIT_OK' + $record = $read.Audit.Record + $record.SourceSetVersion | Should -BeNullOrEmpty + @($record.Playlists).Count | Should -Be 0 + @($record.Guides).Count | Should -Be 0 + @($record.Bindings).Count | Should -Be 0 + $record.Result.GenerationManifestHash | Should -Be $read.Manifest + $record.Result.AcceptedStateHash | Should -Be $read.State + $record.Result.OutputManifestHash | Should -Be $read.Output + $text = [IO.File]::ReadAllText($files[0].FullName) + foreach ($secret in @('example.invalid', 'EXTM3U', '