chore: delete code comments, add ratchet lint and ADRs
Classify every comment as tautology, stale, excuse or decision record. Tautology/stale/excuse comments are deleted (excuses filed as issues #196-#236), decisions moved to docs/adr/0001-0034. - scripts/lint-comments.sh + .comment-baseline: per-file comment count may only go down; wired into tests/all.sh - .claude/skills/delete-comment: repeatable audit workflow - cargo fmt applied to touched crates Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0545702fe0
commit
a94632ea3d
131 files changed
+1051
-1746
No files matched your search
@@ -0,0 +1,31 @@
|
||||
# Comment audit: hx-cli
|
||||
|
||||
Clap doc comments (--help text, main.rs lines 28-124, 135, 137) were kept as functional, 30 lines.
|
||||
|
||||
| file | tautology | stale | excuse | decision | kept |
|
||||
|---|---|---|---|---|---|
|
||||
| acp.rs | 40 | 0 | 0 | 4 | 0 |
|
||||
| rpc.rs | 9 | 0 | 0 | 2 | 0 |
|
||||
| main.rs | 62 | 0 | 2 | 13 | 30 |
|
||||
|
||||
Excuses
|
||||
- main.rs:522 pricing estimate (see issues)
|
||||
- main.rs:440 connecting MCP prompts missing from completion
|
||||
|
||||
Decisions
|
||||
- acp.rs:9-11 hx-step block reporting
|
||||
- acp.rs:380 file tools "always" means session edits
|
||||
- acp.rs:564 soft stop with grace
|
||||
- acp.rs:602 exit_plan has no answerer, plan reported in step
|
||||
- rpc.rs:80 abort/complete bypass agent lock
|
||||
- rpc.rs:188 let running prompt finish on stdin close
|
||||
- main.rs:271-272 claude unsandboxed rule
|
||||
- main.rs:305,309 claude MCP wiring, no recursion
|
||||
- main.rs:383 macOS keychain
|
||||
- main.rs:551 claude sees only mcp-serve tools
|
||||
- main.rs:867-868 mcp-serve log
|
||||
- main.rs:472 stale-while-revalidate
|
||||
- main.rs:672 fail loud
|
||||
- main.rs:1017 startup grace
|
||||
- main.rs:1106,1151 tool snapshot
|
||||
- main.rs:1186-1198 permission routing
|
||||
@@ -0,0 +1,43 @@
|
||||
# Comment audit: hx-core (agent, route, window, switch, subagent, session, stats, context, approve, command)
|
||||
|
||||
Counts are comment blocks (consecutive lines = one comment). Kept: 0 (no SAFETY comments, shebangs or directives in these files).
|
||||
|
||||
| file | tautology | stale | excuse | decision | kept | lines removed |
|
||||
|---|---|---|---|---|---|---|
|
||||
| agent.rs | 48 | 0 | 2 | 3 | 0 | 61 |
|
||||
| route.rs | 31 | 0 | 2 | 2 | 0 | 51 |
|
||||
| window.rs | 25 | 0 | 1 | 1 | 0 | 50 |
|
||||
| switch.rs | 31 | 0 | 1 | 2 | 0 | 44 |
|
||||
| subagent.rs | 26 | 0 | 1 | 2 | 0 | 37 |
|
||||
| session.rs | 26 | 0 | 1 | 1 | 0 | 32 |
|
||||
| stats.rs | 18 | 0 | 0 | 0 | 0 | 27 |
|
||||
| context.rs | 18 | 0 | 0 | 0 | 0 | 24 |
|
||||
| approve.rs | 12 | 0 | 1 | 3 | 0 | 24 |
|
||||
| command.rs | 18 | 0 | 0 | 0 | 0 | 21 |
|
||||
|
||||
## Excuses
|
||||
- agent.rs:68 exact-match loop detector
|
||||
- agent.rs:429 retry ignores retry-after
|
||||
- route.rs:6 keyword heuristics
|
||||
- route.rs:430 log write failure swallowed
|
||||
- switch.rs:132 save failure swallowed
|
||||
- window.rs:104 60k mask cap empirical
|
||||
- subagent.rs:260 read-only child has bash
|
||||
- session.rs:269 no session index
|
||||
- approve.rs:23 reads never prompt
|
||||
|
||||
## Decisions
|
||||
- agent.rs:528 never store empty replies
|
||||
- agent.rs:666 images after tool results
|
||||
- agent.rs:428 retry only before events emitted
|
||||
- route.rs:346 hysteresis scales with history; Fable dropped at once
|
||||
- route.rs:375 history must fit target window
|
||||
- window.rs:9-15 reset invariants, monotone masking boundary
|
||||
- switch.rs:313 client rebuilt to refresh credentials
|
||||
- switch.rs:249 auto/overrides not pinned
|
||||
- subagent.rs:122 abort re-arm per session
|
||||
- subagent.rs:393 abort re-check after slot wait
|
||||
- session.rs:43 skip torn last line
|
||||
- approve.rs:98 unknown permission value denies
|
||||
- approve.rs:301 owner stores "always"
|
||||
- approve.rs:142 codemode inner tools ask themselves
|
||||
@@ -0,0 +1,61 @@
|
||||
# Comment audit: core-b
|
||||
|
||||
| file | tautology | stale | excuse | decision | kept |
|
||||
|---|---|---|---|---|---|
|
||||
| lib.rs | 29 | 0 | 2 | 1 | 0 |
|
||||
| sandbox.rs | 22 | 0 | 1 | 8 | 0 |
|
||||
| permit.rs | 29 | 0 | 3 | 4 | 0 |
|
||||
| tool.rs | 13 | 0 | 1 | 2 | 0 |
|
||||
| hook.rs | 14 | 0 | 0 | 2 | 0 |
|
||||
| compact.rs | 7 | 0 | 0 | 2 | 0 |
|
||||
| herdr.rs | 9 | 0 | 0 | 4 | 0 |
|
||||
| mask.rs | 11 | 0 | 0 | 1 | 0 |
|
||||
| danger.rs | 9 | 0 | 1 | 1 | 0 |
|
||||
| ext.rs | 3 | 0 | 0 | 1 | 0 |
|
||||
| memory.rs | 5 | 0 | 1 | 1 | 0 |
|
||||
| nudge.rs | 2 | 0 | 1 | 1 | 0 |
|
||||
| total | 153 | 0 | 10 | 28 | 0 |
|
||||
|
||||
No SAFETY comments or directives existed in these files.
|
||||
|
||||
## Excuses (original lines)
|
||||
- lib.rs:86 bash tail keyed by command text
|
||||
- lib.rs:97 codemode store memory-only
|
||||
- sandbox.rs:10 one sandbox policy, no per-call network
|
||||
- permit.rs:33 secret detection name-based
|
||||
- permit.rs:59 not a shell parser
|
||||
- permit.rs:243 glob-only allow rules
|
||||
- tool.rs:53 shallow arg validation
|
||||
- danger.rs:25 pattern-rule classifier
|
||||
- memory.rs:7 line-count cap
|
||||
- nudge.rs:4 name heuristic for read-only
|
||||
|
||||
## Decisions (original lines)
|
||||
- lib.rs:73 prompts serialized
|
||||
- sandbox.rs:1 sandbox scope, in-process guards
|
||||
- sandbox.rs:94 git include following
|
||||
- sandbox.rs:167 fail closed
|
||||
- sandbox.rs:250 lexical `..` before canonicalise
|
||||
- sandbox.rs:332 git includes readable
|
||||
- sandbox.rs:469 bwrap mount order
|
||||
- sandbox.rs:500 seatbelt last-match
|
||||
- sandbox.rs:505 stat parents for git
|
||||
- permit.rs:11 readonly list omissions
|
||||
- permit.rs:56 chain splitter accepted syntax
|
||||
- permit.rs:173 cd is free
|
||||
- permit.rs:238 per-segment allow rules
|
||||
- tool.rs:98 danger beats stored rule
|
||||
- tool.rs:118 serialized prompts, re-check
|
||||
- hook.rs:109 shared hook list
|
||||
- hook.rs:142 hook ordering
|
||||
- compact.rs:23 cut at user prompt / fallback
|
||||
- compact.rs:175 roles alternate
|
||||
- herdr.rs:1 single lossy worker
|
||||
- herdr.rs:33 apostrophes rejected
|
||||
- herdr.rs:44 monotonic seq
|
||||
- herdr.rs:132 first report claims pane
|
||||
- mask.rs:1 cache-stable masking
|
||||
- danger.rs:332 judge failure asks user
|
||||
- ext.rs:1 protocol, failures continue
|
||||
- memory.rs:6 index cap forces consolidation
|
||||
- nudge.rs:1 inject at turn end
|
||||
@@ -0,0 +1,43 @@
|
||||
# Comment audit: lens files
|
||||
|
||||
| File | Tautology | Stale | Excuse | Decision | Kept |
|
||||
|---|---|---|---|---|---|
|
||||
| crates/hx-lens/src/deps.rs | 13 | 0 | 1 | 0 | 0 |
|
||||
| crates/hx-lens/src/lib.rs | 30 | 0 | 0 | 3 | 0 |
|
||||
| crates/hx-lens/src/lsp.rs | 13 | 0 | 0 | 5 | 0 |
|
||||
| crates/hx-lens/src/manager.rs | 20 | 0 | 1 | 5 | 0 |
|
||||
| crates/hx-lens/src/runners.rs | 18 | 0 | 0 | 0 | 0 |
|
||||
| crates/hx-lens/src/seq.rs | 4 | 0 | 0 | 0 | 0 |
|
||||
| crates/hx-lens/src/testrun.rs | 26 | 0 | 2 | 0 | 0 |
|
||||
| crates/hx-lens/src/triage.rs | 7 | 0 | 0 | 0 | 0 |
|
||||
| crates/hx-lens/src/watch.rs | 5 | 0 | 1 | 0 | 0 |
|
||||
| .gitea/workflows/build.yml | 2 | 0 | 0 | 6 | 0 |
|
||||
| devenv.nix | 0 | 0 | 0 | 1 | 0 |
|
||||
| flake.nix | 2 | 0 | 1 | 2 | 0 |
|
||||
| tests/*.sh (11 scripts) | 33 | 0 | 0 | 1 | 11 (shebangs) |
|
||||
| tests/*.py, examples/*.py | 13 | 0 | 0 | 2 | 4 (shebangs) |
|
||||
| **Total** | 186 | 0 | 6 | 27 | 15 |
|
||||
|
||||
No SAFETY comments exist in these files. Counts are comment blocks (consecutive comment lines count once; trailing comments count each); totals are approximate. Comment lines removed: 258.
|
||||
|
||||
## Excuses (original line)
|
||||
- crates/hx-lens/src/deps.rs:3-5: line-based import scanning instead of tree-sitter
|
||||
- crates/hx-lens/src/watch.rs:4-5: mtime polling of tracked files, no notify
|
||||
- crates/hx-lens/src/testrun.rs:421-428: v1 heuristic test selection, known FPs/misses
|
||||
- crates/hx-lens/src/testrun.rs:516: graph rebuilt per report, no cache
|
||||
- crates/hx-lens/src/manager.rs:54: clangd has no installer
|
||||
- flake.nix:31: doCheck disabled
|
||||
|
||||
## Decisions (original line)
|
||||
- crates/hx-lens/src/lsp.rs:364,378,386-391: wait for on-save flycheck / stale checks (ADR flycheck-settling)
|
||||
- tests/all.sh:9; crates/hx-lens/src/lib.rs:764: rust-analyzer test serialized; mtime ordering (flycheck-settling)
|
||||
- crates/hx-lens/src/lsp.rs:169: workspace/configuration reply shape (lsp-protocol-quirks)
|
||||
- crates/hx-lens/src/manager.rs:288: rustup proxy exits immediately (lsp-protocol-quirks)
|
||||
- crates/hx-lens/src/manager.rs:369: retry on -32801/-32802 (lsp-protocol-quirks)
|
||||
- crates/hx-lens/src/manager.rs:153,445: outermost root marker wins (lsp-protocol-quirks)
|
||||
- crates/hx-lens/src/manager.rs:465: first empty publish must not be taken (lsp-protocol-quirks)
|
||||
- crates/hx-lens/src/lib.rs:253,373-374,406: attribute run-time disk changes to hx, re-baseline (external-change-baseline)
|
||||
- .gitea/workflows/build.yml:8,34-35,39,61,68,81: version bump, image, node, main ref, exec bit, tag creation (ci-release)
|
||||
- devenv.nix:10: stdenv.cc for rquickjs-sys (build-env)
|
||||
- flake.nix:33,36: aws-lc-sys cmake; bubblewrap runtime (build-env)
|
||||
- tests/tui_smoke.py:7,112-113: realpath cwd; OSC title assertion (build-env)
|
||||
@@ -0,0 +1,75 @@
|
||||
# Audit: hx-ai, hx-mcp, hx-tools comments
|
||||
|
||||
Counts are comment blocks (contiguous runs). Kept: 0 (no SAFETY/shebang/directive comments found).
|
||||
|
||||
| file | tautology | stale | excuse | decision | kept |
|
||||
|---|---|---|---|---|---|
|
||||
| hx-ai/src/anthropic.rs | 13 | 0 | 1 | 5 | 0 |
|
||||
| hx-ai/src/auth.rs | 18 | 0 | 0 | 3 | 0 |
|
||||
| hx-ai/src/claude_cli.rs | 15 | 0 | 6 | 3 | 0 |
|
||||
| hx-ai/src/codex.rs | 5 | 0 | 1 | 4 | 0 |
|
||||
| hx-ai/src/lib.rs | 16 | 0 | 0 | 2 | 0 |
|
||||
| hx-ai/src/models.rs | 16 | 1 | 0 | 1 | 0 |
|
||||
| hx-ai/src/openai_compat.rs | 12 | 0 | 1 | 4 | 0 |
|
||||
| hx-mcp/src/client.rs | 8 | 0 | 1 | 0 | 0 |
|
||||
| hx-mcp/src/config.rs | 12 | 0 | 0 | 0 | 0 |
|
||||
| hx-mcp/src/lib.rs | 25 | 0 | 0 | 3 | 0 |
|
||||
| hx-mcp/src/oauth.rs | 13 | 0 | 1 | 0 | 0 |
|
||||
| hx-mcp/src/serve.rs | 5 | 0 | 0 | 0 | 0 |
|
||||
| hx-mcp/src/tests.rs | 14 | 0 | 0 | 0 | 0 |
|
||||
| hx-tools/src/codemode.rs | 24 | 0 | 0 | 7 | 0 |
|
||||
| hx-tools/src/lib.rs | 9 | 2 | 0 | 1 | 0 |
|
||||
| hx-tools/src/skill.rs | 1 | 0 | 0 | 0 | 0 |
|
||||
| hx-tools/src/web.rs | 12 | 0 | 1 | 1 | 0 |
|
||||
| total | 218 | 3 | 12 | 34 | 0 |
|
||||
|
||||
Stale: hx-ai/src/models.rs:1 (said cache a day; code is 1h), hx-tools/src/lib.rs:1 (listed only read/write/edit/bash), hx-tools/src/lib.rs:36 (duplicated doc line).
|
||||
|
||||
## Excuses and decisions (original line numbers)
|
||||
|
||||
- decision: hx-ai/src/anthropic.rs:13 - OAuth tokens are only accepted with Claude Code tool-name casing.
|
||||
- decision: hx-ai/src/anthropic.rs:64 - Anthropic accepts `[a-zA-Z0-9_-]` in tool ids; Codex ids look like `call|item`.
|
||||
- decision: hx-ai/src/anthropic.rs:77 - Thinking written by another provider (no signature, or a Codex reasoning item) is invalid here.
|
||||
- decision: hx-ai/src/anthropic.rs:129 - Rolling breakpoints (tools+system are covered by the system one): the last message, and the
|
||||
- excuse: hx-ai/src/anthropic.rs:161 - ponytail: fixed token budgets; newer models may prefer adaptive thinking, add when needed
|
||||
- decision: hx-ai/src/anthropic.rs:170 - the budget counts against max_tokens, which must leave room for the reply
|
||||
- decision: hx-ai/src/auth.rs:216 - Anthropic wants JSON, OpenAI wants form encoding.
|
||||
- decision: hx-ai/src/auth.rs:318 - Detached std thread: tokio's stdin would block runtime shutdown until a line arrives.
|
||||
- decision: hx-ai/src/auth.rs:404 - Claude uses the verifier as state (matches Claude Code); Codex uses a random state.
|
||||
- decision: hx-ai/src/claude_cli.rs:3 - Anthropic bills OAuth traffic from third-party apps as "extra usage"; the official binary keeps
|
||||
- excuse: hx-ai/src/claude_cli.rs:5 - stream. ponytail: one `claude` process per hx turn, continued with `--resume`; add a long-lived
|
||||
- decision: hx-ai/src/claude_cli.rs:28 - hx plan mode is on: claude runs with `--permission-mode plan`, else its `ExitPlanMode` is rejected.
|
||||
- excuse: hx-ai/src/claude_cli.rs:29 - ponytail: process-wide flag; make it per-provider if two claude providers ever run at once.
|
||||
- excuse: hx-ai/src/claude_cli.rs:148 - `rate_limit_event` -> window. claude reports `utilization` (0..1) when known, else only a
|
||||
- decision: hx-ai/src/claude_cli.rs:190 - print mode defaults to display "omitted" (empty thinking text) on new models
|
||||
- excuse: hx-ai/src/claude_cli.rs:191 - ponytail: hidden flag; an older claude that rejects it needs a version probe
|
||||
- excuse: hx-ai/src/claude_cli.rs:208 - ponytail: unverified against a real claude (not installed on the dev box)
|
||||
- excuse: hx-ai/src/claude_cli.rs:348 - ponytail: billing/stats see the last request only; split Done if exact sums matter
|
||||
- decision: hx-ai/src/codex.rs:34 - Tool-call ids are stored as `call_id|item_id` so both survive a round trip.
|
||||
- decision: hx-ai/src/codex.rs:68 - encrypted reasoning item is replayed verbatim (store=false)
|
||||
- decision: hx-ai/src/codex.rs:109 - Off has no Codex equivalent (see Effort::levels); send the lowest level instead
|
||||
- decision: hx-ai/src/codex.rs:295 - The server hides models whose `minimal_client_version` exceeds ours, so claim a high one
|
||||
- excuse: hx-ai/src/codex.rs:296 - (override: `HX_CODEX_CLIENT_VERSION`). ponytail: we only list ids; the server still gates use.
|
||||
- decision: hx-ai/src/lib.rs:157 - Start level per provider: Claude thinks only when asked (token cost), Codex always reasons.
|
||||
- decision: hx-ai/src/lib.rs:247 - Incremental stream events. Providers must emit `Done` last with the full assembled message.
|
||||
- decision: hx-ai/src/models.rs:188 - custom endpoints are cheap to ask and their config changes by hand: never serve the cache first
|
||||
- decision: hx-ai/src/openai_compat.rs:80 - tool results first: they must directly follow the assistant's tool_calls
|
||||
- decision: hx-ai/src/openai_compat.rs:106 - plain string: widest server support
|
||||
- excuse: hx-ai/src/openai_compat.rs:254 - ponytail: unparseable arguments are passed on as {"_invalid_arguments": raw} so the
|
||||
- decision: hx-ai/src/openai_compat.rs:345 - not every server knows reasoning_effort: retry once without it
|
||||
- decision: hx-ai/src/openai_compat.rs:357 - servers that close without [DONE] still get their Done
|
||||
- excuse: hx-mcp/src/client.rs:3 - ponytail: hand-rolled instead of `rmcp` (~1 dep tree less); covers initialize, tools, resources, pro
|
||||
- decision: hx-mcp/src/lib.rs:3 - Lazy by default: the system prompt gets a one-line-per-tool index; the model fetches a schema with
|
||||
- decision: hx-mcp/src/lib.rs:24 - Servers whose full tool schemas cost at most this many tokens are registered eagerly: below this the
|
||||
- decision: hx-mcp/src/lib.rs:92 - startup listing must not stall a server for the full tool-call timeout
|
||||
- excuse: hx-mcp/src/oauth.rs:5 - ponytail: public clients only via DCR or a configured `clientId`; no client_credentials/device flow,
|
||||
- decision: hx-tools/src/codemode.rs:2 - inside a QuickJS sandbox; only the script's output reaches the model (pi's codemode, minus
|
||||
- decision: hx-tools/src/codemode.rs:204 - MCP tools first so builtins cannot push them out of the listing budget
|
||||
- decision: hx-tools/src/codemode.rs:289 - The wait for a free worker counts toward the timeout.
|
||||
- decision: hx-tools/src/codemode.rs:324 - QuickJS values are !Send: run the script on its own thread with a local runtime.
|
||||
- decision: hx-tools/src/codemode.rs:522 - The interrupt handler only fires while JS runs; also bound time spent awaiting tools.
|
||||
- decision: hx-tools/src/codemode.rs:529 - Stop as soon as the script settles: unawaited tool calls are dropped (cancelled), not waited for.
|
||||
- decision: hx-tools/src/codemode.rs:619 - Store writes count only for a script that succeeded.
|
||||
- decision: hx-tools/src/lib.rs:401 - own process group so timeouts kill children too
|
||||
- excuse: hx-tools/src/web.rs:92 - ponytail: resolve-then-connect leaves a DNS-rebinding gap; pin the resolved IP via
|
||||
- decision: hx-tools/src/web.rs:120 - GET with manual redirects (each hop checked) and a body cap.
|
||||
@@ -0,0 +1,47 @@
|
||||
# Comment audit: hx-tui
|
||||
|
||||
| file | tautology | stale | excuse | decision | kept |
|
||||
|---|---|---|---|---|---|
|
||||
| agents.rs | 8 | 0 | 0 | 0 | 0 |
|
||||
| btw_view.rs | 2 | 0 | 0 | 0 | 0 |
|
||||
| choose.rs | 13 | 0 | 0 | 0 | 0 |
|
||||
| doc_view.rs | 4 | 0 | 0 | 0 | 0 |
|
||||
| editor.rs | 12 | 0 | 1 | 1 | 0 |
|
||||
| lib.rs | 99 | 2 | 0 | 8 | 0 |
|
||||
| markdown.rs | 9 | 0 | 0 | 1 | 0 |
|
||||
| permit_view.rs | 4 | 0 | 0 | 0 | 0 |
|
||||
| picker.rs | 15 | 0 | 0 | 0 | 0 |
|
||||
| popup.rs | 9 | 0 | 0 | 1 | 0 |
|
||||
| review.rs | 13 | 0 | 0 | 1 | 0 |
|
||||
| scroll.rs | 7 | 0 | 0 | 1 | 0 |
|
||||
| select.rs | 9 | 0 | 1 | 2 | 0 |
|
||||
| sessions.rs | 13 | 0 | 0 | 0 | 0 |
|
||||
| stats_view.rs | 1 | 0 | 0 | 0 | 0 |
|
||||
| status.rs | 26 | 0 | 0 | 0 | 0 |
|
||||
| theme.rs | 15 | 0 | 0 | 1 | 0 |
|
||||
| transcript.rs | 24 | 0 | 0 | 0 | 0 |
|
||||
| total | 283 | 2 | 2 | 16 | 0 |
|
||||
|
||||
Stale: lib.rs:700 (doc "Sessions live next to the current one." on spread_line), lib.rs:1115 ("Returns a line to submit" on fn returning nothing).
|
||||
|
||||
## Excuses (original lines)
|
||||
- editor.rs:160 chars not cell width in wrapping
|
||||
- select.rs:81 assumed space at soft wrap
|
||||
|
||||
## Decisions (original lines)
|
||||
- lib.rs:285 keyboard support query before alternate screen
|
||||
- lib.rs:425 kitty / tmux shift-enter handling
|
||||
- lib.rs:439 panic hook restores terminal modes
|
||||
- lib.rs:453 bracketed paste
|
||||
- lib.rs:460 16 ms redraw throttle
|
||||
- lib.rs:662 200 ms timeout on lens poll (manager lock)
|
||||
- lib.rs:1342 @file completion waits for Tab
|
||||
- lib.rs:1463 unchanged prompt not rewritten (prompt cache)
|
||||
- editor.rs:23 strip control chars from paste
|
||||
- select.rs:1 content-coordinate selection
|
||||
- select.rs:10 OSC 52 size cap
|
||||
- review.rs:560 revert refuses to overwrite manual edits
|
||||
- popup.rs:34 Enter passes through on complete token
|
||||
- scroll.rs:1 follow vs pinned scroll
|
||||
- markdown.rs:1 half-streamed input tolerance
|
||||
- theme.rs:1 no background painting / colour policy
|
||||
Reference in new issue
Block a user