#190 Stale prefixes can orphan signs - #191
Open
tpwalke2 wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Persists raw sign text and reparses cached signs after BlueMap configuration reloads to prevent stale prefixes from orphaning markers.
Changes:
- Adds V5 persistence and migration for raw front/back sign lines.
- Reparses signs against refreshed marker-group configuration.
- Adds tests, troubleshooting guidance, and a minor-version bump.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
README.md |
Documents stale-prefix recovery. |
gradle.properties |
Bumps mod version. |
agent-context/reviews/adversarial-review-feature-tpwalke2-7-line-markers-2026-08-14.md |
Removes an old review artifact. |
ConfigProvider.java |
Centralizes effective marker type. |
BlueMapAPIConnector.java |
Uses covariant marker identifiers. |
AddMarkerAction.java |
Adds covariant identifier accessor. |
UpdateMarkerAction.java |
Adds covariant identifier accessor. |
SignEntry.java |
Stores raw sign lines. |
SignHelper.java |
Captures and parses raw lines. |
SignManager.java |
Reparses signs during reload. |
SignFileVersions.java |
Adds persistence V5. |
RegionShardedSignEntryWriter.java |
Writes V5 files. |
SignEntryV4.java |
Models the previous format. |
Version1SignEntryLoader.java |
Migrates legacy entries through V5. |
Version4Converter.java |
Produces V4 migration records. |
Version5Converter.java |
Converts V4 entries to V5. |
VersionedFileSignEntryLoader.java |
Loads and migrates through V5. |
SignManagerTest.java |
Tests raw-line reparsing. |
SignEntryTest.java |
Tests new fields and equality. |
SignTransitionResolverTest.java |
Updates V5 constructors. |
SignEntryHelperTest.java |
Updates V5 constructors. |
LineGroupResolverTest.java |
Updates V5 constructors. |
SignRegionPartitionerTest.java |
Updates V5 constructors. |
RegionShardedSignEntryWriterTest.java |
Verifies V5 output. |
RegionShardedSignEntryLoaderTest.java |
Updates persisted fixtures. |
VersionedFileSignEntryLoaderTest.java |
Tests V4-to-V5 migration. |
LegacySignFileMigratorTest.java |
Updates migration fixtures. |
Suppressed comments (1)
src/main/java/com/tpwalke2/bluemapsignmarkers/core/signs/SignManager.java:241
- A V5 JSON entry whose raw array contains a
nullelement is accepted by Gson, butSignLinesParser.trimLine()then dereferences it. Because this reparse runs outsidedispatchTransition()'s per-entry catch, one malformed persisted sign aborts the entire reload and prevents all later signs from being refreshed. Catch reparse failures per entry and preserve the cached parse, matching the existing malformed-entry fallback.
var freshFront = parser.parse(entry.frontRawLines());
var freshBack = parser.parse(entry.backRawLines());
return entry.withParsedText(freshFront, freshBack);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
What
Fixes stale-prefix orphaned signs (#190): editing a marker group's prefix (especially a
REGEXprefix) could orphan already-placed signs, which this PR fixes by persisting raw sign text so/bluemap reloadcan reparse it.Why
SignEntryonly stored the parsed label/detail, not the sign's raw text. When a group's prefix/regex was edited and the server reloaded config,SignManagerhad no way to reparse a sign against the new rules — it could only diff a stale cached parse, so signs that no longer matched any group silently vanished from the map and stayed gone.Changes
SignEntrynow storesfrontRawLines/backRawLines; bumped toSignFileVersions.V5with aVersion5Convertermigrating older formats (raw lines absent/nullfor pre-V5 entries).SignHelper: captures raw sign lines once and parses from them, instead of discarding the raw text after parsing.SignManager.reloadConfig(): on/bluemap reload, reparses each cached sign from its raw text (reparseFromRawLines) against the freshly rebuiltSignLinesParserbefore diffing old vs. new representation, so a sign self-heals if its prefix/group now parses differently. Falls back to the old cached-parse diff when raw text isn't available (pre-V5 entries).ConfigProvider: extractedeffectiveType()to centralize the "null type defaults toPOI" rule, removing three duplicated inline checks.README: added a Troubleshooting section documenting that signs orphaned by this bug before upgrading stay broken until manually re-edited or the server restarts (no raw text to recover from) — signs created/edited on a version with this fix self-heal automatically going forward.Testing
./gradlew test— new/updated coverage inSignManagerTest(reparse-on-reload behavior),SignEntryTest,Version4/5ConverterandVersionedFileSignEntryLoaderTest(V5migration)../gradlew runServer— manually verify: place a sign under aREGEXgroup, edit that group's prefix in config, run/bluemap reload, confirm the sign's marker updates/moves groups instead of disappearing.