Skip to content

Fix remaining review issues: tests, help text, DI consistency, boundary semantics, in-memory queries - #9

Merged
progys merged 1 commit into
masterfrom
fix-remaining-review-issues
Aug 15, 2026
Merged

progys merged 1 commit into
masterfrom
fix-remaining-review-issues

Conversation

@progys

@progys progys commented Aug 15, 2026

Copy link
Copy Markdown
Owner

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)

  • Parser (previously 0 tests): `PointParserTest`, `ShapeParserTest`, `CommandParserTest`, `GeneralParserFactoryTest`.
  • Persistence (previously 0 tests): `ShapeEntityTest` (mapping round-trips for all 3 shapes + null rejection), `ObjectStoreTest` (put/getAll, clear, and reload-from-DB on restart using a temp ObjectDB file, with the same enhancer the app uses).
  • Circle.inShape: inside / outside / boundary (closing the geometry containment gap — Triangle and Donut already had these from Reject zero-area shapes with meaningful errors #8).

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

  • 38/38 tests pass; `mvn clean install exec:java` and the file-input launch script both work (the earlier `exec:java` `CaseFormat` failure is not reproducible in the current code — it belonged to the pre-refactor state).
  • End-to-end: help, shape creation, point query, list, clear, exit, persistence across restarts, and `-f` file loading all verified.

…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).
@cursor

cursor Bot commented Aug 15, 2026

Copy link
Copy Markdown

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.

@progys
progys merged commit b26ddf3 into master Aug 15, 2026
4 checks passed
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