Skip to content

refactor(background_tasks): follow the module layout (moves only) - #859

Merged
antosubash merged 2 commits into
mainfrom
refactor/layout-background_tasks
Nov 6, 2026
Merged

antosubash merged 2 commits into
mainfrom
refactor/layout-background_tasks

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Summary

Moves-only restructure of modules/background_tasks to docs/module-layout.md, same pattern as #852 (permissions).

  • Domain areas core/, worker/, executions/, outbox/, logs/ (added to DOMAIN_AREAS), plus web/ and ui/{components,utils}; tasks.py, module.py, models.py stay at the root
  • Python tests mirror the areas with test_background_tasks_* basenames; tests-js imports rewritten
  • Ten old paths (runner, celery_app, sync_db, tenant_context, settings, config_guards, task_routing, worker_settings, outbox_transport, outbox_worker) stay as deprecated sys.modules aliases (remove_in 0.0.46) because existing run_worker.py scripts and smpy_modules import them
  • Test-only fix: one signals test releases a claimed tenant so the new collection order does not leak the task owner into later tests

No logic changes: Celery task names (before/after diff identical), queue names, permission names, i18n keys, settings keys, log event keys, logger-name literals and app.state attributes are unchanged; no durable event or handler moved (host/tests/test_durable_wire_names.py untouched). getLogger(__name__) loggers follow their module's new path (noted in the CHANGELOG).

Note for #851: a trial merge carries its views.py / Workers.tsx edits over cleanly and conflicts only on one import line in tests-js/background_tasks_WorkersPage.test.tsx (WorkerSnapshot now lives in ui/utils/constants).

Verification

  • make lint, make doctor, make ci-css-build, make ci-api-types-fresh, make ci-docs-build pass
  • PYTEST_WORKERS=8 make test-py (8162 passed, SM_TEST_REDIS_URL set), make test-js (898) pass on the move commit; the follow-up commit only fixes stale paths in docs and comments (ruff check/format clean, affected tests rerun)
  • Two independent reviews (correctness, maintainability): alias identity checked for all ten shims, from background_tasks.runner import build_runner_celery works with a DeprecationWarning, import scripts.run_worker works, moved files body-identical apart from imports; stale-path findings fixed
  • No browser smoke (moves-only, skipped)

https://claude.ai/code/session_01FXHA3ZicrtZ4C5QPEgxfgq

Constants, settings, worker engine settings, config guards, health, lifecycle,
the invalidation transport, the sync session factory and tracking -> core/;
the Celery app factory, runner, tenant task bases, routing, heartbeats,
signals, worker settings and fleet inspection -> worker/; enqueue after
commit, tenant context, the admin listing service, filters and retries ->
executions/; the outbox_* files -> outbox/; retained logs -> logs/; deps and
endpoints -> web/; page components and TS helpers -> ui/. tasks.py stays at
the root and Celery task names are unchanged; no durable event or handler
moved. Ten old paths (runner, celery_app, sync_db, tenant_context, settings,
config_guards, task_routing, worker_settings, outbox_transport, outbox_worker)
stay as deprecated sys.modules aliases (remove_in 0.0.46) because worker
scripts and smpy_modules import them. Logger names that come from __name__
change with the move.

One test-only change: a signals test now releases the tenant it claimed, so
the new collection order no longer leaks the task owner into later tests.

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

chatgpt-codex-connector Bot commented Nov 6, 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-11-06T02:57:04.577745Z 591b945 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: 591b945
Status: ✅  Deploy successful!
Preview URL: https://cbeb26ed.simple-module-python.pages.dev
Branch Preview URL: https://refactor-layout-background-t.simple-module-python.pages.dev

View logs

@antosubash
antosubash merged commit a561da8 into main Nov 6, 2026
17 checks passed
@antosubash
antosubash deleted the refactor/layout-background_tasks branch November 6, 2026 03:03
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