Skip to content

fix: Change getSessionToken return type to string | undefined#3036

Open
Carlgo11 wants to merge 1 commit into
parse-community:alphafrom
Carlgo11:bugfix/incorrect-getSessionToken-type
Open

fix: Change getSessionToken return type to string | undefined#3036
Carlgo11 wants to merge 1 commit into
parse-community:alphafrom
Carlgo11:bugfix/incorrect-getSessionToken-type

Conversation

@Carlgo11
Copy link
Copy Markdown

@Carlgo11 Carlgo11 commented May 7, 2026

getSessionToken() was incorrectly declared as returning string | null even though the jsdoc says it returns string or undefined. This caused issues in our parse-server implementation.

Summary by CodeRabbit

  • Bug Fixes
    • Clarified how missing session tokens are represented so absence is handled consistently.
    • Updated behavior and documentation to reduce unexpected issues when a session token is not available.
    • Improved type accuracy to increase reliability for integrations and tooling that check or consume session tokens.

@parse-github-assistant
Copy link
Copy Markdown

parse-github-assistant Bot commented May 7, 2026

🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review.

Tip

  • Keep pull requests small. Large PRs will be rejected. Break complex features into smaller, incremental PRs.
  • Use Test Driven Development. Write failing tests before implementing functionality. Ensure tests pass.
  • Group code into logical blocks. Add a short comment before each block to explain its purpose.
  • We offer conceptual guidance. Coding is up to you. PRs must be merge-ready for human review.
  • Our review focuses on concept, not quality. PRs with code issues will be rejected. Use an AI agent.
  • Human review time is precious. Avoid review ping-pong. Inspect and test your AI-generated code.

Note

Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect.

Caution

Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

ParseUser.getSessionToken() return type changed from string | null to string | undefined; the JSDoc was updated to document undefined when no session token is available.

Changes

ParseUser Type Definition Update

Layer / File(s) Summary
Type Definition
types/ParseUser.d.ts
getSessionToken() return type updated from string | null to string | undefined. JSDoc block documents undefined return when no session token is present.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 6 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description explains the issue and change but is missing required template sections: Issue, Approach, and Tasks checkboxes are not included. Add missing template sections including Issue, Approach, and Tasks sections to match the repository's required PR description format.
✅ Passed checks (6 passed)
Check name Status Explanation
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.
Security Check ✅ Passed Return type change from null to undefined in type declaration. Both are falsy, so authentication checks work identically. No security vulnerability introduced.
Engage In Review Feedback ✅ Passed No review feedback comments exist on this PR. Reviewers list is empty, and there are no review comments to engage with. The check does not apply when no feedback is present.
Title check ✅ Passed The PR title has the required 'fix:' prefix and clearly describes the main change: updating the getSessionToken return type from string | null to string | undefined.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@Carlgo11 Carlgo11 changed the title Change getSessionToken return type to string | undefined Fix: Change getSessionToken return type to string | undefined May 7, 2026
@Carlgo11 Carlgo11 force-pushed the bugfix/incorrect-getSessionToken-type branch from 6df916c to dd41b9f Compare May 7, 2026 09:20
Signed-off-by: Carl <Carlgo11@users.noreply.github.com>
@Carlgo11 Carlgo11 force-pushed the bugfix/incorrect-getSessionToken-type branch from dd41b9f to cb6368d Compare May 7, 2026 09:21
@Carlgo11
Copy link
Copy Markdown
Author

Carlgo11 commented May 7, 2026

Not really sure why the Commit Message test fails. I renamed my commit to the <type>: <summary format

@Carlgo11 Carlgo11 changed the title Fix: Change getSessionToken return type to string | undefined fix: Change getSessionToken return type to string | undefined May 7, 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)
types/ParseUser.d.ts (1)

169-175: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Revert the return type to string | null to match the runtime implementation.

The runtime implementation in src/ParseUser.ts (lines 406–411) explicitly returns null when the session token attribute is null. The declaration file changed this to string | undefined, which does not match the actual behavior. Callers checking for === undefined will miss the null case.

Additionally, update the JSDoc @returns type tag on line 173 from {string} to {string | null} for consistency.

📝 Recommended changes
-    getSessionToken(): string | undefined;
+    getSessionToken(): string | null;
-     * `@returns` {string} the session token, or undefined
+     * `@returns` {string | null} the session token, or null if not logged in
🤖 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 `@types/ParseUser.d.ts` around lines 169 - 175, Update the declaration for
getSessionToken() to match the runtime: change its return type from string |
undefined to string | null and update the JSDoc `@returns` tag from {string} to
{string | null}; ensure the signature getSessionToken(): string | null and the
JSDoc line describe the token or null so callers expecting null are correct and
consistent with src/ParseUser.ts's implementation.
🤖 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 `@types/ParseUser.d.ts`:
- Around line 169-175: Update the declaration for getSessionToken() to match the
runtime: change its return type from string | undefined to string | null and
update the JSDoc `@returns` tag from {string} to {string | null}; ensure the
signature getSessionToken(): string | null and the JSDoc line describe the token
or null so callers expecting null are correct and consistent with
src/ParseUser.ts's implementation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 34009cbb-7c1d-4e2e-8dd0-0529a9d0b107

📥 Commits

Reviewing files that changed from the base of the PR and between dd41b9f and cb6368d.

📒 Files selected for processing (1)
  • types/ParseUser.d.ts

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