Skip to content

fix(sdk): removes topic_id and stream_id from public Stream API - #4249

Open
haubur wants to merge 2 commits into
apache:masterfrom
haubur:fix/iggystream-id-name-binding
Open

haubur wants to merge 2 commits into
apache:masterfrom
haubur:fix/iggystream-id-name-binding

Conversation

@haubur

@haubur haubur commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR address?

Closes #4155

Rationale

User sets both topic_name, topic_id and stream_name and stream_id.
Both are required to align internally. If they are not, the API checks if the topic exists (and also creates if not) based on the name but binds using the topic_id.

What changed?

  1. Remove topic_id and stream_id from the public API. Rather, generate those id's always from names using Identifier::named().
  2. Also remove

Local Execution

  • Passed
  • Pre-commit hooks ran

AI Usage

Integration test written by Claude.
/small-team-review ran on changes.

@github-actions

Copy link
Copy Markdown

Thanks for the PR. It is labeled S-waiting-on-review and queued for review.

Slash commands (own line, regular comment) move it around the queue:

  • /ready - back to S-waiting-on-review after addressing feedback
  • /author - flip to S-waiting-on-author while you finish changes
  • /request-review @user-or-team - request a reviewer
  • /pin - exempt the PR from the stale bot, /unpin to undo

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Sep 21, 2026
@codecov

codecov Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 35.29412% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.18%. Comparing base (968a23e) to head (8a9a63d).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
core/sdk/src/clients/client.rs 0.00% 0 Missing and 6 partials ⚠️
.../src/stream_builder/config/config_iggy_consumer.rs 0.00% 0 Missing and 2 partials ⚠️
.../src/stream_builder/config/config_iggy_producer.rs 0.00% 0 Missing and 2 partials ⚠️
core/sdk/src/clients/consumer.rs 0.00% 0 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (35.29%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@              Coverage Diff              @@
##             master    #4249       +/-   ##
=============================================
- Coverage     87.54%   70.18%   -17.37%     
  Complexity     1575     1575               
=============================================
  Files          1283     1281        -2     
  Lines        223353   187888    -35465     
  Branches     186716   151251    -35465     
=============================================
- Hits         195537   131868    -63669     
- Misses        23106    51188    +28082     
- Partials       4710     4832      +122     
Components Coverage Δ
Rust Core 66.96% <35.29%> (-21.67%) ⬇️
Java SDK 68.68% <ø> (ø)
C# SDK 77.41% <ø> (-0.05%) ⬇️
Python SDK 90.97% <ø> (ø)
PHP SDK 85.67% <ø> (ø)
Node SDK 96.43% <ø> (-0.02%) ⬇️
Go SDK 70.11% <ø> (-0.02%) ⬇️
Files with missing lines Coverage Δ
...dk/src/stream_builder/config/config_iggy_stream.rs 97.59% <100.00%> (+6.01%) ⬆️
core/sdk/src/clients/consumer.rs 85.07% <0.00%> (ø)
.../src/stream_builder/config/config_iggy_consumer.rs 97.59% <0.00%> (-0.32%) ⬇️
.../src/stream_builder/config/config_iggy_producer.rs 96.66% <0.00%> (-0.68%) ⬇️
core/sdk/src/clients/client.rs 90.99% <0.00%> (ø)

... and 375 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hubcio hubcio 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.

findings on lines outside the diff:

warning: core/connectors/runtime/src/source.rs:508 and :513 still parse the names numeric-first with Identifier::try_from, while IggyClient::producer now uses Identifier::named, so a digit-only name makes the durability gate check one topic and the producer write to another. switch both to Identifier::named.

nit: client.producer("1", "2") used to address stream id 1 and now creates a stream named "1". a short migration note in core/sdk/README.md next to the IggyConsumerConfig note would help, the crate has no changelog.

nit: item 2 under "What changed?" in the description stops at "Also remove".

pre-existing, not blocking:

warning: IggyProducerBuilder::stream() and topic() (core/sdk/src/clients/producer_builder.rs:90) accept any Identifier while the config keeps the names, so .stream(Identifier::numeric(7)?) makes init() check stream 7 and then create a stream named after the original string. drop the setters or reject a mismatch.

warning: the HTTP handlers parse path segments with Identifier::from_str_value (core/server/src/http/handlers.rs:334, :373, :939 and more), so over HTTP a digit-only stream name still resolves as a numeric id. this fix holds for the binary transports only, worth a note.

nit: examples/rust/src/shared/system.rs:76 parses --stream-id numeric-first, creates the stream by name at line 84, then creates the topic under the parsed id. Identifier::named fixes it.

@@ -722,8 +723,8 @@ impl IggyClient {
self.client.clone(),
name.to_owned(),
Consumer::group(name.try_into()?),

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.

warning: this still parses a digit-only group name as a numeric id, but the join at consumer.rs:1437 now goes by name, so a member joins one address and polls, syncs and leaves by another. use Identifier::named(name)? here too.

use iggy::stream_builder::{IggyConsumerConfig, IggyStreamConsumer};
use integration::iggy_harness;

const STREAM_NAME: &str = "stream-builder-stream";

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.

warning: both names are non-numeric, so the old numeric-first parsing and Identifier::named give the same identifier and this passes before and after the fix. add a case with a digit-only name like "42" (not "0", ids start at 0).

) -> Result<Self, IggyError> {
let stream_id = Identifier::from_str_value(stream)?;
let topic_id = Identifier::from_str_value(topic)?;
Identifier::named(stream)?;

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.

nit: the result is dropped, so this only rejects an empty or over-long name. either say so in a comment or drop both calls and the Identifier import, the build path runs the same check anyway.

also at config_iggy_producer.rs:127.

@@ -43,13 +43,14 @@ pub(crate) async fn build_iggy_stream_topic_if_not_exists(
client: &IggyClient,
config: &IggyConsumerConfig,

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.

nit: the doc above still says IggyProducerConfig (lines 28 and 36) but the parameter is IggyConsumerConfig. line 31 also doubles "and return" and ends in a stray "d".

};

let consumer_group_id = name.to_owned().try_into()?;
let consumer_group_id = Identifier::named(&name)?;

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.

simplification: _id from the match above is never read, and every caller passes the same string as name and id, so let name = consumer_name; does the job. drop the match and the get_u32_value()?.

pub fn topic_name(&self) -> &str {
self.producer_config.topic_name()
}
}

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.

simplification: this second impl IggyStreamConfig block now holds only two getters. fold them into the block above.

@github-actions github-actions Bot added S-waiting-on-author PR is waiting on author response and removed S-waiting-on-review PR is waiting on a reviewer labels Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author PR is waiting on author response

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(Rust SDK) IggyStream API has unintentional behavior: can create one topic and read from another

2 participants