fix(entrypoint): JSON エントリのプレースホルダを {} で作る - #137
Merged
Merged
Conversation
新規アカウントグループの初回起動で ~/.claude.json が 0 バイトで作られ、
Claude Code が "contains invalid JSON" で起動を拒否していた。
devbase_ensure_entry はファイルエントリを `: > "$path"` で作る。default
グループは devbase_seed_group_settings が /persistent/ai から実体をコピーする
ため踏まないが、非 default はシードを飛ばす (他社テナントの認証情報を持ち込ま
ないための正しいガード) ので必ず空のプレースホルダになる。
空で作ると壊れるエントリを DEVBASE_JSON_FILE_ENTRIES として列挙し、そこに
該当するものは {} を書く。history.jsonl は JSON Lines なので入れない ({} を
書くと 1 行目が履歴の 1 件として読まれる)。CLAUDE.md も空でよい。
拡張子で判定しないのは DEVBASE_FILE_ENTRIES と同じ理由による。かつて .jsonl が
*.json にマッチせず history.jsonl がディレクトリとして作られた経緯がある。
test_non_default_groups_are_not_seeded は「シードされていない」ことを空文字で
表現していたため期待値を {} へ更新した。確認している内容は変えていない。
Closes #136
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NMEpP29QkUDLwrsyYjpnDL
takemi-ohama
commented
Sep 2, 2026
takemi-ohama
left a comment
Contributor
Author
There was a problem hiding this comment.
🤖 cross-review | round 1 | gemini | APPROVE
実装の正確性、既存の仕様との一貫性、テストの網羅性のいずれも問題なく、要件を安全に満たしています。修正指摘はありません。
takemi-ohama
commented
Sep 2, 2026
takemi-ohama
left a comment
Contributor
Author
There was a problem hiding this comment.
🤖 cross-review | round 1 | codex | APPROVE
新規 JSON プレースホルダ、既存内容の保持、非 JSON エントリの後方互換性を確認し、修正必須事項はありません。
2 tasks
This was referenced Sep 2, 2026
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 free
to 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.
Closes #136
背景
新規アカウントグループの初回起動で
~/.claude.jsonが 0 バイトで作られ、Claude Code が起動を拒否していました。#133 の対応で
with/kkgグループを新設したところ、両方で発生しました。原因
devbase_ensure_entryはファイルエントリを: > "$path"で作ります。defaultグループはdevbase_seed_group_settingsが/persistent/aiから実体をコピーするため踏みませんが、非 default はシードを飛ばすので必ず空のプレースホルダになります。このガード自体は正しい設計です。 非 default グループをシードすると PLAN39 で分離したはずの他社テナントの認証情報をコピーしてしまいます。問題はガードではなく、プレースホルダが妥当な JSON になっていないことでした。
変更内容
空で作ると壊れるエントリを
DEVBASE_JSON_FILE_ENTRIESとして列挙し、該当するものは{}を書きます。DEVBASE_JSON_FILE_ENTRIES=( ".claude.json" ".credentials.json" "settings.json" )history.jsonlは 入れません。JSON Lines なので{}を書くと 1 行目が履歴の 1 件として読まれますCLAUDE.mdも Markdown なので空でよい*.json)で判定しないのはDEVBASE_FILE_ENTRIESと同じ理由です。かつて.jsonlが*.jsonにマッチせずhistory.jsonlがディレクトリとして作られた経緯がコメントに残っていますdevbase_is_file_entryとdevbase_is_json_file_entryが同型になったので、名前の照合をdevbase_entry_name_inに集約しました。検討したが採らなかった案
.claude.jsonだけ特別扱いsettings.jsonは共通ボリュームを新規に作れば同じ壊れ方をする。今直せる穴を残す理由がない{}を書くdevbase_ensure_entryの契約を壊す。利用者が意図的に空にしたファイルも書き換えてしまう判断の記録は
issues/PLAN41_json-placeholder-invalid.mdに残しています。影響範囲
DEVBASE_FILE_ENTRIESの各エントリが実際にどの経路を通るかを実機で確認しました。ensure_entryに渡るか.claude.jsonsettings.jsonCLAUDE.md.credentials.json.claudeごと symlink)history.jsonlテストプラン
test_new_group_gets_a_parsable_claude_json/test_shared_settings_json_is_parsable)pytest tests/全件: 1724 passedruff check --select=E9,F63,F7,F82 lib(CI と同じ): All checks passedshellcheck -S warning containers/base/entrypoint.sh: 変更箇所に新規警告なし(既存 3 件は別行)追加したテスト:
test_new_group_gets_a_parsable_claude_json.claude.jsonが妥当な JSONtest_shared_settings_json_is_parsablesettings.jsonも同様test_non_json_entries_stay_emptyCLAUDE.mdは空のままtest_history_jsonl_is_not_pre_createdhistory.jsonlはプレースホルダとして作られない(実挙動の記録)test_existing_file_content_is_not_overwritten{}へ巻き戻さないtest_deliberately_emptied_file_is_left_alone既存テストの期待値変更は
test_non_default_groups_are_not_seededの 1 件のみです。「シードされていない」ことを空文字で表現していた箇所で、確認内容は変えていません。devbase build --no-cacheでイメージを再ビルドし、新規グループのコンテナで実機確認(マージ後に実施)注意
entrypoint.shの変更はdevbase upでは反映されません。反映にはdevbase build --no-cacheによるイメージ再ビルドが必要です。関連
with/kkgグループの新設(踏んだ経緯)🤖 Generated with Claude Code
https://claude.ai/code/session_01NMEpP29QkUDLwrsyYjpnDL