Skip to content

feat(context): tag audit sub-check — inventory @FLOW/@ENTRY doc-tags (closes #305) - #307

Merged
Wolfvin merged 1 commit into
mainfrom
feat/issue-305-tag-audit
Jul 17, 2026
Merged

feat(context): tag audit sub-check — inventory @FLOW/@ENTRY doc-tags (closes #305)#307
Wolfvin merged 1 commit into
mainfrom
feat/issue-305-tag-audit

Conversation

@Wolfvin

@Wolfvin Wolfvin commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Closes #305.

Masalah

Konvensi @WHO/@WHAT/@PART/@ENTRY (file) + @FLOW/@CALLS/@MUTATES (fungsi) dipakai lintas codebase — 46/236 file .py, 21 flow bernama — tapi nol tooling membacanya. Datanya membusuk: LLM_INVOKE/LLM_TOOL_INVOKE masih menamai scripts/llm/ padahal command llm di-drop di #195.

Yang ditambahkan

context --check tags menjawab tiga pertanyaan dari tag yang sudah ada di kode, tanpa mengarang:

  1. Inventory — semua @FLOW unik + lokasinya
  2. Coverage — file header lengkap / parsial / tak ada + persen
  3. Untagged — daftar file tanpa tag

Murni regex, nol LLM, nol network, semua koleksi ter-sort → deterministik.

Keputusan desain

  • Tag hanya dihitung kalau MEMBUKA baris komentar/docstring (marker + whitespace + @TAG:). Ini memisahkan deklarasi nyata dari penyebutan prosa seperti the `@FLOW: PURE` example — tanpa anchor ini, file mana pun yang mendokumentasikan konvensi (engine ini sendiri!) mendaftarkan flow hantu. Ditemukan lewat dogfooding saat self-scan mengembalikan PURE fantom.
  • Read-only. Tidak pernah menulis tag. Auto-tagging + stale-by-body-hash sengaja di luar scope (mengarang nilai tag = authorship; untuk tool no-LLM itu milik manusia/agent, bukan scanner).
  • Reuse BaseEngine untuk walk — nol walker baru.
  • Language-agnostic: tag sama di # (Python) dan // (TS/JS).

Verifikasi (dijalankan)

  • Self-scan CodeLens: 22 flow (21 asli + TAG_AUDIT milik file ini), 46 file header, dua orphan LLM_* tersurface dengan lokasi. PURE fantom hilang setelah anchor diperketat.
  • 13 unit test (tests/test_tag_audit.py) dengan fixture sintetis (bukan cuma self-scan): full/partial/no header, penolakan prosa, tokenisasi nama flow, determinisme, read-only (mtime tak berubah).
  • CLI end-to-end: context --check tags exit 0, envelope {s,st,r} benar, compact 9.5KB lengkap — pada scan repo penuh muncul with_partial_header: 5 (deteksi header parsial bekerja pada data nyata).
  • Gerbang hijau: registry allowlist, docs-sync chore(docs): CI check that command/sub-check docs match the registry (anti-drift) #278 ("tags" di README/SKILL/SKILL-QUICK), command count tetap 12, sync_command_count --check bersih.
  • Full suite: 19 gagal di branch = 19 di main, daftar identik — nol regresi.

Batasan diketahui (tracked)

--format markdown + --format ai merender umbrella context kosong ("Symbol not found") — pra-eksisting, semua sub-check context, bukan bug fitur ini. Difile sebagai #306. json/compact (agent-facing) benar.

Feature-class → design doc docs/design/0305-tag-audit.md disertakan.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

…convention (closes #305)

The @WHO/@WHAT/@PART/@entry + @FLOW/@CALLS/@mutates convention is used
across the codebase (46/236 .py files carry the header, 21 named flows)
but nothing read it back, so the data rotted: two flows (LLM_INVOKE,
LLM_TOOL_INVOKE) still name code whose command was dropped in #195.

`context --check tags` answers three questions from the tags already in
the source, inventing nothing: flow inventory + locations, header
coverage (full/partial/none), and the untagged-file list. Pure regex,
no LLM, no network, all collections sorted — deterministic.

A tag counts only when it opens a comment/docstring line (marker +
whitespace + @tag:), so a prose mention like `the `@FLOW: PURE` example`
is not mistaken for a declaration — without that anchor, any file
documenting the convention (this engine included) registered phantom
flows. Caught by dogfooding.

Read-only by design: never writes tags back. Auto-tagging and
staleness-by-body-hash are out of scope (deciding a tag's value is
authorship, which for a no-LLM tool belongs to the human/agent).

Reuses BaseEngine for the walk — no new walker. Command count stays 12
(sub-check, not a top-level command). Registry allowlist, docs sync
(#278), and command-count gates all green; full suite 19 failures =
19 on main, identical list.

Known limitation: markdown/ai formats render the context umbrella empty
(pre-existing, all sub-checks) — tracked in #306. json/compact correct.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@Wolfvin
Wolfvin merged commit 213826c into main Jul 17, 2026
2 of 8 checks passed
@Wolfvin
Wolfvin deleted the feat/issue-305-tag-audit branch July 17, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(context): tag audit — inventory @FLOW/@ENTRY/@PART headers, list untagged files and stale/orphan flows

1 participant