Repository navigation
Share the action helpers in a Rulebook.Action module (#58) - #73
Merged
Merged
Conversation
The four entry scripts under actions/ each carried their own copies of the annotation escaping, Add-Annotation, Add-Failure, Write-Text and the path resolver, and Format-TableCell and Limit-SummaryText lived in Rulebook.Update although Validate and Scan need them as well. ChangeRule (#11) would have made a fifth copy. modules/Rulebook.Action is a leaf module without engine imports that exports ten helpers: Format-AnnotationText, ConvertTo-SingleLine, Format-TableCell, New-ActionContext (annotations, error messages, the first failure kind), Add-Annotation, Add-Failure, Write-Text, Resolve-ActionPath, Write-ActionOutput and Limit-SummaryText. Format-TableCell and Limit-SummaryText move here from Rulebook.Update, which drops them from its exports; Update and Scan import Rulebook.Action. Validate, Publish, CheckForUpdates and ScanDiagnostics import it and keep their emitted lines, summaries and outputs byte for byte, so the four action suites pass with only Rulebook.Action added to their AfterAll lists. Validate now caps its summary with Limit-SummaryText (cut at a line boundary) instead of the inline character cut, and its Get-Command guard goes. The Limit-SummaryText tests move to the new tests/Rulebook.Action.Tests.ps1. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Review round 1 of #58. Write-ActionOutput writes a value that holds CR or LF in the heredoc form with a random ghadelim_ delimiter, so a value cannot add a forged output line; single-line values are written as before. Write-Text already resolves its path against the PowerShell location, so the four entry scripts no longer pre-resolve -SummaryPath; they still resolve the paths they use elsewhere (JsonPath, WorkPath, StagingPath, ManifestPath). Validate builds its truncation footer from -SummaryLimit (900 KiB at the default, as before). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Review of #67 found the two footers rounding the limit differently (Round and Floor). One variable, rounded, feeds both; at the default limit both still say 900 KiB. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
modules/Rulebook.Action(no engine imports) with the ten helpers the action entry scripts share:Format-AnnotationText,ConvertTo-SingleLine,Format-TableCell,New-ActionContext,Add-Annotation,Add-Failure,Write-Text,Resolve-ActionPath,Write-ActionOutput,Limit-SummaryText.Format-TableCellandLimit-SummaryTextmove fromRulebook.Update(dropped from its exports);Rulebook.UpdateandRulebook.ScanimportRulebook.Action.$script:annotation/failure state for oneNew-ActionContexteach; emitted annotation lines, summaries and outputs are byte-identical (the four action suites pass with onlyRulebook.Actionadded to theirAfterAlllists).Write-ActionOutputwrites a value with CR or LF in the heredoc form (key<<ghadelim_<guid>), so a value cannot forge another output line; single-line values are unchanged.Write-Textresolves its path against the PowerShell location, so the scripts no longer pre-resolve-SummaryPath; they still resolveJsonPath,WorkPath,StagingPathandManifestPath.Limit-SummaryText(line boundary) instead of the inline character cut, with the footer built from-SummaryLimit(900 KiB at the default); theGet-Commandguard goes.tests/Rulebook.Action.Tests.ps1(27 tests, theLimit-SummaryTextcases moved from the Update suite); README, CONTRIBUTING and ARCHITECTURE 5.5 name the module.Verification: Pester 1481 tests on the first commit (1480 passed, 1 skipped: the Actions-only smoke test), the seven affected suites 351/351 after the review fixes, PSScriptAnalyzer clean, Test-Rulebook V1 to V14 clean, Build-Template -WhatIf current.
Review: one Sonnet round at effort high, no must-fix; applied the newline guard in Write-ActionOutput and the single path resolution (plus the ErrorMessages help note and the Validate footer from -SummaryLimit); not applied: Limit-SummaryText fence-reserve efficiency, the first line always kept by Limit-SummaryText, the generic exported names.
Closes #58
🤖 Generated with Claude Code