[Bug]: `theme dev --theme-editor-sync` re-downloads config/settings_data.json every ~45s when it contains a "/" (checksum mismatch)
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- node.js, typescript
Hướng nghiên cứu
The issue links an open pull request, #9076, so work is already underway. To investigate, start from the theme editor sync code that computes the checksum for config/settings_data.json and compare its normalization with Shopify's checksumMd5, especially slash escaping. Reproduce with a settings value containing /; done means the sync settles without repeated downloads, uploads, or preview reloads.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment
- Shopify CLI 4.9.4 (Homebrew), Node v24.19.0, macOS 26.5.2
shopify theme dev --theme-editor-syncagainst a development theme with ~540 files- Slow link to Shopify (Taiwan): each Admin API request takes ~5 s
What happens
While theme dev runs with editor sync, this pair repeats every 40–50 seconds, forever:
• 16:05:58 Synced » download config/settings_data.json from remote theme
• 16:06:04 Synced » update config/settings_data.json
- The file content never changes; every write is byte-identical.
- Each write triggers a live reload on
127.0.0.1:9292, so the preview page keeps refreshing. - The remote file isn't changing either: in the Admin API,
theme.files(filenames: ["config/settings_data.json"])keeps the samechecksumMd5andupdatedAtthe whole time, even across the CLI's ownupdateuploads.
Root cause (as far as I can tell)
For config/settings_data.json, the CLI computes its local checksum by stripping the leading /* … */ comment, removing whitespace outside strings, then taking the MD5. Shopify's checksumMd5 for this file is the MD5 of the compact JSON with forward slashes escaped as \/.
So the two checksums can never match once any value contains a /, which in practice is almost always:
"logo": "shopify://shop_images/logo.png",
"favicon": "shopify://shop_images/favicon.png",
"blocks": { "…": { "type": "shopify://apps/<app>/blocks/<embed>/<uuid>", … } }
Checked against the real file:
| Normalization | MD5 |
|---|---|
| CLI-style (comment + whitespace stripped) | 5b60bb13… |
json.dumps(data, separators=(',',':')) |
5b60bb13… (same) |
same, with / → \/ |
02f9aa4c… = Shopify checksumMd5 ✅ |
Why it loops instead of settling
- Something downloads the file once (startup reconciliation, or one save in the theme editor).
- The file watcher re-hashes the downloaded file. The hash differs from the remote checksum the CLI just recorded, so the CLI treats it as a local edit and uploads it (
update). Shopify accepts it as a no-op;updatedAtdoesn't change. - On a slow connection the upload is still in flight when the next poll starts 3 s later. The file is in
unsyncedFileKeys, so that poll filters it out of the checksum list. - On the following poll the file is back in the list. Compared with the previous (filtered) list it looks like a new remote file, so it's downloaded again, and we're back at step 2.
With a 3-page checksum listing at ~5 s per request, each poll takes ~20 s, so the cycle repeats every two polls (~45 s).
Steps 1–2 and the checksum table are verified (hashes computed from the real file, behaviour read from the 4.9.4 dist code). Step 3 is my reading of the minified code plus the cycle timing; I haven't stepped through it in a debugger.
Steps to reproduce
- Use a theme whose
config/settings_data.jsoncontains any string with/, such as ashopify://shop_images/...logo. - Run
shopify theme dev --theme-editor-sync. - Change and save any setting in the theme editor once, so the CLI downloads the file.
- Watch the terminal: the
download/updatepair keeps repeating, and127.0.0.1:9292keeps reloading.
The loop needs the upload to take longer than the 3 s poll gap. That's easy to hit on a slow connection; elsewhere you may need to throttle the network.
Expected
A download that's byte-identical to the local file shouldn't be re-uploaded or re-downloaded, and the sync should settle after one round.
Possible fixes
- Normalize slash escaping (or parse and re-serialize the way the server does) when computing the
settings_data.jsonchecksum. - After writing a downloaded file, don't treat the watcher's change event for that write as a local edit.
- Don't let a file's in-flight upload drop it from the poll's previous/next checksum lists asymmetrically.
Workaround
shopify theme dev --theme-editor-sync --ignore config/settings_data.json
Related
#4715 ("CLI always requesting reconciliation strategy for settings_data.json", closed as not planned) is very likely the same checksum mismatch showing up at startup: the CLI sees local and remote as different even though git shows no change.
- Ngôn ngữ chính
- TypeScript
- Star
- 778
- Fork
- 306
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 108
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Shopify/cli
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 5/100
Maintainer thường phản hồi trong vòng 1 ngày
-
A background token refresh failure in a non-interactive process wipes every saved CLI session (all accounts)Có thể đã có người làm @efegokdemir đã nhận 36 ngày trước. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: app-logs poll returns HTTP 400 "Malformed JWT" — `shopify app dev` loops "Error while polling app logs" (CLI 4.9.4)Có thể đã có người làm @jay23606 đã nhận 29 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
Shopify/cli#8906 · 1 bình luận · 3 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
no-issue-activity
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Shopify/cli#8753 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
bug
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 62/100
garethgeorge/backrest#1451 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fix(core): \.pluck() returns values in key insertion order instead of requested argument orderCó thể đã có người làm @ManyaS-Git đã nhận 1 ngày trước. Đang mởstatus:in-linear
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
n8n-io/n8n#45027 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 13 ngày
-
bug
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 68/100
navikt/skjemabygging-formio#2399 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
lidofinance/validator-ejector#233 ·
Maintainer thường phản hồi trong vòng 1 ngày