[bug] MergeSettings.ts leaves { "__merge": "append" } wrappers under hooks in the…
Maintainer thường phản hồi trong vòng 5 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- bun, typescript
- Lĩnh vực
- tooling
Hướng nghiên cứu
Đọc LIFEOS/TOOLS/MergeSettings.ts, đặc biệt là mergeSettings, và theo dõi cách các khóa đối tượng chỉ có ở người dùng được xử lý khi lớp hệ thống bỏ qua khóa cha của chúng. Tái hiện bằng JSON hệ thống và người dùng được cung cấp, sau đó kiểm tra rằng các chú thích nối thêm lồng nhau được phân giải thành mảng và các khóa đầu ra còn lại không thay đổi. Thêm bài kiểm thử hồi quy được đề xuất và chạy bài kiểm thử đó cùng với lệnh merge sử dụng --check.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happened
MergeSettings.ts leaves { "__merge": "append" } wrappers under hooks in the generated settings.json when settings.system.json has no hooks key, so Claude Code ignores PostToolUse, SessionStart, Stop and UserPromptSubmit hooks
Summary
What happens
LIFEOS/TOOLS/MergeSettings.ts writes { "__merge": "append", "values": [...] } wrappers into the generated settings.json when the annotated key sits under a parent that the system layer does not define.
Claude Code then rejects each affected hook event:
Hook event "PostToolUse" must be an array of matchers; received object. This entry was ignored.
Every hook under those events stops running. The SessionStart hook that reruns the merge is one of them, so the install does not repair itself.
Cause
In mergeSettings(system, user), a key that exists only in the user overlay is merged as mergeSettings(undefined, user[key]). When that value is a plain object, neither the annotation branch nor the object-merge branch matches, and the function returns cloneJsonValue(user). The object is copied whole, so append annotations nested inside it are never resolved.
settings.system.json ships without a hooks key (hooks are installer-owned), so hooks always takes this path. SettingsBackport.ts writes append annotations into the user overlay for appended hooks, which is what puts them there. permissions.allow is unaffected because permissions exists in the system layer.
validateRoundTripOrThrow and --check both pass on the broken output.
Reproduce
- System layer: any valid file with no
hookskey. - User overlay:
{ "hooks": { "Stop": { "__merge": "append", "values": [ { "hooks": [ { "type": "command", "command": "true" } ] } ] } } }
- Run the merge to a scratch path:
bun LIFEOS/TOOLS/MergeSettings.ts --system system.json --user user.json --output out.json
hooks.Stopinout.jsonis the wrapper object. Expected: the array fromvalues.
Fix verified locally
Before the final return cloneJsonValue(user); in mergeSettings:
if (isObjectRecord(user)) {
const merged: Record<string, any> = {};
for (const key of Object.keys(user)) {
if (isRemoveAnnotation(user[key])) continue;
merged[key] = mergeSettings(undefined, user[key]);
}
return merged;
}
With this patch the four affected events (PostToolUse, SessionStart, Stop, UserPromptSubmit) come out as arrays with the same content, every other key in the output is unchanged, and --check reports no differences.
Suggested follow-ups
- A regression test for an append annotation nested under a parent the system layer omits.
- Make the round-trip validation fail when any
__mergekey survives in the output.
Versions
LifeOS 8.761.0, MergeSettings 1.3.16 (file header), macOS.
Details
- Kind: bug
- LifeOS version: 8.761.0
Filed with the LifeOS /feedback command. The reporter approved this exact text before it was sent; paths, secrets and personal details were stripped locally.
- Ngôn ngữ chính
- TypeScript
- Star
- 19.9k
- Fork
- 2.5k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 danielmiessler/LifeOS
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
danielmiessler/LifeOS#2894 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
danielmiessler/LifeOS#2891 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
danielmiessler/LifeOS#2888 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
danielmiessler/LifeOS#2848 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
danielmiessler/LifeOS#2635 ·
Maintainer thường phản hồi trong vòng 5 ngày
Tất cả issue của danielmiessler/LifeOS
Issue tương tự
-
ready-for-agent
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
LucasSantana-Dev/Lucky#3257 ·
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 75/100
XiaomiMiMo/MiMo-Code#2849 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement frontend good first issue help wanted testing-infrastructure
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement follow-up
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
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 82/100
obsidian-tasks-group/obsidian-tasks#4155 ·
Maintainer thường phản hồi trong vòng 1 ngày