Skip to content

Conversation

BumpyClock
Copy link
Owner

Summary

  • handle feed URLs with mixed-case HTTP protocols
  • ignore library type errors during test compilation
  • test normalizeFeedUrl for case-insensitive protocol stripping

Testing

  • npm test

https://chatgpt.com/codex/tasks/task_e_689c091a04b883279516a22bb4ca6403

Copy link

vercel bot commented Aug 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
digests-nextjs Ready Preview Comment Aug 13, 2025 4:35am

Copy link
Contributor

coderabbitai bot commented Aug 13, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Improved URL normalization to remove HTTP/HTTPS protocols regardless of letter case, ensuring more consistent feed handling.
  • Tests
    • Added a test to verify case-insensitive protocol removal in URL normalization.
  • Chores
    • Updated pre-test build step to streamline type checking without affecting runtime behavior.

Walkthrough

Added --skipLibCheck to TypeScript compilation in pretest script. Updated normalizeFeedUrl to remove protocols case-insensitively. Introduced a new test verifying protocol removal regardless of case. No public APIs changed.

Changes

Cohort / File(s) Summary
Build/Test Tooling
scripts/pretest.js
Add TypeScript compiler flag --skipLibCheck; pretest flow otherwise unchanged.
URL Normalization
utils/url-helpers.ts, tests/urlHelpers.test.js
Make protocol stripping regex case-insensitive (/^https?:///i); update comment. Add test asserting normalizeFeedUrl removes protocol irrespective of case.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

I twitch my nose at URLs that shout,
“HTTP!” in caps—no need to pout.
With gentle regex, snip-snip—clean slate,
The scheme hops off, the host looks great.
Pretests skip the library check—hooray!
A tidy warren, code-ready for the day. 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/locate-and-fix-critical-codebase-bug

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

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

Actionable comments posted: 2

🔭 Outside diff range comments (1)
utils/url-helpers.ts (1)

7-12: Consider supporting any scheme and protocol-relative URLs

If inputs may contain feed://, ftp://, or protocol-relative //example.com, you can generalize the scheme strip and handle // at start. Safe and backward compatible with current behavior.

Apply this diff:

-      // Remove protocol (case-insensitive)
-      .replace(/^https?:\/\//i, '')
+      // Remove any scheme (case-insensitive), e.g., http(s)://, feed://, ftp://
+      .replace(/^[a-z][a-z0-9+.-]*:\/\//i, '')
+      // Handle protocol-relative URLs (e.g., //example.com)
+      .replace(/^\/\//, '')

Optionally, add tests covering:

  • 'HTTPS://Example.com' -> 'Example.com'
  • 'feed://example.com' -> 'example.com'
  • '//example.com/path' -> 'example.com/path'
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 63c31eb and 1909c2a.

📒 Files selected for processing (3)
  • scripts/pretest.js (1 hunks)
  • tests/urlHelpers.test.js (1 hunks)
  • utils/url-helpers.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/urlHelpers.test.js (1)
utils/url-helpers.ts (1)
  • normalizeFeedUrl (1-17)
🔇 Additional comments (3)
scripts/pretest.js (1)

8-8: Skip lib checks: good call to reduce test compile friction

Adding --skipLibCheck makes pretest faster and avoids noisy third-party type errors during test compilation.

utils/url-helpers.ts (1)

7-8: Case-insensitive protocol removal is correct

The i flag is the right fix to strip HTTP(S) regardless of case. The behavior matches the new test.

tests/urlHelpers.test.js (1)

9-11: Nice regression test for case-insensitive protocol stripping

This directly validates the updated regex behavior and guards against future regressions.

try {
execSync(`rm -rf compiled-tests && mkdir compiled-tests`);
execSync(`npx tsc ${modules.join(' ')} --module commonjs --target es2017 --outDir compiled-tests`, { stdio: 'inherit' });
execSync(`npx tsc ${modules.join(' ')} --module commonjs --target es2017 --skipLibCheck --outDir compiled-tests`, { stdio: 'inherit' });
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Confirm this flag is not masking issues elsewhere

If any downstream task relies on stricter type-checking (e.g., CI builds), ensure skipLibCheck is limited to tests only and not bleeding into production builds.

Run this script to see where skipLibCheck is used across the repo:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Searching for 'skipLibCheck' usage across the repository..."
rg -n --no-heading "skipLibCheck" -A2 -B2 || true

Length of output: 781


Limit skipLibCheck to test compilation only

The search shows skipLibCheck is enabled globally in your root tsconfig.json (line 9), in addition to being passed via CLI in scripts/pretest.js (line 8). This means production builds may also be skipping lib checks and masking type errors.

Recommended changes:

  • Remove "skipLibCheck": true from tsconfig.json.
  • Create a dedicated test config (e.g. tsconfig.test.json) that sets "skipLibCheck": true.
  • Update scripts/pretest.js to compile tests with that project file:
    - execSync(`npx tsc ${modules.join(' ')} --module commonjs --target es2017 --skipLibCheck --outDir compiled-tests`, { stdio: 'inherit' });
    + execSync(`npx tsc --project tsconfig.test.json ${modules.join(' ')} --module commonjs --target es2017 --outDir compiled-tests`, { stdio: 'inherit' });
  • Ensure your CI and production build steps use the root tsconfig.json without skipLibCheck.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
execSync(`npx tsc ${modules.join(' ')} --module commonjs --target es2017 --skipLibCheck --outDir compiled-tests`, { stdio: 'inherit' });
execSync(
`npx tsc --project tsconfig.test.json ${modules.join(' ')} --module commonjs --target es2017 --outDir compiled-tests`,
{ stdio: 'inherit' }
);
🤖 Prompt for AI Agents
In scripts/pretest.js around line 8, currently passing --skipLibCheck on the CLI
(and you also have "skipLibCheck": true in the root tsconfig.json), limit
skipLibCheck to test compilation by removing "skipLibCheck" from the root
tsconfig.json, adding a tsconfig.test.json that extends the root and sets
"skipLibCheck": true, and update scripts/pretest.js to compile tests using that
project file (e.g. use -p tsconfig.test.json or --project tsconfig.test.json) so
CI and production builds continue to use the root tsconfig.json without
skipLibCheck.

Comment on lines +9 to +11
test('removes protocol regardless of case', () => {
assert.strictEqual(normalizeFeedUrl('HTTP://Example.com'), 'Example.com');
});
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Broaden test coverage for edge protocols and formats

Add a couple more cases to lock in expected behavior for other common inputs.

Consider adding:

test('removes mixed-case HTTPS', () => {
  assert.strictEqual(normalizeFeedUrl('hTtPs://Example.com/'), 'Example.com');
});

test('decodes and removes encoded protocol', () => {
  assert.strictEqual(normalizeFeedUrl('HTTP%3A%2F%2FExample.com'), 'Example.com');
});

If you adopt the generalized scheme stripping, also add:

test('removes protocol-relative URLs', () => {
  assert.strictEqual(normalizeFeedUrl('//example.com/a//b/'), 'example.com/a/b');
});
🤖 Prompt for AI Agents
In tests/urlHelpers.test.js around lines 9 to 11, the current test only covers
an uppercase HTTP scheme; add additional unit tests to broaden coverage: add a
test for mixed-case HTTPS expecting 'Example.com' (input
'hTtPs://Example.com/'), a test for encoded protocol expecting 'Example.com'
(input 'HTTP%3A%2F%2FExample.com'), and if normalizeFeedUrl implements
generalized scheme stripping also add a protocol-relative URL test expecting
'example.com/a/b' (input '//example.com/a//b/'); include these assertions using
the same test/assert style as existing tests.

@BumpyClock BumpyClock requested a review from Copilot August 13, 2025 04:38
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds case-insensitive protocol handling to the normalizeFeedUrl function to properly handle feed URLs with mixed-case HTTP protocols like "HTTP://" or "Https://".

  • Updated the protocol removal regex to be case-insensitive by adding the i flag
  • Added a test case to verify mixed-case protocol handling works correctly
  • Added --skipLibCheck flag to TypeScript compilation to ignore library type errors during test compilation

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
utils/url-helpers.ts Modified regex to remove HTTP/HTTPS protocols case-insensitively
tests/urlHelpers.test.js Added test case for case-insensitive protocol removal
scripts/pretest.js Added skipLibCheck flag to TypeScript compilation options

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant