Commit 9a1e504
feat: devbase up の機密の注入で SecretStore を持ち回り、サーバ backend の往復を設計の想定へ収める (PLAN55) (#177)
* feat: devbase up の機密の注入で SecretStore を持ち回り、サーバ backend の往復を認証 1 回 + 参照ごとに 1 回にする (PLAN55)
runtime.store_for / release_store を足し、resolve / inject / child_env と
_ensure_env_files が同じ SecretStore を使う。捨てる契機は _dispatch_lifecycle の
finally、TUI の委譲の入口、env init の子プロセスから戻った直後の 3 つ。
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S9okWVz1S7VGUsCQWVMhb3
* Test: characterize secret runtime error and early-return paths
Add characterization coverage for stale secret caches after project dispatch errors, invalid UTF-8 project env files, missing DEVBASE_ROOT, and store release after project name resolution failure.
Item-Id: R1-001
Round: 1
Impl-Runtime: codex
Impl-Model: default
* Test: characterize _inject_secrets error handling branch
Add characterization test verifying that DevbaseError is swallowed and returns an empty SecretEnv when required=False, while DevbaseError is re-raised when required=True.
Item-Id: R1-004
Round: 1
Impl-Runtime: agy
Impl-Model: default
* Refactor: extract_method — lib/devbase/commands/container.py#_resolve_project_name
project 切替時に呼び出し元固有の env キーを unset する段階を
_unset_caller_only_env_keys(caller_keys, target_dir) として抽出した。
_resolve_project_name は 解決 → chdir/PWD 差し替え → 抽出関数呼び出し →
env 反映 の順に整理され、クリーンアップ処理が独立した名前を持つ。
振る舞いは不変 (tests/cli/test_project_name_resolution.py を含む全テストが通過)。
Item-Id: R2-001
Round: 2
Impl-Runtime: kiro
Impl-Model: default
* Refactor: consolidate_duplication — lib/devbase/commands/container.py#_ensure_images
_ensure_images 内で docker compose config を実行し JSON を解釈して dev
サービス定義を取り出す処理を、同ファイルの _resolve_dev_service() の
呼び出しに置き換える。取得できない (None) ときは従来どおり _run_build()
へフォールバックする。
現状固定テストとして _ensure_images の入口を subprocess.run の応答だけで
固定する 10 件を tests/cli/test_base_image_staleness.py に追加した。
Item-Id: R2-002
Round: 2
Impl-Runtime: claude
Impl-Model: default
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Revert "Refactor: consolidate_duplication — lib/devbase/commands/container.py#_ensure_images"
This reverts commit 7add6cf.
* Refactor: extract_method — lib/devbase/commands/container.py#_ensure_images
Extract Compose services reading and dev image specification while preserving image checks and fallback behavior.
Item-Id: R2-003
Round: 2
Impl-Runtime: codex
Impl-Model: default
* Refactor: extract_method — lib/devbase/commands/container.py#cmd_scale
cmd_scale 内のボリューム・ネットワーク確認、compose 生成、起動、待機処理を
_run_scale_pipeline として抽出し、cmd_scale を引数検証・設定更新・パイプライン呼び出し・後続処理に整理。
Item-Id: R2-004
Round: 2
Impl-Runtime: agy
Impl-Model: default
* Revert "Refactor: extract_method — lib/devbase/commands/container.py#cmd_scale"
This reverts commit 30065e3.
* Refactor: consolidate_duplication — lib/devbase/commands/container.py#_build_resolved
_build_resolved 内で 5 回並んでいた `return 0 if <call> else 1` の bool→終了コード
変換を、module ヘルパ `_exit_code(ok: bool) -> int` に集約。委譲行 (_build_with_expires)
も同型のため同じヘルパへ統一した。振る舞いは不変。
Item-Id: R2-005
Round: 2
Impl-Runtime: kiro
Impl-Model: default
* Refactor: consolidate_duplication — lib/devbase/commands/container.py#_read_compose_services
_resolve_dev_service が独自に `docker compose config --format json` を実行して
JSON を読んでいたのを、_read_compose_services の呼び出しへ寄せる。compose config
の呼び方は 1 箇所になり、_resolve_dev_service は returncode!=0 / JSONDecodeError で
None、成功時に services.get(dev_service_name, {}) を返す薄い包みになる。
JSONDecodeError の握りは _resolve_dev_service 側に残す。共通関数側で握って
(rc, {}) を返すと _ensure_images の不正 JSON 経路 (except → _run_build) が
「イメージ未指定 → True」へ変わるため。
両関数の本体はテストで通っていなかったので、書き換え前に現状固定テストを
tests/cli/test_rebuild.py へ追加した (失敗時 None / (rc,{}) / 不正 JSON の伝播)。
Item-Id: R3-001
Round: 3
Impl-Runtime: claude
Impl-Model: default
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Revert "Refactor: consolidate_duplication — lib/devbase/commands/container.py#_read_compose_services"
This reverts commit 3ad3fb9.
* Refactor: consolidate_duplication — lib/devbase/commands/container.py#cmd_login
Share Compose context and secret preparation and override file argument construction. Preserve login command variants and execution order with CLI regression tests.
Item-Id: R3-002
Round: 3
Impl-Runtime: codex
Impl-Model: default
* Refactor: consolidate_duplication — lib/devbase/commands/container.py#_image_max_age_days
Consolidate duplicate non-negative integer environment variable parsing
in _image_max_age_days and _snapshot_min_interval_minutes into a shared
helper _env_non_negative_int.
Item-Id: R3-003
Round: 3
Impl-Runtime: agy
Impl-Model: default
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 78f6bb0 commit 9a1e504
13 files changed
Lines changed: 839 additions & 70 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
47 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
48 | 75 | | |
49 | 76 | | |
50 | 77 | | |
| |||
208 | 235 | | |
209 | 236 | | |
210 | 237 | | |
211 | | - | |
212 | | - | |
213 | | - | |
| 238 | + | |
| 239 | + | |
214 | 240 | | |
215 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
216 | 246 | | |
217 | | - | |
218 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
219 | 258 | | |
220 | 259 | | |
221 | 260 | | |
| |||
431 | 470 | | |
432 | 471 | | |
433 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
434 | 491 | | |
435 | 492 | | |
436 | 493 | | |
| |||
468 | 525 | | |
469 | 526 | | |
470 | 527 | | |
471 | | - | |
472 | | - | |
473 | | - | |
| 528 | + | |
| 529 | + | |
474 | 530 | | |
475 | 531 | | |
476 | | - | |
477 | 532 | | |
478 | 533 | | |
479 | 534 | | |
| |||
483 | 538 | | |
484 | 539 | | |
485 | 540 | | |
486 | | - | |
487 | | - | |
488 | | - | |
| 541 | + | |
489 | 542 | | |
490 | 543 | | |
491 | 544 | | |
| |||
563 | 616 | | |
564 | 617 | | |
565 | 618 | | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
566 | 624 | | |
567 | 625 | | |
568 | 626 | | |
| |||
597 | 655 | | |
598 | 656 | | |
599 | 657 | | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | | - | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
614 | 662 | | |
615 | 663 | | |
616 | 664 | | |
| |||
979 | 1027 | | |
980 | 1028 | | |
981 | 1029 | | |
982 | | - | |
983 | | - | |
| 1030 | + | |
984 | 1031 | | |
985 | | - | |
986 | | - | |
987 | | - | |
988 | | - | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
989 | 1036 | | |
990 | | - | |
991 | | - | |
| 1037 | + | |
992 | 1038 | | |
993 | 1039 | | |
994 | 1040 | | |
| |||
1243 | 1289 | | |
1244 | 1290 | | |
1245 | 1291 | | |
1246 | | - | |
| 1292 | + | |
1247 | 1293 | | |
1248 | | - | |
| 1294 | + | |
1249 | 1295 | | |
1250 | 1296 | | |
1251 | 1297 | | |
1252 | 1298 | | |
1253 | 1299 | | |
1254 | | - | |
| 1300 | + | |
1255 | 1301 | | |
1256 | 1302 | | |
1257 | | - | |
| 1303 | + | |
1258 | 1304 | | |
1259 | 1305 | | |
1260 | 1306 | | |
1261 | 1307 | | |
1262 | 1308 | | |
1263 | 1309 | | |
1264 | 1310 | | |
1265 | | - | |
1266 | | - | |
| 1311 | + | |
| 1312 | + | |
1267 | 1313 | | |
1268 | 1314 | | |
1269 | 1315 | | |
| |||
1302 | 1348 | | |
1303 | 1349 | | |
1304 | 1350 | | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
1305 | 1355 | | |
1306 | | - | |
| 1356 | + | |
1307 | 1357 | | |
1308 | | - | |
| 1358 | + | |
1309 | 1359 | | |
1310 | 1360 | | |
1311 | 1361 | | |
| |||
1343 | 1393 | | |
1344 | 1394 | | |
1345 | 1395 | | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
1346 | 1402 | | |
1347 | 1403 | | |
1348 | 1404 | | |
| |||
1365 | 1421 | | |
1366 | 1422 | | |
1367 | 1423 | | |
1368 | | - | |
1369 | | - | |
1370 | | - | |
1371 | | - | |
1372 | | - | |
1373 | | - | |
1374 | | - | |
1375 | | - | |
1376 | | - | |
1377 | | - | |
1378 | | - | |
1379 | | - | |
1380 | | - | |
1381 | | - | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
1382 | 1450 | | |
1383 | 1451 | | |
1384 | 1452 | | |
| |||
1410 | 1478 | | |
1411 | 1479 | | |
1412 | 1480 | | |
1413 | | - | |
1414 | | - | |
1415 | | - | |
1416 | | - | |
1417 | | - | |
1418 | | - | |
1419 | | - | |
1420 | | - | |
| 1481 | + | |
| 1482 | + | |
1421 | 1483 | | |
1422 | 1484 | | |
1423 | 1485 | | |
1424 | 1486 | | |
1425 | | - | |
1426 | | - | |
1427 | | - | |
1428 | | - | |
1429 | | - | |
| 1487 | + | |
1430 | 1488 | | |
1431 | 1489 | | |
1432 | 1490 | | |
| |||
0 commit comments