refactor: give the frontend its own directory and split the API into routers
The Site's page sat at the repository root while its scripts lived in local/static, a split with no reason behind it. They are together in web/ now, with the page as index.html, which is also what the image serves. app.py held the adapters, the configuration, the shared query helpers and nineteen routes; customer.py held fourteen more but could not import from it without a cycle, so it was wired by passing nine callables into install_routes. Configuration and shared helpers move to local/runtime.py, the rules for attaching artwork to an order move to local/artwork.py where a customer correction and an operator final-file set can share them, and the routes become seven routers under local/api. app.py is 48 lines that create the application, apply the middleware and include them. Routers import downwards only. Three faults came out of the extraction and are worth recording, because each passed a check that looked sufficient. ast reports a function's line at the def, so every decorator on the line above fell outside the extracted range: twelve routes and the security middleware were defined but never registered, and the files still imported and parsed cleanly. Names the old closure renamed on the way in, and a Jsonb import, were missing in three modules. A name-resolution pass over every new module found those; the route count matching the original exactly, 32, is what confirmed the first. The release gate's marker for the fake payment adapter pointed at app.py and the adapter moved to runtime.py, so the gate passed while the condition it guards was unchanged. That is the same silent decay 2.5 set out to fix. A test now asserts every marker still matches something in its file, so the next move fails loudly. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -348,8 +348,8 @@ for this local implementation checkpoint.
|
||||
|
||||
### Existing assets
|
||||
|
||||
- `dtf-site.html`: the Site. Commercial rules, artwork analysis, cart and
|
||||
delivery UI; its behaviour lives in `local/static/site-*.js`.
|
||||
- `web/`: the Site (`index.html`), the Kanban and customer portal pages, and
|
||||
the scripts behind them. `web/site-*.js` holds the Site's behaviour.
|
||||
- `docs/historico/`: the original specification, endpoint sketch, task plan and
|
||||
status report. Background only — they describe a model this system does not
|
||||
implement.
|
||||
@@ -368,7 +368,7 @@ referenced them; recover from Git history if ever needed.
|
||||
- The original Site had no backend payment, freight quote, order persistence,
|
||||
authentication, purchase history, or real cart persistence. Local order
|
||||
persistence, reviewed quotes, mock freight and fake payment now work through
|
||||
`local/static/checkout.js`. The local customer portal now provides accounts and
|
||||
`web/checkout.js`. The local customer portal now provides accounts and
|
||||
order history; cart recovery is browser-local. Production account verification,
|
||||
recovery, and cross-device cart editing are still absent.
|
||||
- Without the local bridge, the original freight fallback remains a stub.
|
||||
|
||||
Reference in New Issue
Block a user