Skip to content

fix(e2e): avoid resolving unrelated workspaces - #23994

Open
sameekshyaranjan wants to merge 1 commit into
eclipse-che:mainfrom
sameekshyaranjan:fix/e2e-workspace-name-resolution
Open

sameekshyaranjan wants to merge 1 commit into
eclipse-che:mainfrom
sameekshyaranjan:fix/e2e-workspace-name-resolution

Conversation

@sameekshyaranjan

@sameekshyaranjan sameekshyaranjan commented Oct 15, 2026 •

Copy link
Copy Markdown

What does this PR do?

Prevents the E2E workspace URL resolver from selecting an unrelated DevWorkspace when an exact name is missing. The generated-name fallback now requires the candidate's kubernetes.io/metadata.name display-name label to equal the requested name. Exact resource-name lookup and backup-restore lookup are preserved.

Adds driverless regression tests for direct and list exact matches, restored workspaces, unrelated suffixed workspaces, missing labels, and ambiguous display names.

Screenshot/screencast of this PR

Not applicable: this changes E2E test infrastructure only.

What issues does this PR fix or reference?

Fixes #23993.

How to test this PR?

From tests/e2e on Linux with Node.js and npm:

npm ci
TS_USE_WEB_DRIVER_FOR_TEST=false USERSTORY=ApiUrlResolverAPI npm run test

The six new resolver tests, TypeScript compilation, and ESLint/Prettier checks on the changed files passed locally. I also attempted the full E2E suite. Its first integration test could not run locally because this Windows environment has no oc CLI or Che cluster credentials. The repository-wide lint command reports line-ending errors in untouched files on this Windows checkout; the changed files pass lint and formatting checks.

PR Checklist

As the author of this pull request, I made sure that:

  • The Eclipse Contributor Agreement is valid (ECA check passed)
  • Code produced is complete
  • Code builds without errors
  • Tests are covering the bugfix
  • The repository devfile is up to date and works (not exercised locally)
  • Sections What issues does this PR fix or reference and How to test this PR are completed
  • Relevant user documentation was considered; no user-facing behavior changes
  • Relevant contributing documentation was considered; no contributor workflow changes
  • CI/CD changes were considered; none are needed

Reviewers

Reviewers, please comment how you tested the PR when approving it.

Summary by CodeRabbit

  • Bug Fixes
    • Improved workspace URL resolution for restored workspaces by checking their metadata name as well as the generated name suffix.
    • Prevented similarly named workspaces from being treated as matches and retained clear errors when no unique match is found.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e92e4f1f-aff6-4070-9bb2-cf1f9ea00d58
📥 Commits

Reviewing files that changed from the base of the PR and between 94f781a and 04c3976.

📒 Files selected for processing: 2
  • tests/e2e/specs/api/ApiUrlResolverAPI.spec.ts
  • tests/e2e/utils/workspace/ApiUrlResolver.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

📝 Walkthrough

The workspace URL resolver now requires a matching display-name label before it accepts a generated-name fallback. End-to-end tests cover exact matches, restored workspaces, near matches, and multiple matching workspaces.

Changes: Workspace URL resolution

Layer / File(s) Summary
Display-name fallback matching
tests/e2e/utils/workspace/ApiUrlResolver.ts
The fallback checks that a listed workspace’s kubernetes.io/metadata.name label equals the requested name before accepting its generated-name suffix. Comments, logs, and error text describe display-name matching.
Resolver end-to-end coverage
tests/e2e/specs/api/ApiUrlResolverAPI.spec.ts
Tests cover direct and list-based exact matches, restored-workspace resolution by label, rejected near matches, and errors for multiple label matches.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 04c39

No actionable merge-blocking risk remains in the workspace URL fallback change after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Issue #23993 requires the resolver to reject an unrelated suffixed DevWorkspace and to preserve restored-workspace resolution. ApiUrlResolver.ts now requires kubernetes.io/metadata.name to equal t…
Out of Scope Changes check Passed The changes are limited to ApiUrlResolver.ts and its driverless regression tests in ApiUrlResolverAPI.spec.ts. The resolver change and test cases directly support issue #23993. No unrelated produc…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preventing the E2E resolver from selecting unrelated workspaces.
Full details: Linked Issues check

Explanation

Issue #23993 requires the resolver to reject an unrelated suffixed DevWorkspace and to preserve restored-workspace resolution. ApiUrlResolver.ts now requires kubernetes.io/metadata.name to equal the requested name before it accepts the generated-name suffix. Exact direct lookup and exact list lookup remain unchanged. The new tests cover exact matches, a restored workspace-4fnq, an unrelated workspace-2, a missing label, and multiple matching labels.

Full details: Out of Scope Changes check

Explanation

The changes are limited to ApiUrlResolver.ts and its driverless regression tests in ApiUrlResolverAPI.spec.ts. The resolver change and test cases directly support issue #23993. No unrelated product or infrastructure changes are shown.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@sameekshyaranjan
sameekshyaranjan force-pushed the fix/e2e-workspace-name-resolution branch 3 times, most recently from 240638b to 92e0405 Compare October 15, 2026 15:47
Require a matching display-name label before accepting a generated DevWorkspace name. Add regression tests for exact and suffixed names, unrelated workspaces, missing labels, and ambiguity.

Fixes eclipse-che#23993

Signed-off-by: Sameekshya Ranjan Sahu <148322255+sameekshyaranjan@users.noreply.github.com>
@sameekshyaranjan
sameekshyaranjan force-pushed the fix/e2e-workspace-name-resolution branch from 92e0405 to 3e98b63 Compare October 15, 2026 15:51
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.

E2E workspace-name fallback can resolve an unrelated DevWorkspace

1 participant