From 29ed833cc11453cb79ba1843cfabaac4080bff69 Mon Sep 17 00:00:00 2001 From: Jumpstile Date: Tue, 17 Nov 2026 00:46:09 -0500 Subject: [PATCH] Guard against stale or generated event facts in event guides (#147) Adds the rule that volatile event facts must carry source, fetched-at and season context or be omitted, and a test that the event guide output carries only the title, time and channel (no description, sub-title or category text from the provider guide). Review found that no current code generates volatile facts. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01NzHAcjThVoUGWWfXrYWsNh --- docs/engineering/ENGINEERING_PRINCIPLES.md | 10 ++++++++++ tests/unit/EventGuidePlan.Tests.ps1 | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/docs/engineering/ENGINEERING_PRINCIPLES.md b/docs/engineering/ENGINEERING_PRINCIPLES.md index 42664343..b19024ef 100644 --- a/docs/engineering/ENGINEERING_PRINCIPLES.md +++ b/docs/engineering/ENGINEERING_PRINCIPLES.md @@ -73,3 +73,13 @@ entry points, safety boundary, evidence, and disposition in the [Product Intent-Fit Audit](INTENT_FIT_AUDIT.md) format. Hold mismatches and record material `PASS_WITH_GAPS` remediation instead of passing the uncertainty to a tester. + +## Volatile event facts + +Volatile event facts are stats, records, results, standings, rosters and +live or final state. They must carry source, fetched-at and season context, or +be omitted (issue #147). No current ChannelForge code writes them into guide +programme text: an event guide carries only the title, time and channel from the user's own guide. +Programme text in a merged guide is the guide author's data, passed through +unchanged. A change that makes ChannelForge write such text must add those +safeguards first. diff --git a/tests/unit/EventGuidePlan.Tests.ps1 b/tests/unit/EventGuidePlan.Tests.ps1 index d1a271e8..af04828f 100644 --- a/tests/unit/EventGuidePlan.Tests.ps1 +++ b/tests/unit/EventGuidePlan.Tests.ps1 @@ -102,4 +102,19 @@ Describe 'Event guide for high channels' { $out = Invoke-Plan -Xmltv (New-Xmltv $tba) -Entry @((New-Entry 'PPV 1' 1 'ppv1'), (New-Entry 'News' 2 'news')) @($out.Rows[$out.Plan.Channel[0].Id] | ForEach-Object { $_.Title } | Select-Object -Unique) | Should -Be @('PPV 1') } + + It 'writes only a title for each event programme and none of the provider description, sub-title or category text' { + $stat = 'Team A is 12-0 this season' + $body = "Big Fight Night$stat$stat$stat" + $xmltv = [Text.Encoding]::UTF8.GetBytes("$body") + $bytes = InModuleScope ChannelForge -Parameters @{ X = $xmltv; E = @((New-Entry 'PPV 1' 1 'ppv1')) } { + $plan = Get-ChannelForgeEventGuidePlan -XmltvBytes $X -Entry $E + [byte[]](Add-ChannelForgePlaceholderGuide -XmltvBytes $X -Channel $plan.Channel -TimeZone ([TimeZoneInfo]::Utc) | Select-Object -Last 1) + } + $doc = [xml][Text.Encoding]::UTF8.GetString($bytes) + $own = @($doc.tv.programme | Where-Object { $_.channel -like 'ChannelForge-*' }) + $own.Count | Should -BeGreaterThan 0 + foreach ($programme in $own) { @($programme.ChildNodes | ForEach-Object { $_.Name }) | Should -Be @('title') } + ($own | ForEach-Object { $_.OuterXml }) -join '' | Should -Not -BeLike "*$stat*" + } }