Skip to content

Accept hyphens in TestingBotSessionID so modern session ids resolve#39

Merged
jochen-testingbot merged 2 commits into
masterfrom
fix-session-id-hyphens
Jul 17, 2026
Merged

Accept hyphens in TestingBotSessionID so modern session ids resolve#39
jochen-testingbot merged 2 commits into
masterfrom
fix-session-id-hyphens

Conversation

@jochen-testingbot

@jochen-testingbot jochen-testingbot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Problem

Modern TestingBot / W3C WebDriver session ids are hyphenated, e.g. b0dbacacfa63-342d529ca760-2f981532f469-.... TestingBotReportFactory extracted them with TestingBotSessionID=([A-Za-z0-9]+), which stops at the first hyphen and captures only the leading segment.

Verified against the live API during an end-to-end test: the full id resolves (/tests/<full> → an internal test id) while the truncated segment 404s. Because getAuthenticationHash() then hashes the truncated id, the embedded mini/ iframe and the share links break as well. Net effect: embedded reports, the TestingBot Build page and the GitHub-checks summary silently failed for every real session.

Fix

Widen the character class to ([A-Za-z0-9_-]+). Single extraction point; no other id parsing exists.

Adds TestingBotSessionIdParsingTest (pure unit test on the static collectSessionIDs) covering hyphenated, plain-hex, multiple and no-match inputs.

Summary by CodeRabbit

  • Bug Fixes

    • Improved session ID recognition to support characters like hyphens and underscores (not just letters and digits).
    • Session IDs are extracted more reliably from test output, including multiple IDs in a single log/result.
  • Tests

    • Added JUnit coverage for parsing hyphenated IDs, plain IDs inside surrounding text, multiple IDs in one input, and returning no matches when tokens are absent.

Modern TestingBot / W3C WebDriver session ids are hyphenated (e.g.
b0dbacacfa63-342d529ca760-...). The extraction pattern was
TestingBotSessionID=([A-Za-z0-9]+), which stopped at the first hyphen and
captured only the leading segment.

That truncated id 404s against the TestingBot REST API (the full id maps to an
internal test id) and, because getAuthenticationHash() then hashes the wrong
string, the embedded mini iframe and share links break too. Net effect: every
embedded report, Build page and GitHub-checks summary silently failed for real
sessions.

Widen the character class to [A-Za-z0-9_-]+ and add TestingBotSessionIdParsingTest
covering hyphenated, plain, multiple and no-match inputs.
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ad088c90-1dd3-40fd-96d2-84863ac090f3

📥 Commits

Reviewing files that changed from the base of the PR and between 90e9658 and 3ce76dd.

📒 Files selected for processing (1)
  • src/test/java/testingbot/TestingBotSessionIdParsingTest.java

📝 Walkthrough

Walkthrough

The session ID regex now accepts letters, digits, underscores, and hyphens. New tests verify hyphenated IDs, plain IDs, multiple tokens, and text without session ID tokens.

Changes

Session ID parsing

Layer / File(s) Summary
Session ID pattern and validation
src/main/java/testingbot/TestingBotReportFactory.java, src/test/java/testingbot/TestingBotSessionIdParsingTest.java
The extraction pattern accepts underscores and hyphens, with tests covering single, embedded, multiple, and absent session ID tokens.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 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 accurately reflects the core change: broadening TestingBotSessionID parsing for modern hyphenated session IDs.
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 docstrings
  • Create stacked PR
  • Commit on current branch

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

@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: 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 `@src/test/java/testingbot/TestingBotSessionIdParsingTest.java`:
- Around line 31-36: Add an underscore-containing session ID such as abc_def-123
to capturesMultipleSessionIds and update the assertion to verify the complete
value is captured alongside the existing IDs.
🪄 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: ASSERTIVE

Plan: Pro Plus

Run ID: 64de2a0f-97c6-4590-a104-c1b48cc9a49d

📥 Commits

Reviewing files that changed from the base of the PR and between 6c594a9 and 90e9658.

📒 Files selected for processing (2)
  • src/main/java/testingbot/TestingBotReportFactory.java
  • src/test/java/testingbot/TestingBotSessionIdParsingTest.java

Comment thread src/test/java/testingbot/TestingBotSessionIdParsingTest.java Outdated
The pattern allows [A-Za-z0-9_-]+; add an underscore-containing id (abc_def-123)
to capturesMultipleSessionIds so the underscore branch of the character class is
exercised alongside the hyphenated ids.
@jochen-testingbot
jochen-testingbot merged commit 45bf325 into master Jul 17, 2026
5 checks passed
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