Commit Graph

129 Commits

Author SHA1 Message Date
can1357 880983c0d8 style(pi-shell): apply rustfmt to children fallback 2026-06-14 23:31:19 +02:00
can1357 f41b1e35f3 fix(pi-shell): scan /proc for children when CONFIG_PROC_CHILDREN is absent
Some Kata/microVM guest kernels (e.g. the CI runner's 6.18.x) are built
without CONFIG_PROC_CHILDREN, so /proc/<pid>/task/<tid>/children does not
exist. The Linux children() relied on it with no fallback, making
children()/live_descendants() return empty and silently turning shell
cancellation cleanup into a no-op inside such containers.

Fall back to scanning /proc and grouping by parent pid (the same primitive
the macOS path already uses) when no children file is readable; kernels
with the file keep the cheap per-task fast path. Also fixes
process::tests::descendants_includes_freshly_spawned_child under Kata CI.
2026-06-14 23:24:03 +02:00
can1357 72f76280c9 test(pi-shell): tolerate PID-namespaced getsid(0) in session tests
Same containerized-CI issue as the pi-natives wrapper test: in a PID
namespace the host process's session leader lives outside the namespace,
so getsid(0) returns 0 (not -1). Relax the host_sid > 0 sanity asserts in
embedded_external_command_runs_in_its_own_session and
embedded_pipeline_stage_runs_in_its_own_session to host_sid >= 0; the
child-session invariants (own session, distinct from host) are unchanged.
2026-06-14 23:24:03 +02:00
can1357 b0a00fdb5d chore: reformat 2026-06-14 18:13:48 +02:00
can1357 ce6ac9a9d2 Merge PR #2384: fix(pi-shell): satisfy clippy in process.rs 2026-06-14 17:29:38 +02:00
oldschoola e60498f1f3 fix(pi-shell): satisfy clippy in process.rs on Windows 2026-06-14 17:23:40 +02:00
oldschoola 8ac68b731f test(pi-shell): gate Unix job-control tests and fix nohup on Windows 2026-06-14 17:22:49 +02:00
can1357 4a2417c92f fix(pi-shell): fixed here-document chains to avoid segmented minimizer re-run failures
- Marked heredoc redirects as unsafe for chain segmentation so commands with here-docs run via the single execution path instead of being replayed.
- Added regression tests in minimizer and shell modules covering quoted, escaped, and chained here-doc pipelines.
- Recorded the fix in the natives changelog for multi-command quoted/escaped heredoc handling.
2026-06-14 08:55:35 +02:00
can1357 e14f7effa7 fix: remove flakey test 2026-06-13 22:14:34 +02:00
can1357 b921b67db7 fix(pi-shell): fixed quoted heredoc execution without trailing newline
- Added `ensure_trailing_newline_for_heredoc` to normalize commands by appending a newline for heredoc inputs missing one.
- Applied the helper in both one-shot and streaming shell execution paths before invoking `run_string`.
- Added a regression test for quoted heredocs at EOF in Unix and documented the fix in the natives changelog.
2026-06-13 14:38:36 +02:00
can1357 2e5b0b5757 fix(brush-core-vendored): fixed async background PID targeting for nohup wrapper
- Added a transparent_background_wrapper flag to builtin registrations and a helper constructor.
- Updated async background job creation to classify transparent wrapper builtins and launch the unwrapped command as the tracked job.
- Marked nohup as a transparent background wrapper and added a test asserting `nohup cmd &` exposes a child PID in `$!`.
2026-06-12 22:37:01 +02:00
can1357 961e7c10d3 feat(utils): added isMacosMallocStackLoggingEnvName() function
- Added isMacosMallocStackLoggingEnvName() function to identify MallocStackLogging and MallocStackLoggingNoCompact variables. Updated filterProcessEnv() and Bun.env initialization to skip these variables during environment filtering. Added test case to verify malloc stack logging toggles are dropped instead of forwarded.
2026-06-12 15:46:52 +02:00
can1357 a8e1f636f6 refactor(minimizer): applied #[must_use] annotations and simplified minimizer parsing internals
- Applied #[must_use] annotations across minimizer and process APIs to flag ignored return values.
- Replaced direct serde_json field reads with typed Value helper calls in several filters.
- Simplified filter parsing with chained if-let guards, rfind checks, and related cleanup.
- Updated minimizer tests and fixtures to build outputs via write! and fmt::Write.
2026-06-12 12:16:18 +02:00
can1357 ab40078473 refactor(pi-shell/minimizer): removed redundant wrapper_invokes helper
- Removed the wrapper_invokes helper function from the minimizer filters module.
2026-06-12 12:06:38 +02:00
metaphorics 2c7c7d7b4d style(pi-shell): cargo fmt sweep over review fix commits 2026-06-12 18:48:56 +09:00
metaphorics 376f612ac1 fix(pi-shell): pass glab mr diff through raw
Op: correct
Restores: spec:glab mr diff output passes through unmodified like gh pr diff
2026-06-12 18:48:56 +09:00
metaphorics 64fe4ce0ae fix(pi-shell): mark omitted glab releases past the cap
Op: correct
Restores: spec:truncated glab release list signals the omission count
2026-06-12 18:48:56 +09:00
metaphorics 84df078fc4 fix(pi-shell): pass pip list --format=json through unmodified
The --format=json / --format json flag forms were not recognised by the
machine-readable opt-out; the output was parsed and rewritten as a text summary.
Extend the opt-out to cover both flag forms.

Op: correct
Restores: spec:any pip list --format=<machine-readable> output passes through unchanged
2026-06-12 18:48:56 +09:00
metaphorics 0ff2311c98 fix(pi-shell): require a non-space rule char in is_horizontal_rule
Whitespace-only lines are not markdown horizontal rules. Current callers trim
first so no live bug, but the invariant should be enforced in the function.

Op: correct
2026-06-12 18:48:56 +09:00
metaphorics a8096aadb1 test(pi-shell): cover command_has_ordered_tokens and command_has_any_token
Reversed-order negative, first==second edge case, --flag=value match and
non-match, and substring-of-value non-match.

Op: extend
2026-06-12 18:48:56 +09:00
metaphorics b211824227 fix(pi-shell): rebuild routed ctx for eslint/tsc/biome JS wrappers
Op: correct
Restores: spec:npx eslint -f json and similar formatter flags preserved through JS wrapper
2026-06-12 18:48:56 +09:00
metaphorics 0cce82cfef fix(pi-shell): route attached docker-compose up through the log filter
Op: correct
Restores: spec:docker-compose up attached output is preserved as log output, not stripped as build progress
2026-06-12 18:48:56 +09:00
metaphorics 50fec8a0f9 fix(pi-shell): bypass the worktree condenser for porcelain/null output
Op: correct
Restores: spec:git worktree list --porcelain output passes through unmodified
2026-06-12 18:48:55 +09:00
metaphorics 41789c84b9 fix(pi-shell): keep go -json benchmark rows out of the pass aggregator
Op: correct
Restores: spec:go test -json -bench runs are not collapsed to a package-count summary
2026-06-12 18:48:55 +09:00
metaphorics 3771d285d1 fix(pi-shell): skip option values when classifying jvm build goals/tasks
Op: correct
Restores: spec:detect_phase and detect_task return last recognised lifecycle
goal/task, not the value of a value-taking option like -pl or -p
2026-06-12 18:48:55 +09:00
metaphorics 42d7f1e40c style(pi-shell): cargo fmt sweep over workflow-committed files
Workflow worktree agents committed without running cargo fmt; main
working tree carried the correctly-formatted versions. No functional
change.
2026-06-12 04:59:56 +09:00
metaphorics c81e6d8a42 fix(pi-shell): gate rsync success shortcut on exit 0
The match_output 'ok (synced)' shortcut was not exit-gated: a rsync run
that exits non-zero but happens to emit 'total size is' without the
(?i) unless keywords would silently succeed. Add only_on_exit = [0] at
the filter level so the entire rsync def is bypassed on failure exits,
passing the raw diagnostic output through.

Op: correct
2026-06-12 04:53:51 +09:00
metaphorics 2219269eb4 refactor(pi-shell): hoist shared gh/glab helpers to primitives
Five byte-identical private helpers across gh.rs and glab.rs
(command_has_ordered_tokens, command_has_any_token, head_tail_dedup,
is_markdown_badge_or_image, is_horizontal_rule) are now pub fn in
primitives.rs. Both callers updated to use primitives::.

Op: compress
2026-06-12 04:26:48 +09:00
metaphorics c5e96e24d3 fix(pi-shell): keep JUnit5 assertion messages in gradle failure output
The failure-block parser in the Gradle test filter only kept exception lines
starting with 'java.' or 'kotlin.', silently dropping JUnit5 assertion messages
(org.opentest4j.AssertionFailedError: expected...). Now any non-stack non-blank
line inside a failure block is treated as exception/message and kept.

Op: correct
2026-06-12 04:22:47 +09:00
metaphorics 5404fa3b1e fix(pi-shell): classify jvm build tasks by last recognized goal/task
detect_phase (Maven): was picking the LAST non-flag token, so 'mvn test -pl
module-a' resolved to Passthrough. Now picks the last RECOGNIZED lifecycle goal,
ignoring option-value tokens.

detect_task (Gradle): was picking the LAST non-flag non-clean token, so 'gradle
test --tests FooSpec' resolved to Other (Foo not recognized). Now picks the FIRST
recognized task token, since tasks precede option-values in gradle command lines.

Op: correct
2026-06-12 04:20:59 +09:00
metaphorics 5b4a92b83e merge: P2 fix from worktree-wf_f9215fe7-fca-6 2026-06-12 04:15:58 +09:00
metaphorics 1be477eafa merge: P2 fix from worktree-wf_f9215fe7-fca-5 2026-06-12 04:15:52 +09:00
metaphorics 8452ff2322 merge: P2 fix from worktree-wf_f9215fe7-fca-4 2026-06-12 04:15:47 +09:00
metaphorics 5edc053a34 merge: P2 fix from worktree-wf_f9215fe7-fca-3 2026-06-12 04:15:42 +09:00
metaphorics 435ed354c6 fix(pi-shell): gate def success shortcuts so they don't mask errors
ssh.toml: narrow Welcome-to strip to distro MOTD banners only; the broad
pattern stripped remote command output starting with that phrase.
rsync.toml: make the unless= guard case-insensitive ((?i)) and add
only_on_exit=[0] so the ok-synced shortcut doesn't fire on error exits.
gcloud.toml: delete the WARNING: access strip — combined with on_empty it
silently returned 'gcloud: ok' on auth failures.

Op: correct
2026-06-12 04:15:05 +09:00
metaphorics 576f055f6f fix(pi-shell): stop double-counting package passes in go -json, preserve benchmarks
In -json mode render_go_test_json_line returned Some(ok\t{pkg}) for package-level
pass events, but the Output event already carries that line, causing double counting
in aggregate_go_test_success. Return None for package-level pass events.

Also: route benchmark output (BenchmarkXxx-N lines) through head_tail instead of
the count-only aggregator, so benchmark results are preserved on exit 0.

Op: correct
2026-06-12 04:13:58 +09:00
metaphorics 29aba02770 fix(pi-shell): keep overlay root filesystem rows in df output
df -h in containers shows the root / as an overlay filesystem. The compact_summary
filter unconditionally stripped ALL overlay rows, silently dropping container disk
usage. Now keep overlay/none rows whose mount point is /.

Op: correct
2026-06-12 04:13:55 +09:00
metaphorics 564a8b7763 fix(pi-shell): pass through explicit eslint output formatters
eslint -f json / --format compact etc. produce machine-readable output that
the condenser destroyed. Pass through any explicit non-stylish -f/--format.
Stylish (the default) still goes through the condenser.

Op: correct
2026-06-12 04:13:49 +09:00
metaphorics e01d699186 fix(pi-shell): preserve warnings from non-test rake tasks
is_rake_keep_line dropped warning: lines from rake tasks such as asset
compilation and database migrations. These carry signal (deprecation notices,
compatibility warnings) that users need to see.

Op: correct
2026-06-12 04:13:49 +09:00
metaphorics 253ea54d25 fix(pi-shell): vendor glab fixtures, repoint include_str! off the absent rtk gitlink
rtk/ is absent from disk with no .gitmodules entry, so the four include_str!
calls in glab.rs pointing at rtk/tests/fixtures/ caused a compile failure on
\`--lib --tests\`. Vendor the three integration .raw files into the crate under
src/minimizer/filters/fixtures/glab/ (parallel to the existing fixtures/jvm/
pattern) and repoint all four include_str! paths.

Op: correct
Restores: test:glab_* unit tests compile
2026-06-12 04:10:37 +09:00
metaphorics 8eb59335a5 fix(pi-shell): review fixes — rake word-boundary, unclosed HTML comment cap
Fix P1 findings from code review:

1. ruby.rs is_rake_keep_line: replace substring contains() with
   whole-word matching. "ok" matched "token", "broken", "took";
   "test" matched "fastest", "contest". Now uses split_whitespace
   + exact word match.

2. glab.rs/gh.rs filter_markdown_body_view/filter_markdown_noise:
   unclosed HTML comment (<!-- without -->) silently dropped ALL
   remaining output. Add 50-line safety cap on comment consumption
   to prevent data loss from malformed/truncated markdown.

Op: correct
Restores: invariant:filter-output-never-silently-drops-all-content
2026-06-12 02:34:04 +09:00
metaphorics ffeb5dad0a style(pi-shell): clippy auto-fix sweep (doc backticks, format interpolation)
Op: compress
2026-06-12 02:34:04 +09:00
metaphorics 3c53dd9e01 test(pi-shell): add glab fixtures, tighten release view filter
Port rtk glab fixtures (ci-trace, release-list, release-view) to the
minimizer fixture harness with savings gate.

Tighten release-view filter: also strip ASSETS section (no-assets
noise), View-on-GitLab footer link. Update test assertions.

Op: extend
2026-06-12 02:34:04 +09:00
metaphorics 01426b51a8 feat(pi-shell): add glab CLI output filter module
Port glab filtering from rtk donor, adapted for minimizer in-process
architecture (no JSON injection - filters default CLI output).

Claims mr, issue, ci, pipeline, release subcommands. Conservative
passthrough for -F/--output/--json/--web/--comments and api subcommand.

Filter strategies:
- ci trace: strip section markers, bare ANSI bracket codes, runner
  boilerplate (16 prefix patterns), keep build output/errors
- release list: parse tab-separated table to compact name (created)
  format, fall through to head_tail_dedup on no-TAB input
- release view: strip SOURCES block, image lines, HTML comments,
  horizontal rules, collapse multi-blanks
- mr/issue view: filter markdown body noise, respect exit_code
- everything else: head_tail_dedup

Op: extend
2026-06-12 02:34:04 +09:00
metaphorics 072a199f46 fix(pi-shell): anchor ls long-format parsing on the date column
parse_ls_long_line locates the date/time anchor and reads the name as
the text after it and the size as the rightmost integer before it, so
filenames with spaces and year-form dates parse correctly.

compact_summary_output strips tmpfs/devtmpfs/overlay rows from df
output only past the 30-line passthrough threshold, keeping short
listings verbatim.

Op: correct
Restores: spec:rtk/src/cmds/system/ls.rs
2026-06-12 02:34:04 +09:00
metaphorics ef7284bf9c perf(pi-shell): add dotnet build success short-circuit, retire dead def
filter_build_like short-circuits to 'ok (build|restore succeeded)' on
zero warnings and zero errors; the redundant defs/dotnet-build.toml
is removed and its inline tests are ported into dotnet.rs.

Op: compress
2026-06-12 02:34:04 +09:00
metaphorics 1f8bf85213 perf(pi-shell): docker batch — frequency-dedup logs, kubectl arms, helm glog strip, compose-legacy dispatch
- filter_docker_logs/filter_logs now collapse repeated lines to order-
  preserving '(×N)' counts via shared compact_log_lines helper.
- kubectl apply|delete|rollout|scale|create|wait|label|annotate now
  route through head_tail_dedup instead of raw passthrough.
- filter_helm strips client-go glog 'W####' warnings and kube-config
  permission warnings before table compaction.
- normalize_program maps standalone 'docker-compose' (v1) to 'docker'
  so it routes through the docker filter with proper subcommand detection.

Op: compress
2026-06-12 02:34:04 +09:00
metaphorics b3ceaa44ee test(pi-shell): engine-level regression tests for rails defs and bundle exec re-dispatch
Guards that rails-migrate/rails-routes defs run standalone (not as
overlays) and that bundle exec correctly re-dispatches to wrapped
filters.

Op: extend
2026-06-12 02:34:04 +09:00
metaphorics 29015b73bc feat(pi-shell): re-dispatch bundle exec to the wrapped tool filter
'bundle exec rspec|rubocop|rake|rails' now routes to the ruby/lint
filter for the wrapped tool (mirroring the uv wrapper), parsing the
command for the wrapped word since detect yields only 'exec'.

Op: extend
2026-06-12 02:34:04 +09:00
metaphorics b7283ac8d7 feat(pi-shell): add rails-migrate and rails-routes defs, scope ruby.rs to avoid overlay
Defs for 'rails/rake db:migrate|rollback' and 'rails routes' run as
standalone primary filters with match_subcommand scope so they never
overlay the minitest filter output. ruby.rs excludes those subcommands
from its generic rake/rails claim.

Op: extend
2026-06-12 02:34:04 +09:00