From 71968ab85aaa2f2113515c4bdf16ab7598733845 Mon Sep 17 00:00:00 2001 From: yktsnet Date: Wed, 4 Nov 2026 22:51:31 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20=E3=80=8C=E6=8C=87=E7=B4=8B=E3=80=8D?= =?UTF-8?q?=E3=82=92=E3=80=8C=E3=83=8F=E3=83=83=E3=82=B7=E3=83=A5=E3=80=8D?= =?UTF-8?q?=E3=81=AB=E8=A8=80=E3=81=84=E6=8F=9B=E3=81=88=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 配信の判定や作り直しの判定に使う値を、文書・docstring・コメントで「ハッシュ」と書くよう改めた。関数名 fingerprint() と _fingerprint() は識別子なので変えていない。issues/done は記録なので残した。 --- codeview/build.py | 2 +- codeview/plugins.py | 4 ++-- codeview/publish.py | 8 ++++---- context/structure.md | 2 +- docs/guarantees.md | 4 ++-- examples/plugins/sessions.py | 4 ++-- tests/test_build.py | 2 +- tests/test_publish.py | 6 +++--- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codeview/build.py b/codeview/build.py index c38ff2a..048be82 100644 --- a/codeview/build.py +++ b/codeview/build.py @@ -364,7 +364,7 @@ def _digest(obj) -> str: def _code_digest() -> str: - """本体のソースと同梱物の指紋。版の番号は開発中に動かないので、中身で見る。""" + """本体のソースと同梱物のハッシュ。版の番号は開発中に動かないので、中身で見る。""" root = Path(__file__).resolve().parent h = hashlib.sha256() for path in sorted(root.rglob("*")): diff --git a/codeview/plugins.py b/codeview/plugins.py index fcc6e73..5ec3428 100644 --- a/codeview/plugins.py +++ b/codeview/plugins.py @@ -6,8 +6,8 @@ side(ctx) -> str トップの左メニューの先頭に差し込む塊 home(ctx) -> str | None トップの右側に出す HTML。None なら出さない build(ctx) -> None public/ と functions/ に自前のページを書く - before_publish(ctx) -> None 配信の指紋を取る前に呼ぶ - fingerprint(ctx) -> str 配信の指紋に足す1行 + before_publish(ctx) -> None 配信のハッシュを取る前に呼ぶ + fingerprint(ctx) -> str 配信のハッシュに足す1行 issues(ctx, account, repos) -> list[Issue] アカウントの `issues` にこのモジュールを挙げたとき、 そのアカウントのリポ(`Repo` の列)から未消化の Issue を返す diff --git a/codeview/publish.py b/codeview/publish.py index 8266ae2..2b38725 100644 --- a/codeview/publish.py +++ b/codeview/publish.py @@ -90,12 +90,12 @@ def _head(path: Path) -> str: def _fingerprint(ctx: plugins.Context) -> dict: - """配信の指紋。`accounts` はアカウントごとの走査対象リポの HEAD、`global` はそれ以外 + """配信のハッシュ。`accounts` はアカウントごとの走査対象リポの HEAD、`global` はそれ以外 (拡張の行・配信するリポの HEAD・本体の版)。 GitHub の Issue は見ない。Issue だけの動きでは配信せず、次にコミットで配信するときに載る。 - 配信するリポの未コミット変更も指紋に出ない。定期実行が拾うのはコミット済みの状態だけで、 - 手元の実験を配信させないため。手動 publish は指紋を見ないので確認はそちらで足りる。 + 配信するリポの未コミット変更もハッシュに出ない。定期実行が拾うのはコミット済みの状態だけで、 + 手元の実験を配信させないため。手動 publish はハッシュを見ないので確認はそちらで足りる。 """ accounts: dict[str, list[str]] = {} for group, path in repos(): @@ -116,7 +116,7 @@ def _load_state() -> dict | None: state = json.loads(STATE.read_text()) except (OSError, ValueError): return None - # 指紋だけを書いていた旧形式は、状態なしとして一度配信し直す + # ハッシュだけを書いていた旧形式は、状態なしとして一度配信し直す if not isinstance(state, dict) or not isinstance(state.get("accounts"), dict): return None return state diff --git a/context/structure.md b/context/structure.md index 00c0d8e..9edfe3b 100644 --- a/context/structure.md +++ b/context/structure.md @@ -31,4 +31,4 @@ tests/ 3. `issues.collect()` がアカウントごとに Issue を集め、ファイルから Issue への索引を作る 4. `build.build_repo()` がリポごとに HEAD のファイルをページにする 5. `layout.build_index()` と `issues_pages()` がトップと Issue のページを書き、拡張の `build()` が自前のページを足す -6. `publish` は指紋(アカウントごとの走査対象の HEAD・設定のリポの HEAD・本体の版・拡張の `fingerprint()`)を取り、`public/` と `functions/` を一時 index に載せて配信ブランチへ force push する。Cloudflare Pages がそのブランチを配る +6. `publish` はハッシュ(アカウントごとの走査対象の HEAD・設定のリポの HEAD・本体の版・拡張の `fingerprint()`)を取り、`public/` と `functions/` を一時 index に載せて配信ブランチへ force push する。Cloudflare Pages がそのブランチを配る diff --git a/docs/guarantees.md b/docs/guarantees.md index 402ed9e..6f5d6fd 100644 --- a/docs/guarantees.md +++ b/docs/guarantees.md @@ -125,7 +125,7 @@ - 走査対象に動きが無ければ、変更なしと判定する - 走査対象のリポに新しいコミットがあれば、変更ありと判定する -- GitHub の Issue だけが更新されても、変更なしと判定する。指紋を取るときに GitHub へ問い合わせない +- GitHub の Issue だけが更新されても、変更なしと判定する。ハッシュを取るときに GitHub へ問い合わせない - 走査対象のリポの未コミットの変更は、変更として扱わない - `publish --dry-run` は、設定ファイルのあるリポの直下に `public/` と `functions/` を書き、push せずに終わる - `publish` は配信ブランチを親を持たない単一コミットとして push し、その木には `public/` と `functions/` だけを載せる @@ -178,7 +178,7 @@ | `list` が成功して0件のときは止めない | `test_build_with_empty_list_is_not_an_error` | | トップの入口と件数 | `test_top_menu_links_sessions_without_titles` | | 設定の誤り | `test_rejects_bad_options` | -| 指紋は最新の更新時刻を `every_hours` の枠に丸めて動く | `test_fingerprint_moves_only_across_windows`、`test_fingerprint_follows_every_hours` | +| ハッシュは最新の更新時刻を `every_hours` の枠に丸めて動く | `test_fingerprint_moves_only_across_windows`、`test_fingerprint_follows_every_hours` | | 変わらないセッションはページを使い回す(件数を左に出さないのは、セッションが1本増えても、ほかのページの内容が変わらないようにするため) | `test_second_build_reuses_unchanged_pages`、`test_session_page_side_has_no_counts` | | 更新されたセッションは作り直す | `test_updated_session_is_rebuilt` | | Issue の状態が変わったら作り直す | `test_issue_link_follows_issue_state` | diff --git a/examples/plugins/sessions.py b/examples/plugins/sessions.py index 638ae3a..066d00a 100644 --- a/examples/plugins/sessions.py +++ b/examples/plugins/sessions.py @@ -14,7 +14,7 @@ ccreel ccreel のコマンド(既定 "ccreel")。定期実行の PATH に無いときはパスで渡す config_dirs 読む config dir の列(既定 ["~/.claude"]) days 載せる期間。この日数のうちに更新されたもの(既定 30) - every_hours 配信の指紋を変える間隔(既定 3) + every_hours 配信のハッシュを変える間隔(既定 3) """ from __future__ import annotations @@ -407,7 +407,7 @@ def _cache_dir() -> Path: def _code_digest() -> str: - """この拡張と本体のソースの指紋。どちらかが変われば、作ったページを全部作り直す。""" + """この拡張と本体のソースのハッシュ。どちらかが変われば、作ったページを全部作り直す。""" import codeview h = hashlib.sha256(Path(__file__).read_bytes()) diff --git a/tests/test_build.py b/tests/test_build.py index 489a02a..ae23166 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -754,7 +754,7 @@ def test_incremental_build_follows_plugin_fingerprint(site): _build_incremental(site) _, err = _build_incremental(site) assert "build skipped" in err - # 拡張の指紋が変われば、リポのページを使い回したまま拡張のページを書き直す + # 拡張のハッシュが変われば、リポのページを使い回したまま拡張のページを書き直す site.env["FP"] = "2" public, err = _build_incremental(site) assert "build skipped" not in err and "beta: unchanged" in err diff --git a/tests/test_publish.py b/tests/test_publish.py index d83a02a..6afba7f 100644 --- a/tests/test_publish.py +++ b/tests/test_publish.py @@ -1,4 +1,4 @@ -"""配信の指紋が走査対象の HEAD で変わり、GitHub の Issue では変わらないことと、 +"""配信のハッシュが走査対象の HEAD で変わり、GitHub の Issue では変わらないことと、 アカウントごとの間隔で変化を見ることを確かめる。""" from __future__ import annotations @@ -24,7 +24,7 @@ def test_fingerprint_ignores_github_issue_update(site): before = site.fingerprint() site.set_gh("beta", [gh_row(7, "beta の問い", "2026-03-01T00:00:00Z")]) assert site.fingerprint() == before - # 指紋を取るだけでは GitHub に問い合わせない + # ハッシュを取るだけでは GitHub に問い合わせない assert site.gh_calls() == [] @@ -113,7 +113,7 @@ def test_publish_checks_account_at_its_interval(site, tmp_path): def test_publish_if_changed_republishes_over_old_state(site, tmp_path): - # 指紋だけを書いていた旧形式の状態は、無いものとして配信する + # ハッシュだけを書いていた旧形式の状態は、無いものとして配信する remote = _with_remote(site, tmp_path) path = _state(site, tmp_path) path.parent.mkdir(parents=True)