Skip to content

feat(cli): improve auth#3466

Open
alkalescent wants to merge 7 commits into
mainfrom
DSPX-2905-auth
Open

feat(cli): improve auth#3466
alkalescent wants to merge 7 commits into
mainfrom
DSPX-2905-auth

Conversation

@alkalescent
Copy link
Copy Markdown
Contributor

@alkalescent alkalescent commented May 12, 2026

Proposed Changes

  • add refresh token utility
  • improve auth client credentials argument doc

Checklist

  • I have added or updated unit tests
  • I have added or updated integration tests (if appropriate)
  • I have added or updated documentation

Testing Instructions

Summary by CodeRabbit

  • New Features

    • Added token refresh support for access-token authentication.
    • Help/usage text now shows required and optional arguments with improved formatting.
  • Bug Fixes

    • Added explicit errors for missing refresh tokens and refresh failures.
    • Improved token expiry detection and handling during refresh flows.
  • Tests

    • Added comprehensive tests for token refresh flows, expiry/refresh-token detection, and help/usage string generation.

Review Change Stack

@alkalescent alkalescent requested a review from a team as a code owner May 12, 2026 20:09
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds OAuth2 refresh-token support (exchange, endpoint resolution, TLS no-verify, client-id fallback), expiry/presence predicates, related errors, comprehensive refresh tests, and updates Cobra command Use-string generation with tests.

Changes

Access Token Refresh with Expiration Helpers

Layer / File(s) Summary
Token refresh errors and expiration predicates
otdfctl/pkg/auth/errors.go, otdfctl/pkg/auth/refresh.go
Adds ErrNoRefreshToken and ErrRefreshFailed. Implements IsTokenExpired and HasRefreshToken for access-token profiles.
Refresh exchange and endpoint resolution
otdfctl/pkg/auth/refresh.go
Implements RefreshAccessToken with endpoint normalization/resolution (getTokenEndpoint), optional TLS no-verify client, OAuth2 refresh-token exchange, expiry derivation (with fallback), client ID defaulting to DefaultPublicClientID, and persistence of refreshed credentials.
Refresh unit and integration tests
otdfctl/pkg/auth/refresh_test.go
Adds extensive tests covering predicates, wrong auth type, missing refresh token, successful refresh, zero-expiry fallback, endpoint resolution errors, unauthorized responses, empty client ID fallback, TLS no-verify handling, and nil-safety.

Command Documentation and Usage String Formatting

Layer / File(s) Summary
Use string generation and integration
otdfctl/pkg/man/man.go, otdfctl/pkg/man/man_test.go
Adds buildUseString and updates ProcessDoc to set cobra.Command.Use with <arg> for required positional args and [arg] for arbitrary args; adjusts Args validator selection and adds tests for formatting and validation.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped through tokens, found a missing key,
I nudged the refresh and set expiry free,
Use strings now tidy, args neat and bright,
TLS can skip checks when certs give a fright,
Hooray — credentials renewed, I bound into the night!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.34% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'feat(cli): improve auth' is vague and generic, using the non-descriptive term 'improve' without conveying what specific auth improvements are being made. Use a more specific title that highlights the primary change, such as 'feat(auth): add refresh token support' or 'feat(cli): add OAuth2 refresh token functionality'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 DSPX-2905-auth

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.

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

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

Inline comments:
In `@otdfctl/pkg/auth/refresh_test.go`:
- Around line 111-115: The tests TestRefreshAccessTokenWrongAuthType and
TestRefreshAccessTokenEndpointError currently assert only require.Error; change
them to assert the specific expected sentinel errors (use require.ErrorIs or
require.ErrorContains). Update TestRefreshAccessTokenWrongAuthType to assert
ErrorIs(err, ErrInvalidAuthType) and update TestRefreshAccessTokenEndpointError
to assert the appropriate sentinel (or stable substring) for endpoint failures
to avoid false positives; ensure RefreshAccessToken in refresh.go wraps/returns
ErrInvalidAuthType (from errors.go) on the wrong-auth-type path so the test can
reliably match it.
- Around line 143-149: The test for RefreshAccessToken currently asserts updated
AccessToken.AccessToken and RefreshToken but omits expiry checks; update the
success-case in refresh_test.go after calling profile.GetAuthCredentials() to
also assert that creds.AccessToken.Expiration is in the future (e.g., compare to
time.Now().Unix() or time.Now()) so the refreshed token's expiration was
persisted (reference symbols: RefreshAccessToken, profile.GetAuthCredentials,
creds.AccessToken.Expiration).

In `@otdfctl/pkg/auth/refresh.go`:
- Around line 96-104: IsTokenExpired currently checks only access-token profiles
and uses time.Unix(...).After(...), which can be confusing when reused; update
it to either (A) keep the name but add/extend the godoc on IsTokenExpired to
explicitly state "returns false for non–access-token auth types because refresh
only applies to access tokens", and change the expiry check to use the
AccessToken.Expiry.Before(time.Now()) or token.Valid() semantics for clarity
(referencing profile.GetAuthCredentials(), profiles.AuthTypeAccessToken, and
creds.AccessToken), or (B) rename the function to ShouldRefresh and adjust the
semantics to reflect a refresh decision using
creds.AccessToken.Expiry.Before(time.Now())/token.Valid(); pick one approach and
update all call sites and comments accordingly so the behavior is unambiguous.
- Around line 59-74: The current logic constructs oldToken and then calls
oauth2Config.TokenSource(ctx, oldToken).Token(), but because oldToken.Valid()
can be true this will return the same token and skip an actual refresh; to force
a refresh clear oldToken.AccessToken (set to empty) and set oldToken.Expiry to a
past time (e.g., zero or time.Now().Add(-time.Hour)) before creating tokenSource
so the Token() call will use the RefreshToken to request a new access token;
keep the existing RefreshToken and the rest of the TLS/http client handling
intact (referencing oldToken, oauth2Config.TokenSource and tokenSource.Token()).

In `@otdfctl/pkg/man/man.go`:
- Around line 248-249: The current command construction sets Args to
cobra.ExactArgs when c.Args is present but then overwrites it with
cobra.ArbitraryArgs when c.ArbitraryArgs is also present, losing required-arg
enforcement; modify the logic in the place that builds the cobra command (where
Use: buildUseString(c.Name, c.Args, c.ArbitraryArgs) and Args: args are set) so
that when both c.Args and c.ArbitraryArgs are populated you set args to
cobra.MinimumNArgs(len(c.Args)) instead of replacing it with
cobra.ArbitraryArgs, leaving cobra.ExactArgs only for the pure-required case and
cobra.ArbitraryArgs only for the pure-arbitrary case.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 49ab52f8-9d6d-4611-9c7e-1ad5c616b507

📥 Commits

Reviewing files that changed from the base of the PR and between 37870f4 and 4ac75b7.

📒 Files selected for processing (5)
  • otdfctl/pkg/auth/errors.go
  • otdfctl/pkg/auth/refresh.go
  • otdfctl/pkg/auth/refresh_test.go
  • otdfctl/pkg/man/man.go
  • otdfctl/pkg/man/man_test.go

Comment thread otdfctl/pkg/auth/refresh_test.go
Comment thread otdfctl/pkg/auth/refresh_test.go Outdated
Comment thread otdfctl/pkg/auth/refresh.go
Comment thread otdfctl/pkg/auth/refresh.go
Comment thread otdfctl/pkg/man/man.go
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a robust mechanism for refreshing access tokens within the CLI, ensuring seamless authentication management. Additionally, it enhances the CLI's documentation generation by improving how command usage strings are formatted, providing better guidance for users regarding required and optional arguments.

Highlights

  • Refresh Token Utility: Added new functionality to handle access token refreshing, including error definitions and logic to interact with the identity provider.
  • CLI Documentation Improvement: Updated the documentation processor to dynamically build command usage strings, improving clarity for required and arbitrary arguments.
  • Testing: Added comprehensive unit tests for the new refresh token logic and the updated documentation command builder.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.


The token fades, the session dies, We need a refresh, a new surprise. With code and test, the fix is clear, Authentication stays sincere.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Copy Markdown
Contributor

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 189.566332ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 109.284133ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 421.899679ms
Throughput 237.02 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 45.519467839s
Average Latency 453.160471ms
Throughput 109.84 requests/second

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements OAuth2 token refresh logic and expiration checks, alongside comprehensive unit tests. It also updates the manual page generation to format command usage strings with proper argument delimiters. The review feedback suggests enhancing the reliability of the new functions by adding nil pointer checks for the profile store and incorporating a safety buffer into the token expiration logic.

Comment thread otdfctl/pkg/auth/refresh.go
Comment thread otdfctl/pkg/auth/refresh.go
Comment thread otdfctl/pkg/auth/refresh.go
Comment thread otdfctl/pkg/auth/refresh.go Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@otdfctl/pkg/auth/refresh.go`:
- Around line 81-89: The stored Expiration currently uses newToken.Expiry.Unix()
which becomes a large negative number if newToken.Expiry is zero; update the
refresh logic in refresh.go where newCreds is built (the block creating
profiles.AuthCredentials) to check newToken.Expiry.IsZero() and set Expiration
to 0 in that case (otherwise use newToken.Expiry.Unix()). Also update
IsTokenExpired to treat Expiration == 0 as "no expiry / not expired" so a
missing expires_in round-trips correctly and freshly-refreshed tokens are not
treated as expired forever.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3ebd5e65-0541-4622-b7c9-b7ff97783142

📥 Commits

Reviewing files that changed from the base of the PR and between 4ac75b7 and 3163494.

📒 Files selected for processing (5)
  • otdfctl/pkg/auth/errors.go
  • otdfctl/pkg/auth/refresh.go
  • otdfctl/pkg/auth/refresh_test.go
  • otdfctl/pkg/man/man.go
  • otdfctl/pkg/man/man_test.go

Comment thread otdfctl/pkg/auth/refresh.go
@github-actions
Copy link
Copy Markdown
Contributor

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 187.110494ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 98.43386ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 431.81512ms
Throughput 231.58 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 43.860796998s
Average Latency 437.737802ms
Throughput 114.00 requests/second

@github-actions
Copy link
Copy Markdown
Contributor

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 199.0165ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 109.078214ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 413.514131ms
Throughput 241.83 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 42.972230757s
Average Latency 428.316849ms
Throughput 116.35 requests/second

jakedoublev
jakedoublev previously approved these changes May 13, 2026
Comment thread otdfctl/pkg/auth/refresh_test.go Outdated
Comment thread otdfctl/pkg/auth/refresh.go Outdated
@jakedoublev jakedoublev requested a review from jentfoo May 13, 2026 18:18
Copy link
Copy Markdown
Contributor

@jentfoo jentfoo left a comment

Choose a reason for hiding this comment

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

Generally looks reasonable, just the one minor bug spotted.

Comment thread otdfctl/pkg/auth/refresh.go
@github-actions
Copy link
Copy Markdown
Contributor

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 157.932409ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 83.881088ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 434.973916ms
Throughput 229.90 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 43.097522933s
Average Latency 429.389388ms
Throughput 116.02 requests/second

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

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

Inline comments:
In `@otdfctl/pkg/auth/refresh_test.go`:
- Around line 251-291: The test TestRefreshAccessTokenTLSNoVerify currently uses
httptest.NewServer (HTTP) so it doesn't validate TLS-skip behavior; replace
httptest.NewServer with httptest.NewTLSServer to exercise TLS handshake against
a self-signed cert and keep the resolver function returning tokenServer.URL so
refreshAccessToken(profile, resolver) actually connects over HTTPS; ensure
TLSNoVerify remains true on the ProfileConfig so utils.NewHTTPClient receives
tlsNoVerify=true and the test asserts the refresh succeeds, and consider adding
a separate negative test that uses TLSNoVerify=false to confirm the same
TLSServer fails.

In `@otdfctl/pkg/auth/refresh.go`:
- Around line 77-86: The refresh flow can hang because oauth2 falls back to
http.DefaultClient (no timeout) when tlsNoVerify is false; update
utils.NewHTTPClient to set a sensible Timeout (e.g., 30*time.Second) and then
call utils.NewHTTPClient(tlsNoVerify) unconditionally in refresh.go (remove the
conditional) and set ctx = context.WithValue(ctx, oauth2.HTTPClient, httpClient)
before creating oauth2Config.TokenSource(ctx, oldToken) so the token fetch uses
the timed HTTP client.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ad66f813-9c3d-4002-9ee3-91a1ac8023c6

📥 Commits

Reviewing files that changed from the base of the PR and between 3163494 and ab9c483.

📒 Files selected for processing (5)
  • otdfctl/pkg/auth/errors.go
  • otdfctl/pkg/auth/refresh.go
  • otdfctl/pkg/auth/refresh_test.go
  • otdfctl/pkg/man/man.go
  • otdfctl/pkg/man/man_test.go

Comment thread otdfctl/pkg/auth/refresh_test.go
Comment thread otdfctl/pkg/auth/refresh.go
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@otdfctl/pkg/auth/refresh_test.go`:
- Around line 129-137: The mock token handlers created via httptest.NewServer
(the http.HandlerFunc assigned to tokenServer and the other similar handlers at
the other locations) currently always return success and must be hardened to
assert the incoming request is a POST and that the expected form fields are
present; inside each handler assert r.Method == "POST", call r.ParseForm(), and
assert the form contains "grant_type" and "refresh_token", and where the test
simulates a client include an assertion for "client_id"; after these assertions
continue encoding the JSON response as before. Ensure you update each handler
instance (the tokenServer handler and the other two similar handlers referenced
in the comment) with the same request validations.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 34401108-1642-4aee-9510-74c1da1252af

