Skip to content

multi-engine B5: streamed drift #998

Open

Description

@lex00

Colour each card as its record arrives (drift-start, records, drift-settle); a resource that never reports becomes not-observed / not-reached. Accepted when cards change colour one by one in the choudoufu-estate demo, and the e2e suite asserts it.

Part of #993.

Acceptance: read verdict lines and recorded artifacts, never exit codes alone. Anything that needs an emulator corpus, an estate run or a real cloud is run by the maintainer by hand. Red-first only for new guards.

Where it stands

Built and on main: the B5 unit merged at c508909 on integration/choudoufu-engine, and path 1 landed on main as behold e765bf6 (chant 1cf732818, choudoufu e5023addda). Unit tests passed at epic-ready. What remains is the maintainer's live run.

  • The read: driftStreamArgv, streamDrift and rootStreamTransport in src/workspace-reader.ts run chant workspace drift --member <name> [--read <r>] [--resource <addr>] --stream (or BEHOLD_DRIFT_CHANT). chant main has --stream (packages/core/src/cli/main.ts:990); no chant release has it yet.
  • src/drift-stream.ts runDriftStream turns each line into a drift SSE frame (begin, start, record, settle, failed, end) on /api/events, and folds unanswered addresses into not-observed / not-reached at settle. Colour comes from toneFor, which since B2 (multi-engine B2: colour from the drift record #995, closed) lives in src/drift-tone.ts:134.
  • Route: POST /api/workspace/drift/stream {member, addresses?} (src/server.ts:1852), refused under --public, one run at a time (409 drift-streaming), {stop: true} stops it.
  • Page: web/drift-stream.js and markStreamedDrift (web/app.js:4385); palette row "Stream drift card by card: ". AGENTS.md section "Drift, streamed card by card (multi-engine B5: streamed drift #998)".
  • On a choudoufu member behold asks once per resource block (H2, choudoufu#2245, has no whole-estate stream), so cards change colour resource by resource.

Carried to #1005 (waits on the chant release, INTENTIUS/chant#4473): registering DRIFT_STREAM_CHANT_FLOOR with its CHANT_FLOORS entry, and replacing the copy in src/drift-line.ts with chant's @intentius/chant/drift-record.

Acceptance

  • src/drift-stream.test.ts passes: argv, the H2 fixture (src/fixtures/drift-stream/choudoufu-resource.ndjson) decoding, the refusals, resourceBlocks, the order of per-resource frames, not-reached at settle, a failed command and an undecodable line (unit tests passed at epic-ready, per the epic-ready comment).
  • just e2e-streamed-drift (e2e/streamed-drift-e2e.sh, e2e/streamed-drift.mjs, fake chant in e2e/fixtures/fake-chant-drift) prints its all-green verdict: from the SSE frames, 21 starts and 21 records arriving apart in time and aws_cloudwatch_log_group.team_c_2 settling as not-reached; from the headless browser, every monolith card reads as reading before its colour, cards change colour at least half a step apart, the silent card ends not-observed / not-reached, and drifted, unclaimed and in-sync cards end in their tones. Needs Docker, choudoufu and a scratch floci (maintainer run).
  • In the choudoufu-estate demo with BEHOLD_DRIFT_CHANT set to a build of chant main, the palette's "Stream drift card by card" row colours the cards one resource at a time, with a recorded screenshot or capture of the frames attached here (maintainer run).

Open questions

None.

Activity

  1. added
    multi-engine
    on Oct 25, 2026
  2. lex00 commented on Oct 25, 2026

    @lex00
    ContributorAuthor

    B5 landed on integration/choudoufu-engine at merge c508909 (unit commit e12712d, branch unit/b5-streamed-drift). npx tsc --noEmit is clean and node --check web/app.js passes. No test, e2e or demo was run.

    What landed

    • The streamed read is in src/workspace-reader.ts, appended at the end so it stays clear of B2's non-streamed read in the same file. driftStreamArgv (:404) builds workspace drift --member <name> [--read <r>] [--resource <addr>] --stream. streamDrift (:430) decodes each stdout line as chant prints it, and kills the read on the first line that does not decode. rootStreamTransport (:456) runs the root's own chant, or BEHOLD_DRIFT_CHANT when that is set. It does not go through the buffered read budget, because the read is a stream and not one document.
    • src/drift-line.ts holds the line types and the checks, following chant's decodeDriftLine, driftRecord and notReachedRecord at chant fdce0d963. They are written out because the chant behold depends on (0.124.52) does not export @intentius/chant/drift-record yet. Once a release does, this file can become a re-export. C1's H2 fixture is copied to src/__fixtures__/drift-stream/.
    • src/drift-stream.ts: runDriftStream (:128) turns each line into a drift SSE frame (begin, start, record, settle, failed, end) on the existing /api/events channel. At settle, every expected address that no record answered becomes not-observed / not-reached, using chant's fold rule. It goes out as a record frame before the settle frame, so no card is left reading. A read that fails is a failed frame, and its cards keep the colour they had. A read that never printed a start stops the run.
    • Colour comes from one function, toneFor(record) (:55), keyed by status. An unknown status is neutral and says so. B2 (multi-engine B2: colour from the drift record #995) has not landed (there is no unit branch), so its (status, read) table is not used yet. Swapping it in means replacing that one function.
    • The route is POST /api/workspace/drift/stream {member, addresses?} (src/server.ts:1838), JSON only. Under --public the request guard refuses it. Only one run goes at a time (409 drift-streaming), and {stop: true} stops it. It is listed in GET /api.
    • In the page: web/drift-stream.js folds a frame into the IR on screen in place, the way web/pending.js does. markStreamedDrift (web/app.js:4384) repaints only the cards a frame moved. It puts the bar and outline in the record's tone and sets data-drift-status, data-drift-tone and data-drift-not-reached. A card that is reading gets data-drift-reading: dimmed and dashed, with its fill and _status left alone (styled in web/index.html). The palette has a "Stream drift card by card: " row for each declared member.
    • AGENTS.md has a new section, "Drift, streamed card by card (multi-engine B5: streamed drift #998)".

    Decision: per resource on a choudoufu member

    H2 (choudoufu#2245) plans one resource per live-plan -resource call, and writes that resource's records when its plan ends. There is no whole-estate stream. So on a choudoufu member behold asks once per resource block, one block after another. It takes the addresses the page sends and keeps only resource addresses: instance keys are dropped, data sources are left out (-resource refuses them), and each block is asked once. The cards change colour resource by resource. Any other member is asked once, without --resource. Frames are keyed by the workspace member behold asked about, because choudoufu writes its estate name in member.

    Still missing

    • The tests are written and have not been run. src/drift-stream.test.ts covers the argv, the H2 fixture decoding, the refusals, resourceBlocks, the order of the per-resource frames, not-reached at settle, a failed command and an undecodable line. Run npx vitest run src/drift-stream.test.ts.
    • The e2e is written and has not been run: just e2e-streamed-drift (e2e/streamed-drift-e2e.sh, plus e2e/streamed-drift.mjs). It sets up the choudoufu-estate demo the way behold demo choudoufu-estate does (Docker, choudoufu, scratch floci). For the drift read only, it points behold at a fake chant (e2e/fixtures/fake-chant-drift/chant) that emits a timed stream per resource and stays silent for aws_cloudwatch_log_group.team_c_2. It asserts from the SSE frames: 21 starts and 21 records, records arriving apart in time, and the silent resource settling as not-reached. It asserts from a headless browser: every monolith card reads as reading before its colour, cards change colour at least half a step apart, the silent card ends not-observed / not-reached, and the drifted, unclaimed and in-sync cards end in their tones. The maintainer runs it by hand.
    • The real chant workspace drift --stream is B2's chant-side work and is not in a release. To watch the demo against a real chant, set BEHOLD_DRIFT_CHANT to a chant built from that branch.
    • No chant floor is registered for the read, because the release that adds it is not known. On a chant without the command, the first read fails with chant's own words and the run stops after one spawn. Add DRIFT_STREAM_CHANT_FLOOR and its CHANT_FLOORS entry once the release is known.
    • When B2 lands, replace toneFor with its table, and drop src/drift-line.ts in favour of chant's module once a chant release ships it.
  3. added a commit that references this issue on Oct 25, 2026
  4. lex00 commented on Oct 25, 2026

    @lex00
    ContributorAuthor

    Path 1 of the multi-engine engine tier is on main: choudoufu e5023addda, chant 1cf732818, behold e765bf6 (each a merge commit of integration/choudoufu-engine, tree identical to the tested tip). Ready for the maintainer: cards changing colour one by one in the choudoufu-estate demo, and just e2e-streamed-drift (needs Docker, choudoufu and a scratch floci). Unit tests passed at epic-ready.

  5. added
    epic:engine-ship
    on Oct 26, 2026
  6. lex00 commented on Oct 26, 2026

    @lex00
    ContributorAuthor

    Run steps for the two maintainer items, against a local chant build. Nothing here was run. No code change was needed for either item: the route, the stream, the page and the e2e are on integration/engine-ship as they landed (behold 6bb48ec is the tip these steps were written against), and the real chant workspace drift --stream is on chant's integration/engine-ship (packages/core/src/cli/main.ts:990). Neither acceptance item can be ticked from code; both are run results.

    0. Checkouts and a local chant build (shared with behold#1000)

    Every repo at its integration/engine-ship. Paths are examples.

    export BEHOLD=~/src/run/behold CHANT=~/src/run/chant CHOU=~/src/run/choudoufu
    git -C ~/Documents/checkouts/intentius/behold    fetch origin && git -C ~/Documents/checkouts/intentius/behold    worktree add --detach "$BEHOLD" origin/integration/engine-ship
    git -C ~/Documents/checkouts/intentius/chant     fetch origin && git -C ~/Documents/checkouts/intentius/chant     worktree add --detach "$CHANT"  origin/integration/engine-ship
    git -C ~/Documents/checkouts/intentius/choudoufu fetch origin && git -C ~/Documents/checkouts/intentius/choudoufu worktree add --detach "$CHOU"   origin/integration/engine-ship
    
    # choudoufu: chant runs `choudoufu` from PATH, behold's scripts read CHOUDOUFU_BIN. A dev build passes the >= 0.22.0 check.
    (cd "$CHOU" && make build && ./choudoufu version)
    export CHOUDOUFU_BIN="$CHOU/choudoufu" PATH="$CHOU:$PATH"
    
    # chant, packed the way a release packs it, versions stamped 0.124.52 (uncommitted).
    # 0.124.52 because example-choudoufu-estate pins the terraform lexicon at exactly 0.124.52.
    (cd "$CHANT" && npm ci && scripts/ci-lexicon-artifacts.sh --steps generate,bundle)
    for pj in "$CHANT"/packages/*/package.json "$CHANT"/lexicons/*/package.json; do
      node -e 'const f=process.argv[1];const p=require(f);if(!String(p.name).startsWith("@intentius/"))process.exit(0);p.version="0.124.52";require("fs").writeFileSync(f,JSON.stringify(p,null,2)+"\n")' "$pj"
    done
    rm -rf /tmp/chant-local && mkdir /tmp/chant-local
    (cd "$CHANT" && npm pack -w packages/core -w packages/k8s-client -w lexicons/terraform -w lexicons/sql -w lexicons/pulumi --pack-destination /tmp/chant-local)
    git -C "$CHANT" checkout -- '*package.json'
    
    # behold with the local chant beside it.
    cd "$BEHOLD" && npm ci && npm install --no-save /tmp/chant-local/*.tgz && npm run build
    node -p 'require("./node_modules/@intentius/chant/package.json").version'   # 0.124.52, from /tmp/chant-local
    "$BEHOLD/node_modules/.bin/chant" --help 2>&1 | grep "workspace drift"   # names [--stream]: the local build, the npm 0.124.52 has none

    The stamp is the same number as the npm release, so the --stream line is the check that the tarballs went in. The floors behold guessed at 0.124.53 (DRIFT_RECORD_CHANT_FLOOR, ADOPTION_REPORT_CHANT_FLOOR) read as unmet on this build. The streamed read has no floor, so neither run below needs them.

    1. just e2e-streamed-drift

    cd "$BEHOLD"
    docker rm -f behold-choudoufu-floci 2>/dev/null   # the script refuses a leftover container
    npx playwright install chromium                   # only when there is no Chrome
    just e2e-streamed-drift                           # = bash e2e/streamed-drift-e2e.sh

    It sets the demo up in a temp dir, serves it on :4698 (BEHOLD_E2E_PORT), and points BEHOLD_DRIFT_CHANT at the fake in e2e/fixtures/fake-chant-drift; every other read is the local chant from step 0. Pass is the last line, streamed drift e2e: all green, after the ticks for the route (400, 202, 409), the frames (21 starts, 21 records arriving apart, aws_cloudwatch_log_group.team_c_2 not-reached) and the page. The behold log is ${TMPDIR:-/tmp}/behold-drift-e2e.log. The container goes on exit.

    2. The choudoufu-estate demo with the real chant

    cd "$BEHOLD"
    export BEHOLD_DRIFT_CHANT="$BEHOLD/node_modules/.bin/chant"    # the local build from step 0
    node bin/behold.js demo choudoufu-estate /tmp/choudoufu-estate-demo --port 4321

    When it is serving:

    # terminal 2: keep the frames, each stamped with the time it came
    curl -sN http://localhost:4321/api/events | while IFS= read -r l; do case "$l" in data:*) printf '%s %s\n' "$(python3 -c 'import time; print(time.time())')" "${l#data: }";; esac; done > /tmp/drift-frames.txt

    Open http://localhost:4321/, then ⌘K and "Stream drift card by card: monolith" (the same as curl -X POST localhost:4321/api/workspace/drift/stream -H 'content-type: application/json' -d '{"member":"monolith"}'). Each card should dim to reading, then take its colour one resource at a time, because chant asks choudoufu once per resource block. Record the screen while it runs, and attach that and /tmp/drift-frames.txt here. The frames for one run go begin, then per resource a start and a record, then settle and end. A failed frame carries chant's own words.

    Stop with Ctrl-C, then bash /tmp/choudoufu-estate-demo/scripts/choudoufu-down.sh to remove the floci container.

    Things that may need a fix in that run, none seen yet: the real stream's per-resource timing (with choudoufu's real plan each record may take seconds, so the run is slower than the e2e's 0.6 s steps), and a resource chant reaches that the page did not list.

  7. lex00 commented on Oct 26, 2026

    @lex00
    ContributorAuthor

    Ready for the maintainer, with one finding. Epic-ready (2026-10-26): behold main 5676314 is the merge of integration/engine-ship, tree identical to the tested tip aa885d8. On that tip, with chant's integration build (9ae806b69, npm pack stamped 0.124.53, installed --no-save): tsc, build, and vitest with 4723 passed, 0 failed; e2e adopt-terraform, adopt-pulumi, pulumi-workspace, multi-engine-demo and three-cloud-change-set all green.

    e2e/streamed-drift-e2e.sh does not pass at behold main 5676314: step 1 fails with "an unknown member answered 404". behold demo choudoufu-estate serves estate/monolith and not the workspace root, so the route finds no declared workspace (code no-workspace, 404) before it can check the member (400). The same failure happens at behold c833451, before this epic, with the same chant build and choudoufu, so this epic didn't cause it; it needs its own fix before the streamed-drift item can tick. The other item (the choudoufu-estate demo with BEHOLD_DRIFT_CHANT set to a chant build, recorded frames) is the maintainer's, as before.

  8. lex00 commented on Oct 26, 2026

    @lex00
    ContributorAuthor

    Audit correction (2026-10-26):

    Both remaining items are blocked, not only the e2e. behold demo choudoufu-estate serves the estate dirs (demos.test.ts:173), not a workspace. The palette row "Stream drift card by card" exists only when projectInfo.workspace is set (web/app.js:12446-12449), and the route answers 404 no-workspace before the member check (src/drift-stream.ts:211).

    The posted run steps are stale:

    Round 2's #1014 unit makes the demo serve the workspace. Fresh steps follow when it lands.

  9. lex00 commented on Oct 26, 2026

    @lex00
    ContributorAuthor

    Ready for the maintainer (epic:engine-ship round 2, 2026-10-26). behold main is a08dadc, whose tree equals the tested tip 9f8d257. Main CI on a08dadc (run 40407758155): success.

    The audit correction's blocker is fixed:

    • e2e/streamed-drift-e2e.sh fails at step 1: unknown member answers 404, not 400 #1014 (merge bf62b04) makes behold demo choudoufu-estate serve the declared workspace, so the palette row "Stream drift card by card: monolith" appears and the route reaches its member check.
    • Merge 9f8d257 makes the page (web/drift-stream.js) and the e2e send the addresses a stack card holds, not the stack's title. Before that, a stream from the default stacked view asked about nothing.
    • DRIFT_STREAM_CHANT_FLOOR is CHANT_RELEASE.version (0.124.53). Published chant 0.124.52 is below it, so the stream needs the local build. The floor is not checked when BEHOLD_DRIFT_CHANT names the chant to run.

    Orchestrator evidence, which is not a tick because item 2 is marked as a maintainer run: on 9f8d257, with local chant 0.124.53 (packed from chant 4b359afcc), choudoufu 567c49d89a and scratch floci, bash e2e/streamed-drift-e2e.sh printed "streamed drift e2e: all green":

    • the route: 400 for an unknown member, 202, then 409;
    • the frames: 21 starts and 21 records at least 300 ms apart, and aws_cloudwatch_log_group.team_c_2 settling as not-observed / not-reached;
    • the page: every card read as reading before its colour, the cards coloured one by one, and the drifted, unclaimed and in-sync tones landed.

    Nothing here runs plunge, so the plunge#27 endpoint setting does not apply.

    0. Worktrees of each main, and the local builds

    export R=~/src/run-r2                       # any scratch parent
    for r in behold chant choudoufu; do
      git -C ~/Documents/checkouts/intentius/$r fetch origin
      git -C ~/Documents/checkouts/intentius/$r worktree add --detach "$R/$r" origin/main
    done
    export BH=$R/behold CH=$R/chant CDF=$R/choudoufu     # behold a08dadcc, chant 9b8fa99ea, choudoufu 71bdb0a757
    
    # choudoufu: chant runs `choudoufu` from PATH, behold's scripts read CHOUDOUFU_BIN.
    (cd "$CDF" && go build -ldflags "-X github.com/intentius/choudoufu/version.Fork=v0.31.1-local.$(git rev-parse --short=10 HEAD)" -o choudoufu ./cmd/choudoufu && ./choudoufu version)
    export CHOUDOUFU_BIN="$CDF/choudoufu" PATH="$CDF:$PATH"
    
    # chant, packed the way a release packs it, stamped 0.124.53 (behold's CHANT_RELEASE.version), uncommitted.
    (cd "$CH" && npm ci && bash scripts/ci-lexicon-artifacts.sh --steps generate,bundle)
    for pj in "$CH"/packages/*/package.json "$CH"/lexicons/*/package.json; do
      node -e 'const f=process.argv[1];const p=require(f);if(!String(p.name).startsWith("@intentius/"))process.exit(0);p.version="0.124.53";require("fs").writeFileSync(f,JSON.stringify(p,null,2)+"\n")' "$pj"
    done
    rm -rf /tmp/chant-local && mkdir /tmp/chant-local
    (cd "$CH" && npm pack -w packages/core -w packages/k8s-client -w lexicons/terraform -w lexicons/sql -w lexicons/pulumi --pack-destination /tmp/chant-local)
    git -C "$CH" checkout -- '*package.json'
    
    # behold with the local chant beside it.
    cd "$BH" && npm ci && npm install --no-save /tmp/chant-local/*.tgz && npm run build
    node -p 'require("./node_modules/@intentius/chant/package.json").version'   # 0.124.53, so the tarballs went in

    If a long TMPDIR breaks the provider handshake (the epic's runs hit this), run with TMPDIR=/tmp.

    1. Item 2: just e2e-streamed-drift

    cd "$BH"
    docker rm -f behold-choudoufu-floci 2>/dev/null   # the script refuses a leftover container
    npx playwright install chromium                   # only when there is no Chrome
    just e2e-streamed-drift                           # = bash e2e/streamed-drift-e2e.sh

    Pass is the line streamed drift e2e: all green after the step 0 to 3 ticks. A skip: line exits 0 and is not a pass (no Docker, or no choudoufu at CHOUDOUFU_BIN). The behold log is ${TMPDIR:-/tmp}/behold-drift-e2e.log.

    2. Item 3: the demo with the real chant stream

    cd "$BH"
    export BEHOLD_DRIFT_CHANT="$BH/node_modules/.bin/chant"     # the local build from step 0
    node bin/behold.js demo choudoufu-estate /tmp/choudoufu-estate-demo --port 4321

    When it is serving, keep the frames in a second terminal:

    curl -sN http://localhost:4321/api/events | while IFS= read -r l; do case "$l" in data:*) printf '%s %s\n' "$(python3 -c 'import time; print(time.time())')" "${l#data: }";; esac; done > /tmp/drift-frames.txt

    Open http://localhost:4321/?alike=0. Stacking has to be off, because a streamed record does not paint a stack card yet (cardsFor matches individual cards only). Then press Cmd-K and pick "Stream drift card by card: monolith", or run curl -X POST localhost:4321/api/workspace/drift/stream -H 'content-type: application/json' -d '{"member":"monolith"}'. Each card should dim to reading, then take its colour one resource at a time. The real choudoufu plan per resource is slower than the e2e's 0.6 s steps. Record the screen and attach the recording and /tmp/drift-frames.txt here. Stop with Ctrl-C, then run bash /tmp/choudoufu-estate-demo/scripts/choudoufu-down.sh to remove the floci container.

  10. lex00 commented on Oct 27, 2026

    @lex00
    ContributorAuthor

    Ready for the maintainer (consolidation-graph, 2026-10-27)

    behold main is 8b74db5, whose tree equals the epic-ready tested tip fd1dd6a. chant main is 47b8594e3. This refreshes the round-2 comment: those steps named behold a08dadc and are replaced by the run sheet entry below.

    What epic-ready proved: with scratch emulators, behold's safe env and the local chant build (b6281ef154 as 0.124.53), e2e/streamed-drift-e2e.sh printed "streamed drift e2e: all green" with no real-cloud call. That run was at 8236662, an earlier integration tip, and it is the orchestrator's, so item 2 stays unticked as a maintainer run. src/drift-stream.test.ts passed in both vitest runs at fd1dd6a (published chant 4906 passed, local chant 4914 passed).

    Left:

    • Item 2: just e2e-streamed-drift on your machine, verdict "streamed drift e2e: all green" and a clean safe-env scan.
    • Item 3: the choudoufu-estate demo with BEHOLD_DRIFT_CHANT at the local chant build, cards colouring one resource at a time, with the recording and the frames attached here.

    Commands: run sheet entry B8 in engine-wt/goals/consolidation-graph-1-runs.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic:engine-shipmulti-engine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions