Skip to content

feat(cpp): expose get and delete personal access tokens - #4628

Open
Mitshah2406 wants to merge 9 commits into
apache:masterfrom
Mitshah2406:feat-4612-cpp-sdk-pat-list-delete
Open

Mitshah2406 wants to merge 9 commits into
apache:masterfrom
Mitshah2406:feat-4612-cpp-sdk-pat-list-delete

Conversation

@Mitshah2406

@Mitshah2406 Mitshah2406 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR address?

Closes #4612

Rationale

A C++ app could not list or delete its personal access tokens, although the Rust SDK already supports both.

What changed?

  • Enabled the two bridge calls that were commented out, as GetPersonalAccessTokens() and DeletePersonalAccessToken(name). A failed delete fills Code(), Kind() and OperationId(), like DeleteUser.
  • Fixed the Rust SDK HTTP delete (core/sdk/src/http/personal_access_tokens.rs), which affects every Rust HTTP user. The token name went into the URL raw, so abc?x deleted abc and ../users/42 hit /users/42. The name is now percent-encoded, and . and .. are rejected with InvalidPersonalAccessTokenName, because the URL parser resolves them even when encoded.
  • Added unit tests for both and an e2e test that creates, lists, deletes and lists again.

Local Execution

  • Pre-commit hooks ran and passed

AI Usage

  1. Which tools? Claude (Claude Code)
  2. Scope of usage? Wrote the implementation and tests under my direction. Also used it to understand and review the code.
  3. How did you verify the generated code works correctly? Ran clippy, the SDK and bridge tests, the Bazel unit tests and the C++ e2e suite against a local server (429 passed, 2 failed).
  4. Can you explain every line of the code if asked? Yes.

@github-actions

Copy link
Copy Markdown

Note for maintainers: @Mitshah2406 also has #4617 open. New contributors are asked to keep one open PR at a time. See CONTRIBUTING.md.

@slbotbm

slbotbm commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

@Mitshah2406 please edit your pr description to follow the repository template. Also, is this ready for review, or do you need to time?

@Mitshah2406
Mitshah2406 force-pushed the feat-4612-cpp-sdk-pat-list-delete branch 2 times, most recently from cdd8986 to 8ba4dac Compare October 24, 2026 10:54
@Mitshah2406
Mitshah2406 marked this pull request as ready for review October 24, 2026 10:56
@Mitshah2406

Copy link
Copy Markdown
Contributor Author

/ready

@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Oct 24, 2026
@slbotbm

slbotbm commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

/skill team-review-slim

@github-actions

Copy link
Copy Markdown

No skill named team-review-slim on the default branch. Available here: connector-review, connector-runtime, connector-sdk, connector-sink, connector-source, connector-testing, connector-transform, connectors-overview, team-review.

@codecov

codecov Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.82192% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.99%. Comparing base (4eccc5e) to head (9f4258f).
⚠️ Report is 25 commits behind head on master.

Files with missing lines Patch % Lines
core/sdk/src/http/personal_access_tokens.rs 47.05% 9 Missing ⚠️
foreign/cpp/src/client.cpp 75.00% 0 Missing and 3 partials ⚠️
foreign/cpp/src/type_conversions.cpp 60.00% 0 Missing and 2 partials ⚠️

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

❗ There is a different number of reports uploaded between BASE (4eccc5e) and HEAD (9f4258f). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (4eccc5e) HEAD (9f4258f)
rust 4 3
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4628      +/-   ##
============================================
- Coverage     90.87%   80.99%   -9.89%     
- Complexity     3104     3106       +2     
============================================
  Files          1482     1482              
  Lines        362179   362249      +70     
  Branches     306049   306071      +22     
============================================
- Hits         329117   293386   -35731     
- Misses        26144    61874   +35730     
- Partials       6918     6989      +71     
Components Coverage Δ
Rust Core 80.32% <47.05%> (-11.89%) ⬇️
Java SDK 78.17% <ø> (+0.03%) ⬆️
C# SDK 83.56% <ø> (-0.04%) ⬇️
Python SDK 85.67% <ø> (ø)
PHP SDK 90.71% <ø> (ø)
Node SDK 96.44% <ø> (-0.01%) ⬇️
Go SDK 69.22% <ø> (-0.09%) ⬇️
C++ SDK 85.61% <91.07%> (+0.06%) ⬆️
Files with missing lines Coverage Δ
foreign/cpp/include/iggy.hpp 89.84% <100.00%> (+0.03%) ⬆️
foreign/cpp/src/client.rs 87.87% <100.00%> (+0.25%) ⬆️
foreign/cpp/src/lib.rs 100.00% <ø> (ø)
foreign/cpp/src/type_conversion.rs 95.14% <100.00%> (+0.02%) ⬆️
foreign/cpp/src/type_conversions.cpp 65.48% <60.00%> (-0.05%) ⬇️
foreign/cpp/src/client.cpp 68.95% <75.00%> (+0.15%) ⬆️
core/sdk/src/http/personal_access_tokens.rs 64.00% <47.05%> (-36.00%) ⬇️

