Skip to content

docs: rewrite CLAUDE.md against the current code - #546

Merged
antosubash merged 4 commits into
mainfrom
ccr-956cd371-ymanmg
Oct 19, 2026
Merged

antosubash merged 4 commits into
mainfrom
ccr-956cd371-ymanmg

Conversation

@antosubash

@antosubash antosubash commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Why

An audit of CLAUDE.md against the code, Makefile and pr.yml found it had drifted: missing lifecycle hooks, a wrong Alembic env path, a claim that diagnostics run in production (they don't), a "linear migration chain" that has four heads, and a per-module settings description that no module follows. It also carried several hundred words of GitHub-issue history that every session paid for in context without it changing how code gets written. Rationale now lives behind links into docs/, which already covers it.

Every concrete claim in the new file was checked against code by three fact-check passes plus one adversarial review, and the corrections from that review are in the second commit. The third commit broadens the Codex rule.

Corrections

  • Hook list: adds register_setup_steps, register_body_limits, register_design_packs, register_audit_links.
  • Diagnostics (SM0xx) run only in development; production boot is failed by strict discovery, the auth-provider check, placeholder secrets, a localhost broker and SM010.
  • Migrations: four heads, make migrate runs upgrade heads; env is host/migrations/env.py. make migration currently fails with "Multiple heads are present"; the file gives the working --head <label>@head recipe (see follow-ups).
  • Inertia render keys use ModuleMeta.name; i18n namespace and app.state slot use the package name.
  • Module settings are DbBackedSettings registered through register_module_settings; env applies only to secrets/process wiring.
  • No env var is required; Redis is one SM_REDIS_URL.
  • make lint contents and the CI job list; hardcoded-string, metadata and README checks are local-only.
  • gen-pages CSS imports are absolute paths; file-size exemptions; untranslated-string exemption syntax; dev-services path is ../dev-services.

Added

  • "Before you push" checklist (gen-pages, lint incl. Ruff on .md fences, gen-i18n diff gate, migration review, CHANGELOG entry).
  • No-magic-strings constants rule (check_hardcoded_strings.py).
  • "Adding a module or package" checklist: scaffold shortfalls that fail make lint, package-lock.json, release.yml matrices, docs pages, branch_labels; framework packages wired by hand.
  • Background tasks / audit links / design packs integration rules, AwareDateTime, session.on_commit, full fixture list.
  • "Working in parallel": fan independent slices out to subagents with an explicit per-task model. Use the Codex CLI as a first-class subagent when installed and authenticated (command -v codex && codex login status): codex exec -s read-only for review and fact-check slices, -s workspace-write only inside its own git worktree for write slices, bypass flags forbidden.
  • Pointer to the shipped skills/ directory to keep in sync.

Follow-ups found but out of scope here

  • make migration is broken while the history has several heads (Makefile:184 passes no --head). Either take a head=<label> argument or merge the heads with alembic merge heads.
  • The make new-module scaffold emits code that fails make lint: literal inertia.render("<Class>/Create") (scripts/_templates_endpoints.py:106), permission/menu strings without constants or label_key, and direct app.state.<pkg> assignment instead of register_module_settings (scripts/_templates_module.py:35-39).
  • Stale docs/skills: docs/module-authoring.md § Multi-module branches ("chains linearly"), skills/simple-module-testing (vitest does collect modules/**/tests-js; e2e is in PR CI), skills/simple-module-doctor and skills/README.md (codes stop at SM021), skills/simple-module-registries (missing most hooks), docs/release.md (13 vs 20 PyPI packages), docs/framework-conventions.md and _dev_boot.py docstring (say diagnostics run in production), .claude/skills/running-the-stack (".env beats process env" is backwards; the leak is the unpinned vite_dev_url in the settings fixture).

https://claude.ai/code/session_01TJ3Gy55Ngyuj5o4UakoF2v

Audit found the previous file had drifted from the codebase and was carrying
GitHub-issue history that cost context every session without changing how
code gets written here. This rewrite is shorter in words and checked claim
by claim against the code, Makefile and CI workflow.

Corrections:
- Lifecycle hook list was missing register_setup_steps, register_body_limits,
  register_design_packs and register_audit_links.
- Diagnostics (SM0xx) run only in development; production boot is failed by
  strict discovery, the auth-provider check and SM010, not by the suite.
- Migration history has several heads (make migrate runs `upgrade heads`);
  the Alembic env is host/migrations/env.py.
- Inertia render keys use ModuleMeta.name; the i18n namespace and
  app.state slot use the package name. The two were conflated.
- Module settings are DbBackedSettings registered via
  register_module_settings, not env-driven dataclasses.
- No env var is required (SQLite default); Redis uses one SM_REDIS_URL.
- `make lint` and the CI job list were incomplete; the hardcoded-string,
  metadata and README checks are local-only.
- gen-pages CSS imports are absolute paths, not a `#module/` alias.
- File-size cap exemptions, untranslated-string exemption syntax and the
  dev-services path were wrong or incomplete.

Added:
- "Before you push" checklist (gen-pages, lint incl. ruff on .md fences,
  gen-i18n diff gate, Postgres round trip, CHANGELOG entry).
- No-magic-strings constants rule enforced by check_hardcoded_strings.py.
- "Adding a module or package" checklist (package-lock, release matrix,
  docs pages, branch_labels; framework packages wired by hand).
- Background tasks, audit links, design packs integration rules;
  AwareDateTime; session.on_commit; full fixture list.
- "Working in parallel": fan out independent slices to subagents with an
  explicit per-task model, and use the Codex CLI as a read-only second
  reviewer when it is installed and authenticated.
- Pointer to the shipped skills/ directory to keep in sync.

Claude-Session: https://claude.ai/code/session_01TJ3Gy55Ngyuj5o4UakoF2v
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Deploying simple-module-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5f603c5
Status: ✅  Deploy successful!
Preview URL: https://b7044a00.simple-module-python.pages.dev
Branch Preview URL: https://ccr-956cd371-ymanmg.simple-module-python.pages.dev

View logs

- `make migration` fails with "Multiple heads"; give the working
  `revision --autogenerate --head <label>@head` recipe.
- The scaffold is not lint-clean (literal render key, magic strings,
  direct app.state assignment); say so in § Adding a module.
- Production boot: name every fatal check (placeholder secrets, localhost
  broker, SM025 reported, SM010 first-run exception).
- Env-reading modules are not only background_tasks; .env/pytest advice
  states the real mechanism and says to restore the file; redis fixture
  skips locally and fails only under CI.
- Restore dropped rules: configuration lives in the DB, active-tenant
  routes, tenant_resolver, invalidation TTL floor, CSP provider,
  SetupAction, menu label fallback, secret never copied to DB,
  playwright install.
- Narrow AwareDateTime to explicit column types; default_tenant stamping;
  i18n.messages null on every X-Inertia request; rate limit "by default".
- Codex: probe with `command -v codex`, no npx, review via
  `exec -s read-only review --base main`, forbid the bypass flags.
- framework/* packages also need the publish-pypi matrix; § Styling link.

Claude-Session: https://claude.ai/code/session_01TJ3Gy55Ngyuj5o4UakoF2v
Broaden the Codex rule from "read-only second reviewer" to a parallel
subagent for any independent slice. Read-only slices run with
`-s read-only`; write slices get their own git worktree via `-C` so two
agents never edit one working tree, and their diff is reviewed before it
merges into the branch. The bypass flags stay forbidden.

Claude-Session: https://claude.ai/code/session_01TJ3Gy55Ngyuj5o4UakoF2v
@antosubash
antosubash marked this pull request as ready for review October 19, 2026 04:55
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-10-19T04:59:15.991412Z 984294d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Resolve the CLAUDE.md conflict by keeping the rewrite and folding in
main's additions from #550 and #525: pytest-xdist parallel runs
(`-n auto --dist loadgroup`, `PYTEST_WORKERS=0`), the serial Postgres
suite, single tests running in-process, the test plugin's reduced
password-hash work factor and `SM_TEST_REAL_PASSWORD_HASHING`, and the
xdist collection rules (deterministic parametrize ids, per-worker names).

Claude-Session: https://claude.ai/code/session_01TJ3Gy55Ngyuj5o4UakoF2v
@antosubash
antosubash merged commit 158a078 into main Oct 19, 2026
13 checks passed
@antosubash
antosubash deleted the ccr-956cd371-ymanmg branch October 19, 2026 11:13
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.

2 participants