Skip to content

Fix script output dropping last line without trailing newline#4995

Merged
denik merged 7 commits into
mainfrom
denik/random-bugfixes-4
Jun 1, 2026
Merged

Fix script output dropping last line without trailing newline#4995
denik merged 7 commits into
mainfrom
denik/random-bugfixes-4

Conversation

@denik
Copy link
Copy Markdown
Contributor

@denik denik commented Apr 16, 2026

Changes

Fix experimental.scripts hooks silently dropping the last line of output when it doesn't end with a trailing newline (e.g. printf "done").

Tests

Added acceptance test at acceptance/bundle/scripts/no-trailing-newline/ and unit tests for the script executor.

Running the acceptance test against the previous release demonstrates the bug:

$ go test ./acceptance -run 'TestAccept/bundle/scripts/no-trailing-newline' -useversion 0.296.0

--- Expected
+++ Actual (v0.296.0)
@@ -5,3 +5,2 @@
 line 2
-line without newline
 Name: scripts_no_trailing_newline

v0.296.0 drops "line without newline" because the last line has no trailing \n. The fix correctly includes it.

denik added a commit that referenced this pull request Apr 16, 2026
denik added a commit that referenced this pull request Apr 22, 2026
@denik denik force-pushed the denik/random-bugfixes-4 branch from a86395c to f43f4d2 Compare April 22, 2026 16:10
denik added a commit that referenced this pull request Apr 29, 2026
denik added a commit that referenced this pull request Apr 29, 2026
Drop the placeholder Bundles changelog line that was never replaced when
the PR-linked entry was added, leaving a single entry referencing #4995.
Also remove TestExecuteNoScript which only re-exercises the trivial
getCommand early-return without adding coverage for the fix.

Task: 007.md
Task-review: /home/denis.bilenko/work/prompts-features/cli/random-bugfixes-4/006.SUMMARY.md

Co-authored-by: Isaac
denik added a commit that referenced this pull request Apr 29, 2026
@denik denik force-pushed the denik/random-bugfixes-4 branch from f43f4d2 to 7802668 Compare April 29, 2026 09:50
@denik denik temporarily deployed to test-trigger-is April 29, 2026 09:50 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is April 29, 2026 09:50 — with GitHub Actions Inactive
@denik denik enabled auto-merge May 22, 2026 13:52
@denik denik temporarily deployed to test-trigger-is May 22, 2026 13:52 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 22, 2026 13:52 — with GitHub Actions Inactive
@eng-dev-ecosystem-bot
Copy link
Copy Markdown
Collaborator

eng-dev-ecosystem-bot commented May 22, 2026

Commit: b1c60f5

Run: 26743886904

denik added a commit that referenced this pull request May 26, 2026
Drop the placeholder Bundles changelog line that was never replaced when
the PR-linked entry was added, leaving a single entry referencing #4995.
Also remove TestExecuteNoScript which only re-exercises the trivial
getCommand early-return without adding coverage for the fix.

Task: 007.md
Task-review: /home/denis.bilenko/work/prompts-features/cli/random-bugfixes-4/006.SUMMARY.md

Co-authored-by: Isaac
@denik denik force-pushed the denik/random-bugfixes-4 branch from 966f67f to e0c91f9 Compare May 26, 2026 10:40
@denik denik requested a deployment to test-trigger-is May 26, 2026 10:41 — with GitHub Actions Abandoned
@denik denik requested a deployment to test-trigger-is May 26, 2026 10:41 — with GitHub Actions Abandoned
denik added a commit that referenced this pull request Jun 1, 2026
Drop the placeholder Bundles changelog line that was never replaced when
the PR-linked entry was added, leaving a single entry referencing #4995.
Also remove TestExecuteNoScript which only re-exercises the trivial
getCommand early-return without adding coverage for the fix.

Task: 007.md
Task-review: /home/denis.bilenko/work/prompts-features/cli/random-bugfixes-4/006.SUMMARY.md

Co-authored-by: Isaac
@denik denik force-pushed the denik/random-bugfixes-4 branch from 3015ef4 to b1c60f5 Compare June 1, 2026 08:28
@denik denik temporarily deployed to test-trigger-is June 1, 2026 08:29 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 1, 2026 08:29 — with GitHub Actions Inactive
denik added a commit that referenced this pull request Jun 1, 2026
Drop the placeholder Bundles changelog line that was never replaced when
the PR-linked entry was added, leaving a single entry referencing #4995.
Also remove TestExecuteNoScript which only re-exercises the trivial
getCommand early-return without adding coverage for the fix.

Task: 007.md
Task-review: /home/denis.bilenko/work/prompts-features/cli/random-bugfixes-4/006.SUMMARY.md

