Persist exact listed price for live GE offers - #79
Conversation
Updated the comment for listedPrice to clarify its purpose and added the @SerializedName annotation.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesOfferEvent price persistence
Estimated code review effort: 1 (Trivial) | ~4 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/test/java/com/flippingutilities/OfferEventSerializationTest.java (1)
21-23: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert JSON values structurally instead of using substring matching.
containscan pass on prefix matches such as"p":910. Parse the JSON object and assert the exact numeric values forpandlp.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/com/flippingutilities/OfferEventSerializationTest.java` around lines 21 - 23, Update OfferEventSerializationTest to parse the serialized JSON into a JSON object before asserting values. Replace substring checks for "p" and "lp" with structural numeric assertions that require exact values 91 and 94, preventing prefix matches such as 910.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/test/java/com/flippingutilities/OfferEventSerializationTest.java`:
- Around line 21-23: Update OfferEventSerializationTest to parse the serialized
JSON into a JSON object before asserting values. Replace substring checks for
"p" and "lp" with structural numeric assertions that require exact values 91 and
94, preventing prefix matches such as 910.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a0b6f25b-c168-4d27-a182-b9ff878d0c72
📒 Files selected for processing (2)
src/main/java/com/flippingutilities/model/OfferEvent.javasrc/test/java/com/flippingutilities/OfferEventSerializationTest.java
Parse the serialized offer into a JsonObject instead of substring-matching
the raw string. `json.contains("\"lp\":94")` is sensitive to formatting,
cannot distinguish a top-level key from a nested one, and can be satisfied
by a longer key that happens to end in the one under test.
Add the equal-price case, which a substring assertion cannot check at all:
when the listed and execution prices are both 91 there is a single distinct
value in the document, so `contains` passes even if only one of the two keys
was written.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Javadoc on the round-trip and backward-compatibility cases, stating what each one guarantees rather than restating the assertions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Summary
OfferEvent.listedPricefield as compact JSON keylpprice/punchanged as the average execution price of filled unitslpdeserializes to0listedPriceis already populated from RuneLite'sGrandExchangeOffer.getPrice(). Persisting it allows a restarted client and other local integrations to recover the exact limit price of a live offer, including offers with zero fills, without conflating it with execution price.Verification
gradlew testpasses with Temurin JDK 11pandlpround-trip independently and old JSON remains readableSummary by CodeRabbit
Bug Fixes
Tests