Skip to content

Share the action helpers in a Rulebook.Action module (#58) - #73

Merged
Arthurvdv merged 3 commits into
mainfrom
wp09/action-helpers
Oct 8, 2026
Merged

Arthurvdv merged 3 commits into
mainfrom
wp09/action-helpers

Conversation

@Arthurvdv

Copy link
Copy Markdown
Member

Summary

  • New leaf module 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-TableCell and Limit-SummaryText move from Rulebook.Update (dropped from its exports); Rulebook.Update and Rulebook.Scan import Rulebook.Action.
  • Validate, Publish, CheckForUpdates and ScanDiagnostics drop their helper copies and the $script: annotation/failure state for one New-ActionContext each; emitted annotation lines, summaries and outputs are byte-identical (the four action suites pass with only Rulebook.Action added to their AfterAll lists).
  • Write-ActionOutput writes 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-Text resolves its path against the PowerShell location, so the scripts no longer pre-resolve -SummaryPath; they still resolve JsonPath, WorkPath, StagingPath and ManifestPath.
  • Validate caps its summary with Limit-SummaryText (line boundary) instead of the inline character cut, with the footer built from -SummaryLimit (900 KiB at the default); the Get-Command guard goes.
  • New tests/Rulebook.Action.Tests.ps1 (27 tests, the Limit-SummaryText cases 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

Arthurvdv and others added 2 commits October 8, 2026 20:39
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>
@Arthurvdv Arthurvdv added the enhancement New feature or request label Oct 8, 2026
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>
@Arthurvdv
Arthurvdv merged commit 6558ac7 into main Oct 8, 2026
5 checks passed
@Arthurvdv
Arthurvdv deleted the wp09/action-helpers branch October 8, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shared helper module for the action entry scripts (annotations, summary, outputs)

1 participant