Skip to content

Keep substreams run stdout to module data only - #884

Merged
maoueh merged 1 commit into
developfrom
feature/substreams-run-stdout-spurious-printing
Aug 17, 2026
Merged

Keep substreams run stdout to module data only#884
maoueh merged 1 commit into
developfrom
feature/substreams-run-stdout-spurious-printing

Conversation

@maoueh

@maoueh maoueh commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

substreams run mixed human-readable status lines into standard output, so piping its JSON into jq or any other consumer broke on the first non-JSON line. The most visible one was the Completed successfully trailer printed after the last block.

All informational and diagnostic output from the run path now goes to standard error, leaving standard output carrying nothing but module data:

  • Completed successfully and the received <signal> notice on shutdown.
  • The cursor and clock output-mode banners, which polluted the very streams those modes exist to produce.
  • The Error wrapping message diagnostic emitted while formatting JSON output.
  • The .substreams.env loader messages (Reading SUBSTREAMS_API_TOKEN from ... and its read errors), which fire on every invocation when the file exists.

The .substreams.env messages live in the shared sink package, so this also affects the sink CLIs that load auth the same way — stderr is the correct stream for them too.

Scripts that grep stdout for Completed successfully to detect success will stop matching; they should check the exit code, or read stderr.

Verified: an invocation in a directory holding a .substreams.env now produces an empty stdout, with the auth line on stderr. The Completed successfully path itself was not exercised end-to-end — that needs a live endpoint and an API token, which this environment does not have.

Human-readable status lines were interleaved with the JSON module data on
standard output, so piping the output into `jq` broke on the first non-JSON
line. The most visible one was the `Completed successfully` trailer.

Route all informational and diagnostic output to standard error:

- `Completed successfully` and the `received <signal>` shutdown notice
- the `cursor` and `clock` output-mode banners, which polluted the very
  streams those modes exist to produce
- the `Error wrapping message` diagnostic from the JSON formatter
- the `.substreams.env` loader messages, which fire on every invocation
  when the file exists

# Conflicts:
#	docs/release-notes/change-log.md
@maoueh
maoueh force-pushed the feature/substreams-run-stdout-spurious-printing branch from 5316c9a to be66d09 Compare August 17, 2026 20:11

@UlysseCorbeil UlysseCorbeil left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sduchesneau

Copy link
Copy Markdown
Contributor

🔍 Vulnerabilities of ghcr.io/streamingfast/substreams:d99e9d8

📦 Image Reference ghcr.io/streamingfast/substreams:d99e9d8
digestsha256:a9cf33e1748e97c6103fb006e30e11b789ff6c84d71b09ad7f6df8103c804b90
vulnerabilitiescritical: 0 high: 0 medium: 0 low: 0
platformlinux/amd64
size123 MB
packages382
📦 Base Image oisupport/staging-amd64:24.04
also known as
  • a215e986b44aae6f10795ded1e39ce93d9c236d8163d21a522ffd0ab3659f546
  • noble
  • noble-20260730.1
digestsha256:019e8eb29a85e74d64925745884f2ec79aa27e3feab36353d24656f4d6b89467
vulnerabilitiescritical: 0 high: 0 medium: 5 low: 4

@maoueh
maoueh merged commit 535497d into develop Aug 17, 2026
12 checks passed
@maoueh
maoueh deleted the feature/substreams-run-stdout-spurious-printing branch August 17, 2026 20:20
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