fix(scripts): clean up migration script before live run
- Drop unused `import shutil` (Phase C will reintroduce it).
- Drop unused `import sqlite3` (same).
- Drop the `skipped_no_combined` stat key — `rglob("combined.md")` only
yields existing files, so the counter could never be incremented; a
zero in the final log would have read like a successful absence
rather than an unchecked condition.
- Move the `from cli.comments import NOTE_TITLE` import up to the
top with stdlib imports; the previous post-COMMENTS_ROOT placement
+ bogus `# noqa: E402` justification was misleading.
Surfaced by code review on commit beacbd7. Smoke + idempotency
re-verified.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,19 +21,17 @@ from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import shutil
|
||||
import sqlite3
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from cli.comments import NOTE_TITLE
|
||||
|
||||
logging.basicConfig(format="%(asctime)s %(levelname)s %(message)s", level=logging.INFO)
|
||||
log = logging.getLogger("migrate-comments-md-to-notes")
|
||||
|
||||
|
||||
COMMENTS_ROOT = Path(".state/comments")
|
||||
|
||||
from cli.comments import NOTE_TITLE # noqa: E402 — after stdlib imports
|
||||
|
||||
|
||||
def _safety_preflight() -> None:
|
||||
"""Refuse to run unless _sync_notes is on disk — sanity check that
|
||||
@@ -76,8 +74,7 @@ def phase_a_backfill(root: Path) -> dict[str, int]:
|
||||
}
|
||||
|
||||
stats = {"scanned": 0, "attached": 0, "skipped_have_note": 0,
|
||||
"skipped_no_combined": 0, "skipped_unknown_item": 0,
|
||||
"errors": 0}
|
||||
"skipped_unknown_item": 0, "errors": 0}
|
||||
|
||||
for combined in root.rglob("combined.md"):
|
||||
stats["scanned"] += 1
|
||||
|
||||
Reference in New Issue
Block a user