Skip to content

Quest/journal sync fixes, v14 compat, and review cleanup#46

Open
camrun91 wants to merge 1 commit into
stagingfrom
quest-journal-review-fixes
Open

Quest/journal sync fixes, v14 compat, and review cleanup#46
camrun91 wants to merge 1 commit into
stagingfrom
quest-journal-review-fixes

Conversation

@camrun91

Copy link
Copy Markdown
Owner

Review branch off staging for a second set of eyes before merging. All changes verified against the archivistai/archivist-api quest/journal contract and Foundry v13.351 / v14.359. npm run lint passes (0 errors); no automated test suite exists in this repo, so a manual smoke test of the setup wizard import and the quest sheet is the one gap.

Highlights for reviewers

API contract correctness (archivist-api.js)

  • _normalizeQuestPayload rewritten as a strict whitelist. The API's QuestCreate/QuestUpdate declare extra="forbid"; the old mapper emitted read-only fields (quest_giver_id, progress_log_entries, first/last_session) that would 422 the entire write. Also drops empty-text objectives (min_length=1).
  • keepalive limited to bodies < 60 KiB (Chromium rejects larger keepalive requests — was silently failing large journal writes).
  • listQuests normalized back to camelCase for consistency with get/create/update.

Quest sheet (page-sheet-v2.js)

  • Objective add/remove now PATCH the full list to Archivist (previously edited local flags only, never synced).
  • Status/category labels localized via game.i18n with English fallback.
  • Removed inert static TABS block and a dead journal length check.

Sync dialogs + realtime

  • Fixed shift+click range-select double-toggling the clicked row.
  • Escaped journal names in the delete-confirmation dialog (was raw HTML).
  • Folder fallback for journal/quest imports on worlds set up before 2.0.
  • Replaced per-item full re-renders with direct DOM progress updates (sync-dialog + world-setup import loops) — ~2 renders instead of ~N on large imports.
  • Skip the redundant quest-name PATCH on quest page-content edits.

v14 compatibility

  • module.json: minimum 13.351 / verified 14.359 (was reversed — as-was, the module could not install on v13).
  • cleanHTML fallback chain and inert stripHtml.

Cleanup

  • Removed committed utils.js.bak and dead ask-chat-sidebar-tab.js (both were shipping in the release zip).

Testing notes

  • npm run lint: 0 errors.
  • Node --check on all modified scripts: passes.
  • Not yet run in a live Foundry world — worth a manual pass on the world-setup import (progress bar behavior changed) and quest objective editing (new API write path).

🤖 Generated with Claude Code

Verified against the archivist-api quest/journal contract and Foundry
v13.351 / v14.359. Groups several fixes from a full PR review plus the
quest/journal work.

API contract (archivist-api.js):
- Rewrite _normalizeQuestPayload as a strict whitelist. QuestCreate/
  QuestUpdate declare extra="forbid", so the old blocklist that emitted
  read-only fields (quest_giver_id, progress_log_entries, first/last_session)
  would 422 the whole write; drop empty-text objectives (min_length=1).
- Guard keepalive to bodies < 60 KiB (Chromium rejects larger keepalive
  writes), computed once outside the retry loop.
- Restore _normalizeQuestResponse in listQuests for camelCase consistency.

Quest sheet (page-sheet-v2.js):
- Objective add/remove now PATCH the full list back to Archivist.
- Localize status/category labels via game.i18n with English fallback.
- Remove inert static TABS block and the dead journal length check.

Realtime + sync dialogs:
- sync-dialog: shift+click range-select no longer double-toggles the
  clicked row; escape journal names in the delete-confirm dialog; folder
  fallback for journals/quests on pre-2.0 worlds; surface swallowed
  journal errors.
- Replace per-item full re-renders with direct DOM progress updates in
  sync-dialog and the world-setup import loops.
- Skip the redundant quest name PATCH on quest page-content edits.

v14 compatibility:
- module.json: minimum 13.351 / verified 14.359 (was reversed).
- utils/merge: cleanHTML fallback chain and inert stripHtml.

Cleanup: remove committed utils.js.bak and dead ask-chat-sidebar-tab.js.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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