Skip to content

Release: Portainer deployment, workflow history, submissions inbox, semantic equivalence - #60

Merged
theUpsider merged 100 commits into
mainfrom
dev
Sep 25, 2026
Merged

theUpsider merged 100 commits into
mainfrom
dev

Conversation

@theUpsider

Copy link
Copy Markdown
Contributor

Summary

Promotes dev to main: 98 commits, 191 files. The first push to main after this merge runs the new Deploy workflow, which builds the three images to GHCR and calls the Portainer webhook (setup in README, "Deploying with Portainer").

Deployment

  • docker-compose.prod.yml runs the stack behind Traefik from prebuilt GHCR images; required settings fail the start by name, the backend loads Portainer's stack.env via env_file.
  • .github/workflows/deploy.yml builds and pushes backend, frontend and models images on every push to main, then triggers the Portainer stack webhook (PORTAINER_WEBHOOK_URL secret).
  • TRUST_PROXY makes the Express trust-proxy depth configurable (2 behind Traefik + nginx); nginx forwards the outer X-Forwarded-Proto.
  • yarn dev:up gives the real stack the same one-command start as the debug stack; host ports are configurable so the database no longer collides with a local PostgreSQL.

Grading and models

  • text/semantic-equivalence decides answer equivalence by rules, a cosine floor and entailment instead of a bare similarity threshold; the worker exposes /entailment and lets an operator choose the embedding model, task and trust setting.
  • Six embedding models measured per workflow (docs/embedding-model-comparison.md), calibration recorded in docs/semantic-equivalence-calibration.md.
  • Deployment default model with production local-worker hiding; the language model node takes a plain string prompt (SPEC-0019).

Workshops, runs and review

  • Every completed or failed run is persisted; a Submissions inbox sits in the preview rail.
  • Review flag node wired into every workshop graph; score card and classification chip in the workshops.
  • Workflow version history: keep, restore and delete earlier versions.
  • Workshop templates rewritten around everyday-science questions, re-laid-out with consistent spacing, method tags on template cards; only Workshops 1 to 3 are shown by default.

Editor and UI

  • Canvas rendered at device pixel ratio, connection highlighting, node-type pills with category colours, help dialog, system-aware dark mode.
  • Resizable editor rail with keyboard support, larger and zoom-scaled inline text editors, visible run failures, safe offline submit, queued cancel.

Test plan

  • PR checks (typecheck, lint, test, build; browser smoke test; specification lint) on dev
  • docker compose -f docker-compose.prod.yml config with and without the required variables
  • nginx -t on the changed frontend configuration in nginx:stable-alpine
  • After merge: Deploy workflow pushes the three images to GHCR; make the packages pullable and set PORTAINER_WEBHOOK_URL before expecting a redeploy

🤖 Generated with Claude Code

theUpsider and others added 30 commits September 19, 2026 00:07
…questions

Participants should evaluate the assessment workflow, not their own subject
knowledge, so the three tutorial graphs now ask about day and night, the water
cycle and sharing a pizza instead of the Strategy pattern, a race condition and
a deadlock. The workflow designs are unchanged: three separate kinds of evidence
with no grade; one grader per rubric criterion with deterministic aggregation and
feedback from the reports; classification, policy-driven feedback and review.

Slugs now name the assessment concept (words-vs-understanding, same-score-
different-gaps, different-mistakes-different-help) so a future example swap does
not need a new slug. The seeder gets a RETIRED_TEMPLATE_SLUGS list and unpublishes
the three first-generation slugs on boot, following the same ownership rule as
updates (a facilitator-edited template is left alone), so a deployment that
already installed them does not offer two generations of the same workshop.

The water-cycle rubric is 4 x 0/1/2 = 8 points and its total is published as a
text output: the score card's pass threshold and progress bar are on a 0-100
scale and would misread 6/8.