Co-authored-by: Isaac
@denik denik force-pushed the denik/random-bugfixes-4 branch from b1c60f5 to aba812f Compare June 1, 2026 13:57
@denik denik temporarily deployed to test-trigger-is June 1, 2026 13:58 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 1, 2026 13:58 — with GitHub Actions Inactive
denik added 4 commits June 1, 2026 16:09
bufio.Reader.ReadString returns both data and io.EOF when the stream
ends without a delimiter. The old loop condition `for err == nil` caused
the last line of output to be silently dropped when it lacked a trailing
newline. This affected any bundle script (experimental.scripts hooks)
whose output didn't end with `\n`.

Restructure the loop to always process data before checking for errors,
which is the idiomatic Go pattern for ReadString.

Task: 001.md

Co-authored-by: Isaac
This test demonstrates the bug where the last line of script output
was dropped when it didn't end with a trailing newline. Running this
test with -useversion 0.296.0 shows the bug: "line without newline"
is missing from the output.

Task: 002.md

Co-authored-by: Isaac
Drop the placeholder Bundles changelog line that was never replaced when
the PR-linked entry was added, leaving a single entry referencing #4995.
Also remove TestExecuteNoScript which only re-exercises the trivial
getCommand early-return without adding coverage for the fix.

Task: 007.md
Task-review: /home/denis.bilenko/work/prompts-features/cli/random-bugfixes-4/006.SUMMARY.md

Co-authored-by: Isaac
When a test script is killed by the timeout, the test directory holds
partial state: any "out.*" files reflect an incomplete recording and
output.txt contains only the prefix that streamed before the kill.
Previously `make test-update` would overwrite committed reference files
with this partial state and emit untracked "out.requests.txt" files
across cluster, deploy, and template tests.

Wrap the timeout error with the errScriptTimedOut sentinel and gate
OverwriteMode on errors.Is matching it. Also short-circuit the
unexpected-files loop so leftover partial files are not flagged or
written. Existing comparisons still run, so selftest/timeout keeps
passing.

Task: 009.md

Co-authored-by: Isaac
@denik denik force-pushed the denik/random-bugfixes-4 branch from aba812f to bd961c2 Compare June 1, 2026 14:09
@denik denik temporarily deployed to test-trigger-is June 1, 2026 14:10 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 1, 2026 14:10 — with GitHub Actions Inactive
denik added 2 commits June 1, 2026 16:31
Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
@denik denik force-pushed the denik/random-bugfixes-4 branch from bd961c2 to 3b3cfbd Compare June 1, 2026 14:31
@denik denik temporarily deployed to test-trigger-is June 1, 2026 14:32 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 1, 2026 14:32 — with GitHub Actions Inactive
@denik denik disabled auto-merge June 1, 2026 15:11
@denik denik merged commit 4e25c5a into main Jun 1, 2026
23 checks passed
@denik denik deleted the denik/random-bugfixes-4 branch June 1, 2026 15:11
@eng-dev-ecosystem-bot
Copy link
Copy Markdown
Collaborator

Commit: 4e25c5a

Run: 26763716692

deco-sdk-tagging Bot added a commit that referenced this pull request Jun 4, 2026
## Release v1.2.0

### CLI
* `experimental open` now opens every DABs resource type that has a workspace URL, picking up `catalogs`, `schemas`, `volumes`, `database_instances`, `database_catalogs`, `synced_database_tables`, `postgres_catalogs`, `postgres_synced_tables`, `quality_monitors`, `vector_search_endpoints`, and `vector_search_indexes` ([#5346](#5346)).

### Bundles
* Retry transient HTTP 5xx and 408 errors in direct deployment engine ([#5349](#5349), [#5364](#5364)).
* Preserve `.designer.ipynb` suffix when translating notebook task paths so Lakeflow Designer files referenced from a `notebook_task` resolve correctly in the workspace ([#5370](#5370)).
* Fix script output dropping last line without trailing newline ([#4995](#4995)).
* engine/direct: Add `--select` flag to `bundle plan` and `bundle deploy` to plan/deploy a subset of resources (e.g. `--select my_job` or `--select jobs.my_job`); resources referenced by the selection are included transitively ([#5413](#5413)).
* Support `purge_on_delete: true` on `postgres_projects` so bundles can hard-delete a Lakebase project on destroy (skipping the soft-delete retention window) ([#5414](#5414)).
* Support terraform references in direct engine ([#5392](#5392))
* Support lifecycle.started for SQL warehouses ([#5348](#5348))

### Dependency updates
* Bump Go toolchain to 1.26.4 ([#5420](#5420)).
* Bump `github.com/databricks/databricks-sdk-go` from v0.136.0 to v0.141.0 ([#5361](#5361))
* Bump Terraform provider from v1.115.0 to v1.117.0 ([#5421](#5421))
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.

3 participants