8000 Comments: a rule, about 40 that are wrong today, and a pass over every file · Issue #312 · alexbeeken/skrongle-mini · GitHub
[go: up one dir, main page]

Skip to content

Comments: a rule, about 40 that are wrong today, and a pass over every file #312

Backlog

Description

@alexbeeken

The comments are mostly good: 8,971 comment lines in 66,496 (13.5 %), no commented-out code, no TODO markers, and about 85 % say why. So this is a targeted pass, expected to remove 400 to 600 lines and shorten about 770.

1. Comments that are wrong today. Fix these first; they mislead.

Where Says The code
src/main.rs:376-377 "at most 8 accounts and 32 connections" 50 and 128 (src/caps.rs)
src/auth.rs:57; src/routes/auth.rs:~308; src/tutor.rs:~750 the pool "has three threads"; "(two) async workers" 1 worker, 2 blocking threads
src/routes/manage.rs:578 CurrentUser::require_ai require_ai_courses, require_ai_tutor
src/routes/guide.rs:534 pages::set_start does not exist
src/ai/error.rs:185 failure_kind failure_kind_from_text
src/jobs/retention.rs:15 see TODO.md no such file
src/routes/mod.rs:210; src/routes/pages.rs:1 Study mode has an overview /study redirects to /lessons
src/sprint.rs module doc "Two kinds of exercise" three follow
src/routes/dev_ai.rs:9 "the two key profiles" one
src/dev.rs:9-10; src/dev_ai.rs:1-5 simulator covers three providers six
src/signup.rs:9-15, :410-412 open never makes an owner it does
src/main.rs:93; src/routes/mod.rs:564 example version 0.1.0 drop the number
src/owner.rs:4 ./spanish-learning the binary is skrongle

Describing what mini does not have:

  • Per-learner keys: src/ai.rs:7-8, src/ai/queue.rs:14-15, :373, :609, src/prices.rs:2, :5, src/routes/mod.rs:288, src/routes/courses/mod.rs:3, src/routes/courses/create.rs:188, src/routes/courses/generate.rs:7, :34-35, :387.
  • Metering, allowance, reservation: src/ai.rs:365-367, :1485, src/ai/budget.rs:3, :19, :70-71, src/ai/prompt.rs:190-192, src/routes/profile.rs:2-3.
  • Plans: src/routes/courses/generate.rs:60-62. Postgres and several servers: src/jobs.rs:9-12, :14-16, :153. Coins, shop, leaderboard: src/motivators.rs:3, :13, :16. Google sign-in: src/profile.rs:8-9.

2. Issue numbers. 816 references on 769 lines. About 71 % are the parent repo's numbers and mean nothing here; the two sets collide (#190 means two different things in two files, and src/caps.rs:10 has to write "mini #133"). A reader cannot trust a bare #N.

3. Banners and history. 109 section banners (// ---- … ----), and 60 to 80 lines that narrate history ("It was 8 until…", "Split out of…", "no longer").

4. Not-yet-done notes that should be issues or go: src/jobs/retention.rs:14-16 (retention periods "are placeholders until the owner decides them": decide, or say 730 days is the decision); src/algebra_tiles.rs:9 (no negative tiles yet); src/notes.rs:3; src/ai.rs:1310-1312 (the rebinding gap: keep the comment, it is tracked in the Generate-form issue).

Proposed rule for CLAUDE.md:

## Comments
- A comment says why: a constraint, an invariant, a security reason, a measured number, a trap.
  If deleting it would cost the next reader nothing the code does not say, delete it.
- No history: never "was", "used to", "no longer", "now", "moved from", "since/before #N".
  Describe the code as it is; history lives in git and CHANGELOG.md.
- No issue numbers in code, comments, assert messages or SQL (the parent's numbers and
  mini's collide); the PR title carries the number. Write the reason itself.
- No section banners and no TODO / "for now" / "to come": open an issue.
- Keep `// SAFETY:`, `// panic-ok: <why>`, one `//!` paragraph per module, and `/// GET /path` on handlers.
- Never describe what mini does not have (plans, e-mail, metering, per-learner keys, Postgres).
- Touching code means re-reading the comments beside it.

Applying it: seven batches by subsystem, about 1,270 comment lines each, no file in two batches, so they can be done side by side: AI; courses; accounts and security; connected apps and Manage Users; learning core; router, pages and modes; infrastructure, dev and checkers. Then Cargo.toml, and last the 129 file.rs:N line references in docs/architecture.md, which every batch shifts and no test checks: replace them with names.

What tooling reads comments, so must not break:

  • Every // panic-ok: stays on its line (14 sites). A trailing comment containing x[ or .unwrap() counts as a panic site.
  • src/mastery/cache.rs:255-285 flags any non-comment line containing user_progress; a trailing comment naming it fails the test.
  • src/test_course.rs:171 collects every alias = " in src/content.rs, comments included.
  • scripts/pi-budget.sh:160 reads src/caps.rs constants by pattern: comments only there.
  • Shipped .sql files: a comment inside a CREATE TABLE is stored in sqlite_master, so leave them alone.
  • Run scripts/file-size-lint.sh --update in each PR. Never cargo fmt.

From the code review of 24 November 2026. Line numbers are as of 0.5.0 (2547b36).

Activity

  1. added
    review
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0