Fix remaining review issues: tests, help text, DI consistency, boundary semantics, in-memory queries - #9
Merged
Conversation
…ry semantics, in-memory queries - Add parser tests (PointParser, ShapeParser, CommandParser, GeneralParserFactory), persistence tests (ShapeEntity mapping, ObjectStore round-trip), and Circle containment tests. Suite grows 21 -> 38 tests on this branch. - Fix HelpCommand copy-paste bug (circle example described donut radii). - Inject PrintStream into FileInputProcessor instead of hardcoded System.out. - Replace ShapeCommand's silent boolean with a ShapeOutputMode enum. - Make Triangle boundary semantics strict-interior like Circle (s > 0, t > 0). - Cache shapes in memory in ObjectStore so point queries never hit the database (quiz requirement: scale to tens of millions of shapes in memory).
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cleans up the remaining items from the architecture review, in priority order.
1. Test coverage (the biggest gap — now 38 tests on this branch)
2. Help text bug
`circle 3 5 2 - ... inner radius 1.8 and outer radius 2` was a copy-paste from the donut line. Fixed, and the donut example now uses ascending radii (`donut 1.1 7.8 1.8 2`). `HelpCommandTest` updated (it had locked in the buggy strings).
3. DI consistency
`FileInputProcessor` printed to hardcoded `System.out`; it now receives the injected `PrintStream`, matching the rest of the app. (It intentionally keeps the `ConcreteParserFactory` path: file input is shape-definitions only — routing it through the general parser would let an `exit` line in a file terminate the whole app.)
4. `silent` boolean → `ShapeOutputMode`
`ShapeCommand` took a raw `boolean silent`. Replaced with a `ShapeOutputMode { SILENT, VERBOSE }` enum threaded through `CommandFactory`/processors — no more unnamed boolean flags.
5. Consistent boundary semantics
`Triangle.inShape` used `s >= 0 && t >= 0` (edges on two sides counted as inside) while `Circle` used strict `<`. Triangle now uses strict interior (`s > 0 && t > 0`) to match.
6. Point queries no longer hit the database
`ObjectStore` now keeps an in-memory copy of all shapes (loaded once from ObjectDB at startup, updated on put/clear). `getAll()` serves queries from RAM, matching the quiz requirement of "tens of millions of shapes held in program memory" instead of re-querying ObjectDB on every point query.
Verified