Skip to content

fix(types): Generator annotations for @contextmanager (ty 0.0.85 deprecation) - #411

Merged
antosubash merged 1 commit into
mainfrom
fix/ty-contextmanager-generator
Oct 7, 2026
Merged

antosubash merged 1 commit into
mainfrom
fix/ty-contextmanager-generator

Conversation

@antosubash

Copy link
Copy Markdown
Owner

ty 0.0.85 (CI installs the latest; uv.lock is not committed) reports -> Iterator[...] on @contextmanager/@asynccontextmanager functions as deprecated, and ty check exits non-zero on it, so Python typecheck fails on main and on every open PR. This changes the 9 sites to Generator/AsyncGenerator; no behaviour change.

Verified: uv run ty check clean, ruff format/check clean, 524 tests in framework/db, background_tasks, file_storage, tenants owner-race pass.

https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

…ator

ty 0.0.85 (unpinned, uv.lock is not committed) reports the Iterator overload
of contextmanager/asynccontextmanager as deprecated, and  exits
non-zero on those warnings, so Python typecheck fails on main and every PR.

Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 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-07T06:54:39.899012Z 651bb85 PR opened
ℹ️ 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.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying simple-module-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 651bb85
Status: ✅  Deploy successful!
Preview URL: https://b8477abf.simple-module-python.pages.dev
Branch Preview URL: https://fix-ty-contextmanager-genera.simple-module-python.pages.dev

View logs

@antosubash
antosubash merged commit 9b9e3eb into main Oct 7, 2026
13 checks passed
antosubash added a commit that referenced this pull request Oct 7, 2026
…uilder line cap)

Merging main brought #408's middleware wiring into app_builder.py (302 lines);
move project-root resolution to _project_root.py. #409's new contextmanager
used the Iterator annotation that ty 0.0.85 flags (see #411).

Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
antosubash added a commit that referenced this pull request Oct 7, 2026
* feat(hosting): ship the /setup wizard with the framework (#351)

SetupMiddleware redirected a fresh install to /setup, but the route and page
lived only in this repo's unpublished host, so any other host got
/ -> /setup -> 404.

- simple_module_hosting.setup_wizard: GET /setup, POST /setup/test-connections
  and POST /setup/steps/<id>, mounted by create_app. Router-level gates: 404
  outside setup mode, then the session CSRF token.
- SetupStep.action (SetupAction/SetupField in core): a module hands the wizard
  a form spec and a handler; the wizard runs it only while that step is
  pending (409 otherwise). host.migrations uses it for alembic upgrade.
- users ships the first-administrator action: password policy, then a DB
  lock (pg_advisory_xact_lock / SQLite write lock) plus an in-process lock,
  re-check and insert in one transaction, so concurrent POSTs mint one admin.
- The wizard page ships from the wheel: gen-pages registers it as
  Setup/Wizard in modules.generated.ts/.assets.json/.css like a module's
  pages. Strings live in a new "hosting" catalog.
- Required steps without an action are logged at boot; the gate logs once
  when it starts redirecting.
- host/ no longer carries setup code; the UI-less /setup/site-basics is gone.

Fixes #351

Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

* fix(setup): don't echo migration errors to the anonymous caller

The migrations action is reachable without auth while the step is pending,
and an alembic failure routinely carries the database URL, SQL or paths.
Log the error with the correlation id; return a generic detail.

Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

* refactor(optimize): drop duplicate constant, redundant filter and import in setup wizard

Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

* fix(setup): mark the wizard document no-store (embeds CSRF token)

Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

* fix(setup): review fixes - keep app loggers alive after in-process migrations, share admin-exists query

Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

* fix(setup): boot an unmigrated first-run install to the wizard

QA found a fresh unmigrated database crashed the boot in Users/Permissions
on_startup (no such table), so /setup was unreachable and the migrations step
useless. A failing on_startup on a behind-head first run is now deferred and
replayed after the wizard applies the migrations. Also add the missing
sqlmodel import to the scaffolded alembic script template.

Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

* fix(setup): replay deferred startup from the gate too, serialise migrations, keep app logging

Review findings: any worker that observes the schema at head now finishes the
deferred on_startup hooks (not only the one that ran the migrations); replay is
locked and never raises after migrations committed; concurrent migration runs
are serialised; in-process alembic no longer clobbers the app's logging.

Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

* fix: reconcile setup wizard with main (ty Generator annotation, app_builder line cap)

Merging main brought #408's middleware wiring into app_builder.py (302 lines);
move project-root resolution to _project_root.py. #409's new contextmanager
used the Iterator annotation that ty 0.0.85 flags (see #411).

Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
@antosubash
antosubash deleted the fix/ty-contextmanager-generator branch October 8, 2026 11:40
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.

1 participant