Pipeline pages: list, pipeline and run views, live updates, permissions in one place

This commit is contained in:
claude committed 2026-10-11 22:21:44 +02:00
1 parent d4d8c28c20
commit 644756b965
6 files changed
+796

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
# Pipeline UI (phase 2) Plan
**Goal:** Let people see their pipelines and watch a run unfold, and start, pause and cancel them from the website.
**Approach:** One pure module lays out the graph and draws it as SVG, so it can be unit tested without Django. Thin views and templates sit on top of it. The page follows the existing RektBench theme (tokens in `style.css`), and the flow graph is the one element that gets real design attention: the path a run actually took is drawn bold, everything else stays quiet.
**Stack:** Django views and templates, inline SVG, a small fetch-and-swap script for live updates.
## Decisions taken from the skills
- Every new page and action requires a login. Closed by default.
- One function, `can_manage(user, pipeline)`, decides who may start, pause, delete or cancel: the author, or an approver. Nothing else checks roles.
- Mutating routes accept POST only, carry the CSRF token, take no fields from the body, and redirect only to fixed internal paths.
- Every decision is logged as an event: who, which pipeline, allowed or denied.
- Names of steps are user text. They are escaped when the SVG is built, and the template marks only that finished string safe.
- The graph branches and loops, so steps are never numbered. The chip on a test page names the step and the pipeline.
## Tasks
1. **Layout and SVG (pure).** `OpenBench/pipeline_layout.py`, tests in `UnitTests/test_pipeline_layout.py`. Check: unit tests pass, including layering, loops, orphans and HTML escaping.
2. **Cancel a run.** `cancel_run()` in `pipelines.py`, plus keeping a cancelled run cancelled when late workloads finish. Check: new Django tests fail before, pass after.
3. **Views and permissions.** `OpenBench/pipeline_views.py`, URLs. Check: Django tests for the permission matrix (anonymous, stranger, author, approver, disabled profile) on every mutating route, and that GET never mutates.
4. **Templates, CSS, live script, navigation.** Check: pages render in the test client, the live script is served, the full suite is green.
5. **Chip on the test page.** Check: shown for a pipeline step, absent otherwise, absent when logged out.
Checkpoint after task 3: permissions are the part most worth a human look.