Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions docs/archive/evidence/weekly-repo-hygiene-review-2026-05-17.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
id: weekly-repo-hygiene-review-2026-05-17
title: Weekly Repo Hygiene Review Evidence 2026-05-17
role: dev_rel
status: ready
created_at: 2026-05-17
updated_at: 2026-05-17
author: codex
target_repo: Synapse-Network-Growing
---

# Weekly Repo Hygiene Review Evidence

## Scope

- Automation: `weekly_repo_hygiene_review`
- Date: `2026-05-17`
- Worktree: `/Users/cliff/.codex/worktrees/bb4b/Synapse-Network-Growing-agent-b`
- Week key: `2026-W20`

## Repo Scan Findings

The read-only scan reproduced the repo's weekly hygiene findings under the documented local PostgreSQL dev environment.

- Root markdown review items remain: `CLAUDE.md`, `GEMINI.md`, `harness-engineering.md`
- Docs metadata items remain: missing frontmatter in
`docs/design-docs/company-ops-latest-architecture.md`,
`docs/design-docs/context-loading-map.md`,
`docs/design-docs/current-feature-inventory.md`,
`docs/design-docs/system-design-principles.md`,
`docs/plans/README.md`
- PR template newline hygiene is already present
- Ops stale-state findings: none in the local database snapshot

## Safe Cleanup Selected

One low-risk mechanical cleanup item was safe to apply:

- Fix `server/services/scheduling/repo_hygiene_scan.py` so TODO/FIXME detection only matches actual source comments, not embedded string literals in scanner code.

Why this item:

- It removed a self-referential false positive from the weekly scan.
- It did not touch production resources, secrets, auth, deployments, Docker, caches, funds, or settlement flows.
- No duplicate weekly cleanup candidate or requirement existed for `2026-W20` in the local Ops database.

## Verification

Commands run:

```bash
export OPS_DATABASE_URL="postgresql+psycopg://synapse_growing:synapse_growing_dev@127.0.0.1:54329/synapse_growing_local"
export PYTHONPATH=.
/Users/cliff/workspace/agent/.venv/bin/python -m pytest -q tests/test_weekly_repo_hygiene_review.py
/Users/cliff/workspace/agent/.venv/bin/python - <<'PY'
from server.services.scheduling.repo_hygiene_scan import scan_repo_hygiene_payload
import json
print(json.dumps(scan_repo_hygiene_payload(), ensure_ascii=False, indent=2, default=str))
PY
git diff --check
```

Results:

- `tests/test_weekly_repo_hygiene_review.py`: `8 passed`
- `git diff --check`: clean
- Weekly scan finding count dropped from `9` to `8`
- Removed false-positive finding: `todo:server/services/scheduling/repo_hygiene_scan.py`

## Delivery

- Publish path: small cleanup PR only
- Auto-merge: disabled
13 changes: 12 additions & 1 deletion server/services/scheduling/repo_hygiene_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
from __future__ import annotations

from pathlib import Path
import re
from typing import Any

from server import config


ROOT_MARKDOWN_ALLOWLIST = {"AGENTS.md", "ARCHITECTURE.md", "README.md", "llms.txt"}
TODO_COMMENT_PATTERNS = (
re.compile(r"#\s*(TODO|FIXME)\b"),
re.compile(r"//\s*(TODO|FIXME)\b"),
re.compile(r"/\*\s*(TODO|FIXME)\b"),
re.compile(r"\*\s*(TODO|FIXME)\b"),
)


def _repo_rel(path: Path) -> str:
Expand Down Expand Up @@ -114,6 +121,10 @@ def _pr_template_findings(root: Path) -> list[dict[str, Any]]:
]


def _has_todo_comment(text: str) -> bool:
return any(pattern.search(text) for pattern in TODO_COMMENT_PATTERNS)


def _todo_findings(root: Path, *, limit: int = 8) -> list[dict[str, Any]]:
findings: list[dict[str, Any]] = []
for base in [root / "server", root / "scripts", root / "dashboard" / "src"]:
Expand All @@ -126,7 +137,7 @@ def _todo_findings(root: Path, *, limit: int = 8) -> list[dict[str, Any]]:
text = path.read_text(encoding="utf-8", errors="replace")
except OSError:
continue
if "TODO" not in text and "FIXME" not in text:
if not _has_todo_comment(text):
continue
findings.append(
_finding(
Expand Down
22 changes: 22 additions & 0 deletions tests/test_weekly_repo_hygiene_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,28 @@ def test_weekly_repo_hygiene_scanner_detects_repo_entropy(tmp_path, monkeypatch)
assert payload["auto_fixable_count"] == 2


def test_weekly_repo_hygiene_scanner_ignores_todo_strings_inside_code(
tmp_path, monkeypatch
):
monkeypatch.setattr(repo_hygiene_scan.config, "PROJECT_ROOT", tmp_path)
server_dir = tmp_path / "server"
server_dir.mkdir()
(server_dir / "embedded_string.py").write_text(
'MESSAGE = "TODO should not count when it is only a string literal."\n',
encoding="utf-8",
)
(server_dir / "real_comment.py").write_text(
"# TODO: tracked cleanup item\n",
encoding="utf-8",
)

payload = repo_hygiene_scan.scan_repo_hygiene_payload(root=tmp_path)

ids = {item["id"] for item in payload["repo_findings"]}
assert "todo:server/real_comment.py" in ids
assert "todo:server/embedded_string.py" not in ids


def test_weekly_repo_hygiene_high_risk_or_duplicate_noops(db_session):
high_risk = _finding(id="auth:secret-cleanup", risk_level="high", auto_fixable=True)

Expand Down
Loading