Skip to content

refactor: show beta notices whenever stderr is a terminal - #336

Merged
socksy merged 1 commit into
developfrom
refactor/simplify-beta-notice
Aug 18, 2026
Merged

refactor: show beta notices whenever stderr is a terminal#336
socksy merged 1 commit into
developfrom
refactor/simplify-beta-notice

Conversation

@socksy

@socksysocksy commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

In keeping with #322 this refactors the beta code to not use stdout/stderr stuff directly from non-output.rs related code

Summary by CodeRabbit

  • Improvements
    • Beta feature notices are now displayed consistently across storage and knowledge commands.
    • Notices appear only when appropriate and are shown no more than once, reducing repeated messages.
    • Beta notices continue to include relevant labels and documentation links when available.

@github-actions

This comment was marked as resolved.

@coderabbitai

coderabbitaiBot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Storage beta notifications now use a BetaFeature::notify_once method and a shared output helper that performs terminal and persistence gating. Catalog and knowledge commands call the Storage feature method at their existing notification points.

Changes

Beta notice flow

Layer / File(s)Summary
Centralized notice gating
crates/tower-cmd/src/output.rs
output::notice_once checks stderr terminal status, claims the notice through configuration, and emits it once through notice_to_stderr.
BetaFeature notification API
crates/tower-cmd/src/beta.rs
BetaFeature::notify_once delegates notice emission to the output helper; tests now cover notice formatting.
Catalog command integration
crates/tower-cmd/src/catalogs.rs
Catalog and knowledge handlers call beta::STORAGE.notify_once() for storage operations.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
participant CatalogCommand
participant BetaFeature
participant output_notice_once
participant config_claim_notice
CatalogCommand->>BetaFeature: notify_once()
BetaFeature->>output_notice_once: pass feature id and notice
output_notice_once->>config_claim_notice: claim_notice(id)
config_claim_notice-->>output_notice_once: claim result
output_notice_once-->>CatalogCommand: emit notice when eligible
Loading

Possibly related PRs

Suggested reviewers:konstantinoscs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title accurately reflects the main refactor: beta notices are now emitted through terminal-aware stderr handling.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/simplify-beta-notice

Comment @coderabbitai help to get the list of available commands.

match config::claim_notice(id) {
Ok(true) => notice_to_stderr(label, msg),
Ok(false) => {}
Err(err) => debug!("Failed to persist CLI notice {}: {}", id, err),

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

not realllly sure we need this, but wanted to keep the diff here clean as a move

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.

This writes locally (similar to session persistence). Keep it

@socksy
socksy changed the base branch from main to developJuly 30, 2026 15:38
match config::claim_notice(id) {
Ok(true) => notice_to_stderr(label, msg),
Ok(false) => {}
Err(err) => debug!("Failed to persist CLI notice {}: {}", id, err),

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.

This writes locally (similar to session persistence). Keep it

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
crates/tower-cmd/src/beta.rs (1)

34-67: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Retain coverage for the new notice-gating path.

The refactor removes the existing terminal/claiming test while introducing output::notice_once as the central behavior. Add tests for non-terminal stderr, first claim, already-claimed notices, and persistence failures—ideally in output.rs—so regressions in the dispatch contract are caught.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/tower-cmd/src/beta.rs` around lines 34 - 67, Add coverage around
output::notice_once for the notice-gating dispatch contract: test non-terminal
stderr behavior, successful first claiming, suppression of already-claimed
notices, and persistence failures. Place these tests in output.rs where
possible, and retain the existing BetaFeature notice formatting tests in
beta.rs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@crates/tower-cmd/src/beta.rs`:
- Around line 34-67: Add coverage around output::notice_once for the
notice-gating dispatch contract: test non-terminal stderr behavior, successful
first claiming, suppression of already-claimed notices, and persistence
failures. Place these tests in output.rs where possible, and retain the existing
BetaFeature notice formatting tests in beta.rs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6a5701b3-e208-4e79-9121-29a82b59477f

📥 Commits

Reviewing files that changed from the base of the PR and between 8d5ef43 and 7d58f19.

📒 Files selected for processing (3)
  • crates/tower-cmd/src/beta.rs
  • crates/tower-cmd/src/catalogs.rs
  • crates/tower-cmd/src/output.rs

@socksy
socksy merged commit ba98ff3 into developAug 18, 2026
51 of 52 checks passed
@socksy
socksy deleted the refactor/simplify-beta-notice branch August 18, 2026 13:25
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Aug 18, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@socksy@konstantinoscs