Uh oh!
There was an error while loading. Please reload this page.
fix: custom pages overwrite each other in page sync (all share name "legacy") - #85
Open
k-r-a-s-s wants to merge 2 commits into
Open
fix: custom pages overwrite each other in page sync (all share name "legacy")#85k-r-a-s-s wants to merge 2 commits into
k-r-a-s-s wants to merge 2 commits into
Conversation
syncPages names each local file by page.name, but every custom (page-builder) page shares the name "legacy". On campaigns with more than one custom page, all of them are written to the same legacy.json (last write wins), so most custom pages never appear locally and the surviving file's identity changes between syncs. Name files by the page's unique name when it is unique across the campaign, and fall back to the page path otherwise (cause-areas.json, terms.json, ...). Residual collisions after sanitization are disambiguated with a short uuid suffix. Deploy is unaffected: pages are PATCHed by the uuid stored inside each file. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 72243dd. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
Two-pass assignment so a custom page whose path sanitizes to a template page's name (e.g. /profile vs the profile template at /:id) can never take that template's filename, regardless of API order. The custom page gets the uuid-suffixed name instead. Addresses Bugbot review on raisely#85. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
k-r-a-s-s
commented
Aug 27, 2026
Author
Good catch from Bugbot — fixed in 5489e7d. |
k-r-a-s-s pushed a commit
to High-Impact-Athletes/raisely-cli
that referenced
this pull request
Aug 29, 2026
Two-pass assignment so a custom page whose path sanitizes to a template page's name (e.g. /profile vs the profile template at /:id) can never take that template's filename, regardless of API order. The custom page gets the uuid-suffixed name instead. Addresses Bugbot review on raisely#85. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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 freeto 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.

Problem
raisely update/raisely initwrite each synced page topages/<page.name>.json. Template pages have unique names (home,dashboard,profile, …), but every custom page-builder page hasname: "legacy"— so on any campaign with more than one custom page, all of them are written to the samelegacy.json, last write wins.Observed on our campaign: the API returns 72 pages, 55 of which are custom (
name: "legacy"). After a sync, only the ~20 uniquely-named template pages plus a singlelegacy.jsonexist locally — 54 custom pages never land on disk, andlegacy.jsonholds whichever custom page the API happened to return last (which can change between syncs).Beyond the missing files, this is a correctness hazard:
raisely deployPATCHes every local page JSON by its embedded uuid, so a stalelegacy.jsonsnapshot of a semi-random page can silently revert that page's body/status/path in the admin.Fix
Extract the naming logic into
pageFileNames(pages), which computes names for a campaign's page set as a whole:nameis used only when it's unique within the campaign (all existing template-page filenames are unchanged:home.json,dashboard.json, …);/cause-areas→cause-areas.json), matching the existing fallback already used for unnamed pages;Deploy needs no changes — it already resolves the target page from the
uuidinside each file, not the filename.Notes
legacy.jsonis left behind and can be deleted (it duplicates one of the new files' uuid).tests/sync.test.jscovering unique names, the shared-legacyfallback, unnamed pages, sanitization, and suffix disambiguation. Full suite passes (111/111).🤖 Generated with Claude Code
Note
Medium Risk
Sync output filenames change for campaigns with multiple custom pages, which can leave stale
legacy.jsonlocally but fixes silent data loss and deploy correctness risk from wrong page bodies keyed by uuid.Overview
Fixes page sync so multiple custom (page-builder) pages no longer overwrite a single
legacy.jsonwhen they all sharename: "legacy".pageFileNames(pages)replaces per-pagepageFileName: it assigns filenames across the whole campaign—uniquepage.namevalues still map to stable template files (home.json, etc.), while shared or missing names use path-based names with sanitization, and uuid suffixes when paths collide after sanitization. A two-pass rule reserves unique name-based filenames so API order cannot steal e.g.profile.jsonfrom a template page.syncPageswrites each page using the computed filename; deploy behavior is unchanged because targets are resolved by embedded uuid, not filename. Newtests/sync.test.jscovers sharedlegacy, unnamed pages, sanitization, template reservation, and collision suffixes.Reviewed by Cursor Bugbot for commit 5489e7d. Bugbot is set up for automated code reviews on this repo. Configure here.