Skip to content

feat: oxidize streaming_brief feature#419

Merged
tigarmo merged 5 commits intofeature/oxidationfrom
work/rust-streaming-brief/CRAFT-4968
Feb 25, 2026
Merged

feat: oxidize streaming_brief feature#419
tigarmo merged 5 commits intofeature/oxidationfrom
work/rust-streaming-brief/CRAFT-4968

Conversation

@bepri
Copy link
Member

@bepri bepri commented Feb 18, 2026

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run make lint && make test?

I recommend reviewing per-commit.

Adds back the streaming_brief feature, which really only is noticeable in a niche circumstance where streaming_brief=True and a logging event with a verbosity level > logging.DEBUG is received. Below is a minimal script to demonstrate this behavior.

import logging
import subprocess
from time import sleep

from craft_cli import EmitterMode
from craft_cli._rs.emitter import Emitter

logger = logging.getLogger(__name__)

e = Emitter("blah.log", EmitterMode.BRIEF, "example.com", "Hello", streaming_brief=True)
logger.info("Testing")
with e.open_stream("Counting") as pipe:
    for i in range(5):
        logger.info("Printing %d", i)
        sleep(0.3)
        subprocess.run(["echo", str(i)], check=True, stdout=pipe)
        sleep(0.3)

e.message("Done")

As a fly-by, this adds back the ability to prefix messages piped with Emitter.open_stream, as mentioned at #416 (comment). This behavior is shown in the testing script as well.

@bepri bepri self-assigned this Feb 18, 2026
@bepri bepri force-pushed the work/rust-streaming-brief/CRAFT-4968 branch 2 times, most recently from 0462a04 to 8204def Compare February 19, 2026 21:01
@bepri bepri force-pushed the work/rust-streaming-brief/CRAFT-4968 branch from 8204def to bc54b3a Compare February 20, 2026 17:53
@bepri bepri marked this pull request as ready for review February 20, 2026 17:54
@bepri bepri requested a review from tigarmo as a code owner February 20, 2026 17:54
@bepri bepri requested a review from mr-cal February 20, 2026 17:54
Copy link
Contributor

@mr-cal mr-cal left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reintroduces the streaming_brief behavior in the Rust-backed emitter/logging path, and adds infrastructure to prefix terminal output (notably for open_stream) while simplifying the printer’s message model.

Changes:

  • Add streaming_brief plumbing into Emitter and LogListener to allow streaming library logs in brief mode.
  • Refactor printer message handling to rely on a new Message.permanent flag (and simplify MessageType usage).
  • Add a global, printer-managed prefix that can be applied to emitted messages.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/emitter.rs Adds streaming_brief, updates verbosity comparisons, and introduces open_stream(prefix=...) plus prefix helpers.
src/logs.rs Adds streaming_brief handling for brief-mode logging decisions and sets Message.permanent for log records.
src/printer.rs Introduces Message.permanent, adds prefix support, and simplifies routing to be target-based.
src/streams.rs Updates stream-to-printer messages to use permanent + MessageType::Text.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@tigarmo tigarmo left a comment

Choose a reason for hiding this comment

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

LGTM thanks. I'll point out that what you called a 'niche' circumstance is really the main way that users get feedback from our apps todays (streaming brief is the default, and the build messages are shown as 'info' logs)

@bepri
Copy link
Member Author

bepri commented Feb 23, 2026

I'm only calling it niche in the sense that the exact set of requirements "must be in brief mode, with streaming_brief, and only via logging records of the right verbosity level" makes it a surprisingly narrow path a message must follow to see this behavior. When I was reviewing the original code, I doubted my own interpretation because it seemed like there should've been more to it than that, heh

The MessageType enum gave the printer a need to understand what level of importance messages had, and had it making decisions on where a message should go. This behavior should instead belong to any object using the printer, so the permanence of a message is now communicated as an attribute on the message.\n\nThis had the nice side effect of fixing a bug where brief mode would sometimes overwrite one too many lines and clear the previous command in the shell.
@bepri bepri force-pushed the work/rust-streaming-brief/CRAFT-4968 branch from 2e30a07 to e8bc46d Compare February 23, 2026 15:32
@bepri
Copy link
Member Author

bepri commented Feb 23, 2026

Force-pushed to clean up commit history.

@tigarmo tigarmo merged commit ba6fae4 into feature/oxidation Feb 25, 2026
6 of 20 checks passed
@tigarmo tigarmo deleted the work/rust-streaming-brief/CRAFT-4968 branch February 25, 2026 14:58
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.

4 participants