Skip to content

Raise the script-cleanup changes to 9.5/10 #102

Open

Description

@tony

Summary

A fresh review of the support-script cleanup commits on master (bc837b3~1..e388643, the commits closing #96, plus Stop-TmuxServer and the rename cmdlets from #89 and #90) scored 13 dimensions. Twelve applied and none reached 9.5/10. Readability fell below the 8.5 gate at 8.0, and one policy check failed: ci.yml still holds hand-written tmux builds and PowerShell downloads. Close this issue when a new review of these changes scores every applicable dimension at 9.5 or higher and every policy check passes.

Motivation

Scores, with the evidence for each. MCP is N/A: the commits changed no MCP tooling.

Dimension Score Evidence
Readability 8.0 tests/support/HelpExampleAssertions.ps1 holds one 709-line function, Get-HelpExampleAssertion, which the commits grew by 39 lines. 19 lines in the scripts and the attach harness pass 140 characters.
tmux fidelity 8.5 The Remove suite tests that Stop-TmuxServer ends the daemon within 1000 ms. No test starts a replacement right after it, the race that Server.Kill fixed in the go and swift ports.
Docs 8.5 PlanMatrix.Tests.ps1 says "every check has a deliberate break" and prints 27 checks and 23 breaks. The PowerShell stand-ins behind "passed 1 of 5 runs" in SCRIPTS.md are not committed.
Scannability 8.5 The sh exception in SCRIPTS.md is one 50-line list item that ends in a 23-name paragraph.
Async correctness 8.5 Get-RecordingTmuxBuild calls $lock.WaitOne() with no timeout and no abandoned-mutex handling, around an unbounded dotnet build.
AI use 8.5 AGENTS.md links SCRIPTS.md but does not say the scripts are PowerShell run with pwsh -File or where they live.
Data sourcing 8.5 fff506f ("23 event and input combinations"), 469cdda and c009c08 report old-versus-new agreement with no command or SHA.
Freshness 8.5 scripts/plan-matrix/matrix.json says "eng/ci/plan_matrix.py turns it into the jobs of ci.yml" and "eng/ci/test_matrix_manifest.py checks the documents", both deleted by these commits.
DX 9.0 One command per suite and no aggregate for the five script suites.
Language idioms 9.0 The analyzer enables two formatting rules (PSPlaceOpenBrace, PSUseConsistentWhitespace) and no indentation or alignment check.
Examples 9.0 QuickStart.ps1 now stops its server with Stop-TmuxServer. The untouched docs/input.md and examples/Guides.ps1 still run exec python3 -u -m http.server.
Async, control, streaming 9.0 No finding beyond Async correctness.

Policy check that failed:

  • Right language: no *.py or *.sh is tracked, no workflow starts Python, and the sh tmux stand-ins have a recorded, measured exception. ci.yml still holds three hand-written tmux builds (git clone, autogen.sh, configure, make) in the clone, refusal and old-daemon lanes, the last with a build() function, and four copies of the PowerShell download with sha256sum. eda26ce replaced only the ref lane with the shared build-tmux action. SCRIPTS.md lets a workflow keep run: lines that call one command.

Proposal

  • Call libtmux/.github/actions/build-tmux for the clone, refusal and old-daemon lanes, and move the PowerShell download and checksum check into one composite action or scripts/ command called by a single-line run:.
  • Split Get-HelpExampleAssertion into one function per cmdlet and wrap the lines over 140 characters.
  • Fix the two paths in matrix.json and add a test that every path in its $comment exists.
  • Add a Remove-suite case that runs Stop-TmuxServer and then New-TmuxSession on the same socket, in a loop behind LIBTMUX_TEST_SLOW.
  • Give Get-RecordingTmuxBuild a WaitOne timeout, handle AbandonedMutexException, and bound dotnet build.
  • Put the old-script SHA and the comparison loop behind each "identical output" claim in the closing comment of Clean up support scripts under SCRIPTS.md #96, and commit or drop the PowerShell stand-in variant behind "1 of 5".
  • Say "most checks have a deliberate break" in PlanMatrix.Tests.ps1, or add the four missing breaks.
  • Enable PSUseConsistentIndentation and PSAlignAssignmentStatement in PSScriptAnalyzerSettings.psd1, or run Invoke-Formatter and fail on a diff.
  • Add one line to AGENTS.md naming scripts/<name>/, pwsh -File and eng/Lint.ps1.

References

Activity

  1. tony commented on Nov 16, 2026

    @tony
    ContributorAuthor

    On master at 5a244e1; powershell and docs are green there (https://github.com/libtmux/libtmux-powershell/actions/runs/43806695559, attempt 2: the Sandbox canary "a default socket in a sandbox its children only joined did not fail the run" failed once on PowerShell 7.6.6 / tmux 3.8 and passed on rerun; it passed on the other legs and locally). Commits per item:

    • ci.yml tmux builds and PowerShell downloads: 3b32cab (matrix, reject and old-daemon jobs use libtmux/.github/actions/build-tmux at 30f81842, building the commit the table pins; apt-get step, libtmux-dotnet checkout, cache step and CORE_REVISION gone) and 903964e (scripts/install-powershell, scripts/verify-package, replacing four download copies and three jq | while sha256sum loops; release.yml and macos-trial.yml use the installer too). The reject and old-daemon lanes run only at scope full, so I dispatched one to exercise them: https://github.com/libtmux/libtmux-powershell/actions/runs/43807775586.
    • Split Get-HelpExampleAssertion: 911b4b6 (one function per cmdlet; the 70 entries compare identical before and after, and the Help suite passes against the packaged modules). Lines over 140 characters in the script modules and the attach harness: 3b32cab.
    • matrix.json paths and the test that every path in its comment exists: 3b32cab.
    • Stop-then-replace case in the Remove suite: a55a779 (one round, 100 with LIBTMUX_TEST_SLOW=1; both pass locally against tmux 3.6b, so the library has no race).
    • Get-RecordingTmuxBuild timeout, abandoned mutex, bounded build: 1045837 and 5a244e1 (own suite).
    • "most checks have a deliberate break": 3b32cab.
    • Analyzer indentation and alignment rules, applied to scripts/: 3b32cab.
    • AGENTS.md line: d9200fa.
    • sh exception: f9ccb51 splits it into a section, adds the pane programs (Help, PaneTextWait, InputReceiver.ps1) with a hyperfine measurement, and drops the suite figures that came from an uncommitted PowerShell variant.

    Remaining: the old-script SHA and comparison loop behind the "identical output" claims in the closing comment of #96. The deleted Python scripts are in history; I did not rerun the comparison.

  2. tony commented on Nov 16, 2026

    @tony
    ContributorAuthor

    Correction and update. The full-scope run (https://github.com/libtmux/libtmux-powershell/actions/runs/43807775586) passed the rewritten reject and old-daemon lanes and 21 other jobs. Its one real failure was the new Remove case: a session created right after Stop-TmuxServer failed with server exited unexpectedly on PowerShell 7.6.6 / tmux 3.3a, so the library does have the race I reported as absent. It is #103; the case now runs only with LIBTMUX_TEST_SLOW=1 (ec92e88). Two more commits followed: 5a244e1 gave the RecordingTmux test its own suite, and fd3cfac keeps it off the parallel batch after the Sandbox canary failed twice on 7.6.6 / tmux 3.8 (a cheaper test and a sequential slot; I did not measure the cause). powershell and docs are green at fd3cfac: https://github.com/libtmux/libtmux-powershell/actions/runs/43810087347. Left open for the #96 comparison sources and #103.

  3. tony commented on Nov 16, 2026

    @tony
    ContributorAuthor

    Workflow commands now follow SCRIPTS.md: every run: in .github/workflows calls one command (the counter reports 0 of 67 blocks multi-command, 12 of 40 before). Logic moved into PowerShell scripts with a README and tests under scripts/.

    • ced0ed5 splits the port job's three multi-command steps into one step per command.
    • f7d817d adds scripts/release-source for the release tag check.
    • 53e31c6 adds scripts/docs-preview-cleanup for the preview eligibility check and delete.
    • 65bcc78 lets InstallPowerShell.ps1 install the macOS asset (-Platform, -Sha256).
    • ef133c5 adds scripts/build-tmux-macos. The shared build-tmux action installs with apt, so it does not run on macOS.
    • 249ad55 adds scripts/macos-trial for the provenance record and the suite report.
    • 7c0b373 switches macos-trial.yml to the scripts.

    Checks at 7c0b373: docs passed. powershell passed on its second attempt after Sandbox.Tests.ps1 failed on a 7.6.6 leg, tracked in #104. A dispatched macos-trial run passed all eight legs, which exercised the macOS install, build, provenance and report scripts. docs-preview-cleanup runs only when a pull request closes, so it was checked with its tests and actionlint, not run.

    The other items in this issue are unchanged by this work, so it stays open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions