Skip to content

chore: deflake tests#425

Merged
zepatrik merged 4 commits into
masterfrom
alnr/flake
May 12, 2026
Merged

chore: deflake tests#425
zepatrik merged 4 commits into
masterfrom
alnr/flake

Conversation

@alnr
Copy link
Copy Markdown
Collaborator

@alnr alnr commented Mar 31, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of workspace vs. project credential conflicts so project API key takes proper precedence.
  • Refactor

    • Command initialization now enables usage templating immediately.
  • Tests

    • Adjusted project retrieval test coverage and updated legacy namespace setup behavior in test helpers.
  • Chores

    • Updated several dependency versions.

Review Change Stack

@alnr alnr requested a review from shaunnkhan March 31, 2026 12:25
@alnr alnr self-assigned this Mar 31, 2026
@alnr alnr requested a review from zepatrik March 31, 2026 12:58
Comment thread cmd/cloudx/client/command_helper_test.go Outdated
Use an 8-char slug prefix so the test exercises prefix lookup while staying
unique within the fresh test account.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

Warning

Rate limit exceeded

@alnr has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 35 minutes and 57 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3dd544aa-8f9d-46ea-837c-2b827962750f

📥 Commits

Reviewing files that changed from the base of the PR and between f1e0437 and 2e56c86.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (1)
  • go.mod
📝 Walkthrough

Walkthrough

This PR tracks when a workspace is sourced from config, changes project-ID resolution so a project API key path clears conflicting config-derived workspace IDs, enables Cobra usage templating directly in NewRootCmd, updates related tests, and bumps several module versions.

Changes

Workspace Precedence and Command Initialization

Layer / File(s) Summary
Workspace Origin Tracking
cmd/cloudx/client/command_helper.go
CommandHelper struct gains a workspaceFromConfig boolean field to record whether the active workspace was derived from configuration.
Config-Based Workspace Determination
cmd/cloudx/client/command_helper.go
determineWorkspaceID sets workspaceFromConfig = true when config.SelectedWorkspace is used to populate workspaceID.
Project API Key Precedence
cmd/cloudx/client/command_helper.go
determineProjectID refines the workspace conflict check to ignore conflicts when the workspace originated from config and explicitly clears workspaceID so the project API key path takes precedence.
Root Command Templating
cmd/root.go
NewRootCmd now directly calls cmdx.EnableUsageTemplating during construction instead of using sync.Once lazy initialization; sync import and commandTemplatingOnce package variable are removed.
Test Updates
cmd/cloudx/client/command_helper_test.go, cmd/cloudx/relationtuples/relationtuples_test.go
GetProject test now uses an 8-character slug prefix; relationtuples test helper switches from append to replace operation for namespace configuration.
Dependency Updates
go.mod
Bumped versions for github.com/ory/kratos, github.com/moby/moby/api, github.com/moby/moby/client, and github.com/ory/dockertest/v4.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided by the author, leaving all required sections from the template empty, including the problem statement and related issue reference. Add a description explaining why the tests were flaky, what changes fix the issues, and reference the related issue if one exists.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore: deflake tests' accurately summarizes the main changes, which involve modifying tests to reduce flakiness in multiple test files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch alnr/flake

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

Kratos's v26.2.0 tag declares module github.com/ory/kratos (no /v26 suffix),
so it's recorded as the pseudo-version of that commit. Also bumps the
indirect dockertest pin off the beta.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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

🧹 Nitpick comments (1)
go.mod (1)

202-203: Consider updating to newer patch versions of moby modules.

Both github.com/moby/moby/api (v1.54.1) and github.com/moby/moby/client (v0.4.0) are valid releases. However, newer patch versions are available: api v1.54.2 and client v0.4.1. Consider updating to these more recent patches to incorporate any bug fixes or improvements.

🤖 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 `@go.mod` around lines 202 - 203, Update the moby module versions in go.mod:
change github.com/moby/moby/api from v1.54.1 to v1.54.2 and
github.com/moby/moby/client from v0.4.0 to v0.4.1, then run `go get`/`go mod
tidy` (or `go get github.com/moby/moby/api@v1.54.2
github.com/moby/moby/client@v0.4.1`) to refresh the lockfile and ensure the new
patches are pulled; finally run your build/tests to verify no regressions after
updating these modules.
🤖 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 `@go.mod`:
- Line 32: Update the github.com/ory/kratos dependency in go.mod to the secure
pseudo-version that fixes the HIGH severity SQL injection (replace the existing
kratos line with github.com/ory/kratos v1.3.1-0.20260320110106-9d7085948039),
run the module update commands (e.g., go get
github.com/ory/kratos@v1.3.1-0.20260320110106-9d7085948039 and go mod tidy) to
refresh go.mod and go.sum, and amend the PR description to explicitly call out
this kratos security patch as a critical dependency update separate from the
test-deflake changes.

---

Nitpick comments:
In `@go.mod`:
- Around line 202-203: Update the moby module versions in go.mod: change
github.com/moby/moby/api from v1.54.1 to v1.54.2 and github.com/moby/moby/client
from v0.4.0 to v0.4.1, then run `go get`/`go mod tidy` (or `go get
github.com/moby/moby/api@v1.54.2 github.com/moby/moby/client@v0.4.1`) to refresh
the lockfile and ensure the new patches are pulled; finally run your build/tests
to verify no regressions after updating these modules.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6321ca68-eb1d-4e08-92a3-6e780d37ce40

📥 Commits

Reviewing files that changed from the base of the PR and between 41c19ca and f1e0437.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (1)
  • go.mod

Comment thread go.mod
Fixes GHSA-9jj7-4m8r-rfcm flagged by the docker image scan.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alnr alnr requested a review from zepatrik May 11, 2026 18:38
@zepatrik zepatrik merged commit d2c5a3e into master May 12, 2026
17 checks passed
@zepatrik zepatrik deleted the alnr/flake branch May 12, 2026 09:01
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.

2 participants