📥 Commits

Reviewing files that changed from the base of the PR and between ab9c483 and 038b6b7.

📒 Files selected for processing (1)
  • otdfctl/pkg/auth/refresh_test.go

Comment thread otdfctl/pkg/auth/refresh_test.go
@github-actions
Copy link
Copy Markdown
Contributor

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 177.589891ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 89.75952ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 448.410694ms
Throughput 223.01 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 44.122219493s
Average Latency 439.46774ms
Throughput 113.32 requests/second

jakedoublev
jakedoublev previously approved these changes May 21, 2026
@alkalescent alkalescent added this pull request to the merge queue May 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 22, 2026
@alkalescent alkalescent added this pull request to the merge queue May 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 22, 2026
@alkalescent alkalescent added this pull request to the merge queue May 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 22, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
otdfctl/pkg/man/man.go (1)

239-274: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix verification gaps for otdfctl/pkg/man/man.go (lines 239-274)

  • gofumpt can’t be executed here (gofumpt: command not found), so formatting isn’t checkable.
  • golangci-lint run otdfctl/pkg/man/man.go fails typecheck (undefined: DocFlag, undefined: styleDoc), while go test ./otdfctl/pkg/man/... passes—lint needs to be rerun with a proper package-level invocation so it typechecks with the rest of the package.
🤖 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 `@otdfctl/pkg/man/man.go` around lines 239 - 274, The linter/formatter failures
are due to running tools against a single file (which causes undefined symbols
like DocFlag and styleDoc) and gofumpt not being installed; rerun the checks at
package level and ensure gofumpt is available: install gofumpt (e.g., go install
mvdan.cc/gofumpt@latest) and add it to PATH, then run golangci-lint from the
package or repo root (e.g., golangci-lint run ./otdfctl/pkg/man or golangci-lint
run) so typechecking includes definitions for DocFlag and styleDoc and the
formatter runs correctly; after that re-run gofumpt/golangci-lint to verify
buildUseString/Doc usage and related symbols pass.
🤖 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.

Outside diff comments:
In `@otdfctl/pkg/man/man.go`:
- Around line 239-274: The linter/formatter failures are due to running tools
against a single file (which causes undefined symbols like DocFlag and styleDoc)
and gofumpt not being installed; rerun the checks at package level and ensure
gofumpt is available: install gofumpt (e.g., go install mvdan.cc/gofumpt@latest)
and add it to PATH, then run golangci-lint from the package or repo root (e.g.,
golangci-lint run ./otdfctl/pkg/man or golangci-lint run) so typechecking
includes definitions for DocFlag and styleDoc and the formatter runs correctly;
after that re-run gofumpt/golangci-lint to verify buildUseString/Doc usage and
related symbols pass.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c010a3ad-2306-4ed5-b121-52e19602a933

📥 Commits

Reviewing files that changed from the base of the PR and between 038b6b7 and f6e546a.

📒 Files selected for processing (5)
  • otdfctl/pkg/auth/errors.go
  • otdfctl/pkg/auth/refresh.go
  • otdfctl/pkg/auth/refresh_test.go
  • otdfctl/pkg/man/man.go
  • otdfctl/pkg/man/man_test.go

@github-actions
Copy link
Copy Markdown
Contributor

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 157.721607ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 75.724379ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 400.799182ms
Throughput 249.50 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 43.02109539s
Average Latency 428.666909ms
Throughput 116.22 requests/second

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Govulncheck found vulnerabilities ⚠️

The following modules have known vulnerabilities:

  • examples
  • otdfctl
  • sdk
  • service
  • lib/fixtures
  • tests-bdd

See the workflow run for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants