feat: sync issue resolver — recover broken/missing character links + re-sync stranded data#70
Merged
Merged
Conversation
Recovers broken/missing character links and re-pushes stranded data (the case where an actor was edited while the module was offline, so updateActor never fired and the linked entity kept its blank initial snapshot): - getSyncIssues(): scan character actors; flag 'unlinked' / 'broken' (entityId flag pointing at a 404'd entity = "failed to find existing character"), each with a name-matched entity suggestion + the full candidate list. - matchActorToEntity() / createEntityForActor() (creates the system's character type) / repushActor() (re-push a linked actor's current fields). - _notifySyncIssues(): on initial sync, warn the GM to open the dashboard when issues exist. Dashboard resolver tab (UI) to follow. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y14Y6VXb7iB2xcNrYNDJa5
Adds an "Issues" tab that surfaces orphaned character actors (unlinked, or linked
to a now-missing entity = "failed to find existing character") and lets the GM
resolve each:
- Match to existing: a name-matched <select> (best guess preselected) → links
the actor to the chosen Chronicle entity and pushes its current data.
- Create new: creates a Chronicle character of the SYSTEM's type (Draw Steel
-> Hero) and links it.
Plus a per-actor "Re-sync" button on the Characters tab for linked actors — the
stranded-data fix (actor edited while the module was offline) that "Push All
Actors" skips. A nav badge + the connect-time notification point here.
Wires _buildIssuesData() + resolve-match/create/repush actions to the ActorSync
model methods. Template compiles; JS syntax validated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y14Y6VXb7iB2xcNrYNDJa5
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.
Sync Issue Resolver — recover character links + re-sync stranded data
Fixes the class of problem behind "my heroes are blank in Chronicle even though Foundry has the data": pushes to Chronicle only happen on live
createActor/updateActorhooks, and the initial sync only pulls. So if an actor is filled in while the module is disconnected, or its entity link breaks, the data strands in Foundry with no way to reconcile — and "Push All Actors" skips already-linked actors.What this adds
Detection (
actor-sync.mjs) —getSyncIssues()scans character actors and flags:unlinked— noentityIdflagbroken—entityIdflag points at an entity that 404s = "failed to find existing character"each with a name-matched Chronicle-entity suggestion + the full candidate list. Plus model methods:
matchActorToEntity(),createEntityForActor()(creates the system's character type via the adapter — Draw Steel → Hero), andrepushActor().Notification — on connect/initial-sync, if issues exist: "N character(s) need attention — open the Chronicle dashboard (Issues)."
Resolver tab (dashboard) — a new Issues tab (with a count badge) listing each orphan with:
<select>of Chronicle characters, best name-match preselected → links + pushes the actor's current dataRe-sync (Characters tab) — a per-actor Re-sync button for linked actors → re-pushes current fields. This is the one-click fix for the stranded-data case (the thing that needed a manual sheet-edit before).
Testing
Foundry ApplicationV2 UI — validated here by
node -c(JS) + a real Handlebars compile of the template, but it needs a live Foundry to exercise (cut a module release, then open the Chronicle Sync dashboard → Issues, and Characters → Re-sync). The model methods reuse existing API/adapter plumbing.Immediate workaround (no release needed): open each affected actor in Foundry and make any small system edit + save — that fires
updateActorand pushes its full current data. Once this ships, that's a one-click "Re-sync" instead.🤖 Generated with Claude Code
https://claude.ai/code/session_01Y14Y6VXb7iB2xcNrYNDJa5
Generated by Claude Code