fix(DOC-1940): clarify rpk topic consume keeps connection open#1612
fix(DOC-1940): clarify rpk topic consume keeps connection open#1612mfernest wants to merge 12 commits into
Conversation
Add a note explaining that rpk topic consume runs indefinitely by default, waiting for new records. Documents how to exit: Ctrl+C, --num, or an end offset with --offset. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
✅ Deploy Preview for redpanda-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis pull request adds documentation to the rpk topic consume command page, clarifying its default behavior. The changes explain that the command maintains a persistent connection and waits indefinitely for new records unless interrupted or controlled by the Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@modules/reference/pages/rpk/rpk-topic/rpk-topic-consume.adoc`:
- Around line 10-14: The doc text for rpk topic consume should clarify the range
offset pattern and either replace or augment `-o start:end` with explicit,
documented examples and a note about `end`'s meaning in ranges: update the
sentence referencing `--offset`/`-o` to show a clear example like `-o :end`
(consume until current end) and/or `-o `@-1m`:end` (consume from one minute ago to
current end), and add a short parenthetical explaining that `end` inside a range
denotes the current end offset (different from using `end` alone); edit the
offset table and examples section to include this explicit `:end`/`@-1m:end`
pattern and the clarifying note so readers aren’t confused by the standalone
`end` meaning.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 47393d7b-97a3-4f2f-9010-2d4e19f43fda
📒 Files selected for processing (1)
modules/reference/pages/rpk/rpk-topic/rpk-topic-consume.adoc
| indefinitely for new records to arrive. It does not exit after consuming | ||
| existing records. To stop consuming, press `Ctrl+C`, or use `--num` to exit | ||
| after a fixed number of records, or specify an end offset with `--offset` | ||
| (for example, `-o start:end`). |
There was a problem hiding this comment.
-o start:end
-o :end is enough.
There was a problem hiding this comment.
Good call — fixed to -o :end. Also took the opportunity to clean up a few other prose issues on the page (kbd macro for Ctrl+C, simplify the --format json sentence, fix a tense issue, and a grammatical error).
There was a problem hiding this comment.
Thanks — applied as -o :end in PATCH 2.
…c-consume-connection
- Change -o start:end example to -o :end per daisukebe review - Use kbd:[Ctrl+C] macro for keyboard shortcut - Simplify --format json description; remove vague "special format" - Fix "prints the number in as ASCII" -> "as ASCII" - Use present tense: "will have their values printed" -> "have" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
micheleRP
left a comment
There was a problem hiding this comment.
Review Summary
The core issue (DOC-1940)
DOC-1940 reports that AI tools (and users) don't realize rpk topic consume opens a persistent connection and waits indefinitely. The description says: "we noticed that some AI tools fail to realize that rpk topic consume opens a connection and stays waiting for new messages to arrive."
RPK automation impact
Like PR #1618, this file is an rpk reference page where the generator (gen-rpk-ascii.py) produces:
- The title and
:description:attribute - The opening description paragraph (from
rpk topic consume --helpoutput) - The
== Usagesection - The
== Flagstable
The sections below the flags table (Attributes, Text, Headers, Values, Offsets, Examples) are manual additions that survive regeneration because the generator doesn't produce them.
The problem: The new paragraph about persistent connection behavior is inserted in the description zone (between the intro paragraph and the include:: directive). This zone is overwritten by whatever rpk topic consume --help outputs. So this addition will be lost on the next rpk doc regeneration.
The two bug fixes ("in as ASCII" → "as ASCII" on line 85, and "will have their values printed" → "have their values printed" on line 106) are in the manual sections and will survive regeneration.
Recommendation
The core value of this PR — documenting that rpk topic consume waits indefinitely — should be placed somewhere that survives regeneration. Two options:
-
Move the new paragraph below the
== Flagstable (e.g., as a new== Behavioror== Connection behaviorsection before== Attributes). Manual sections after the flags table are not overwritten by the generator. This is the simplest fix that preserves the intent. -
Update the
rpk topic consume --helptext upstream in the Redpanda Go source so it includes the persistent-wait behavior in the command description itself, and then regenerate.
Style notes
The content is well-written. A few suggestions:
-
"opens a persistent connection" is imprecise for Kafka protocol semantics. Consider: "runs continuously, waiting for new records to arrive" — this describes the observable behavior without implying a specific connection model.
-
The three-clause "To stop consuming, press Ctrl+C, or use
--num... or specify an end offset..." is long. Split into two sentences:To stop consuming, press kbd:[Ctrl+C]. You can also use
--numto exit after a fixed number of records, or use--offset(for example,-o :end) to stop at a specific offset. -
The grammar fix on line 85 ("in as ASCII" → "as ASCII") and the tense fix on line 106 ("will have" → "have") are both correct and good catches.
…c-consume-connection
…flags table Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Ran this through Claude: Does it address DOC-1940? ✅ Yes The new == Connection behavior section directly addresses the ticket — it explains --- The rpk docs are fully regenerated from rpk --help output by gen-rpk-ascii.py. The # If the file exists, delete it. with open(filename, "w", encoding="utf-8") as filetowrite: There is no overrides mechanism for rpk docs (unlike properties → The other editorial changes (rewording --format json, removing "in as ASCII", --- The content needs to be added to the rpk source code help text in the redpanda repo If upstreaming to rpk isn't feasible right now, this should at minimum be flagged // NOTE: The section below is manually maintained and must be re-added after each asked Claude how this can be done without impacting automated content: There is no overrides mechanism for rpk docs — it doesn't exist yet. Unlike So the options are: 1. Keep the PR as-is with a clear comment warning it will be overwritten on Given that the overrides pattern is already established for properties and My recommendation: request changes on the PR noting that directly editing a |
|
@JakeSCahill Curious to know why we don't have an overrides file for rpk like we do for props? |
…ual zone Per @micheleRP's review and the constraint that rpk reference pages are fully regenerated from `rpk --help`: the only manual edits that survive regeneration are those below the Flags table. Revert the line-10 wording change in the auto-gen description zone (would have been silently overwritten on the next rpk doc regen), and move the default-output-format clarification into the new == Connection behavior section in the manual zone so it persists. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@micheleRP — picking this up from
Could you clear the Separately: the underlying gap your review surfaced — that rpk reference pages have no overrides mechanism analogous to |
micheleRP
left a comment
There was a problem hiding this comment.
Approving — all the change requests from my earlier review are addressed:
- New
== Connection behaviorsection now sits below the Flags table (survivesgen-rpk-ascii.pyregeneration), and the description-zone edit was reverted in PATCH 4. - "opens a persistent connection" reworded to "runs continuously, waiting for new records to arrive."
- The long stop-mechanisms sentence was split as suggested.
- The two prose fixes (
in as ASCII→as ASCII,will have→have) are correct and consistent with the current upstreamrpksource.
One optional, non-blocking nit: the second paragraph under == Connection behavior ("Records are formatted according to --format...") is about output formatting rather than connection behavior, and slightly overlaps the auto-gen description zone. Fine to leave as-is given the regeneration-durability tradeoff. Thanks for landing this!
Summary
Resolves DOC-1940. The ticket reports that AI tools and users don't realize
rpk topic consumeopens a persistent connection and waits indefinitely for new records.This PR was originally opened by
@mfernest, who is no longer with the team.@Feediver1is taking it over to finalize after@micheleRP's review.What changed
All edits land below the Flags table so they survive the next
gen-rpk-ascii.pyregeneration:== Connection behaviorH2 (manual zone) explaining thatrpk topic consumeruns continuously by default, doesn't exit after consuming existing records, and listing three ways to stop it:kbd:[Ctrl+C],--num, or--offset(for example,-o :end).== Connection behaviorsection: "Records are formatted according to--format. The default,--format json, prints each record as a JSON object." This was originally in the auto-gen description zone; relocating it preserves the cleaner wording without risking it being overwritten by the next rpk doc regeneration."prints the number in as ASCII"→"prints the number as ASCII", and"will have their values printed"→"have their values printed".Review history
@daisukebe-o :endinstead of-o start:end— applied. Approved 2026-03-24@r-vasquez@micheleRPCHANGES_REQUESTED2026-03-24 — asked to move the new content out of the auto-gen description zone and applied two style nits. Both substantively addressed: PATCH 3 (3-24) moved the content to a new manual-zone H2, and this PR's latest commit completes the cleanup by reverting the leftover description-zone wording change. Re-requesting reviewNote on rpk overrides
While reviewing this PR, I noted that the docs repo has no overrides mechanism for rpk reference pages — unlike properties (
property-overrides.json) and connectors (overrides.json). Any manual edit in the auto-gen description / usage / flags zones of rpk pages is silently lost on the nextgen-rpk-ascii.pyrun. The right long-term fix is either (a) a newrpk-overrides.jsontooling feature indocs-extensions-and-macros, or (b) upstreaming descriptive prose into the rpk Go source. This PR works around the constraint by keeping every edit in manual zones; the broader tooling gap is a follow-up.Preview pages
== Connection behaviorsection at the bottom of the pageTest plan
== Connection behaviorsection renders below the Flags table, with the three stop-mechanisms enumerated== Connection behavior🤖 Generated with Claude Code