Repository navigation
[FEAT, TEMPLATE, DOCS] v2.0.0 stage 1: fastkit doctor, unified API conventions, template set - #94
Conversation
[FIX, TEMPLATE, CICD] harden generated secrets and auth, add Windows support (v1.5.2)
…tions - add `fastkit doctor` with --fix, --dry-run and --format json - addroute: --dry-run/--diff/--entity, full CRUD for both layouts - one HTTP contract for all templates, init options and addroute output - pagination built in; JWT and FastAPI-Users options implemented - session invalidation, stricter SECRET_KEY rule outside development - startdemo/addroute exit 1 on failure - bump version to 2.0.0 (unreleased; base of the 2.0.0 work) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…move three templates
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
✅ Template Inspection Passed All changed templates have been validated successfully. Last updated: 2026-12-02T02:47:14.782Z |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d33cf31900
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ) -> <entity_class>Read: | ||
| """Create a record; the Location header points at it.""" | ||
| record = repository.add(payload.model_dump()) | ||
| location = request.url_for("get_<entity_snake>", <entity_snake>_id=record.id) |
There was a problem hiding this comment.
Make reverse-route names unique to each route module
When two routes use the same entity name—for example, orders and archived_orders --entity Order—both generated routers register a getter named get_order with the same order_id parameter. The planner permits this because their files and module-level bindings do not collide, but request.url_for() resolves the first matching route, so creating an archived order returns a Location pointing into the orders collection instead. Use a route-specific name for reverse lookup rather than deriving it solely from the entity. The domain and enveloped route templates need the same treatment.
Useful? React with 👍 / 👎.
| write_generated_text(planned.path, planned.content) | ||
| created_files.append(planned.path) |
There was a problem hiding this comment.
Include partially written new files in rollback
If writing a new file fails after opening it, such as when the filesystem runs out of space, write_generated_text() leaves an empty or partial file behind but execution never reaches created_files.append(). Rollback therefore does not remove that file, and its nonempty parent directories also remain. This defeats the new all-or-nothing route application behavior and causes a subsequent addroute attempt to reject the leftover files as an existing route. Record the destination before writing, or write through a temporary file that is cleaned up on failure.
Useful? React with 👍 / 👎.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
- Location header resolved another router's route when two routes shared an entity name - a new file left half-written by a failed write is now removed on rollback Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Requesting Merging
Description
First of several staged PRs for v2.0.0. This one contains two commits:
fastkit doctor,addroute --dry-run/--diff/--entity, and one HTTP contract for every template, everyfastkit initoption andaddrouteoutput.fastapi-helloadded,fastapi-sqlmodelon three databases, plus fixes to CLI messages and to project creation with Poetry and PDM.Later stages (catalog and generation API, unified
fastkit init, post-generation guidance, web generator, docs rebuild, translations) follow in separate PRs.__version__is already2.0.0; the CHANGELOG heading has no release date yet.Type of Change
Test Environment
EncodingWarningfromfastapi_fastkitas errors: 3207 passed, 21 skippedLC_ALL=C,PYTHONUTF8=0),-m "not extended": 3116 passed, 21 skippedos/signalattributes removed): 3199 passed, 29 skippedmypy src,black --check,isort --check: cleanmkdocs build --strict: no warningsdev: 98%fastapi-sqlmodelgenerated and run against SQLite, PostgreSQL 17 and MySQL 8.4 (migrations up and down, CRUD, timestamps,/ready; its 124 tests pass on each)fastapi-hellogenerated, installed and run with uv, pip, Poetry 2.5.2 and PDM 2.29.8Not verified on real Windows. The
windows-latestjob runs this code for the first time on this PR.Major Changes
Breaking
/api/v1,GET /healthat the root,GET /readywhere a database or cache exists, paginated list envelope, 201 withLocation, 204 on delete, PUT replaces and PATCH updates. The CHANGELOG has the before/after table.fastapi-async-crud,fastapi-dockerizedandfastapi-psql-ormwith their tutorials. Existing projects keep working.ENVIRONMENTother thandevelopmentrefuses a missing, example or shortSECRET_KEY.startdemo,addrouteanddeleteprojectexit 1 on refusal or failure.runserverwithout.venvexits 1 unless the user continues with the current Python.initno longer offers CORS and Pagination; every project includes them.CLI
fastkit doctor [PATH]with--fix,--dry-run/--diff,--yes,--format json. Passed checks read as passes; checks that do not apply are skipped.addroutegenerates a typed CRUD resource with tests in both layouts;--dry-run,--diff,--entity. It refuses only real single-file projects.startdemovalidates the template name before prompting and suggests close matches.runserverprints the commands that create.venvfor the project's package manager and uses the current interpreter's uvicorn.list-templatesis ordered from simplest to most involved;list-featuresshows built-in utilities;--helphas a "Start here" section.Templates
fastapi-hello: onemain.py, three endpoints, tests, concept comments linking to the FastAPI docs.fastapi-sqlmodel: SQLite, PostgreSQL or MySQL throughDATABASE_URL, optional driver extras, a compose file for local servers, migrations that work on all three.fastkit initoptions: JWT and FastAPI-Users are implemented; session logout invalidates the session; rate limiting useslimits; MongoDB uses PyMongo's async client.Docs
reference/translation-statuslists the pages).Screenshots (optional)
N/A
Etc
startdemodependency table lists test tools and comment lines fromrequirements.txt; thefastapi-sqlmodelDocker image installs development tools.