Skip to content

chore(ui): trace output cleanup — say/set-x/subshell filters#198

Merged
CGMossa merged 2 commits into
mainfrom
chore/ui-trace-cleanup
May 17, 2026
Merged

chore(ui): trace output cleanup — say/set-x/subshell filters#198
CGMossa merged 2 commits into
mainfrom
chore/ui-trace-cleanup

Conversation

@CGMossa
Copy link
Copy Markdown
Contributor

@CGMossa CGMossa commented May 16, 2026

AI-written details

Summary

  • Two coordinated cleanups to the xtrace filter in ui/helpers.sh and the four ui/main_*.sh scripts that consume it, carved out of rpkg: dvs_init returns config as a single-row tibble #170 (dvs_init returns tibble) where they were riding along.
  • Tightens the BASH_XTRACEFD filter regex so it drops three classes of leakage:
    • Bare say (no args, used as blank-line separator) — was matching only say "..." because the regex required a trailing space.
    • > set +x lines from mkfiles / mkrandfile / mkdatasetfiles bodies where the { set +x; } 2>/dev/null trick can't reach fd 10.
    • Deeper >>+ subshell traces (>> exec, >> BASH_XTRACEFD=, >>> grep) emitted while sourcing helpers.sh.
  • Defers set -x in ui/main.sh / main_parallel.sh / main_progress.sh / main_status.sh until after helpers.sh is sourced, so the sourcing itself doesn't trace.
  • Net effect on /tmp/ui-status.log: 19 > say + 44 > set + ~6 >>+ lines → 0 of each.
  • No behavior change; trace-output cosmetics only.

Test plan

  • just ui-run clean — /tmp/ui-*.log contain no > say, > set [+-]x, or >>+ lines
  • Spot-check ui/output/ui-status.html renders without the noise

Drafted by Claude (claude-opus-4-7). Reviewed by the author.

CGMossa added 2 commits May 16, 2026 11:53
The BASH_XTRACEFD filter from #168 was '^> say ' (with trailing space),
which only matched calls like 'say "blah"'. Bare 'say' (no args, used
for blank-line separators between sections) traces as '> say' with no
trailing whitespace and was leaking through.

Tighten the regex to '^> say($| )' so both the no-arg and the with-arg
forms are dropped. After this, /tmp/ui-status-test.log has 0 '> say'
lines (was 19).
Three coordinated changes across helpers.sh and all five ui/main*.sh:

1. Tighten the BASH_XTRACEFD filter in ui/helpers.sh from `^> say($| )`
   to `^> say($| )|^> set [+-]x$|^>>+`. Drops the `> set +x` lines that
   leak from mkfiles/mkrandfile/mkdatasetfiles bodies (where the
   `{ set +x; } 2>/dev/null` trick can't reach fd 10) and any deeper
   `>>+` subshell traces (the `>> exec`, `>> BASH_XTRACEFD=`, `>>> grep`
   noise emitted while sourcing helpers.sh).

2. Move `set -x` and `set -o pipefail` to after `source helpers.sh` in
   every main script. Pre-source lines (trap, SCRIPT_DIR/REPO_ROOT,
   source itself) no longer trace at all — no more `+ trap`, `+ source`,
   `++ pwd`, `+++ dirname` noise at the top of each log. `set -eu` still
   applies before sourcing.

3. Convert the `echo "NOTE: ..."` banner to `say "NOTE: ..."` (and move
   it after sourcing) in all five scripts so it doesn't show as a
   `+ echo` trace line.

After these changes a typical log starts with the NOTE text and goes
directly into real commands. /tmp/ui-status.log went from 19 `> say`,
44 `> set`, ~6 `>>+` lines down to 0 of each.
@CGMossa CGMossa merged commit 4a6ad6c into main May 17, 2026
CGMossa added a commit that referenced this pull request May 17, 2026
…get/status

Adds ui/main_recursive.sh (550 lines) exercising the matrix:

- dvs add: explicitly rejects --recursive (glob is the recursion
  encoding; flag-based recursion was deliberately excluded for add).
- dvs get: positional file, single-dir, single-dir + --recursive,
  '.' + --recursive, mixed file/dir inputs.
- dvs status: same matrix, plus the no-path case where --recursive
  is a documented no-op (whole-repo iteration is already recursive).

Each case logs both the command and the resulting state of the
working tree so the CLI/R parity can be eyeballed in the published
HTML.

ui/CLAUDE.md: adds main_recursive.sh to the script roster + widens
the comment column to accommodate the longer name.

Carved out of #154. Stacked on the rpkg PR. ui-trace cleanup hunks
that #154 used to carry are intentionally NOT here — they land
separately via #198 (chore/ui-trace-cleanup).
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.

1 participant