Commit Graph
536 Commits
Author SHA1 Message Date
stroblme 6802cd2203 Make changing engine-run code superuser-only
Writing node source, installing modules and any flow save that adds,
retypes or repoints a code node (Function, Command), edits a Command
node's settings or changes a node's resources.env now answer 403 for
everyone but a superuser. MCP tools and the assistant reach the same
routes, so they inherit the gate. Node types report runs_code.

The editor shows code read-only with a note, disables a Command node's
settings, leaves code nodes and reusable nodes out of the palette and
paste, and the Modules page offers no install.
2026-10-06 11:36:30 +02:00
stroblme 2914d860b1 Make self-service signup opt-in via SIGNUP_ENABLED
/users/signup answers 403 unless SIGNUP_ENABLED is set. A public
GET /utils/config/ tells the login page, which hides the sign-up link,
and the signup page explains that an administrator creates accounts.
2026-10-06 11:24:27 +02:00
stroblme a057b61859 Explain the terminal chart colours by the terminal theme
The docstring still justified the ANSI colours by the old one-hue web ramp.
The web now draws from the categorical --chart-1…8; the terminal keeps named
ANSI colours so it follows the user's terminal theme.
2026-10-06 07:24:54 +02:00
stroblme 70421c7454 Scroll the current dashboard to the middle of the phone rail
On mount and on every switch the horizontal rail scrolls itself (not the
page) so the active entry is centred, instantly under reduced motion.
2026-10-06 07:24:53 +02:00
stroblme eca2ccde2f Make dialog close and footer buttons 44px below md
The close button grows to a 44px target centred on where its icon already
sits, and every footer button is 44px tall, on a phone only; desktop keeps
its sizes.
2026-10-06 07:24:53 +02:00
stroblme b5513f8615 Edit json, record and list values in the JSON dialog
An inject's payload and a flow input's starting value of those types use
JsonField instead of a one-line text field. The field can now hold no value
(shown as the placeholder; an emptied editor saves null) and checks the shape:
a record must be an object, a list an array.
2026-10-06 07:24:43 +02:00
stroblme 409a90db28 Draw charts from one categorical palette, --chart-1…8
The one-hue ramp told lines apart by lightness alone. --chart-1 is now
--primary and slots 2-8 are distinct hues (orange, violet, green, orchid,
ochre, teal, magenta) that clear 3:1 on --card and stay apart under
protanopia and deuteranopia; red and sage are left out as the status
colours. A chart takes the slots in order instead of spreading a ramp,
and a dashboard's own palette continues after its primary and listed
colours with slots 2-8 rather than tints of its scheme. Line charts stay
at five series. Tokens mirror index's, as design-check requires.
2026-10-06 07:05:09 +02:00
stroblme 2c605b2c13 Float the dashboard rail along the bottom on a phone
Below md a dashboard stacks to one column and dropped its rail. The rail is
now a horizontal row in the dashboard's own look, floated over the bottom
of the screen on /panel/{id} and above the dock in the app's view, with
44px items, sideways scrolling when it overflows, and padding so the last
tile clears it; a panel's read-only notice moves up out of its way. The
three looks share the geometry from ui/core.
2026-10-06 00:22:28 +02:00
stroblme 5a145b8f59 Edit JSON node settings in a dialog from a one-line preview
A free setting typed json and a declared object or array setting (a Switch
node's rules, HTTP headers) show one line of their value; clicking opens a
Monaco JSON editor in a dialog that saves only once the text parses.
Declared object settings were not shown at all before. Escape in a dialog
opened from a side panel no longer closes the panel too.
2026-10-05 23:49:42 +02:00
stroblme 6fe59347e0 Name a port apart from its message in the node panel, two lines per port
The port name follows the message until it is typed by hand, and clearing
it follows again. The second line holds the message, so a list port's item
type no longer squeezes the name.
2026-10-05 23:28:04 +02:00
stroblme aa7d9eece8 Document the wren node and the chat's Control tab 2026-10-05 20:59:23 +02:00
stroblme afe0c94a24 Talk to wren nodes from the chat's Control tab, opened from Home 2026-10-05 20:59:11 +02:00
stroblme 14d3208a5d Add the wren node: a typed command into values for the devices wired to it 2026-10-05 20:58:59 +02:00
stroblme 61b89961db Document the icon and colour names a forecast can carry 2026-10-05 18:57:58 +02:00
stroblme 11c7fdcb8b Centre a node arrived on from another screen
The viewport effect marked the selection as centred before the layout
had placed anything, so an arrival at ?node= fitted the whole flow.
It is recorded once the fit has run.
2026-10-05 18:19:38 +02:00
stroblme a677409079 Find a flow's declared inputs and outputs in the global search
/search lists each input and batch output under its qualified message,
and picking one opens the flow on the label's id, which the editor now
treats like a click on the label: it opens the flow's settings.
2026-10-05 18:15:35 +02:00
stroblme 901e85f3fb Word the soak harness's host-safety note host-neutrally 2026-10-05 18:01:34 +02:00
stroblme f09e0ffc44 Spell the API host as api.${DOMAIN} in the worker and login examples 2026-10-05 16:54:09 +02:00
stroblme f14f7bd413 Make narrowed backend test runs and the quarantine test order- and load-proof
The session db fixture now disposes the engine before deleting the file, since a
module under a no-op db (tests/sdk, tests/flow) may have connected first; the
sdk import tests forget the study packages they import; the supervision tests
keep the real quarantine length so it cannot expire mid-assertion.
2026-10-05 16:54:00 +02:00
stroblme 43e777b7c7 Read a key a run lacks as its flow's declared value in "What differs"
Runs from before the declared values were folded into params lack them, so
every such key read as varied next to a newer run with the same value.
2026-10-05 16:34:48 +02:00
stroblme a0b90afe5c Show one seed column when the flow declares a seed input
The run-level seed is that parameter then, so the comparison table drew it
twice and counted it twice in "N of M varied".
2026-10-05 15:11:01 +02:00
stroblme 929933d7c3 Record which inputs a run's caller passed, and mark defaults from it
`Run.passed` (migration d5a3c8e1f246) keeps the names the caller chose, so
the run detail and the comparison table can mark a value as the flow's own
again; rows from before it fall back to the names their params lack. Retries
hand on their parent's list, imports record their entry's.

Also: a cancel of a queued run no longer leaves its id in `_cancelled`, a
linked comparison no longer crashes before the list loads, and the pre-commit
failures are fixed (stale client, `text-[10px]`, worker formatting).
2026-10-05 15:01:33 +02:00
stroblme bca28dbf75 Keep a run's lease while its pipeline builds; allow cancelling it then
A claimed run only joined the leased set once its pipeline was built, so a
build waiting for a busy worker pool got the run swept as abandoned. Cancel
now also stops such a run, and a terminal status being overwritten is logged.
2026-10-05 11:23:54 +02:00
stroblme 3f818c878c Back to development 2026-10-03 11:55:17 +02:00
stroblme e5a9a3738d Release v0.1.6
Publish / publish (push) Failing after 39s
v0.1.6
2026-10-03 11:51:21 +02:00
stroblme 0649062327 Bound warm workers' host memory and account local RAM
A worker over FLOW_WORKER_MAX_RSS_MB (--worker-max-rss) when its node
returns is retired instead of kept warm, in the shared pool and in every
declared one; 0, the default, keeps them all. The engine now accounts its
own memory (FLOW_RAM / --ram, else the box or the cgroup limit less 1 GB),
so a node's `ram` declaration holds locally. A declared environment the
shared pool already has is that pool rather than a duplicate set of warm
workers.
2026-09-27 16:11:13 +02:00
stroblme 7240b7b823 Add the assistant: a chat that drives the MCP tools in-process
A provider set under Settings (OpenAI-compatible; key encrypted in
flow-data/ai.json) turns on an Assistant panel in the sidebar. Each turn runs
the FastMCP tools in-process as the person chatting, streams the rounds over
SSE and keeps one transcript per user. The panel floats on any screen and
shares the editor's lane: a settings panel keeps the top half, the chat the
bottom. The MCP client is now built once, for the endpoint and the chat.
2026-09-16 23:28:23 +02:00
stroblme af18d134a4 Add POST /runs/import for runs executed elsewhere
A history recorded before the move (MLflow experiments) had nowhere to
go, since runs were only made by running a flow. Each entry is stored as
it ended: parameters completed and checked like a submit, cause
"import", empty commit and code digest, metrics and artifacts written
as given, nothing queued or announced. Run.external_id (new migration)
makes a second import a no-op and is an export column so a row joins
back. The request is all or nothing and capped at 200 entries;
Client.import_runs pages a longer history.
2026-09-16 17:01:07 +02:00
stroblme ff4feb7af6 Drop an unused fixture from the ignore-walk test 2026-09-16 17:01:07 +02:00
stroblme 831bda9c46 Sync only the declaring module before a run; skip git-ignored paths
`fluksio run` walked the working directory and imported every module in
it, which ran a research repository's analysis scripts before the run was
submitted. A flow's origin now records the file and module name that
declared it, and run/sweep import just that, under the same name so the
generated node bodies do not change. A flow with no record still walks,
now skipping what .gitignore covers.

Every code-defined flow reports `flow` changed once on its next sync,
since the origin gained two fields.
2026-09-16 16:55:02 +02:00
stroblme f950cfbf6c Bind serve's socket before writing client.json
A serve that lost the port race had already signed in, so client.json
named a port another engine held and every client talked to that one.
The socket is now bound first and handed to uvicorn.
2026-09-16 16:47:11 +02:00
stroblme 42ea2e50ac Export FLOWS and build from the top-level fluksio package
A test of the declarations had to import them from fluksio.sdk while the
guide teaches `from fluksio import ...`. The worker's inert module gets the
same two names so a module importing them still loads inside a node.
2026-09-16 16:44:47 +02:00
stroblme 02907bbe27 Leave a dotted key out of the runs export header
_leaves named a column for a key like `-1.0` that _dig can never read
back, so the export showed an always-empty column. Skip such a key.
2026-09-16 16:43:52 +02:00
stroblme d4f0345e97 Sweep stale e2e fixtures before a run, not after one
An aborted Playwright run never reaches `afterAll`, so its flows and
dashboards stayed in the store until somebody deleted them by hand. A
setup-project test now removes them before the next run, which is the
only point that is reached even when the run before it died.

The suite runs against whatever stack is up — somebody's own instance
with real flows in it — so the predicate matches only the shape every
fixture has, `test_<spec>_<base36 Date.now()>` with an optional suffix,
and only once that timestamp is an hour old.

Also correct the coverage-html fallback hint: `make clean` cannot clear
a root-owned htmlcov either, for the same reason `coverage html` cannot
write it.
2026-09-14 16:27:36 +02:00
stroblme a1141fbd6a Surface a node's health when the engine's floor expires
`node_health` fires once at the transition, while `HEALTH_FLOOR` still
hides the node, and nothing is published when the floor expires 60 s
later. Schedule a per-node re-read for that moment, cancelled when the
node recovers and on socket teardown. Health now also invalidates the
brain graph, whose key is a sibling of the flow's rather than a child,
so Home's fault rings never moved on a health flip at all.
2026-09-14 15:50:33 +02:00
stroblme 57fd3d1b2c Collapse the button-variant fork and the canvas's duplicate work
LoadingButton kept its own copy of buttonVariants, which had drifted past
`brand` and the icon sizes; it imports Button's now, so the Connect /
Re-pair button can show the loader instead of swapping its own label.

DashboardView mounted a second LookProvider inside the one CanvasSurface
already gives it and dropped `touch` on the way, so every widget on a
touch panel read `useLook().touch` as false. The provider is now mounted
once, by whatever owns the canvas root.

useCanvasRoot resolved the palette twice per render — once for the theme
class, once for the tokens — so useDashboardTheme takes the roles the
caller already has.

The bar assertions in widgets.spec.ts are scoped to the Load tile rather
than the page, which held only because the unbound spare bar draws no
rows.
2026-09-14 15:29:40 +02:00
stroblme 4faf5312ff Measure the bar where it settles, not mid-spring
`widgets.spec.ts` took a one-shot `boundingBox()` of a fill that is still
moving. Two ways that reads wrong. "a bar draws a row per reading" compared
two widths that are both zero until the socket has delivered the readings,
and a plain `expect` over a captured number does not retry. "a reading over
its scale fills the track and no more" allowed the fill one pixel past the
track, but the house spring is underdamped: `motion`'s own generator puts the
fluksio look at 100.66% of the track 276ms in (material 100.91%, glass
103.58%), which on this tile's ~240px track is ~1.6px — over the tolerance,
and reached only if the sample happens to land near the peak.

Neither is the widget. `fractionOf` clamps the reading to [0, 1] and
`.dui-bar-track` is `overflow: hidden`, so nothing past a full track is ever
drawn; a bounding box just is not clipped by an ancestor's overflow. So both
now poll: one until the shorter reading is drawn shorter, the other until the
fill is flush with its track — which is a stricter reading of "and no more"
than the pixel of slack was.

The live-socket test gains the other half of what that spin cost: an ASGI
task that never returns is one uvicorn's graceful shutdown waits on forever,
which is why `fluksio serve` could only be SIGKILLed and left `serve.pid`
behind.
2026-09-14 15:02:42 +02:00
stroblme 94c9260452 Spin the Add remote user button; stop the search prefilter dropping typos
"Add remote user" was the one call site swapping its label instead of
using LoadingButton, so it alone had no spinner.

Global search's couldMatch was a strict subsequence test while cmdk's
scorer steps over one query character for a transposition, so a typo it
would have scored never reached it. The prefilter now carries that one
skip, which recovers every single-transposition query in a sweep of the
index shapes and admits nothing cmdk scores zero.
2026-09-14 14:40:17 +02:00
stroblme 46f9575870 Stop a bound dashboard setting rebuilding every tile
A setting driven by a flow re-renders whatever reads it on every message.
`LookProvider` and `PaletteProvider` built a fresh context value each time,
and `CanvasSurface` called its render prop again, so a value on `theme`,
`palette`, `look`, `background`, `touch` or `locked` reconciled the whole
widget tree and re-ran every chart's `setData`.

The palette is now read as roles once per set of colours, the tokens and
both context values are memoised on it, and the canvas holds the tiles it
built while the callback and the scale stay put. `WidgetBody` is memoised
too: its two props are stable while the document is, so a grid rendered for
its own reasons no longer rebuilds every chart with it.
2026-09-14 14:38:59 +02:00
stroblme 0f040b6e1d Merge branch 'main' of git.stroblme.de:Fluksio/app
# Conflicts:
#	frontend/src/client/sdk.gen.ts
2026-09-07 08:41:45 +02:00
stroblme 4e8d04d5d7 Hold a node down for a minute before calling it down
A connector that misses one poll turned the health badge amber and the node
on the canvas red until it recovered. `LoadedNode.health_since` marks when the
status last actually changed — a rotating error detail under an unchanged
status does not move it, or a connector retrying with a different errno each
poll would never debounce — and `unhealthy_nodes` applies a 60 s floor to it.

The floor is on the surfacing, not on the transition: the stored health is the
truth the moment a node reports it, so a flow reading node health is never
told a stale story. Only going down is held back; recovery clears at once.
2026-09-07 07:54:10 +02:00
stroblme 23a80db6bb Let the native clipboard through where the canvas has nothing to copy
A bound chord used to be `preventDefault`ed before its handler ran, so the
canvas took every ⌘C and ⌘V whether or not the node clipboard would act —
which is what blocked copying selected text out of the chrome floating over
the canvas. A binding may now return `false` to decline the key; ⌘C does so
when there is a text selection or no node selected, ⌘V when nothing of ours
is stored.
2026-09-06 18:16:17 +02:00
stroblme 7d8fe6456a Drop the unreachable branch in the live socket loop
`asyncio.wait(..., FIRST_COMPLETED)` returns with at least one of the two
tasks done, so `receiver` missing from `done` already means `sender` is in
it. The `elif sender not in done: continue` could never fire.
2026-09-06 18:16:09 +02:00
stroblme 332975bb53 Read the run-context shot against the flow its dashboard belongs to
The two runs were taken off the top of the unfiltered table, so the shot
only showed anything while the newest runs happened to be the ones the
`_results` dashboard reads. Another flow finishing a run since photographed
an empty grid — every tile "No curve was recorded", every stat blank. The
table is filtered to that dashboard's flow first.
2026-09-06 17:51:11 +02:00
stroblme 8d36446289 End the live socket when its client goes, instead of spinning on it
`receive_text` raises `WebSocketDisconnect` once the peer has gone and
`RuntimeError` on every call after that. The loop swallowed both — the
exception was checked only to decide whether the frame held a media
subscription — and immediately made another read, which raised again. A
closed tab therefore left a coroutine reading a dead socket at full tilt:
around 15,000 turns a second, one orphaned `Queue.get()` per turn parked on
the bus queue's waiter list. The event loop stalled behind it, `/health`
answered 503 on its loop-lag check, and Docker's probe plus Traefik took
the API out of the pool mid-request — which is what `make verify` was dying
on, with `TypeError: Failed to fetch` from the browser.

The spin ended only when an event finally reached the send path and the
socket raised there, so it lasted from milliseconds to minutes depending on
what the bus happened to be carrying. Four abandoned sockets logged 2,518
`Task was destroyed but it is pending!` lines and up to 2.6s of loop lag;
twenty now log none and cost 1.0ms.

A failed read is the disconnect, so it ends the stream. The getter created
beside it is cancelled rather than abandoned: nothing reads it after the
turn that made it, and left behind it would also take an event the live
reader wanted.
2026-09-06 17:36:49 +02:00
stroblme e7bf767d40 Bound the work-queue durability claim to the appendfsync window
Redis runs with appendfsync everysec, so an unclean stop loses up to a
second of journaled entries. Name that where the docstrings promised a
crash costs nothing, and state the setting and its trade-off on the
configuration page.
2026-09-06 17:16:01 +02:00
stroblme 6fdc30a4d1 Make lint-backend green, and regenerate the stale client
`wanted_names` never read its `previous` argument — the caller reassigns
`wanted` from the return value — so the parameter goes rather than gaining
an underscore; its one call site and four test calls follow. Sorts the
imports in test_artifacts.py. Both were failing `make lint-backend` at HEAD.

Regenerates the client, which 8c097d9 left behind when it corrected the
revoke_client docstring.
2026-09-06 15:29:35 +02:00
stroblme fa5ce4f694 Give both summaries a modified time, and the dashboard list a footprint
Home's "recently modified" order was a proxy — drafts first, then the
version counter, then the name. Both summaries now carry `updated_at`,
read as the mtime of the working copy: every write in the store commits
immediately, so a file's mtime is its commit time, and `git log -1 --
<path>` costs ~990ms across this instance's 15 documents (it walks the
history back to the last commit touching each one, so it is slowest for
the stalest) against ~1.8ms for the stats. No cache needed.

`DashboardSummary` also carries `footprint`: each widget as its type plus
the placement a panel resolves, which is the whole of what the mosaic
draws. That drops the document fetch per tile and with it the cap of
eight, past which tiles showed a name and nothing else. Verified against
this instance's 8 dashboards: the blocks are identical to what the old
client-side derivation produced.
2026-09-06 15:26:48 +02:00
stroblme 8c097d9222 Make revoking an agent and locking a dashboard actually revoke and lock
An MCP access token is a stateless JWT good until it expires, so deleting
the client row revoked nothing already handed out — on the MCP endpoint or
on the REST API, which takes the same token directly. Both doors now look
the client up by the `client_id` the token has always carried, so tokens
already in circulation are held to it too.

A dashboard's `locked` setting stopped the client drawing a control and
nothing else; the server took a publish from a panel showing it anyway. It
now bounds the panel's write scope, resolved live where a flow drives the
flag, exactly as the client resolves it. Reads are untouched — read-only is
not blind — and so is a querying chart's request, which is how that tile
reads rather than something anyone touched.
2026-09-06 15:24:53 +02:00
stroblme c9172adfaa Keep a flow's runs when the flow goes
A run record is a record of what ran, so deleting a flow no longer sweeps its
history: `_forget_runs` is gone from the flow-delete path, and `DELETE /runs/{id}`
is the only thing that removes a run one at a time. The in-flight guard stays —
that is about work, not history.

`DELETE /runs?flow=` is the counterpart to the list's flow filter and what a
reseed needs, sharing the four statements with the single-run delete and
refusing the same way while a run of that flow is still going.

A run whose flow is gone reads as one: `useFlowInputs` reports the 404 rather
than an empty declaration set, so the run page says "flow deleted", explains it,
and disables Retry, which the route would refuse anyway.
2026-09-06 14:53:23 +02:00