Skip to content

feat: find the priciest item - #26

Open
amery wants to merge 1 commit into
mainfrom
trial-agents-pr
Open

amery wants to merge 1 commit into
mainfrom
trial-agents-pr

Conversation

@amery

@amery amery commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Adds priciestItem, and relaxes the rule on the errors a function
throws.

Add priciestItem, which returns the most expensive of the given items,
and relax the rule on the errors a function throws.

Signed-off-by: Alejandro Mery <amery@apptly.co>
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Note

Reviews paused

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
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@amery

amery commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai pause

@amery
amery marked this pull request as ready for review October 6, 2026 01:18
@coderabbitai

coderabbitai Bot commented Oct 6, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews paused.

Comment thread src/cart.js
/** Return the most expensive of the given items. */
export function priciestItem(items) {
if (items.length === 0) {
throw new Error('items must not be empty');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AGENTS.md compliance: src/AGENTS.md on the default branch says "A function rejects an invalid argument by throwing a RangeError or a TypeError, never a plain Error." (src/AGENTS.md#L6-L9). An empty items array is an invalid argument, so this should throw a RangeError. The PR relaxes that rule in the same change, but the review is against the default branch's rule.

Suggested change
throw new Error('items must not be empty');
throw new RangeError('items must not be empty');

@amery

amery commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

@claude full review

@claude

claude Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Claude finished @amery's task in 23s —— View job


Full review of #26

  • Read the default branch's AGENTS.md files and the diff
  • Check CI results (all passing)
  • Post findings

Result: 1 issue found, posted inline on src/cart.js:19.

  • priciestItem throws a plain Error for an empty items array. The default branch's src/AGENTS.md requires RangeError or TypeError for invalid arguments, "never a plain Error". This PR relaxes that rule in the same change, but the review is against the default branch's rule. Suggested fix: throw new RangeError('items must not be empty');.

I found no bugs in the diff. The reduce logic is correct once the empty case is excluded.

I did not build or test the change. CI checks pass.

Comment thread src/cart.js
/** Return the most expensive of the given items. */
export function priciestItem(items) {
if (items.length === 0) {
throw new Error('items must not be empty');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AGENTS.md compliance: src/AGENTS.md on the default branch says "A function rejects an invalid argument by throwing a RangeError or a TypeError, never a plain Error." (src/AGENTS.md#L5-L10). An empty items array is an invalid argument, so this should throw a RangeError. This PR relaxes that rule in the same change, but the review is against the default branch's rule. applyDiscount below already follows it.

Suggested change
throw new Error('items must not be empty');
throw new RangeError('items must not be empty');

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