Skip to content

feat: sync issue resolver — recover broken/missing character links + re-sync stranded data#70

Merged
keyxmakerx merged 3 commits into
mainfrom
claude/gallant-johnson-kd574n
Jun 25, 2026
Merged

feat: sync issue resolver — recover broken/missing character links + re-sync stranded data#70
keyxmakerx merged 3 commits into
mainfrom
claude/gallant-johnson-kd574n

Conversation

@keyxmakerx

Copy link
Copy Markdown
Owner

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/updateActor hooks, 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 — no entityId flag
  • brokenentityId flag 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), and repushActor().

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:

  • Match to existing — a <select> of Chronicle characters, best name-match preselected → links + pushes the actor's current data
  • Create new — creates a Chronicle character of the correct system type and links it

Re-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 updateActor and 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

claude added 3 commits June 25, 2026 19:31
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
@keyxmakerx keyxmakerx merged commit 6b77be0 into main Jun 25, 2026
1 check 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.

2 participants