Skip to content

Replace TAP filtering with split-output NDJSON pipeline#16

Open
friedenberg wants to merge 1 commit into
masterfrom
claude/tap-split-output-failures-NSSgB
Open

Replace TAP filtering with split-output NDJSON pipeline#16
friedenberg wants to merge 1 commit into
masterfrom
claude/tap-split-output-failures-NSSgB

Conversation

@friedenberg
Copy link
Copy Markdown

Summary

This PR replaces the --hide-passing TAP filtering mechanism with a new split-output NDJSON pipeline. Instead of filtering TAP output on stdout, the wrapper now:

  1. Default behavior (split mode): Emits failure records to stdout and writes passing records to a per-run tmpdir file (run.passes.ndjson), keeping build logs focused on failures
  2. Legacy behavior: Supports --no-split / --full-output flags to restore the historical TAP-14 stream with all records on stdout
  3. Caller control: Accepts --pass-out PATH to override the passing-records file location

Changes

Core wrapper changes (batman.ts and batman.nix)

  • Removed --hide-passing flag and the makeHidePassingFilter() TAP filtering function
  • Added --no-split and --full-output aliases to disable split mode
  • Added --pass-out PATH to specify custom passing-records output location
  • Integrated tap-dancer format-ndjson --split into the output pipeline
  • Updated runGroup() to remove TAP filtering logic and always inherit stdout

Build system changes (bats-lane.nix)

  • Added splitNdjson parameter (default true) to control output splitting
  • When splitNdjson = true: Produces run.failures.ndjson and run.passes.ndjson with inline stderr echo of failures only
  • When splitNdjson = false: Produces combined run.ndjson with full inline echo (original behavior)
  • Updated documentation to describe both modes

Test updates

  • Updated bats_wrapper.bats to use --no-split in existing tests that expect TAP-14 output
  • Replaced --hide-passing tests with new split-mode tests:
    • bats_wrapper_split_emits_failures_only_on_stdout: Verifies failures appear on stdout, passes don't
    • bats_wrapper_split_writes_passes_to_pass_out: Verifies passing records are written to the file
    • bats_wrapper_full_output_is_alias_for_no_split: Verifies --full-output works as an alias
  • Renamed and updated plan/version preservation test to verify TAP-14 stream under --no-split

Documentation updates

  • Updated bats-testing.7.scd to document --no-split, --full-output, and --pass-out flags
  • Updated bats-lane.7.scd to describe the split/combined NDJSON output modes and splitNdjson parameter
  • Updated ndjson_failure_demo.bats comments to reflect the new split behavior

Rationale

The split-output approach provides better signal-to-noise in build logs by default (failures only on stdout) while preserving full test results in structured NDJSON format. The --no-split escape hatch maintains backward compatibility for consumers that need the historical TAP-14 stream.

Test Plan

Existing test suite covers the new behavior:

  • bats_wrapper.bats validates split mode, full-output mode, and pass-out file handling
  • batman.bats validates argument parsing for the new flags
  • bats-lane.nix integration tests exercise both splitNdjson = true and false paths

https://claude.ai/code/session_017uRx2GuzzkccSduBwG2cX4

Switch every test-output surface to amarbel-llc/tap's new split mode so
stdout (or, for batsLane, the inline build-log echo) carries only
failure NDJSON records, while passing records land in a side-channel
file. This dramatically reduces the noise an interactive user or build
log has to scroll through.

- bats wrapper (nix/packages/batman.nix): pipe through
  `tap-dancer format-ndjson --split --pass-out` by default. New flags
  `--no-split` / `--full-output` restore the TAP-14 stream;
  `--pass-out PATH` overrides the per-run tmpdir for passing records.
  The hand-rolled hide-passing TAP filter is removed.
- batman orchestrator (packages/batman/src/batman.ts): drop the
  duplicate TS-side hide-passing filter; pass `--no-split` through to
  the bats wrapper when `--full-output` / `--no-split` is set.
- batsLane (nix/packages/bats-lane.nix): new `splitNdjson ? true`
  option layered on `emitNdjson`. Default produces
  `$out/run.failures.ndjson` + `$out/run.passes.ndjson`; the inline
  stderr echo carries failures only with a one-line pass-count
  summary. `splitNdjson = false` keeps the legacy combined
  `run.ndjson` and full echo.
- Tests + docs updated: bats_wrapper.bats's four hide-passing tests
  replaced with split / no-split / pass-out / alias coverage; batman
  and bats-lane manpages updated.
friedenberg added a commit that referenced this pull request May 25, 2026
- batman.nix: add pkgs.socat to the bats wrapper runtimeInputs so
  fence can find socat for its bridge setup even when callers strip
  /home/* from PATH (e.g. test-batman-fence). Without this, fence
  was resolving socat only via ~/.nix-profile, which is gone after
  the PATH strip.
- bats-lane.nix: drop the redundant `| tr -d ' '` around
  `wc -l < file`. GNU wc-on-stdin emits the count with no leading
  whitespace, so the strip is dead.
- batman.ts: drop `fullOutput` from the ParsedArgs return shape.
  It's only consumed inside parseArgs to build `passthrough`; no
  caller of parseArgs ever reads it.
- bats-testing.7.scd: document that --no-tempdir-cleanup also
  preserves the wrapper's auto-generated --pass-out tmpdir
  (caller-supplied --pass-out paths are still never auto-cleaned).

Signed-off by Clown 🤡 (https://github.com/amarbel-llc/clown)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants