Skip to content

[seed 1a2ddc] Evaluation change; do not merge - #26

Open
sshiv012 wants to merge 1 commit into
coderabbit-eval/basefrom
seed/1a2ddc
Open

[seed 1a2ddc] Evaluation change; do not merge#26
sshiv012 wants to merge 1 commit into
coderabbit-eval/basefrom
seed/1a2ddc

Conversation

@sshiv012

@sshiv012 sshiv012 commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Evaluation PR. Do not merge.

  • Update resolveUidByEmail to return the UID from the email lookup result.
  • Remove rejection of missing or placeholder users with BadRequestException.
Author Lines added Lines removed
sshiv012 3 10

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change simplifies resolveUidByEmail. It removes explicit rejection of missing or placeholder users and directly returns the UID from the email lookup result.

Changes

Computing unit access

Layer / File(s) Summary
Simplify email-based UID resolution
computing-unit-managing-service/src/main/scala/org/apache/texera/service/resource/ComputingUnitAccessResource.scala
resolveUidByEmail now directly dereferences the email lookup result and returns its UID. Explicit BadRequestException handling was removed.

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

Suggested reviewers: pg1204, xuang7

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title identifies this as an evaluation change, which matches the PR objective, but it does not describe the resolveUidByEmail behavior change.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch seed/1a2ddc

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

@sshiv012

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sshiv012

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sshiv012

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

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
`@computing-unit-managing-service/src/main/scala/org/apache/texera/service/resource/ComputingUnitAccessResource.scala`:
- Around line 117-120: Update resolveUidByEmail to inspect the fetched user’s
getIsPlaceholder value and throw BadRequestException for placeholder accounts
before returning the UID. Preserve the existing UID resolution for
non-placeholder users so grantAccess cannot persist access for placeholder
accounts.
- Around line 117-120: Update resolveUidByEmail to validate the result of
userDao.fetchOneByEmail before calling getUid: throw BadRequestException("User
with the given email does not exist") when the result is null or
getIsPlaceholder is true, ensuring grant/revoke create no access record for
either case.
🪄 Autofix

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: 6689d7f1-258c-42a3-a304-61540f649289

📥 Commits

Reviewing files that changed from the base of the PR and between 133da7b and c07593b.

📒 Files selected for processing (1)
  • computing-unit-managing-service/src/main/scala/org/apache/texera/service/resource/ComputingUnitAccessResource.scala

Comment on lines +117 to +120
* Resolves an email to its user id. Shared by grant/revoke.
*/
private def resolveUidByEmail(email: String): Integer = {
val user = userDao.fetchOneByEmail(email)
if (user == null || user.getIsPlaceholder) {
throw new BadRequestException("User with the given email does not exist")
}
user.getUid
}
private def resolveUidByEmail(email: String): Integer =
userDao.fetchOneByEmail(email).getUid

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 12 \
  'getIsPlaceholder|setIsPlaceholder|grantAccess|ComputingUnitUserAccessDao|merge\(' \
  --glob '*.scala' .

Repository: sshiv012/texera

Length of output: 50372


Authorization Bypass (CWE-863): Incorrect Authorization

Reachability: External

Reject placeholder users before persisting access.

resolveUidByEmail returns the UID for a placeholder account, so grantAccess can persist access for that account. Reject users where getIsPlaceholder is true and return BadRequestException, as required by the existing test.

🤖 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
`@computing-unit-managing-service/src/main/scala/org/apache/texera/service/resource/ComputingUnitAccessResource.scala`
around lines 117 - 120, Update resolveUidByEmail to inspect the fetched user’s
getIsPlaceholder value and throw BadRequestException for placeholder accounts
before returning the UID. Preserve the existing UID resolution for
non-placeholder users so grantAccess cannot persist access for placeholder
accounts.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 10 \
  'fetchOneByEmail|resolveUidByEmail|nonExistentEmail|BadRequestException' \
  --glob '*.scala' .

Repository: sshiv012/texera

Length of output: 50372


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- resource structure and relevant implementation ---'
ast-grep outline computing-unit-managing-service/src/main/scala/org/apache/texera/service/resource/ComputingUnitAccessResource.scala
sed -n '100,205p' computing-unit-managing-service/src/main/scala/org/apache/texera/service/resource/ComputingUnitAccessResource.scala

printf '%s\n' '--- focused tests ---'
rg -n -C 12 \
  'nonExistentEmail|placeholder|grantAccess|revokeAccess|ComputingUnitAccessResource' \
  computing-unit-managing-service/src/test --glob '*.scala' || true

printf '%s\n' '--- DAO declarations and implementations ---'
rg -n -C 8 \
  'fetchOneByEmail|class UserDao|trait UserDao|interface UserDao' \
  --glob '*.scala' --glob '*.java' \
  computing-unit-managing-service user-service core || true

printf '%s\n' '--- placeholder fields and user creation ---'
rg -n -C 8 \
  'getIsPlaceholder|setIsPlaceholder|isPlaceholder|placeholder' \
  --glob '*.scala' --glob '*.java' \
  computing-unit-managing-service user-service core || true

Repository: sshiv012/texera

Length of output: 50371


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- UserDao lookup contract ---'
rg -l --glob '*.scala' --glob '*.java' 'class UserDao|trait UserDao|fetchOneByEmail' . \
  | head -n 40
rg -n -C 15 --glob '*.scala' --glob '*.java' \
  'class UserDao|trait UserDao|fetchOneByEmail' . \
  | head -n 240

printf '%s\n' '--- resource imports and exception conventions ---'
sed -n '1,45p' computing-unit-managing-service/src/main/scala/org/apache/texera/service/resource/ComputingUnitAccessResource.scala
rg -n -C 8 --glob '*.scala' \
  'getIsPlaceholder|User with the given email does not exist|placeholder account' \
  computing-unit-managing-service/src/main computing-unit-managing-service/src/test \
  | head -n 220

Repository: sshiv012/texera

Length of output: 39546


Validate the resolved user before using its UID.

When fetchOneByEmail returns null, throw BadRequestException("User with the given email does not exist") instead of dereferencing getUid. Also reject users where getIsPlaceholder is true; both cases require HTTP 400 and no access record.

🤖 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
`@computing-unit-managing-service/src/main/scala/org/apache/texera/service/resource/ComputingUnitAccessResource.scala`
around lines 117 - 120, Update resolveUidByEmail to validate the result of
userDao.fetchOneByEmail before calling getUid: throw BadRequestException("User
with the given email does not exist") when the result is null or
getIsPlaceholder is true, ensuring grant/revoke create no access record for
either case.

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.

1 participant