... and 508 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 commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

/skill team-review

@github-actions github-actions Bot 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.

Summary: The C++ binding adds personal access token listing and deletion in the existing bridge pattern, but the new delete call reaches an HTTP SDK path that writes the raw token name into the URL, so a name such as ../users/42 retargets the DELETE to another endpoint. The README error list and the delete method's outcome note are also inconsistent with the rest of the API.

Counts: critical 1, warning 0, nit 2, simplification 0


This review was generated by Claude Code 2.1.284 on deepseek-flash[1m]. Review the output before you act on it.

Comment thread foreign/cpp/src/client.rs Resolved
Comment thread foreign/cpp/include/iggy.hpp Resolved
Comment thread foreign/cpp/include/iggy.hpp Resolved
@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 Oct 24, 2026
@Mitshah2406

Copy link
Copy Markdown
Contributor Author

/ready

@github-actions github-actions Bot added S-waiting-on-review PR is waiting on a reviewer and removed S-waiting-on-author PR is waiting on author response labels Oct 25, 2026

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

main gap is tests - nothing lists or deletes a real token, and nothing covers the new HTTP path encoding. a few things outside the diff:

  • the PR description only covers the C++ side - please mention the rust SDK fix in core/sdk/src/http/personal_access_tokens.rs, since it changes the delete path for everyone on the rust HTTP client.
  • foreign/cpp/README.md:103 still leaves DeletePersonalAccessToken out of the list of methods that fill Code() and Kind().
  • please open the issue you offered for C# and java - both HTTP clients still put the raw token name in the delete path (HttpMessageStream.cs:906, PersonalAccessTokensHttpClient.java:56).
  • follow-up, not this PR: core/sdk/src/http/users.rs:90 (also lines 37, 101, 114, 131) has the same raw-path bug, so DeleteUser("../streams/1") over HTTP sends DELETE /streams/1.
  • follow-up, not this PR: a token named login can't be deleted over HTTP - the POST-only /personal-access-tokens/login route in core/server/src/http.rs:409 wins over {name} and answers 405.

Comment thread foreign/cpp/tests/e2e/client.cpp Resolved
Comment thread foreign/cpp/include/iggy.hpp Resolved
Comment thread foreign/cpp/include/iggy.hpp Resolved
Comment thread foreign/cpp/src/type_conversions.cpp Resolved
Comment thread foreign/cpp/src/lib.rs Resolved
Comment thread foreign/cpp/src/client.cpp Resolved
@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 Oct 26, 2026
@slbotbm

slbotbm commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

@Mitshah2406 could you rebase? create_personal_access_token's pr was merged. please use that function in the tests for the two functions you've added as well

@Mitshah2406

Copy link
Copy Markdown
Contributor Author

@Mitshah2406 could you rebase? create_personal_access_token's pr was merged. please use that function in the tests for the two functions you've added as well

Sure. Will do

@Mitshah2406

Copy link
Copy Markdown
Contributor Author

Thanks for the review, addressed all the points in the latest push.
I opened 3 issues as follow ups too:-
#4672 for the Java and C# clients
#4673 for users.rs
#4674 for the login / . / .. token names.

@Mitshah2406

Copy link
Copy Markdown
Contributor Author

/ready

@github-actions github-actions Bot added S-waiting-on-review PR is waiting on a reviewer and removed S-waiting-on-author PR is waiting on author response labels Oct 28, 2026
@Mitshah2406
Mitshah2406 force-pushed the feat-4612-cpp-sdk-pat-list-delete branch from 3cd24c7 to 3bab3db Compare October 29, 2026 14:27
@Mitshah2406
Mitshah2406 requested a review from hubcio October 31, 2026 10:24
@Mitshah2406

Copy link
Copy Markdown
Contributor Author

@hubcio please review whenever you get time.

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

please address the issues below.

const PATH: &str = "/personal-access-tokens";

fn delete_path(name: &str) -> String {
format!("{PATH}/{}", encode_segment(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.

warning: deleting a valid token named login over http hits the static, post-only /personal-access-tokens/login route instead of token deletion. route delete requests for that path to deletion and add a regression test.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

noted, thanks for catching.. updating with a regression test.

@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 Nov 4, 2026

This branch has not been deployed

No deployments
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.

C++ SDK: expose get_personal_access_tokens and delete_personal_access_token

3 participants