Skip to content

feat(watch)!: stream RustFS object notifications - #295

Merged
cxymds merged 7 commits into
mainfrom
cxymds/issue-1374-watch
Jul 22, 2026
Merged

feat(watch)!: stream RustFS object notifications#295
cxymds merged 7 commits into
mainfrom
cxymds/issue-1374-watch

Conversation

@cxymds

@cxymds cxymds commented Jul 22, 2026

Copy link
Copy Markdown
Member

Closes rustfs/backlog#1374

Background and user impact

rc had no equivalent to mc watch. Users could not observe RustFS object creation, access, removal, version, or delete-marker activity from the CLI without polling.

Solution

  • Adds typed streaming notification contracts to rc-core.
  • Adds a SigV4-signed RustFS ListenNotification transport with incremental, bounded JSON-line decoding.
  • Adds rc watch ALIAS[/BUCKET] with mc-compatible event shorthands, prefix/suffix filters, compact schema-v3 JSON Lines, human output, quiet mode, reconnects, and Ctrl-C handling.
  • Advertises listen_notification only for the exact known RustFS 1.0.0-beta.10 release family while allowing undeclared future servers to answer authoritatively.
  • Extends output schema v3 additively with watch source and delete-marker fields.

Review resolution

This PR supersedes #273 after its deleted base branch made reopening impossible.

  • Replaces infallible streaming println! paths with fallible stdout writers.
  • Treats stdout BrokenPipe as a clean watch termination with exit code 0, covering head, grep -m1, and closed pager pipelines without panic or spurious stderr.
  • Preserves non-BrokenPipe stdout failures as ordinary I/O errors.
  • Resets the reconnect budget after every successfully received event or keepalive, so --reconnect-attempts counts consecutive failures rather than lifetime disconnects.
  • Adds regression tests for writer EPIPE, clean loop termination, and failure → healthy frame → disconnect → successful reconnect.
  • Keeps malformed event frames fatal as an explicit integrity policy: the decoder does not silently discard a possibly corrupted notification.

BREAKING protected-file process

BREAKING: this PR adds a public command contract under the protected docs/reference/rc/ tree. The behavior is additive: no existing command, flag, exit code, configuration schema, or v1/v2 output contract changes. New watch consumers should read one schema-v3 JSON object per line and tolerate optional delete_marker and source fields. Transport keepalives are consumed without emitting output records.

Validation

  • cargo fmt --all --check: passed.
  • cargo clippy --workspace -- -D warnings: passed with zero warnings.
  • cargo test --workspace: passed.
  • Watch, formatter EPIPE, output-v3 schema, capability, help-contract, launcher, ops, and replication focused tests: passed after semantic integration with latest main.
  • Compatibility script unit tests and repository consistency check: passed.
  • git diff --check: passed.

@cxymds

cxymds commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

This PR supersedes #273 and carries all prior review fixes. The BrokenPipe path now terminates cleanly without panic, the reconnect counter resets after healthy frames, and both behaviors have regression coverage. The branch is integrated with latest main and the mandatory full workspace validation passes. Please re-review the migrated changes.

@cxymds
cxymds requested a review from overtrue July 22, 2026 14:22
@cxymds
cxymds marked this pull request as ready for review July 22, 2026 14:22
@cxymds
cxymds merged commit 51e91f5 into main Jul 22, 2026
17 checks passed
@cxymds
cxymds deleted the cxymds/issue-1374-watch branch July 22, 2026 14:30
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.

1 participant