Verified live against KATALYST (qwen3.8-flash-next) with real all-mpnet
embeddings, three runs each: every prepared answer received its intended
judgment, category and points (A and B both 6/8 with feedback aimed at the
different missing stage; the all-keywords wrong answer scores the highest
similarity of the four, 0.81, while the everyday correct answer scores 0.69).
One prompt fix from the runs: the day-and-night NEXT STEP must be a hint, not a
restatement of the reference. The live harness now prints finish reason and
token usage per model call and can dump raw replies (DUMP_RAW=1).
Text now starts at rows*20 + 6 (LiteGraph's own widget origin) instead
of rows*20 + 14, removing the dead band below the slots; the 64px
minimum node shows two lines instead of one. The inline editor drops its
own left padding so glyphs land on the same origin and wrap width as the
canvas, and the canvas wrapper breaks after hyphens like the browser, so
opening the editor no longer shifts any line.
Body text goes from 11px #d4d7dd to 13px #E6E9EF (line height 17), one
step under the 14px slot labels and titles, so node content stays
legible when the canvas is zoomed out. The one-line preview on every
other keyValue node uses the same style and is now cut by measured
width instead of a fixed 34 characters, so it fills wide nodes and never
spills out of narrow ones. Text nodes keep room for two lines (68px
floor) and the inline editor derives its font size from the constant.
LiteGraph paints a neutral #222 clear color plus a #222/#191919/#141414
grid tile; our #2B2D3A node body sat at 1.17:1 against it and vanished.
CANVAS_THEME moves the canvas down to #14161C with a matching grid tile
and the node body up to #3B4056 (1.77:1), with a slightly darker #2F3346
title bar. Text keeps >6:1 on the body and every wire color >3:1 on the
canvas. applyCanvasTheme() sets the per-instance canvas colors from
Canvas.tsx; the inline editor takes its background from the node fill
instead of a hard-coded color.
Follow prefers-color-scheme automatically (live), persist an optional
System/Light/Dark choice in localStorage, theme MUI shell plus canvas
border and editor background, keep the PWA theme-color in step.
Body overflow:hidden clipped every route taller than the viewport. The document scrolls again; admin uses min-height instead of a nested scroll box, and the editor locks its own overflow.
Inspector textareas default to 8 rows (prompt 10) with a vertical drag-resize handle; canvas Textfield nodes start at 300x160 and stay corner-resizable.
The textarea overlay for Textfield/Question/SampleSolution nodes sized
its width, height and left padding in graph units without applying
ds.scale, so at zoom < 1 it outgrew the node body while the canvas
preview shrank correctly. Route the origin through convertOffsetToCanvas
and multiply extents by the zoom factor.
The overlay clipped overflowing text (overflow: hidden) and opened with
the caret at the end, so long values started scrolled to their last line
while the canvas preview shows the first. Scroll vertically instead with
a thin thumb in the body text color, reserve the lane with
scrollbar-gutter: stable and add it back to the box width so the content
box keeps the preview's exact wrap width, and open with scrollTop 0 and
the caret before the first character.
This reverts commit e651f72, reversing
changes made to ca0887e.
theUpsider and others added 29 commits September 22, 2026 11:12
The answer to "can we use jina-embeddings-v3 if we attribute it?" is no, and
the answer to "can we let people choose it themselves?" is yes. CC-BY-NC-4.0
requires attribution *and* restricts use to non-commercial purposes; giving
credit satisfies the first and does nothing about the second. But no weights
ship in this repository - the worker downloads whatever `EMBEDDING_MODEL` names
at startup - so the licence that binds a deployment is the licence of the model
that deployment chose. A default must therefore be one every deployment may
run, which is why `BAAI/bge-m3` and the NLI cross-encoder are both MIT; a
non-default is the operator's own decision to make.

Choosing jina-v3 previously did not work even though the variable existed.
It needs `trust_remote_code` at load, because its architecture ships as Python
beside the weights, and `task="text-matching"` at encode, because its adapters
are task-conditioned. Two new variables supply both, `EMBEDDING_TRUST_REMOTE_CODE`
defaulting to false since it executes code from the Hub inside the worker
process, and `/health` reports what actually loaded so an override can be
confirmed rather than assumed.

sentence-transformers forwards unknown keywords to the module forward pass and
drops them when the module declares none, so a task name a model does not
implement is accepted and silently ignored - verified in the pinned 3.4.1 as
well as in current releases. The worker therefore encodes the same text with
and without the task at boot and refuses to start if the vectors are identical,
which is the only version-independent evidence that the setting is in effect.

`models/calibrate.py` takes the matching `--trust-remote-code` and `--task`
flags, so a candidate can be measured the way it would run before a deployment
commits to it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…bstract

A single accuracy number hid three things worth knowing, because the graph
performs four different comparisons and the models do not rank the same way in
any two of them. `models/compare_models.py` measures each separately - short
answer against reference, one keyword against one sentence, paragraph against
paragraph, and German against English - and reports ROC AUC, which asks the
threshold-free question rather than rewarding whoever guessed a cutoff best.

The results change what we can say.

`multilingual-e5-large-instruct` is the strongest embedding measured, ahead of
`jina-embeddings-v3` on three scenarios of four, and it is MIT. The licence
question that prompted the configurable-model work does not need answering: a
permissively licensed model already wins.

`bge-m3` earns its place as the default on exactly one axis. It is third on the
mean, last of six on keyword checking, and perfect on cross-lingual pairs where
the old English-only default scores 0.425 - worse than a coin toss, meaning a
German answer against an English reference is ranked backwards. That is the
whole case for the swap.

On paragraph-length answers no model reaches 0.55 AUC. Six models across four
architectures agree, so this is not a model problem: a reversed claim keeps the
vocabulary, and vocabulary is most of what an embedding measures. The
similarity-scorer block now says so, because a percentage that looks precise and
means nothing is worse than no percentage.

And staging dominates model choice. Through the full cascade the six models span
11 points where raw cosine spans 28, with the ordering inverted - `bge-m3` is
the worst raw scorer and the second best staged. The default stays `bge-m3`
rather than moving to `e5-large-instruct` for that reason: e5 wins on raw
similarity and loses in the cascade, 86% against 89%, with three false positives
against two.

`calibrate.py` puts its CLI behind a `__main__` guard so the pair set and rule
stages can be imported rather than copied.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…mber

Workshop 1 exists to separate evidence from an assessment decision, and it was
missing the branch that makes the distinction concrete. It compared a lexical
keyword hit, an embedding similarity and an LLM judgment; the similarity branch
was the one participants were most likely to mistake for a grade, and nothing in
the graph showed what the alternative looks like.

Branch D reads the same two texts as branch B, through the same embedding, and
decides. Side by side they demonstrate the whole argument: paraphrase the answer
and the similarity number moves while the verdict holds, invert the meaning and
the number barely moves at all - "the Sun orbits the Earth" against "the Earth
orbits the Sun" sits at 0.97. The Decided by output names the stage that settled
it, so a participant sees why rather than being handed a number to threshold.

The other two graphs that touch similarity keep their wiring. The extended lab
already carries `text/semantic-equivalence` and has to stay flat, because its
test asserts that every registered node type appears at the top level. Simple
LLM Feedback is a reconstruction of an existing workshop graph and its score
reaches the model as text, which is the only defensible use for it; both now say
so in their headers, alongside the measurement that justifies it.

Blocks stay insertable rather than embedded. A bundled workflow that embedded
`answer-equivalence` would carry a frozen copy of it, and the copy would not
improve when the block does - the same argument that makes template revisions
immutable.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
+Add panel does not move everything to the right anymore
…oose

`SIMILARITY_WORKER_URL` falls back to a hardcoded third-party host when it is
unset, and that fallback is silent. A developer running `yarn dev` without an
`.env` therefore gets working similarity, keyword and equivalence nodes - which
is the problem, not the convenience. The nodes work because every learner answer
they touch is being sent to a machine nobody in that session chose. The backend
now warns at startup, naming the variables and what leaves the machine, the same
way it already warns about `COOKIE_INSECURE`.

The fallback itself stays: removing it would break deployments that rely on it,
and this is the wrong change to bundle that into.

The five worker knobs the compose file interpolates were documented nowhere an
operator would look. `.env_template` now carries them with their defaults, and
`models/.env_template` is new, for running the worker outside Docker where
`python-dotenv` reads it. Neither changes behaviour: every value shown is one
the worker already applies.

`yarn dev` does not start the NLP worker and the README never said so, which is
how the silent fallback stays invisible. It now explains both routes - the debug
stack, or a local worker - and notes the first-boot download.

The debug compose model service says in the file what it is: a deterministic
stand-in, not the real worker, where `EMBEDDING_MODEL` does not apply and
`/entailment` answers 503 on purpose so the browser suite exercises the
`nli-unavailable` path.

Verified against the running production stack: the `models` container reports
`Embedding model loaded: BAAI/bge-m3 (1024 dimensions, max 512 tokens)` with all
five variables set as intended.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ps saying yes

`text/semantic-equivalence` returned true for unrelated sentences on the debug
stack. The node was not at fault; the stand-in worker was. Its embedding summed
character codes into eight buckets by position, so every English sentence of
similar length pointed almost the same way: the Workshop 1 reference answer
against "The dog barks loudly in the garden" scored 0.9896. That cleared the
0.92 ceiling, and with /entailment answering 503 the ceiling was the only thing
deciding. Debug runs therefore demonstrated the exact failure the cascade exists
to prevent.

Two changes. The embedding is a hashed bag of words over 128 dimensions:
identical text scores 1, shared vocabulary lands in between, unrelated text near
0. And /entailment now answers from token overlap and a negation list instead of
503, so the cascade stays whole; DEBUG_NLI_DISABLED=1 brings the 503 back for
testing the nli-unavailable fallback deliberately rather than by accident.

Its entailment tier for partial overlap sits at 0.55, just under the node's 0.60
threshold. Shared vocabulary is not shared meaning - "the reaction is exothermic"
and "... endothermic" overlap 0.75 - and a stub that cannot read should not be
the thing that says two answers agree.

Checked against the Workshop 1 reference through the node itself: unrelated 0.338
cosine-low, off-topic 0.255 cosine-low, wrong cause 0.660 nli-neutral, verbatim
1.000 exact. Every one false except the verbatim match. A correct paraphrase also
comes back not equivalent, which is the honest limit of arithmetic without a
model, and both the compose file and the module map now say so: this stack tells
you a graph runs, not how the cascade behaves.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`docker-compose.yml` published the database on host 5432, hardcoded. That is the
port the PostgreSQL a contributor already runs is listening on - `.env_template`
tells them to run one - so `docker compose up` fails to bind and no service
starts. All four host ports are now overridable the way the debug stack's
already are; only the host side moves, since the services reach each other on
the Compose network regardless.

The README also now says that `--build` is not optional after a pull. Compose
reuses any image carrying the right tag, so a stale one starts cleanly and
serves last month's code: missing routes, an older set of bundled templates,
migrations that look already applied. That failure is silent and easy to mistake
for a broken feature. Same section says to keep PROVIDER_ENCRYPTION_KEY in
`.env` rather than passing it per command, because a fresh key cannot decrypt
what the previous one wrote.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The startup warning added with the worker-address work fired on every correct
production deployment. `docker-compose.yml` sets `MODEL_WORKER_URL` empty on
purpose — there is no local text-generation endpoint unless someone provides
one, and `ProviderService` reads `process.env` directly to disable the `local`
provider when it is — so a stack configured exactly as documented was told its
learner answers were leaving the machine.

They were not. Nothing in `packages/lib` reads the injected `MODEL_WORKER_URL`,
so its legacy fallback sends no traffic anywhere; `SIMILARITY_WORKER_URL` is the
one the embedding, keyword and equivalence nodes use, and the only one worth
warning about. A warning that cries wolf on the correct configuration trains
people to ignore the one that matters.

Found by reading the log of a freshly built `docker compose up --build`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…g one

`yarn debug:up` starts a full stack in one command; running the stack that a
server actually runs meant a hand-written `docker compose` line, and three of
the ways that line goes wrong produce a stack that starts cleanly and is
quietly broken:

- without `--build`, Compose reuses whatever image carries the tag, so after a
  pull you are served the previous image's routes, templates and migrations;
- a `PROVIDER_ENCRYPTION_KEY` supplied per command is a new key next time, and
  the new one cannot decrypt the provider credentials the old one wrote;
- with no `ADMIN_USERNAME`/`ADMIN_PASSWORD` the stack is healthy and has no way
  to create the workshop it exists to serve.

`tools/stack.mjs` removes all three. It always builds, writes a generated key
into `.env` once and never rewrites a value that is already there, and after
the containers report healthy it prints the endpoints — honouring the
`NODEGRADE_*_PORT` overrides — followed by whatever is still missing: the admin
credentials, a language-model credential, or a `CORS_ORIGIN` left on 8080 while
the UI moved. It also says up front that the first start downloads 2.3 GB
before the NLP worker answers, which otherwise looks like a hang, and spells
out what `reset` deletes before it deletes it.

Exposed as `yarn dev:up`, with `dev:serve|down|status|logs|reset` mirroring the
debug verbs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…p graph

Participants play the tutor in the workshop, but the templates' review
recommendation was plain text in an ordinary result card. This adds
`output/review-flag`, a node that turns a reviewer's RECOMMENDATION /
REASON reply (or a boolean) into a structured `review` output with a
verdict, and a result card that shows it as "Needs review" or "No issue
found" with the reminder that it is a recommendation, not an approval.

All three bundled workshop graphs and the validation-review block end in
one flag fed by a model. Workshop 1 flags JUDGMENT: UNCLEAR; Workshop 2
gains a review stage mirroring Workshop 3. The registry's stale output
display options are corrected in passing.

SPEC-0020 is added as a draft; run persistence and the Submissions tab
follow in the next two changes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… inbox

Adds the Run model and migration, a workspace-scoped run module (list,
detail, mark reviewed) under packages/backend/src/run/, and has
GraphHandlerService write the record before the terminal runStateChanged
event so a client that refetches on completion finds the row. Cancelled
runs and pre-execution failures leave no record; a failed write is logged
and never fails the run. LTI launches under the published projection are
refused by the API but still recorded with the launch name.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Every run of a workflow now shows up in a third preview tab as a submission,
with counts, a filter, a detail view with the stored answer and result cards,
a mark-reviewed / reopen control and a "Run again" that puts the old answer
through the current graph. The tab and its API calls are editor-only; LTI
student launches never see it. Strings ship in English and German, and a
Playwright check walks the loop on the WAIE workshop. SPEC-0020 is now
implemented. Also wraps two backend lines Prettier flagged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The editor autosaves, so a mistake becomes the stored state within seconds and
the only escapes were "Reset to source template", which discards every edit, and
"Save as", which preserves the broken graph rather than the working one.

The server now keeps the states a workflow leaves behind. A `WorkflowVersion` row
is written before the save that replaces it, coalesced to one per two minutes so
a stream of autosaves produces checkpoints instead of a row per keystroke, and
unconditionally before a reset or a restore. The newest 20 per workflow are kept;
rows cascade with the workflow and therefore with the workspace.

`/workflows/:id/versions` lists them, restores one, deletes one, or clears them
all, scoped by the bearer token like every other workflow route and refused for
LTI launches under the published projection. A restore captures the live graph
first, so it is itself undoable, and answers with the restored workflow and its
new entity tag; the editor loads that content directly. The Version history
dialog in the editor's overflow menu asks a second time before restoring,
deleting or clearing.

Specified in SPEC-0021.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…orkshops

Workshop 2 now scales the rubric total to a percentage through a visible
"Maximum points" node and publishes it as a `score` output, so participants
see the bar and pass chip a learner would get next to the raw points.
Workshop 3 lifts the CATEGORY line off the diagnosis and publishes it as a
`classifications` output (a chip) beside the full diagnosis text.

Adds `text/extract-line`, a deterministic node that returns the line after a
prefix, so a structured reply becomes a bare label without a second model
call. Registered in the node registry, mirrored in the graph builder's slot
table, exercised by the extended assessment laboratory and covered by a
backend spec.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…-to-main webhook

docker-compose.prod.yml runs the deployed topology behind Traefik from prebuilt
images instead of building: only the frontend joins the Traefik network, the
required settings fail the start by name, and the backend loads Portainer's
stack.env through env_file so optional variables need no compose change.
.github/workflows/deploy.yml builds and pushes the backend, frontend and models
images on every push to main and then calls the Portainer stack webhook.

Behind Traefik two proxies stand in front of the backend, so the trust-proxy
depth becomes TRUST_PROXY (default 1) and nginx forwards the scheme the outer
proxy saw instead of its own plain http.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…lowlist and the resizable rail

The template gallery now lists only the three workshops, so the browser suite
checks that instead of the block template it used to expect, and reads a new
template's publication from the public listing rather than from the gallery
cards. The resizable rail added a "Resize editor details" handle whose label
contains "Editor details", so the rail lookups match the label exactly. The
result card's review chip is wrapped the way prettier wants it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@theUpsider
theUpsider merged commit c1320a7 into main Sep 25, 2026
3 checks passed
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.

2 participants