Skip to content

fix(internals): add url length validation for url generation#169

Open
coryrylan wants to merge 1 commit into
mainfrom
topic-url-generation-fix
Open

fix(internals): add url length validation for url generation#169
coryrylan wants to merge 1 commit into
mainfrom
topic-url-generation-fix

Conversation

@coryrylan

@coryrylan coryrylan commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator
  • Introduced a maximum URL length constant and validation in the createPlaygroundURL function to ensure URLs do not exceed 32,768 characters.
  • Added tests to verify that errors are thrown when the URL length limit is exceeded, ensuring error handling in service and utils.

Summary by CodeRabbit

  • Bug Fixes
    • Improved playground URL generation to enforce a maximum URL length and return a clear “limit exceeded” error when the playground base URL is configured.
    • Enhanced URL serialization to safely encode large payloads without failing on oversized data.
  • Tests
    • Added coverage for URL-length enforcement, including browser-boundary scenarios and updated serialization behavior.
  • Chores / CI
    • Updated the GitHub Pages artifact upload to include hidden files under the built pages output.

@coryrylan coryrylan self-assigned this Jul 1, 2026
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 46e819fe-8532-4222-87f1-bc149c984fab

📥 Commits

Reviewing files that changed from the base of the PR and between b7e16c3 and 8c79be4.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • projects/internals/tools/src/playground/service.test.ts
  • projects/internals/tools/src/playground/utils.test.ts
  • projects/internals/tools/src/playground/utils.ts

📝 Walkthrough

Walkthrough

Adds playground URL length enforcement and chunked serialization in playground utilities, extends oversize-path tests, and updates the Pages artifact upload to include hidden files.

Changes

Playground URL length limit enforcement

Layer / File(s) Summary
URL validation and serialization
projects/internals/tools/src/playground/utils.ts
createURL returns early when the base URL is empty, validates the encoded URL against MAX_PLAYGROUND_URL_LENGTH, and throws ToolError when exceeded; serialize switches to chunked byte-to-binary conversion before base64 encoding.
Oversize URL tests
projects/internals/tools/src/playground/utils.test.ts, projects/internals/tools/src/playground/service.test.ts
Tests assert createPlaygroundURL throws ToolError with a limit-specific message for oversized content, and PlaygroundService.create returns an error result with no result when the generated URL exceeds the limit.

Pages artifact upload

Layer / File(s) Summary
Hidden files in Pages artifact
.github/workflows/ci.yml
The Pages artifact upload step is configured to include hidden files in the uploaded output.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: johnyanarella

Sequence Diagram(s)

🚥 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 clearly matches the main change: adding URL length validation to playground URL generation.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch topic-url-generation-fix

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

projects/internals/tools/src/playground/service.test.ts

Parsing error: error TS5012: Cannot read file '/tsconfig.json': ENOENT: no such file or directory, open '/tsconfig.json'.

projects/internals/tools/src/playground/utils.test.ts

Parsing error: error TS5012: Cannot read file '/tsconfig.json': ENOENT: no such file or directory, open '/tsconfig.json'.


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 `@projects/internals/tools/src/playground/utils.ts`:
- Around line 153-163: Return early in the playground URL builder when
ELEMENTS_PLAYGROUND_BASE_URL is unset so the empty-string fallback is preserved;
move the guard ahead of the url construction and MAX_PLAYGROUND_URL_LENGTH
validation in utils.ts, before encodeURI(...) and the ToolError check inside the
playground URL generation logic.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 36e5c4ad-5862-42d2-9902-47438694ec89

📥 Commits

Reviewing files that changed from the base of the PR and between a9a0571 and b68f580.

📒 Files selected for processing (3)
  • projects/internals/tools/src/playground/service.test.ts
  • projects/internals/tools/src/playground/utils.test.ts
  • projects/internals/tools/src/playground/utils.ts

Comment thread projects/internals/tools/src/playground/utils.ts Outdated
@coryrylan coryrylan force-pushed the topic-url-generation-fix branch from b68f580 to 02eff2a Compare July 1, 2026 19:12

@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 `@projects/internals/tools/src/playground/utils.test.ts`:
- Around line 576-577: The comment in the playground URL length test is
describing the wrong constraint; update the wording near the Uint8Array setup in
utils.test.ts to reflect the real intent. In the test around serialize and
MAX_PLAYGROUND_URL_LENGTH, rephrase it to say the data is high-entropy and
resists gzip so the generated playground URL exceeds the length limit, rather
than mentioning V8’s argument-count limit.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 3430600c-95dd-4764-86c5-554822b8e768

📥 Commits

Reviewing files that changed from the base of the PR and between b68f580 and 02eff2a.

📒 Files selected for processing (3)
  • projects/internals/tools/src/playground/service.test.ts
  • projects/internals/tools/src/playground/utils.test.ts
  • projects/internals/tools/src/playground/utils.ts

Comment thread projects/internals/tools/src/playground/utils.test.ts
@coryrylan coryrylan force-pushed the topic-url-generation-fix branch 2 times, most recently from c4d85dc to b7e16c3 Compare July 1, 2026 23:09
@github-actions github-actions Bot added scope(ci) github_actions Pull requests that update GitHub Actions code labels Jul 1, 2026
- Introduced a maximum URL length constant and validation in the createPlaygroundURL function to ensure URLs do not exceed 32,768 characters.
- Added tests to verify that errors are thrown when the URL length limit is exceeded, ensuring robust error handling in service and utils.

Signed-off-by: Cory Rylan <crylan@nvidia.com>
@coryrylan coryrylan force-pushed the topic-url-generation-fix branch from b7e16c3 to 8c79be4 Compare July 1, 2026 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code scope(ci) scope(internals)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants