Skip to content

acceptance: give title its own trailing newline - #7003

Draft
janniklasrose wants to merge 1 commit into
mainfrom
janniklasrose/acc/title-trace-newlines
Draft

janniklasrose wants to merge 1 commit into
mainfrom
janniklasrose/acc/title-trace-newlines

Conversation

@janniklasrose

Copy link
Copy Markdown
Member

Follow-up to the review thread on #6957 (#6957 (comment)).

Problem

The acceptance-test title helper printed \n=== <label> with no trailing newline, relying on a following trace (which prepends \n) to terminate the header line. This had two consequences:

  • When a title was followed by non-trace output, the header got mashed onto the output, e.g. === Recorded create-branch request bodies{.
  • Authors compensated inconsistently — a bare echo after the title (139 occurrences) or a literal \n appended to the label (~359 occurrences).

Change

title now prints its own trailing newline, so it is self-contained and the mashing is fixed. To keep the common title+trace output tight (no blank line between the === header and the >>> command), trace drops its leading newline when it immediately follows a title; a trace after any intervening output still gets its usual blank-line separator.

The "immediately follows a title" state is tracked by an _after_title flag: title sets it, trace reads and clears it, and a DEBUG trap clears it before any other top-level command. The trap requires set -T because the harness runs the main script in a subshell (readMergedScriptContents in acceptance_test.go), and a FUNCNAME guard keeps it from firing inside the helper functions themselves.

The now-redundant workarounds are removed and all acceptance goldens regenerated.

Net effect on output.txt

  • Idiomatic title+trace blocks: unchanged.
  • title followed by non-trace output: no longer mashed onto the header line.
  • Consecutive section headers: now separated by a blank line.
  • Workaround-driven inconsistencies (manual \n, bare echo): removed, so these blocks match the tight majority.

Testing

./task test regenerated via -update; full suite re-run without -update passes. The only failures observed locally are pre-existing/environmental and unrelated to this change: bundle/deploy/mlops-stacks (needs network to clone the upstream template; its output.txt is unchanged here) and bundle/apps/job_permissions (documented-flaky deploy-order output in out.after_first_deploy.txt, which this change does not touch).

This pull request and its description were written by Isaac.

Follow-up to the review thread on #6957.

`title` printed `\n=== <label>` with no trailing newline, relying on a
following `trace` (which prepends `\n`) to terminate the header line.
When a `title` was instead followed by non-`trace` output the header got
mashed onto the next line (e.g. `=== Recorded request bodies{`), and
authors worked around the missing newline inconsistently: a bare `echo`
after the title, or a literal `\n` appended to the label.

Make `title` self-contained by printing its own trailing newline. To
keep the common `title`+`trace` output tight (no blank line between the
header and the command), `trace` drops its leading newline when it
directly follows a `title`; a `trace` after any intervening output still
gets its usual separator. This is tracked with an `_after_title` flag
that `title` sets, `trace` reads and clears, and a `DEBUG` trap clears
before any other top-level command. The trap needs `set -T` because the
main script runs in a subshell, and a `FUNCNAME` guard keeps it from
firing inside the helpers themselves.

Remove the now-redundant workarounds (bare `echo`/`echo ""` after a
title, trailing `\n` in labels) and regenerate the acceptance goldens.

Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions github-actions Bot added DABs DABs related issues AIR Databricks AI Runtime CLI labels Oct 9, 2026

This branch has not been deployed

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

Labels

AIR Databricks AI Runtime CLI DABs DABs related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant