-
Notifications
You must be signed in to change notification settings - Fork 0
feat(PLAN66): 名前の形に合わないプロジェクトを、作られた時点で知らせる (#203) #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
takemi-ohama
merged 7 commits into
release/v3.7.0
from
feature/v3.7.0-project-name-warn
Sep 22, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
363203d
chore(PLAN66): 名前の形の知らせ(実装 1 本目)の作業を始める
takemi-ohama 5d62f5f
docs(PLAN66): 実装 1 本目(知らせ)の計画を置く
takemi-ohama f00493d
feat(PLAN66): プラグインの同期が名前の形に合わない名前を projects/ に載せる直前に知らせる
takemi-ohama 8a0a662
feat(PLAN66): env import が名前の形に合わないプロジェクト名を取り込むとき保存先に応じて知らせる
takemi-ohama 788d727
docs(PLAN66): 確定仕様の「運用」と CHANGELOG に名前の形の知らせを書く
takemi-ohama 570a2fe
Test: characterize project name extraction, server import, and sync a…
takemi-ohama 7687bfb
fix(PLAN66): projects/ 直下の . 始まりの実ディレクトリに名前の形の警告を出さない
takemi-ohama File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| # PLAN66 実装 1 本目: 名前の形に合わないプロジェクトを、作られた時点で知らせる | ||
|
|
||
| ## 関連リンク | ||
|
|
||
| - 課題: devbasex/devbase#203 | ||
| - 要求と受け入れ条件: `issues/PLAN66_project-name-validation.md` | ||
| - 設計: `issues/PLAN66_project-name-validation-design.md`(設計 PR #230。弾かずに警告に留める案を承認済み) | ||
| - release PR: #212(base は `release/v3.7.0`) | ||
| - この計画が扱うのは設計の「実装の分け方」の **1 本目(知らせ。F1・F2)だけ**である。2 本目(スナップショットの | ||
| 名前を `utils/names` の述語へ寄せる。F3・決定 5・6)はこの Pull Request のマージ後に別に出す | ||
|
|
||
| ## モード | ||
|
|
||
| `standard`(要求の文書の判定のまま。出力が増えるだけで、終了コードと作られるものは変えない)。 | ||
|
|
||
| ## 目的と非目的 | ||
|
|
||
| 達成したい状態: | ||
|
|
||
| - `devbase plugin install` / `update` / `sync` が、名前の形に合わない名前を `projects/` に載せる直前に | ||
| 1 行知らせる(プラグインのプロジェクト・合成した別名・`projects/` 直下の実ディレクトリ) | ||
| - `devbase env import` が、名前の形に合わないプロジェクト名を取り込むとき、保存先に応じた文で 1 行知らせる | ||
| (`--dry-run` でも出す) | ||
| - 名前の形の説明文を `utils/names.NAME_FORM_HINT` の 1 か所に置く | ||
|
|
||
| やらないこと: | ||
|
|
||
| - 名前を弾く・載せない・整える(決定 1)。終了コードと作られる symlink・ディレクトリは変えない | ||
| - `discover_projects` と `_collect_project_candidates` での検査(決定 2)・`.` 始まりの除外の変更(決定 8) | ||
| - 下流の検証(`bin/devbase`・`cli.py`・`commands/container.py`)の変更(決定 3) | ||
| - `env/secret_store.py`・`env/bundle.py`・`_PROJECT_ENV_RE` の変更(決定 4。G4 の束 #188 との重なりを避ける) | ||
| - `snapshot/manager.py` の変更と確定仕様「運用」の 2 つ目の箇条書き(2 本目) | ||
|
|
||
| ## 受け入れ条件 | ||
|
|
||
| 要求の文書の番号をそのまま使う。この Pull Request が満たすのは 1〜9・13 の 1 つ目・14 の Added・15〜17 である。 | ||
|
|
||
| - [ ] 1・2・3・3-2・4・5(同期): `tests/plugin/test_repos_core.py` に新しいテストクラスを足す | ||
| - [ ] 6・7・8(import の平文): `tests/env/test_io_import.py` へテストを足す | ||
| - [ ] 9(import の age): `tests/cli/test_env_bundle_backend.py` へテストを足す | ||
| - [ ] 13 の 1 つ目: `docs/specifications/cli-argument-resolution.md` の「運用」の 1 つ目の箇条書き | ||
| - [ ] 14 の Added: `CHANGELOG.md` の `[Unreleased]` | ||
| - [ ] 15・16: 既存のテストを変更せずに通す | ||
| - [ ] 17: `uv run --locked pytest tests/ -q` が exit=0 | ||
|
|
||
| ## 修正対象 | ||
|
|
||
| - `lib/devbase/utils/names.py`(`NAME_FORM_HINT` を足す) | ||
| - `lib/devbase/plugin/syncer.py`(`_warn_unusable_name` を足し、`sync_projects` の 2 か所と `_link_loser_projects` から呼ぶ) | ||
| - `lib/devbase/env/_import_merge.py`(`project_name_of` を足す) | ||
| - `lib/devbase/env/io_import.py`(`import_bundle` の `_build_plans` の直後、`--dry-run` の判定より前に知らせる) | ||
| - `tests/plugin/test_repos_core.py`・`tests/env/test_io_import.py`・`tests/cli/test_env_bundle_backend.py` | ||
| - `docs/specifications/cli-argument-resolution.md`・`CHANGELOG.md` | ||
|
|
||
| ## タスク分解 | ||
|
|
||
| ### Task 1: 同期の知らせ(F1) | ||
|
|
||
| - **対象ファイル:** `lib/devbase/utils/names.py`・`lib/devbase/plugin/syncer.py`・`tests/plugin/test_repos_core.py` | ||
| - **変更内容:** `NAME_FORM_HINT` を足す。`_warn_unusable_name(name, source, base=None)` を足し、出所ごとに | ||
| 案内を選ぶ(設計「警告の文」の表の 4 行)。`sync_projects` で `sorted(real_projects)` の名前ごとと、winner の | ||
| symlink の直前に呼ぶ。`_link_loser_projects` で別名の symlink の直前に、元のプロジェクト名を `base` として呼ぶ。 | ||
| `verbose` に依存させない | ||
| - **満たす受け入れ条件:** 1・2・3・3-2・4・5・15 | ||
| - **進め方:** 失敗するテスト → 通す最小実装 → 整理 | ||
|
|
||
| ### Task 2: import の知らせ(F2) | ||
|
|
||
| - **対象ファイル:** `lib/devbase/env/_import_merge.py`・`lib/devbase/env/io_import.py`・`tests/env/test_io_import.py`・`tests/cli/test_env_bundle_backend.py` | ||
| - **変更内容:** `project_name_of(arcname)` を足す。`import_bundle` で `plans` を回し、形に合わない名前に 1 行知らせる。 | ||
| 保存先が `projects/<名前>/.env`(`plan.ref is None` かつ `plan.target` がそのパス)なら「この import が | ||
| `projects/<名前>/` を作る」文、それ以外(age・サーバ backend)は保存先を名指しして `projects/` に何も作らない文 | ||
| - **満たす受け入れ条件:** 6・7・8・9・16 | ||
| - **進め方:** 失敗するテスト → 通す最小実装 → 整理 | ||
|
|
||
| ### Task 3: 確定仕様と CHANGELOG | ||
|
|
||
| - **対象ファイル:** `docs/specifications/cli-argument-resolution.md`・`CHANGELOG.md` | ||
| - **変更内容:** 「運用」の 1 つ目に、知らせが出ること・4 つの出所・弾かないことを足す。CHANGELOG の Added に F1・F2 | ||
| - **満たす受け入れ条件:** 13 の 1 つ目・14 の Added | ||
| - **進め方:** 文書のためテスト駆動を適用しない | ||
|
|
||
| ## リスクと対処 | ||
|
|
||
| | リスク | 対処 | | ||
| | --- | --- | | ||
| | `sync_projects(verbose=False)` を数える用途(`updater`)でも警告が出る | 設計の決定どおり(黙る経路を作らない)。`updater` の差分計算は `discover_projects` を使い、`sync_projects` の出力には触れない | | ||
| | 警告の文が長く、`caplog` の件数が他の WARNING と混ざる | テストは名前の形の行を定型の先頭文で絞って数える | | ||
| | 触る範囲は 4 ファイルで、どれもテストが厚い | 実装の後の構造改善で足りる | | ||
|
|
||
| ## 切り戻し手順 | ||
|
|
||
| コードの差分は知らせの追加だけで、データ・スキーマを持たない。この Pull Request の revert で完全に戻る。 | ||
|
|
||
| ## 完了の定義 | ||
|
|
||
| - [ ] 受け入れ条件 1〜9 がテストで確かめられ、15〜17 の全件が exit=0 | ||
| - [ ] Draft の Pull Request の本文に Test plan と実行結果を載せる |
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.