Skip to content

feat: add cat lookup/removal and python geometry helpers - #65

Open
tsah-baz wants to merge 4 commits into
mainfrom
test/prlc-3-basic
Open

feat: add cat lookup/removal and python geometry helpers#65
tsah-baz wants to merge 4 commits into
mainfrom
test/prlc-3-basic

Conversation

@tsah-baz

@tsah-baz tsah-baz commented Aug 4, 2026

Copy link
Copy Markdown

Adds name-based lookup and removal to the NestJS cats service, and a small python geometry helper module for area calculations.

Testing: ran the nestjs unit tests locally.

@baz-scm baz-scm deleted a comment from baz-reviewer-dev Bot Aug 4, 2026
@baz-reviewer-dev

baz-reviewer-dev Bot commented Aug 4, 2026

Copy link
Copy Markdown

Merger

Pending

The reviewer’s unresolved medium-severity concern is unaddressed: remove(name) deletes only the first duplicate-named cat, leaving others. Author action or an explicit semantic decision is needed before re-evaluation.

Commit 7158939 · Evaluated 2026-08-04 14:29 UTC


Review this PR on Baz | Customize your next review

Comment on lines +24 to +29
remove(name: string): Promise<void> {
const index = this.cats.findIndex((candidate) => candidate.name === name);
if (index === -1) {
throw new NotFoundException(`No cat named ${name}`);
}
this.cats.splice(index, 1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Removal leaves duplicate named cats

create doesn't enforce unique names, so an admin can add two cats with the same name — then remove(name) deletes only the first match and leaves the duplicate, so the name persists — should we enforce uniqueness on insert or make remove/findByName address all matches?

Severity

Want Baz to fix this for you? Activate Fixer

Prompt for AI Agents
Before applying, verify this suggestion against the current code. In
`typescript/nestjs/src/cats/cats.service.ts` around lines 24-29, the `remove(name)`
method deletes only the first matching cat (it uses `findIndex` + `splice(index, 1)`),
which breaks correctness when duplicate `name` entries exist. Refactor by making the
service’s duplicate semantics consistent: either enforce unique `name` when creating
cats (add a pre-insert check and throw an appropriate HTTP error like conflict), or
change `remove(name)` to remove all cats with that `name` (e.g., filter/splice all
matches) so `findByName(name)` no longer returns a remaining entry after removal. Ensure
the corresponding logic for `findByName(name)` (and any `create` method) aligns with the
chosen semantics and add/update tests to cover duplicate removal.

@tsah-baz

tsah-baz commented Aug 5, 2026

Copy link
Copy Markdown
Author

Baz summarize

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant