Wire the app like the boilerplate: door, queue, schedules, eight tabs

app/main.py assembles it in the boilerplate's order, auth.connect first,
then the queue with the scheduler and the pages. TABS is Roles,
Applications, Agents, Companies, Jobs, Schedules, Messages and Account:
the alpha page's three views become templates on the boilerplate's
base.html, driven by static/roles.js (the old app.js) through api() and
toasts.js, over the unchanged JSON routes. Companies lists every board with
its open roles and the affinity control. A 422 is one sentence, so a toast
never reads [object Object].

Config takes the boilerplate's shape: APP_CONFIG or config.yaml, a missing
file is the defaults, an unknown key is an error. roles.yaml is gone;
config.yaml is the committed default and carries the starter agents.

pull is now a job that asks for the pull cascade, because a schedule
enqueues a job kind; its default schedule, every 6h, is declared beside it
in app/jobs/cascade.py. pull_batch's targets are keyword-only so the Jobs
tab offers no batch button. `app worker` is the boilerplate's; `app job`
still drains a queue of its own and fires no schedules.

test_coupling holds pipeline, auth and desk apart (desk may import
pipeline) and plugins to desk; test_architecture keeps app's layers, now
with main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-23 12:48:12 +02:00
1 parent 24508dd6fc
commit 59a301c351
42 files changed
+2407 -998

No files matched your search

+11 -6
View File
@@ -1,10 +1,12 @@
"""The package boundaries, held as a test rather than as a convention.
Adapted from news/tests/test_architecture.py. One tree of our own, `app`,
and two external ones, `desk` and `pipeline`, imported from ../news.
and three copied ones: `pipeline` and `auth` from the boilerplate, `desk` from
news. Which of those may import which is `tests/test_coupling.py`'s rule; this
file holds `app`'s own layers.
1. **Direction.** Within `app`, a package imports only from packages below
it in `LAYERS`. `desk` and `pipeline` may be imported by any of them.
it in `LAYERS`. `desk`, `pipeline` and `auth` may be imported by any of them.
2. **Doors.** From outside a package, only `<tree>.<package>` is imported, and
only names it lists in `__all__`. `desk.tools` has no door of its own, so
there the door is the tool: `desk.tools.<tool>`, one level, no deeper.
@@ -25,10 +27,11 @@ import pytest
ROOT = Path(__file__).resolve().parents[1]
#: Bottom to top. `cli` is the entry point and may reach anything.
LAYERS = ["models", "config", "storage", "jobs", "web", "cli"]
#: Bottom to top. `main` assembles the app from everything below it; `cli`
#: and `__main__` are the entry points and may reach anything.
LAYERS = ["models", "config", "storage", "jobs", "web", "main", "cli", "__main__"]
APP = "app"
EXTERNAL = {"desk", "pipeline"}
EXTERNAL = {"desk", "pipeline", "auth"}
TREES = {APP} | EXTERNAL
@@ -142,7 +145,9 @@ def test_the_rules_catch_what_they_are_for() -> None:
assert plugin_violations("from desk.sources.base import Source")
assert not plugin_violations("from desk.sources import Source, Item")
assert direction_violations("storage", "from app.web import create_app")
assert direction_violations("storage", "from app.web import TABS")
assert direction_violations("web", "from app.main import create_app")
assert not direction_violations("main", "from app.web import pages_router")
assert direction_violations("storage", "from app import jobs")
assert not direction_violations("jobs", "from app.storage import Store")
assert not direction_violations("models", "from pipeline import job")