diff --git a/.llm/2026-11-02-scaffold-documented-lifecycle.md b/.llm/2026-11-02-scaffold-documented-lifecycle.md new file mode 100644 index 0000000000..131398598f --- /dev/null +++ b/.llm/2026-11-02-scaffold-documented-lifecycle.md @@ -0,0 +1,9 @@ +# Documented scaffold lifecycle — issue 2591 + +PR: https://github.com/rickylabs/netscript/pull/2592. The implementation observes durable seed +publication in the existing worker lifecycle and adds explicit service consumers to plugin install. +A pristine documentation-driven runtime gate tests both negative controls and restoration. + +Run context and source validation: `.llm/runs/orch-divybot-6572256863--2591/context-pack.md`. +The PR carries the current immutable-head runtime evidence and READY decision. Refs #2591; +Cockpit owns review and merge during the canary hold. No lock or dependency version changes. diff --git a/.llm/runs/orch-divybot-6572256863--2591/context-pack.md b/.llm/runs/orch-divybot-6572256863--2591/context-pack.md new file mode 100644 index 0000000000..ed00c2d315 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/context-pack.md @@ -0,0 +1,41 @@ +# Resume — issue 2591 + +PR: https://github.com/rickylabs/netscript/pull/2592 (draft; Refs #2591). +Branch `orch/divybot-6572256863`; baseline `6766130bbafbe78a9bb5870f704987cb0743c5e6`. +S1 commit `321eca9b9c53d7ac7b12e832d09b9c43c861bde7`; repaired source candidate +`41fb51d1bcf48094b57265c87020654725ed2784`. This final sign-off commit changes run evidence only. + +S1 and S2 independently PASS, same separate cross-family Opus session throughout. See +s1-review.md and s2-review.md. Event-driven post-seed observation uses existing durable +idempotency; plugin install --service persists managed service links and preserves manual links. +The documented block includes explicit stream service selection and detached Aspire startup. + +behavior.documented-scaffold runs after static init and before all link/restart repair fixtures. +It reads the actual docs and runs skip-seed-handoff, drop-link and restored in pristine Postgres +workspaces. It requires real seed-correlated completion, actual stream/HTML Activity, stable +resident worker PID and exact AppHost/container cleanup. Read-side retries are test observation +only. The first live candidate exposed a public DTO mismatch; see memory-runtime-contract.md. + +Deno 2.9.7: 191 focused test/step results PASS, all 21 owned-source check/lint/fmt files covered, +root check 4206 files PASS, broader quality PASS, CLI/workers JSR audits PASS with existing +warnings. Four carrier generators and all 15 root check tasks PASS with no generated drift. +See validation.json for source hashes and actual local summaries. RTK and local Docker unavailable. +No full local runtime claimed. Owned local reproduction AppHost stopped; foreign resources left alone. + +Next: run canonical one-pass scaffold.runtime CI at this sign-off head; require both controls RED +for their precise symptoms and restored PASS, plus canonical cleanup. Complete all remote checks +and same-session independent evidence review, then put final exact-head evidence on PR 2592. +Keep head fixed once accepted. Write READY with the full SHA by atomic ignored final-report file +handoff only; file creation queues publication, not confirmation of posting. Never commit the +assignment or final report. Preserve draft/no-merge canary hold; Cockpit reviews and merges. +No rebase or force push. Public artifacts use repo-relative paths. No accepted product debt. + +Latest steering: 650fb2e runtime CI passed the seed control/Activity/exact cleanup, then failed +recursive scratch deletion with PermissionDenied. The S3 repair retains generated workspaces and +reduces repeated success logs to preserve all variant receipts. See memory-runtime-workspace-retention.md. +Final acceptance is still pending; the latest PR head and exact CI run supersede earlier candidates. + +S3 source review now PASS (s3-review.md). Independent rerun: 31 focused tests plus changed-file +check/lint/fmt; broader quality also passes. The sign-off commit retains generated scratch after +exact runtime cleanup, with all acceptance assertions unchanged. Run the final one-pass CI at +this next pushed head and use its full SHA, never an earlier failed candidate, for READY. diff --git a/.llm/runs/orch-divybot-6572256863--2591/drift.md b/.llm/runs/orch-divybot-6572256863--2591/drift.md new file mode 100644 index 0000000000..0156079485 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/drift.md @@ -0,0 +1,11 @@ +# Drift + +- RTK absent; direct read commands and structured validation wrappers used. +- Local Docker runtime unavailable. Full local reproduction is unproven, not a product pass. +- Specific operator instructions override generic assignment boilerplate: Refs #2591, draft + review surface, no merge during the canary hold. Final report uses the file publication handoff. +- No product debt accepted. + +- S2 adds tracked Aspire-referencing gate files, so its generated surface inventory must refresh. + The allowed derived surface includes `.llm/tools/validation/fixtures/aspire-surface-manifest.tsv`, + regenerated exclusively through `aspire-surface-manifest.ts`; no version pin changes. diff --git a/.llm/runs/orch-divybot-6572256863--2591/lesson-2026-11-02.md b/.llm/runs/orch-divybot-6572256863--2591/lesson-2026-11-02.md new file mode 100644 index 0000000000..638e25b2db --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/lesson-2026-11-02.md @@ -0,0 +1,18 @@ +# Documented scaffold acceptance + +Runtime fixtures that repair links or restart children can mask failures in the documented order. +Test the documented sequence in an independent pristine workspace before fixture-only interventions. +Use real post-seed execution with its correlation identity, and assert the actual stream-backed +Activity projection after a committed mutation. A generic healthy resource or a manually triggered +sample cannot prove either wiring contract. Keep both deliberate fault controls alongside the gate. + +Public execution DTOs may deliberately omit correlation keys. Bind provenance through the public +filtered route and parse regression fixtures through the real response schema. Preserve nested +errors from live controls so a gate failure identifies the application boundary. Canonical exact +AppHost cleanup is stronger than hoping a detached host appears in an enumerated process list. +Distinguish source review PASS from actual final-head runtime acceptance. + +A Postgres bind mount can leave container-owned scratch that a non-root runner cannot recursively +delete. Prove runtime disposal separately and retain the generated workspace for diagnosis; do not +turn successful acceptance into a privileged filesystem cleanup requirement. Bounded command logs +should retain compact per-scenario receipts instead of repeating every successful CLI invocation. diff --git a/.llm/runs/orch-divybot-6572256863--2591/memory-environment.md b/.llm/runs/orch-divybot-6572256863--2591/memory-environment.md new file mode 100644 index 0000000000..9045e901f9 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/memory-environment.md @@ -0,0 +1,7 @@ +# Environment — 2026-11-02 + +Deno is 2.9.7. RTK and a global memory service are unavailable; use structured wrappers directly. +Local Docker has no daemon/socket, no dockerd, systemd, or sudo. A foreign AppHost exists and must be left alone. +Read prior scaffold lessons in `.llm/runs/orch-divybot-6569760641--2587/memory-*.md` before retrying prior paths. +CLI spelling for the brief's shorthand installs: `plugin install worker --name workers --samples` and +`plugin install stream --name streams --samples`. Positional plural without --name fails validation. diff --git a/.llm/runs/orch-divybot-6572256863--2591/memory-final-evidence.md b/.llm/runs/orch-divybot-6572256863--2591/memory-final-evidence.md new file mode 100644 index 0000000000..2ea9bcf7c0 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/memory-final-evidence.md @@ -0,0 +1,14 @@ +# Bind final acceptance to the public runtime + +Same-session cross-family S2 repair review passed at source candidate `41fb51d`. +The reviewer traced the public by-correlation route and result payload persistence, and independently +ran the focused runtime/builder/runner tests plus changed-source checks. Live acceptance remains a +separate obligation; a source PASS does not certify the final CI runtime. + +The canonical cleanup helper stops the exact generated AppHost and asserts no owned container +survivors. Its process classification array is empty by design; do not describe that receipt as a +complete process inventory. Foreign and unproven resources are left untouched. + +Record the final-head domain report and all three documented variants in the PR evidence. Keep the +source head fixed once that run passes; final publication goes through the ignored atomic report +file, and its creation means queued publication only. diff --git a/.llm/runs/orch-divybot-6572256863--2591/memory-install-consumers.md b/.llm/runs/orch-divybot-6572256863--2591/memory-install-consumers.md new file mode 100644 index 0000000000..956ae377a4 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/memory-install-consumers.md @@ -0,0 +1,10 @@ +# Service consumers and generated output + +`plugin install --service ` writes `linking.consumers.services` in the installed manifest; +`reconcilePluginReferences` then writes the service's PluginReferences and helper regeneration +wires discovery. `--service-refs` is the opposite direction: services the plugin depends on. +Do not confuse the two. Reinstall without --service preserves the recorded selection. + +The root formatter excludes CLI sources. For owned CLI files, copy only root fmt/lint settings +to an ignored config without selection exclusions, then pass explicit owned files to the wrappers. +Existing unrelated install test files have legacy format drift; do not include them in this slice. diff --git a/.llm/runs/orch-divybot-6572256863--2591/memory-masked-runtime.md b/.llm/runs/orch-divybot-6572256863--2591/memory-masked-runtime.md new file mode 100644 index 0000000000..fcf89dbcb2 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/memory-masked-runtime.md @@ -0,0 +1,6 @@ +# Why runtime CI masked the reported path + +`packages/cli/e2e/suites/scaffold/capability-suites.ts` restarts background resources after DB seed. +`prepare-streams-storage-fixture.ts` explicitly adds users->streams, while pristine install links only apps. +`plugins/workers/bin/runtime.ts` reads the durable seed request just once at combined-process startup. +A running worker misses a later seed. A new gate must assert documented setup before either repair fixture. diff --git a/.llm/runs/orch-divybot-6572256863--2591/memory-runtime-contract.md b/.llm/runs/orch-divybot-6572256863--2591/memory-runtime-contract.md new file mode 100644 index 0000000000..c83d999da9 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/memory-runtime-contract.md @@ -0,0 +1,15 @@ +# Runtime acceptance must respect the public DTO + +Workers execution responses deliberately omit correlationId. Use the public +`/api/v1/workers/executions/by-correlation/{correlationId}` endpoint to establish seed provenance, +then assert completion, actual result, progress and time. Parse the canonical public response +schema in a regression fixture; a hand-built DTO containing hidden fields can mask a broken test. + +The first CI run 41418574351 at f82ef33 exercised two documented variants in 189693ms. The seed +negative control was RED while real stream-backed Activity passed. The next variant completed a +real job, exposing the test's incorrect DTO assumption. That run is a failed attempt, not acceptance. + +The general teardown reporter did not enumerate detached AppHosts on that runner. Reuse the existing +runtime/evidence/cleanup.ts fixture helper with the exact generated AppHost and project root. +Place the documented gate after static init so the main cleanup tail has a valid AppHost file, +while keeping it before all plugin-link and runtime-restart fixtures. Preserve nested errors. diff --git a/.llm/runs/orch-divybot-6572256863--2591/memory-runtime-workspace-retention.md b/.llm/runs/orch-divybot-6572256863--2591/memory-runtime-workspace-retention.md new file mode 100644 index 0000000000..d5d60219e9 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/memory-runtime-workspace-retention.md @@ -0,0 +1,13 @@ +# Runtime cleanup and disposable workspace retention + +Run 41423746948 at 650fb2ed00389105ebe6cb242a212c827f4c1309 passed the seed-handoff negative +control, actual stream/Activity mutation and canonical exact-AppHost/container cleanup. It then +failed at recursive workspace removal with filesystem PermissionDenied. Database bind mounts can +leave data owned by a container user; runtime cleanup must not require deleting that scratch data. +Keep the generated workspace under the owned smoke root for diagnostics after stopping its AppHost +and proving no owned container survivors. Do not add sudo, broad chmod or container-user workarounds. + +The earlier 41423003834 attempt failed rendering Fresh after its esbuild subprocess stopped. It is +a retained failed diagnosis, not acceptance; the later run rendered the page and reached cleanup. +Reduce successful per-command log repetition so the command evidence tail retains all three variant +IDs, negative symptoms, unchanged worker PID and cleanup outcomes in the final full-suite report. diff --git a/.llm/runs/orch-divybot-6572256863--2591/memory-scoped-controls.md b/.llm/runs/orch-divybot-6572256863--2591/memory-scoped-controls.md new file mode 100644 index 0000000000..fe790ce707 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/memory-scoped-controls.md @@ -0,0 +1,7 @@ +# Scratch tests and runtime proof + +Deno's repository test configuration excludes `.llm/tmp`, even when a test path is explicit. +A copied config in that scratch directory cannot list the real workspace members: Deno requires +members to be nested beneath the config's workspace root. Those failed launches prove nothing. +Prefer the ordinary source regression modules and the registered runtime gate's deliberate controls. +The full Docker-backed path is required in CI; do not infer it from local wrapper success. diff --git a/.llm/runs/orch-divybot-6572256863--2591/memory-watcher-review.md b/.llm/runs/orch-divybot-6572256863--2591/memory-watcher-review.md new file mode 100644 index 0000000000..6773ef3c7f --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/memory-watcher-review.md @@ -0,0 +1,10 @@ +# Watcher review lessons + +Arm the directory watch before checking current seed intent; normalize the parent with realPath. +Deno 2.9.7 closes a pending watch iterator cleanly and permits disposal after close. Its test +sanitizers do not prove watcher cleanup. Test observed events and bounded termination explicitly. +Startup may reject malformed existing intent, but later sample dispatch failures must preserve +pending intent and leave the healthy worker running. Separate readiness from observer lifetime. +Bound observer drain at shutdown and preserve the worker's original error. Re-arm when the watched +parent is removed. Service reselection must revoke only prior CLI-managed edges, preserving manual +appsettings links; retain the previous consumer set in planning before writing new metadata. diff --git a/.llm/runs/orch-divybot-6572256863--2591/plan.md b/.llm/runs/orch-divybot-6572256863--2591/plan.md new file mode 100644 index 0000000000..9a2bbe2eeb --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/plan.md @@ -0,0 +1,30 @@ +# Plan & Design — READY FOR REVIEW + +Repair wiring through existing lifecycle and manifest consumer metadata. + +1. Watch the seed handoff's parent directory using Deno.watchFs before checking existing intent. + Dispatch existing and future publications through the same idempotent worker handoff. Tie + watcher lifetime and failures to the combined worker process; no polling or request handlers. +2. Add an explicit `plugin install --service ` consumer selection alongside `--app`. + Validate before writes, persist through the existing linking manifest and reconciler, and + preserve it on reinstall. Document streams installation with that selection. +3. Add a clean documented-order runtime gate that runs before existing restart/link fixtures, + verifies post-seed completion and stream-backed Activity, and exercises both negative controls. +4. Regenerate all affected carriers using their tasks, run scoped and broader gates, separate + cross-family IMPL-EVAL, final-head runtime CI, then READY handoff. Do not merge. + +PLAN-EVAL: N/A. Owner explicitly scopes this as wiring with no design changes. The solution +reuses filesystem notification, existing seed dispatch/idempotency, and existing manifest edges. +No public contract redesign, storage migration or release is planned. + +Gates: Deno 2.9.7 structured scoped check/lint/fmt/tests; quality:gate; JSR audits for affected +packages; full carrier chain and every root check task; clean runtime gate and negative controls; +one-pass scaffold.runtime in CI at the final head. Tests must verify real execution and Activity. + +Risks: missing watcher events (subscribe before read; atomic publication and lifecycle tests), +duplicate dispatch (existing stable seed identity and durable acceptance), unwanted linking +(explicit service selection, validation and reinstall preservation), runtime fixture masking +(independent pristine setup), unavailable local Docker (record unproven; CI runtime required). + +Deferred: visual redesign, unrelated plugins, protocol/storage changes. No accepted product debt. +Open decisions: none that require owner input. Exact focused test list follows the implementation. diff --git a/.llm/runs/orch-divybot-6572256863--2591/research.md b/.llm/runs/orch-divybot-6572256863--2591/research.md new file mode 100644 index 0000000000..d3c24654d1 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/research.md @@ -0,0 +1,19 @@ +# Research + +Read issue 2591 and all comments, issue 2587 and comments, and merged PR 2589's body. +No triage comment or existing PR for 2591 was found. Consulted prior run memory first. +Called the in-repo MCP `find_guidance` for scaffolding, lifecycle, linking and doctor. + +At baseline, combined workers dispatch seed intent only once at startup. The documented +start/init/generate/seed order publishes intent after that read. The runtime suite restarts +workers after seed, hiding this ordering failure. Its streams storage fixture also adds the +users service's stream reference; normal install links only apps. Both mask acceptance gaps. + +Reproduced clean local init, worker install, stream install and isolated Aspire start under +Deno 2.9.7 in `.llm/tmp/2591-repro/documented-2591`. Settings confirm app->streams but no +orders->streams edge. Plugin doctor verifies the generated registry but reports worker runtime +unhealthy. All three DB commands fail because this environment has no Docker daemon. Full +baseline runtime reproduction is unproven locally and must run on the CI runtime runner. + +CLI is Archetype 6; workers is Archetype 5 with runtime behavior. No new package entrypoint +or third-party dependency is needed. Existing seed identity and worker idempotency remain. diff --git a/.llm/runs/orch-divybot-6572256863--2591/s1-review-initial.md b/.llm/runs/orch-divybot-6572256863--2591/s1-review-initial.md new file mode 100644 index 0000000000..534ac9be58 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/s1-review-initial.md @@ -0,0 +1,69 @@ +## IMPL-EVAL S1 — issue 2591 · **FAIL_FIX** + +**Session model observed:** `claude-opus-5` (Opus 5). Requested `claude-opus-5` @ xhigh — model matches; reasoning effort is not attestable from this session surface, so I don't claim it. + +**Scope reviewed:** `.llm/runs/orch-divybot-6572256863--2591/{plan,worklog,research,context-pack,drift,supervisor}.md` + working diff (16 files). `profiles/` not read. No product source edited, nothing committed. + +### What is correct (don't re-litigate) +- **The ordering race the issue is about is genuinely closed.** `watchSeedSample` arms `Deno.watchFs` (line 72) *before* the first `dispatchSeedSample` (line 77), so a publication can neither fall in the gap nor be double-dispatched. The seed writer's hard-link publication (`generate-database-seed.ts:38-54`) is atomic, so there is no partial-read window, and the `AlreadyExists` swallow keeps reseed identity stable — the doc's claim is accurate. +- Verified on Deno 2.9.7: `watcher.close()` during a suspended `for await` ends the iterator **cleanly**, and `using` double-close is safe. Not a defect. +- `Deno.realPath` normalization (line 70) correctly handles symlinked roots. +- Idempotency preserved: KV receipt + stable `scaffold-seed:` key; `accepted` short-circuits before `job`/`enqueue`. +- The unhandled-rejection window (floating `seedWatch` rejecting before the race — I reproduced it killing the process at exit 1, bypassing `runChildHealthProcess`'s 1-second `failed` grace) is **already closed** by `void seedWatch?.catch(() => {})`. +- `--allow-write` is declared for the background child (`workers-contribution.ts:24-33`), so the new `Deno.mkdir` is permitted. +- **Public/local parity is complete**: option, `InstallPluginRequest.service`, `planPluginInstall` dependency, and shared `persistPluginMetadata` all line up; validation runs in planning, before writes, and the test proves `appsettings.json` is byte-identical. + +### Findings + +**F1 · HIGH · confirmed — a post-startup seed dispatch failure tears down the healthy worker.** +`plugins/workers/bin/runtime.ts` (`await Promise.race([worker.start(), seedWatch])`). Any rejection from a *watcher-driven* dispatch — transient Redis on `enqueue`, KV on `accepted`/`remember`, a republished malformed marker — rejects `seedWatch`, wins the race, and the `finally` stops worker **and** scheduler. I simulated the exact control flow with a failing `enqueue`: `STARTCOMBINED THREW: transient redis blip` / worker+scheduler stopped. Pre-change the seed path was one-shot and could not touch a running worker; this is a new failure mode where a *sample* handoff kills production worker runtime. +Fix — isolate the loop body; only the initial dispatch may fail startup: +```ts +await dispatchSeedSample(ports); // startup failure stays fatal +for await (const event of watcher) { + if (signal.aborted) break; + if (!event.paths.some((changed) => resolve(changed) === marker)) continue; + try { await dispatchSeedSample(ports); } + catch (error) { console.error('Seed sample dispatch failed; intent stays pending:', error); } +} +``` +Then drop `seedWatch` from the **worker** race entirely (it can no longer reject post-startup). + +**F2 · MEDIUM-HIGH · confirmed — `await seedWatch` in `finally` masks the real cause and can fail a clean shutdown.** +Same file, `finally { …; await seedWatch; }` with no catch. A dispatch rejecting while the watcher closes during an *orderly* stop makes `startCombinedProcess` reject → `run-child-health-process.ts:88-96` sets `Deno.exitCode = 1` and a `failed`/`crash-looping` terminal snapshot on a normal shutdown — exactly what the false-readiness/crash-loop negative controls exist to catch. It also replaces a genuine `worker.start()` error with a teardown-time seed error. +Fix: `await seedWatch?.catch(() => {});`, and bound it (`Promise.race` with a short delay) so an in-flight queue/KV call against a shutting-down Redis cannot hang the child's exit. + +**F3 · MEDIUM · confirmed — `--service` edges accumulate and can never be moved or revoked.** +`kernel/adapters/plugin/plugin-reference-reconciler.ts:79`: `addConsumerReference` only adds; `pruneUninstalledReferences` only drops references to *uninstalled* plugins. Reproduced against the real reconciler: install `--service orders` → `Services.orders.PluginReferences = ['event-relay']`; reinstall `--service users` → **both** `orders` and `users` carry it. Explicit consumer *selection* that cannot be changed undercuts the feature and the new apiTable row. Pre-existing for `--app`, newly exposed by `--service`. +Fix: before `addConsumerReference`, revoke that `resourceConfigKey` from every `services`/`apps` entry not in the declaration's consumer set; add a regression test for the move case. + +**F4 · MEDIUM · confirmed — `--service` unions with manifest consumers while `--app` replaces them.** +`plugin-app-references.ts:28` returns `[request.app]`; line 50 returns `[...declared, request.service]`. One CLI surface, two semantics, documented as neither. For a plugin that declares `linking.consumers.services`, `--service users` cannot narrow to `users`. Make `--service` replace (matching `--app` and the doc's "selects a plugin consumer"), or document the union and align `--app`. The new test only covers `declaredConsumers === undefined` — add the declared+explicit case. + +**F5 · MEDIUM · confirmed — the documented ordered block is not runnable as written.** +`docs/site/orchestration-runtime/how-to/add-a-plugin.md:79-91`. (a) **`aspire restore` is missing**; `quickstart.vto:112-117`, `cli-reference.md:20-23,60`, `explanation/aspire.md:381` all restore first, and `cli-reference.md:23` names the exact error a reader hits without it. (b) `aspire start` blocks in an interactive terminal (`quickstart.vto:127` — "leave it open"), yet the block says "Run these commands in order" with `netscript db init` on the next line. The `--apphost … --non-interactive --nologo` form is the E2E/automation form (`e2e/.../typed-db-background-restart_test.ts:84-92`), not the human form. +Fix: add the restore step, and either split the block at `aspire start` with a "leave running / second terminal" note or state that this is the non-interactive form where `aspire start` detaches. The `` markers have no consumer yet — if the S2 gate will execute this block, it must match exactly. + +**F6 · LOW-MEDIUM · confirmed — the watcher goes silently deaf if `.netscript/` is removed and recreated.** +Probed on Linux: after removing the watched directory the iterator stays open forever and events in a recreated directory are never delivered. `remove-plugin.ts:253-263` prunes an empty `.netscript`, so remove-plugin → generate → seed with the child still up yields a live-but-dead watcher and no dispatch, silently. Fix: re-arm on a `remove` event matching the watched directory, or at minimum log once. + +**F7 · LOW · confirmed — a test name claims more than it proves.** +`plugins/workers/tests/runtime/seed-sample_test.ts:46` — "without leaking a watch". Deno's sanitizers do **not** track `Deno.watchFs` (a deliberately leaked watcher passes a test cleanly), so the `using` cleanup on the throw path is unverified. Fix: after the rejection, publish into the marker directory again and assert `messages.length` is unchanged — or rename the test. + +**F8 · LOW · simplification — `Promise.race([scheduler.start(), seedWatch])` can proceed with an unstarted scheduler.** +If `seedWatch` *resolves* first (pre-aborted signal), the race resolves and execution continues past scheduler startup; only the following `options.signal?.aborted` check saves it. Express the intent as rejection-only: +```ts +const seedFailure = seedWatch?.then(() => new Promise(() => {})) ?? new Promise(() => {}); +await Promise.race([scheduler.start(), seedFailure]); +``` + +### Evidence I ran (read-only / focused) +- `deno test plugins/workers/tests/runtime/seed-sample_test.ts` → **7 passed** +- `deno test packages/cli/src/public/features/plugins/install/plugin-app-references_test.ts` → **4 passed** +- scoped `run-deno-check.ts`: install feature (20 files) and `plugins/workers/{src/runtime,bin}` (7 files) → **0 occurrences** +- scoped `run-deno-lint.ts` → **0 occurrences** (one batch refused `partial-exclusion` — tool quirk, not a lint failure) +- 5 Deno 2.9.7 probes (close-during-iteration, dir-removal, symlink paths, unhandled rejection with a live `Deno.serve`, sanitizer watcher tracking) + 1 reconciler drift repro + 1 control-flow simulation of F1 +- **Explicitly not a finding:** root `deno fmt --check` flags the markdown file, but `deno.json` `fmt.include` is `ts`/`tsx` only, `fmt:check` passes `--ext ts,tsx`, and the baseline file was already unformatted. Per AGENTS.md this is not a package-quality verdict. + +### Not certified (S2 scope — per brief, no gates asserted) +Documented runtime gate + both negative controls, `e2e:cli run scaffold.runtime`, carrier regeneration completeness, and end-to-end Activity/stream behavior. Docker is unavailable in this environment, so no runtime verdict is possible here and I do not self-certify final runtime evidence. Remains the evaluator session for subsequent rounds. diff --git a/.llm/runs/orch-divybot-6572256863--2591/s1-review.md b/.llm/runs/orch-divybot-6572256863--2591/s1-review.md new file mode 100644 index 0000000000..7258c99ecc --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/s1-review.md @@ -0,0 +1,39 @@ +## IMPL-EVAL S1 (repair re-review) — issue 2591 · **PASS** + +Same evaluator session, continuing from the earlier FAIL_FIX. Product source read-only; nothing committed. Session model observed: `claude-opus-5` — matches the matrix fallback recorded in the worklog; reasoning effort is not attestable from this session surface, so no effort claim. + +### Prior findings — all closed, each verified independently + +**F1 (late dispatch killing the worker) — closed.** `watchSeedSample` now splits startup from steady state: the initial `dispatchSeedSample` still propagates (so a malformed marker fails startup as before), while every event-driven dispatch goes through `dispatchPublishedSeed`, which catches and reports. `startCombinedProcess` no longer races the observer against `scheduler.start()`/`worker.start()` — both are direct awaits, and the observer promise is only ever observed via `.catch`. The failure mode I reproduced last round (a transient `enqueue` rejection tearing down a healthy worker) is now covered by a real-filesystem regression test that asserts the observer survives, `receipts.size === 0`, and the next publication succeeds. + +**F2 (finally masking / hanging) — closed, probed.** I replicated the `finally` shape against `jsr:@std/async@^1`: with the observer rejected and `worker.start()` rejecting, `REAL worker failure` propagates (no masking); with the observer hung, it propagates at ~2000 ms and the process exits cleanly with no lingering timer. `deadline(seedWatch.catch(() => {}), 2_000).catch(...)` can neither rethrow nor stall shutdown. + +**F3 (consumer edges accumulating) — closed, and keyed correctly.** The revocation map is keyed `rendered.plugin.serviceConfigKey ?? rendered.plugin.configKey`, which is the **identical expression** `persistPluginMetadata` uses to write `linking.resourceConfigKey`, so the key matches the reconciler's `declaration.resourceConfigKey` for any `--name` — this was my main residual risk and it holds by construction, not coincidence. Revocation is correctly scoped: only keys present in `previousServiceConsumers` and absent from the new declaration are dropped; `manual` links and other plugins' references survive, and the other three `reconcilePluginReferences` callers keep the no-revocation default. + +**F4 (`--service` union vs `--app` replace) — closed.** `return [request.service]`. Validation before writes unchanged, and the test still asserts `appsettings.json` is byte-identical on the reject paths. + +**F5 (documented block not runnable) — closed, verified against the real CLI.** `aspire restore --apphost … --non-interactive --nologo` is valid: `aspire restore --help` from the installed CLI lists all three options. The detach claim matches `quickstart.vto:127-131` and the e2e `start` form. + +**F6 (watcher deaf after directory removal) — closed, and broader than claimed.** The re-arm keys on `kind === 'remove'` for the watched directory. I probed the near neighbour I was worried about: on Linux a directory **rename** also surfaces as `kind: 'remove'` with the directory path, so rename re-arms too. The re-arm test is well built — it watches the parent independently for the recreate rather than sleeping, and every wait is `Promise.race`d against the observer so a rejection can't hang it. + +**F7 (overclaiming test name) — closed.** Renamed to "rejects malformed **startup** intent". + +### Validation I ran this round (not relying on the supplied receipts) +- `deno test --allow-all --unstable-kv plugins/workers/tests/runtime packages/cli/src/public/features/plugins/install packages/cli/src/kernel/adapters/plugin/plugin-reference-reconciler_test.ts packages/cli/src/local/features/plugins/install/install-local-plugin_test.ts` → **56 tests + 56 steps passed, 0 failed** (= the 112 TAP results in `s1-repair-tests.json`; the count reconciles). +- `run-deno-check.ts` over the 14 changed non-generated `.ts` files → **0 occurrences**. +- `check-doctrine.ts --all-roots` → **exit 0** (pre-existing warnings only); `check-root-coverage.ts` → `ok: true`; `scan-code-quality.ts --root packages --root plugins --root docs/site --max-allow 7` → **`ok: true`, 0 findings, allowCount 7 at the cap, no new allowances**. This matters because the supplied `s1-quality-receipt.json` predates the repair, and the repair touched a kernel adapter under doctrine — I re-ran it rather than inherit a stale receipt. +- `@std/async` confirmed already declared in `plugins/workers/deno.json`, so the new import does not break the publish surface. +- 2 new Deno 2.9.7 probes (directory-rename event kind; `deadline` masking/hang/exit behaviour). + +### One evidence-accuracy correction for the handoff (not a code change) +`s1-repair-lint.json` and `s1-repair-fmt.json` report `filesProcessed: 14, droppedFiles: [], refusals: []`. Root `deno.json` excludes `packages/cli/` from **both** `lint` and `fmt`, and `packages/cli/deno.json` declares neither — `deno lint` on those paths returns "No target files found" and `deno fmt --check` on the same 14 files reports "Checked 3 files". So 11 of the 14 never linted or formatted; the three that did are the `plugins/workers` files, which are genuinely clean. The CLI's substance is covered by `quality:scan` + `check-doctrine` instead, both of which I ran green above. Fix the wording so the receipt isn't later cited as a lint/fmt verdict over CLI source — the same caution the worklog already applies to the fmt file selection. + +### Residuals — non-blocking, for follow-up not S1 +1. **`--app` still accumulates.** Selection semantics are now aligned (both replace), but revocation was implemented for `services` only; `addConsumerReference(apps, …)` is unchanged, so switching `--app a` → `--app b` still leaves `a`'s edge. The new doc paragraph correctly scopes the move claim to `--service` and says nothing false about `--app`. Pre-existing gap, now an asymmetry worth a tracked follow-up. +2. **No way to clear a consumer.** There is no `--no-service`; once set, reinstalls preserve it and only a different `--service` can move it. Parity with `--app`, and the docs state the preserve behaviour plainly. +3. **The initial dispatch has no timeout.** A wedged KV or queue blocks worker startup indefinitely between `dependenciesReady()` and `running`, surfacing as a readiness-probe failure rather than a fast structured failure. Same shape as before this slice, so not a regression — but S2's readiness assertions sit directly on it. +4. **A rejected observer stays dead and is only logged.** If `watchFs` fails during re-arm (e.g. inotify `ENOSPC`), later publications are never dispatched and nothing latches degraded health. Defensible — worker availability over sample dispatch — but undiscoverable from the health surface. +5. Cosmetic: `SEED_WATCH_SHUTDOWN_MS` is declared in the middle of the import block in `plugins/workers/bin/runtime.ts`. Lint and fmt are clean on it; move it below the imports when that file is next touched. + +### Not certified +S2 clean documented-order runtime acceptance and its negative controls are not implemented and are **not** covered by this verdict. No runtime proof is claimed: Docker is unavailable in this environment, so the `scaffold.runtime` one-pass E2E, the Activity/stream end-to-end behaviour, and the final-head runtime CI remain unproven. `PASS` here means S1's watcher lifecycle, install consumer wiring, documented sequence, and focused test evidence hold on inspection and on the checks listed above — nothing more. This session remains the evaluator for S2 and should not be the session that produces the runtime evidence it will review. diff --git a/.llm/runs/orch-divybot-6572256863--2591/s1-validation.json b/.llm/runs/orch-divybot-6572256863--2591/s1-validation.json new file mode 100644 index 0000000000..3a6c20c330 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/s1-validation.json @@ -0,0 +1,101 @@ +{ + "schemaVersion": 1, + "recordedAt": "2026-11-02T08:47:43.838040+00:00", + "scope": "S1 source snapshot, before commit; hashes bind the reviewed working tree", + "baseHead": "dcd095c8bb8294a67ff4275aae65c95b5bc66881", + "denoVersion": "2.9.7", + "sourceHashes": { + "docs/site/orchestration-runtime/how-to/add-a-plugin.md": "33e41b3cb8cd71bf9f08f79fd119ef8939380c3003d5b5fec049e353159a20da", + "packages/cli/src/kernel/adapters/plugin/plugin-reference-reconciler.ts": "18abe860f359cc8657ca78ac26549376289c7c6e0934648a4c8571ad8032ba82", + "packages/cli/src/kernel/adapters/plugin/plugin-reference-reconciler_test.ts": "7698d18e1c022b0c9aaf42f54e315d819c59c076f6d495dda6042955e683152d", + "packages/cli/src/local/features/plugins/install/install-local-plugin-command.ts": "94320b7070d00c4c1968c5aa3ef1019b6a814f7ff0c614946b517a286bce8be9", + "packages/cli/src/local/features/plugins/install/install-local-plugin.ts": "34e93d9a1dd3d8d011f76deed3182a2cd3bd84e667b335c33d03bcb07facda96", + "packages/cli/src/public/domain/plugin-install-plan.ts": "0bc69eff45f51cf5674b80606a50cf783b777562bf23ee4ef967fd5be8527e74", + "packages/cli/src/public/features/plugins/install/install-plugin-command.ts": "c01a92b7c36ceb37576de134497aa69904662c2ec8ca042a437b550b32441159", + "packages/cli/src/public/features/plugins/install/install-plugin-input.ts": "5466ac4cbfb436693dc54258d9517c75706fd4de1b9fe533939e7553cced7669", + "packages/cli/src/public/features/plugins/install/install-plugin.ts": "a39a931a83320c2363ddd59d527dc976eaf9a9089437209df71a686412bb1a4f", + "packages/cli/src/public/features/plugins/install/plan-plugin-install.ts": "9da750de638f71d1d9fc91aa43b94120bf8e20ee76039bbee4e63e492f9a9025", + "packages/cli/src/public/features/plugins/install/plugin-app-references.ts": "9772918624a9911131821f9bcafce99153df1cf69280f1d1749843d94a12d877", + "packages/cli/src/public/features/plugins/install/plugin-app-references_test.ts": "0a58ff4b9852c5104fc50097409899d3c1647bb6accca5e0d800052d305bd57e", + "packages/mcp/src/infrastructure/docs/agent-docs-prose.generated.ts": "b02b55ff9428fb17a10383329ab2c68d9777d7f921994df84835738b3c474cf4", + "packages/mcp/src/publish-assets.generated.ts": "8d622405acf96dda5826007f2ce22d61e78263800586409f0bb2615f2f1e6e78", + "plugins/workers/bin/runtime.ts": "3038637fe89bc75f689e260e710a92fc7d79121984f07e7ec1937a133f0f5e18", + "plugins/workers/src/runtime/seed-sample.ts": "53d1256e91ea88d7b1ecb6fdc78cf033ff23f2727008c18ec4698f028f2bd677", + "plugins/workers/tests/runtime/seed-sample_test.ts": "7f9462dc0a2d69b1c200e401a237d1f51bf892ffb0859aeccaccfe043135db2e" + }, + "focusedTests": { + "exitCode": 0, + "durationMs": 21873, + "summary": { + "passed": 112, + "failed": 0, + "ignored": 0, + "totalResults": 112, + "uniqueFailures": 0 + }, + "failures": [] + }, + "scoped": { + "check": { + "selection": { + "filesSelected": 14, + "batches": 1, + "failedBatches": 0 + }, + "summary": { + "totalOccurrences": 0, + "uniqueOccurrences": 0, + "uniqueCodes": 0, + "uniquePaths": 0 + } + }, + "lint": { + "selection": { + "filesSelected": 14, + "batches": 1, + "failedBatches": 0 + }, + "summary": { + "totalOccurrences": 0, + "uniqueOccurrences": 0, + "uniqueRules": 0, + "uniquePaths": 0 + }, + "coverage": { + "filesSelected": 14, + "filesProcessed": 14, + "droppedFiles": [], + "refusals": [] + } + }, + "fmt": { + "summary": { + "filesSelected": 14, + "batches": 1, + "failedBatches": 0, + "findings": 0, + "ignoredFindings": 0 + }, + "coverage": { + "filesSelected": 14, + "filesProcessed": 14, + "droppedFiles": [], + "refusals": [] + } + } + }, + "actualInstall": { + "initial": "orders -> streams", + "reinstallWithoutService": "orders -> streams retained" + }, + "runtime": "UNPROVEN locally: Docker daemon unavailable; CI required", + "quality": { + "gateId": "quality-gate", + "invocationId": "scaffold-2591-s1-repair-quality", + "gitHead": "dcd095c8bb8294a67ff4275aae65c95b5bc66881", + "outcome": "PASS", + "exitCode": 0, + "startedAt": "2026-11-02T08:46:21.518Z", + "finishedAt": "2026-11-02T08:46:34.062Z" + } +} diff --git a/.llm/runs/orch-divybot-6572256863--2591/s2-review-initial.md b/.llm/runs/orch-divybot-6572256863--2591/s2-review-initial.md new file mode 100644 index 0000000000..3d341014e2 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/s2-review-initial.md @@ -0,0 +1,48 @@ +## IMPL-EVAL S2 (source/slice review) — issue 2591 · **FAIL_FIX** + +Same evaluator session. Diff reviewed against committed S1 `321eca9` (4 modified + 3 new files). Product source read-only; nothing committed. `profiles/` not read. Observed model: **`claude-opus-5`** (Opus 5); reasoning effort is not attestable from this session surface. + +### Correction to my S1 report +My S1 caveat about `s1-repair-lint.json` / `s1-repair-fmt.json` overstating coverage was **wrong**, and I withdraw it. I had run `deno lint`/`deno fmt` with the root `deno.json`, whose `lint.exclude`/`fmt.exclude` contain `packages/cli/`. The scoped commands pass `--config .llm/tmp/2591/source-config.json`, which carries the root lint rule set and fmt style with no selection excludes. I verified it directly: `deno lint --config .llm/tmp/2591/source-config.json packages/cli/src/.../plugin-app-references.ts` → "Checked 1 file", and the same for `deno fmt --check`. The receipts' `filesProcessed: 14, droppedFiles: []` was accurate for the command actually run; `packages/cli/` source was genuinely linted and format-checked. No evidence-hygiene issue stands. + +### What is sound — verified against the real generated markup, not assumed +- **Ordering is correct and enforced, not just commented.** `buildExecutionPlan` returns `suite.gates` unsorted and `createScaffoldCapabilitySuite` maps the ordered id list, so array position is execution order; `phase: BEHAVIOR` is only a label (the runner special-cases `'cleanup'` alone). `documented-scaffold_test.ts:45-53` pins `indexOf(BEHAVIOR_DOCUMENTED_SCAFFOLD) < indexOf(RUNTIME_STREAMS_STORAGE_FIXTURE)` and `< indexOf(RUNTIME_ASPIRE_RESTART_AFTER_DB)`. The "no link fixture or post-seed restart can repair it" claim holds and is locked. +- **The drop-link control detects the right symptom.** I traced the generated app: `if (id === 'streams' && !service?.[1].PluginReferences?.includes(identity.name)) return { state: 'installed-unwired', description: 'Record activity is not linked from the record service to this stream resource.' }`. That trigger is *exactly* the service→streams edge the control removes, and it lands on the Activity `
`. The 10:05 edit from prose-matching to attribute-matching is a strict improvement with an identical trigger condition. +- **The three Activity assertions are satisfiable.** `events.slice(-5).reverse().map(({value}) => ({ label: value.reference, actor: value.actor.name, timestamp: value.timestamp, … }))`, rendered as `{item.actor}`, `{item.label}` and `
` cannot stand in for an Activity event. +- **Command parsing faithfully executes the doc.** The block is read from `DOCUMENTED_SCAFFOLD_DOC` at run time; `/^[\w./ -]+$/` plus the `netscript|aspire|cd` allowlist fails closed on `;`, `&&`, pipes, `$`, quotes and `=`; `cd` is a cwd change, not a spawn; the test pins all ten commands, `--service users` as the streams install's last two words, and `--non-interactive` on start. `args[2] === 'streams'`/`indexOf('--service')` correctly strips only the streams link. `offset=-1` matches the app's own `snapshot = { offset: '-1', … }`. +- **Controls are mutually exclusive and fail closed.** Each control requires its typed error *and* the other contract passing; `progressPercent`/`completedAt`/`workspaceEntries` failures raise a plain `Error`, so a half-broken state can never be laundered into an accepted symptom. `outcome()` has no false-PASS path. Even if the sample job were independently scheduled, the `correlationId === scaffold-seed:` filter still yields `SeedHandoffAcceptanceError`. +- **Cleanup cannot hide a primary failure** (current shape, after the latest edit): the boxed `primaryFailure = { error }` survives a falsy throw, cleanup runs exactly once outside any `finally`, a cleanup failure aggregates with the primary, and the primary is rethrown last. Tolerating teardown exit `4` is right — `teardownExitCode` returns 4 only when `escalated.length || actionsRequired.length`, and the gate still throws on `actionsRequired`, so foreign/unknown survivors are reported and left alone per AGENTS.md. Ownership proof is solid: `smokeRoot = /.llm/tmp/cli-e2e`, so `pathContained(path, worktreeRoot)` already owns everything the variants start; `--owned-root projectRoot` is belt-and-braces and clears `MIN_OWNED_ROOT_SEGMENTS`. `writeRunResources` mkdirs the slice dir, so the `.netscript/e2e-cleanup` path needs no pre-creation. +- `commandGate` positional arguments land correctly (`cwd` defaults to `repoRoot`, `outputMode: 'capture'`, `retry: undefined`, `timeoutMs: 1_200_000`); the Postgres-only filtering and SQLite exclusion are asserted in `suite-registry_test.ts`; the `skip-seed-handoff` fault is injected before `aspire start` and guarded by `broken === source`; `workerPid` requires exactly one `displayName === 'workers'`, which is the prefix-sibling guard. + +### Required fixes + +**1. The restored variant can fail for a non-defect reason — no bounded retry on the Activity projection.** `activity()` calls `probeAppHome(projectRoot, 'dashboard', appHost)` with **no options**, so it waits only for the app to serve, never for the streams capability; it then does a **single** `fetch` and demands `data-capability-state="ready"` plus the exact caught-up description. The generated app explicitly models three transitional projection states — `state: snapshot.items.length ? 'ready' : 'empty'`, `'Catching up with stream history…'` and `'Events observed since the preview skipped earlier history.'` — over a per-URL cached snapshot with bounded catch-up. The gate's own test (line 130) proves `state="empty"` throws. So a first render that has not yet read the event fails the restored variant with a generic `Error`, and because this gate is `critical: true` and runs first, that flake fails the entire merge-readiness suite after paying for three scaffolds. Fix: retry the HTML read with a bounded budget (the existing 30×1s convention), treating `StreamLinkAcceptanceError` as terminal so the drop-link control still short-circuits instead of burning the budget: +```ts +for (let attempt = 1; ; attempt++) { + const html = await fetchHome(); + try { assertLinkedActivityHtml(html); return await finish(html); } + catch (error) { + if (error instanceof StreamLinkAcceptanceError || attempt === ATTEMPTS) throw error; + await delay(1_000); + } +} +``` +Do **not** instead pass `readyCapabilities: ['streams']` to `probeAppHome` — for drop-link that never becomes ready, and the probe's generic failure would replace the typed symptom the control requires. + +**2. The gate will likely time out on a cold runner, and it does not raise Aspire's own start timeout.** `timeoutMs: 1_200_000` (20 min) covers three full Postgres-backed walkthroughs: init + two plugin installs + restore + start (Postgres, Redis, five processes) + db init/generate/seed + doctor + probes + teardown, with `skip-seed-handoff` additionally burning its whole 30×1s execution-probe budget. At the aspire skill's own observed figures that is plausibly 12–21 minutes, i.e. at or over the ceiling on first-run image pulls. Separately, every existing gate that starts Aspire sets `ASPIRE_CLI_START_TIMEOUT` (`garnet-coexistence-fixture.ts:311-312` defaults it; `verify-typed-db-phase-b.ts:137` injects it), while the new `command()` helper passes no `env` at all, so its three `aspire start` calls use Aspire's default. Fix: raise `timeoutMs` to ~2,400,000 (or justify the ceiling with a measured figure) and pass `ASPIRE_CLI_START_TIMEOUT` on the `aspire start` invocations, matching the established pattern. + +### Non-blocking notes +- Cleanup asserts only that `actionsRequired` is empty; it logs `stoppedAppHosts.length`/`removedContainers.length` without requiring either to be non-zero. Ownership is proven by worktree containment here, so this is hardening rather than a hole — but asserting that this variant's own AppHost appears in `stoppedAppHosts` would make a misclassified leak loud instead of a "cleanup: PASS" line. +- The `skip-seed-handoff` symptom is recognised by substring-matching `probePluginResource`'s **last** retry error. A transient failure on the final attempt turns a correct RED into a confusing "Seed control did not isolate the missing handoff". Matching any collected error, or surfacing a typed non-completion signal, removes the flake. +- `projectRoot` is hard-coded as `activity-demo` alongside the `cd activity-demo` guard; derive it from the `init` positional so the doc stays the single source. The guard makes a mismatch fail closed today. +- The inline CLI invocation applies `--minimum-dependency-age=0` for any `jsr:` entrypoint, while the canonical `cli()` helper restricts it to `jsr:@netscript/cli@`. Equivalent today; export a shared predicate to prevent drift. (No `--unstable-kv` needed — the canonical builder omits it too.) +- A blank line or `#` comment added to the fenced block throws "Unsupported documented shell syntax". Fail-closed and arguably correct for a contract block, but worth stating in the doc so a cosmetic edit is not a surprise. +- The scratch parent (`smokeRoot/documented-scaffold/documented-*`) is never removed by the gate; three generated workspaces per run accumulate unless the suite's cleanup tail removes `smokeRoot`. Ephemeral in CI, noticeable locally. +- `assertLinkedActivityHtml` runs twice per restored pass (directly and inside `assertDocumentedActivity`) — harmless. + +### Validation I ran +`deno test --allow-all --unstable-kv` over `documented-scaffold_test.ts`, `suite-registry_test.ts`, `suite-runner_test.ts`, `tests/application/builders` → **76 passed, 0 failed** (matches `s2-tests.json`). `run-deno-check.ts` over **all seven** touched files → 0 occurrences; note `s2-check.json` selected only 3 files, so the four modified files were not in that receipt — I covered them. Verified the `source-config.json` lint/fmt claim directly. Traced the generated-app markup, capability-state derivation, projection mapping, `verifyGeneratedCrudAcceptance`, `teardownExitCode`/`validOwnedRoot`/`writeRunResources`, `commandGate`, `buildExecutionPlan` and the suite assembly order, and confirmed `aspire restore`/`start` accept the documented flags. + +### Explicitly unproven +Live CI acceptance of `behavior.documented-scaffold` does not exist yet and is **not** certified here. Docker-backed runtime is unavailable locally, so the three variants have never executed: no claim is made that the controls go RED for their expected symptoms in practice, that the restored path passes, that the PID-stability and committed-mutation assertions hold against a live stack, or that the gate fits its time budget. This verdict is a source/slice judgement only. Re-steer this session with the final-head `scaffold.runtime` CI evidence and I will review it as the same evaluator. diff --git a/.llm/runs/orch-divybot-6572256863--2591/s2-review.md b/.llm/runs/orch-divybot-6572256863--2591/s2-review.md new file mode 100644 index 0000000000..956da096a8 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/s2-review.md @@ -0,0 +1,38 @@ +## IMPL-EVAL S2 (repair review) — issue 2591 · **PASS** (source/slice) + +Same evaluator session, continuing from my S2 FAIL_FIX. Reviewed the working tree against `f82ef33`. Source read-only; nothing committed. Observed model: **`claude-opus-5`** (Opus 5); reasoning effort is not attestable from this session surface. + +### Both required fixes are properly addressed + +**1. Projection readiness — fixed as recommended, and verified empirically.** `waitForDocumentedActivity` retries only read-side effects (`readHtml`/`readEvents`) on a finite 30×1s budget, and `assertLinkedActivityHtml(html)` runs *before* `readEvents()`, so `StreamLinkAcceptanceError` is thrown without ever issuing a stream read or sleeping — the drop-link control still short-circuits instead of burning the budget, which was the trap in my suggested fix. The single committed PATCH sits in `activity()` outside the loop, so retries cannot add stream events. Budget exhaustion raises `Error(..., { cause: lastFailure })`, preserving the last diagnosis. The three new tests are genuinely behavioral, not pure-function: transient `empty → ready` asserts `reads === 2`, `eventReads === 1`, `delays === [1000]`; the unlinked case makes `readEvents` and `delay` *reject if called* and asserts `reads === 1`; the budget test asserts `reads === 2` at `attempts: 2` and matches on "bounded budget". + +**2. Timeout and `ASPIRE_CLI_START_TIMEOUT` — fixed, and the ceiling is now evidence-backed.** 40 min against a measured 189,693 ms for two variants (~95 s each) leaves ample headroom even with the restored variant's CRUD acceptance plus up to 30 s of projection retries. The env injection is correct: I probed `Deno.Command` with a partial `env` and confirmed it **merges** — `PATH` and `HOME` survive and `ASPIRE_CLI_START_TIMEOUT=300` is delivered. That was the highest-risk unproven detail in this fix (a replacing `env` would have broken `aspire` resolution on every start, and the first CI run predates the change), and it is sound. An inherited override is respected, and the per-command deadline is derived from it (`max(330s, timeout+30s)`). + +### The DTO boundary is handled correctly, and I traced every new assertion to the real runtime +The switch to `/api/v1/workers/executions/by-correlation/{correlationId}` is the right call and weakens nothing: +- The route exists in the public contract (`workers.contract-definition.ts:504-507`), takes `correlationId` + optional `limit`, and returns `{executions: batchQueryExecutionItem[], total}`. +- Filtering is genuinely server-side: `runs.ts:167` calls `state.listByCorrelation(correlationId, { limit })`. The seedId binding is real, not a client-side pretence — my concern that a route fall-through would silently degrade the control to "any completed health-check" does not apply. +- `batchQueryExecutionItem` is `ExecutionRecordResponseZodSchema` + optional `payload`, so the gate's `executionList.parse` succeeds exactly as it did against `/executions` in the first CI run (which is what proves `id` is present in the DTO). +- **The new `result.payload` assertion is satisfiable.** I checked the chain that CI never reached: the sample handler returns `createSuccessResult({ jobId, payload: context.payload, workspaceEntries })`, `createSuccessResult` wraps as `{success, data}`, and `job-execution.ts:89-94` persists `result: result.data` — **unwrapped**. So `execution.result.workspaceEntries` is a number and `execution.result.payload` is `{ source: 'database-seed' }`, which only `dispatchSeedSample` ever enqueues. This is a *stronger* assertion than the `correlationId` field it replaced: it proves the handler received seed-originated input, independent of the DTO. +- The regression is pinned honestly: the fixture is built by parsing the real `ExecutionRecordResponseSchema` and then asserts `!('correlationId' in execution)`. A future DTO change that re-adds the field would not silently restore a weaker path. + +### Cleanup is now the canonical helper, correctly wired +`runtime/evidence/cleanup.ts` argv `(appHost, projectRoot, 'true', receiptPath)` matches its `import.meta.main` contract. `stopAndProbe` issues a plain then a **forced stop of the exact AppHost only**, re-probes owned survivors with a bounded retry and one extra forced exact stop (so asynchronous container teardown is not a false positive), writes the receipt **before** `assertNoOwnedSurvivors`, and requires the terminal stop transcript to exit 0. Permissions are sufficient and not over-granted: cleanup.ts imports only `@std/path` and contains no `Deno.env` or `fetch`, so `--allow-read --allow-write --allow-run=aspire,docker` covers it. `if (appHostStarted) await cleanup(...)` is the right guard — nothing in the documented order creates containers before `aspire start`, and it fixes the first run's "0 AppHosts enumerated" symptom at the root. The primary error is still preserved and cleanup errors aggregate; successful variant roots are removed only after `primaryFailure` is cleared, so failure evidence survives, and the non-recursive `Deno.remove(parent)` can only succeed when all three variants cleaned up. `AggregateError` replacing `JSON.stringify(Error) → {}` restores the nested diagnosis on control mismatches. + +### Also verified +- **Placement**: moved to immediately after `SCAFFOLD_INIT` (static scaffold, no runtime, no links), still ahead of `RUNTIME_STREAMS_STORAGE_FIXTURE` and `RUNTIME_ASPIRE_RESTART_AFTER_DB` — and the ordering test was updated to pin all three relations, so the load-bearing "no repair fixture has run" invariant remains enforced by a test, not a comment. +- **Generated surface**: `check-aspire-version-parity.ts` → exit 0, `ok: true`, `manifestFresh: true`, `fail: 0`, `missing: 0`. The three added rows are generator-consistent, and the derived surface is declared verbatim in both `drift.md` and `supervisor.md` with the owning generator named and no version pin change. The remaining deferred/info entries are pre-existing owner-deferred literals. +- `--minimum-dependency-age=0` now matches the canonical `cli()` predicate (`jsr:@netscript/cli@`) — my earlier drift note is closed. +- The docs command block is unchanged (`git diff f82ef33 -- docs/` is empty), so the executable contract the gate reads is untouched. + +### Remaining items — all minor, none blocking +- `Math.max(330_000, (Number(startTimeout) + 30) * 1_000)` throws `TypeError: Argument 1 is not a finite number` from `AbortSignal.timeout` if `ASPIRE_CLI_START_TIMEOUT` is set to something like `5m` or `300s` (probed). Fail-loud, not silent, but one guard would make it graceful: `const seconds = Number(startTimeout); const effective = Number.isFinite(seconds) && seconds > 0 ? seconds : DEFAULT_ASPIRE_START_TIMEOUT_SECONDS;`. +- `stopAndProbe` passes `processes: []` to `evaluatePostStopProbe`, so process classification is vacuous: `ownedProcesses` is always empty and the gate's `foreignOrUnknownLeftAlone` sum only ever reflects containers. The helper's contract is container/AppHost disposal and the forced exact stop is what reaps children, so this is acceptable — but the receipt key implies process coverage it does not have. Either rename it or state the scope. +- No test pins the new `result.payload` requirement in isolation; the `{result: {workspaceEntries: 0}}` case happens to drop `payload` too, so it would throw for two reasons. A `{result: {workspaceEntries: 3, payload: {source: 'manual'}}}` case would nail it. +- Cosmetic: `cleanup()` rebuilds `join(projectRoot, 'aspire/apphost.mts')` instead of taking the existing `appHost`; `Deno.remove(parent)` leaves `smokeRoot/documented-scaffold` behind. + +### Validation I performed +`deno test --allow-all --unstable-kv` over `documented-scaffold_test.ts`, `suite-registry_test.ts`, `suite-runner_test.ts`, `tests/application/builders` and `plugins/workers/tests/runtime` → **106 passed, 0 failed** (consistent with the 191 test/step results in `final-focused-tests.json`, which also spans the S1 CLI install and reconciler suites). `run-deno-check.ts` over the changed files → 0 occurrences. `deno lint`/`deno fmt --check --config .llm/tmp/2591/source-config.json` over all five changed source/test files → clean (using the scoped config, per my S1 correction). `check-aspire-version-parity.ts` → exit 0, manifest fresh. Traced the public workers contract, the by-correlation handler, `createSuccessResult`, `job-execution.ts`'s result persistence, the sample health-check stub, `stopAndProbe`/`PostStopProbeEvaluation`, and `commandGate` wiring. Two Deno probes: `Deno.Command` partial-`env` merge semantics, and `AbortSignal.timeout` on a non-finite argument. + +### Explicitly unproven +Live final-head CI acceptance is **not** certified and I do not self-certify it. Nothing here has executed against a live stack since `f82ef33`; the repairs to the correlation query, the env injection, the projection retry and the canonical cleanup are all source-verified only. The specific things the next exact-head run must demonstrate: the `%3A`-encoded path segment resolves through the generated router (a 404/400 would surface as a generic error and fail both `drop-link` and `restored`); `result.payload.source` and `result.workspaceEntries` read as traced; both controls go RED for their precise typed symptoms while the other contract passes; `restored` converges within the 30×1s projection budget; the canonical cleanup reports zero owned survivors for all three variants; and the gate completes inside the 40-minute ceiling. Re-steer this session with that evidence and I will review it as the same evaluator. diff --git a/.llm/runs/orch-divybot-6572256863--2591/s2-validation.json b/.llm/runs/orch-divybot-6572256863--2591/s2-validation.json new file mode 100644 index 0000000000..dc06cae7d9 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/s2-validation.json @@ -0,0 +1,84 @@ +{ + "schemaVersion": 1, + "recordedAt": "2026-11-02T09:10:52.273867+00:00", + "scope": "S2 source candidate; runtime acceptance pending in CI", + "denoVersion": "2.9.7", + "sourceHashes": { + "packages/cli/e2e/src/application/gates/scaffold/documented-scaffold-contract.ts": "233055ec1d98ecf78d08f2149e750f7a870d05bd899106192a864e818e993330", + "packages/cli/e2e/src/application/gates/scaffold/verify-documented-scaffold.ts": "29d21819eecbc8f47e4672a2bdee4ebe7f733643b1dfb107a352842d1c592c3b", + "packages/cli/e2e/tests/application/gates/scaffold/documented-scaffold_test.ts": "8cc93b21da2c99886f0daa87ea98835d1f43b6275ec4f0bd9aad0f5b18c9b027", + "packages/cli/e2e/src/domain/cli-surface.ts": "fb8547310ec32b969853989bf8f6de601e0eea7102c46ea1125ba5eac847c0f5", + "packages/cli/e2e/src/application/gates/scaffold/runtime/behavior-gates.ts": "7a39bc1edecfdd5404a33d806b4c7e8a69434f869ea547426fb97fcefbe98d69", + "packages/cli/e2e/suites/scaffold/capability-suites.ts": "0a2ed87009e0d207bacf79c52c26cf48d8b84c9d8a6091636efe3e8d7554c8f6", + "packages/cli/e2e/tests/presentation/suite-registry_test.ts": "a3c0e2c43a103803b67c5bf9e1c86b1bb047b8c4b3b8fb2a9b263ac2c3dac08e" + }, + "focusedTests": { + "exitCode": 0, + "durationMs": 1155, + "summary": { + "passed": 76, + "failed": 0, + "ignored": 0, + "totalResults": 76, + "uniqueFailures": 0 + }, + "failures": [] + }, + "scoped": { + "check": { + "selection": { + "filesSelected": 7, + "batches": 1, + "failedBatches": 0 + }, + "summary": { + "totalOccurrences": 0, + "uniqueOccurrences": 0, + "uniqueCodes": 0, + "uniquePaths": 0 + } + }, + "lint": { + "selection": { + "filesSelected": 7, + "batches": 1, + "failedBatches": 0 + }, + "summary": { + "totalOccurrences": 0, + "uniqueOccurrences": 0, + "uniqueRules": 0, + "uniquePaths": 0 + }, + "coverage": { + "filesSelected": 7, + "filesProcessed": 7, + "droppedFiles": [], + "refusals": [] + } + }, + "fmt": { + "summary": { + "filesSelected": 7, + "batches": 1, + "failedBatches": 0, + "findings": 0, + "ignoredFindings": 0 + }, + "coverage": { + "filesSelected": 7, + "filesProcessed": 7, + "droppedFiles": [], + "refusals": [] + } + } + }, + "quality": { + "gateId": "quality-gate", + "invocationId": "scaffold-2591-s2-quality", + "gitHead": "321eca9b9c53d7ac7b12e832d09b9c43c861bde7", + "outcome": "PASS", + "exitCode": 0 + }, + "runtime": "UNPROVEN until the canonical full CI suite runs this candidate" +} diff --git a/.llm/runs/orch-divybot-6572256863--2591/s3-review.md b/.llm/runs/orch-divybot-6572256863--2591/s3-review.md new file mode 100644 index 0000000000..aaeb182193 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/s3-review.md @@ -0,0 +1,37 @@ +## IMPL-EVAL S3 (cleanup repair) — issue 2591 · **PASS** (source/slice) + +Same evaluator session, continuing from the S2 repair PASS. Reviewed the working tree against `650fb2e`. Source read-only; nothing committed or posted. Observed model: **`claude-opus-5`** (Opus 5); reasoning effort is not attestable from this session surface. + +### The diff is exactly what was described, and provably outside every assertion path +`git diff --numstat` on `verify-documented-scaffold.ts` is **5 insertions / 3 deletions across 4 hunks**: a per-variant `console.info` added before the command loop, the per-command success `console.info` removed, `await Deno.remove(root, { recursive: true })` replaced by a comment, and `await Deno.remove(parent)` replaced by the summary line. No other `Deno.remove` of the scratch remains. The fault-control blocks, the `waitForDocumentedActivity` call, the `beforeSeedPid`/`afterSeedPid` comparison and the whole `cleanup()` path are byte-identical to `650fb2e`. Nothing in production source changed. + +### The CI evidence confirms the diagnosis — the deleted statement was the sole cause, and it ran after everything that matters +I read `signoff-ci-report/e2e-report-scaffold-runtime.json` rather than taking the summary on faith. The `behavior.documented-scaffold` step (98,841 ms, `verdict: failed`, `timedOut: false`, exit 1) shows, in order: +``` +{"variant":"skip-seed-handoff","verdict":"PASS","seed":"RED: missing handoff", + "activity":"7c6b82ef-86a5-465f-9fe3-e1122318bd41","residentWorkerPreserved":true} +{"cleanup":"PASS","exactAppHostStopped":true,"foreignOrUnknownLeftAlone":0} +``` +then `PermissionDenied: Permission denied (os error 13): remove '.../documented-8da0a05acaacf427/skip-seed-handoff'` at `verify-documented-scaffold.ts:308` — precisely the removed line. So against a live stack the seed control went RED for its typed symptom while the Activity path produced a **real** stream event id, the resident worker PID was unchanged, and the canonical exact-AppHost stop reported zero owned survivors with `foreignOrUnknownLeftAlone=0`. The failure occurred strictly *after* the variant receipt and *after* the cleanup receipt, in disposable-directory deletion only. Removing that statement cannot weaken any of it. + +I also confirmed the root cause independently rather than assuming it: `render-ts-apphost.ts:142` sets `DataPath: '.data/postgres'`, and `generate-register-infrastructure.ts:192-196` wires it through `.withDataBindMount(resolveDataPath(appHostDir, …))`. Postgres chowns its data directory to the container uid, so the host-side tree is not removable by the non-root test process. Retention is the correct resolution — the alternatives (privileged deletion, or a throwaway container doing `rm -rf` on the mount) would both broaden the gate's mutation scope in exactly the way `AGENTS.md` forbids ("mutation … remains scoped to positively proven resources"). Keeping the residue under `.llm/tmp/cli-e2e/…` is the sanctioned scratch location and stays outside the Aspire scan scope, quality and fmt selections, so nothing downstream is polluted. + +### The logging reduction is evidence-motivated, and failure diagnostics are intact +The report's `stdoutTail` is bounded and already began mid-run at `skip-seed-handoff: netscript init …`, with the two receipts only just surviving at the end. With three variants each emitting ten command lines plus `probeAppHome` output, the earlier variants' `{"variant":…}` and `{"cleanup":…}` lines would have been pushed out of the tail. So this is a real receipt-preservation fix, not cosmetics — and the CI artifact demonstrates it. Failure diagnostics are unchanged: `command()` still throws `${executable} ${args.join(' ')} exited ${code}: \n`, so a failing command is still fully identified, and the new per-variant line preserves variant-level progress. The only genuine loss is live progress for a *hang*, and that is self-limiting: every command carries `AbortSignal.timeout(ceiling)` (330 s, or start-timeout + 30 s), so a hang becomes a thrown error naming the exact command well inside the 40-minute gate budget. + +The final summary is honest as written: `runVariant` throws on failure and the loop awaits sequentially, so reaching that line means all three variants completed. + +### Checks performed +- `deno test --allow-all --unstable-kv` over `documented-scaffold_test.ts` + `suite-registry_test.ts` → **31 passed, 0 failed** (matches `s3-tests.json`). +- `run-deno-check.ts` on the single changed file → 0 occurrences (matches `s3-check.json`). +- `deno lint` and `deno fmt --check` with `--config .llm/tmp/2591/source-config.json` on the changed file → clean. I separately measured line lengths: lines 264 and 273 exceed 100 chars but are unbreakable template literals pre-existing from S2, and the new summary line is wrapped and within the limit — fmt's clean verdict is genuine, not a selection artefact. +- `git diff --numstat` / hunk count to prove the assertion regions are untouched; `grep` to confirm no scratch deletion remains. +- Traced the Postgres bind-mount generation chain and read the CI report's gate step directly. + +### Non-blocking recommendations +1. **The retained residue is also undeletable by the operator.** `.data/postgres` is owned by the container uid, so a developer who runs this gate locally accumulates workspaces under `.llm/tmp/cli-e2e/documented-scaffold/` that plain `rm -rf` cannot remove, and there is no reaper. Irrelevant on an ephemeral CI runner; a papercut locally, with three full workspaces (including `node_modules`) retained per run. The one option that reduces residue without crossing the privileged-deletion line is a per-entry removal that skips the data directory — delete everything in `root` except `activity-demo/.data`, and say so in the comment. Worth doing, not worth blocking on. +2. **The summary prints the `DOCUMENTED_SCAFFOLD_VARIANTS` constant rather than an accumulated list.** True today because of the loop shape, but it would silently lie if the loop ever became `Promise.allSettled` or gained a filter. Accumulating completed names is a one-line change that makes the claim structurally rather than incidentally honest. +3. Consider noting the retained-workspace behaviour in the gate's `failureHint` or the e2e README, so an operator finding root-owned directories knows they are expected. + +### Explicitly unproven +Live final-head runtime acceptance is **not** certified, and I do not treat run 41423746948 as overall runtime acceptance — it failed, and only `skip-seed-handoff` executed; `drop-link` and `restored` have still never run end to end. Nothing here has executed against a live stack since `650fb2e`. A fresh one-pass `scaffold.runtime` at the next final pushed head remains mandatory, and must show: all three variants completing in sequence (the specific thing this repair unblocks), `drop-link` failing only with `StreamLinkAcceptanceError` while its seed assertion passes against the by-correlation endpoint, `restored` passing both contracts, a `{"cleanup":"PASS","exactAppHostStopped":true}` receipt per variant, and the `{"documentedScaffold":"PASS"}` summary — all inside the 40-minute ceiling. The earlier 41423003834 Fresh/esbuild EPIPE stands as its own separate failed attempt; I agree no product fix is inferable from a single render failure, and later successful rendering does not retire it. Re-steer this session with the final-head evidence and I will review it as the same evaluator. diff --git a/.llm/runs/orch-divybot-6572256863--2591/supervisor.md b/.llm/runs/orch-divybot-6572256863--2591/supervisor.md new file mode 100644 index 0000000000..faa1465743 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/supervisor.md @@ -0,0 +1,10 @@ +# Supervisor — issue 2591 + +- Baseline: `6766130bbafbe78a9bb5870f704987cb0743c5e6`. +- Branch/worktree: `orch/divybot-6572256863`, repository root `.`. +- Assignment: repair the documented scaffold lifecycle and stream linking; no visual redesign. +- Implementation: Codex, feature tier, matrix `sol` at `xhigh`; separate cross-family evaluator required. +- Matrix read with `deno task agentic:matrix --tier feature --json`: implementation `sol` then `muse_spark_1_3`; implementation evaluation `muse_spark_1_3` then `opus_5`, both xhigh. Plan evaluation `glm_5_3` then `fable_5_1` if risk-selected. +- Allowed write surface (including generated Aspire inventory `.llm/tools/validation/fixtures/aspire-surface-manifest.tsv` via its owning generator): `packages/cli/`, `plugins/workers/`, canonical scaffold templates/resources under `resources/`, related docs under `docs/`, generated carriers only through their generation tasks, this run directory, `.llm/2026-11-02-scaffold-documented-lifecycle.md`. Ignored local scratch under `.llm/tmp/`; final handoff `.divybot-final-report.md`. +- Public run artifacts use repository-relative paths only. No credentials. Assignment file is excluded from commits. +- Delivery: early draft PR with `Refs #2591`; no issue closing keyword, no rebase, no force push, no merge. Honor the operator's specific canary hold over generic assignment boilerplate. READY only after final-head checks and runtime CI evidence. diff --git a/.llm/runs/orch-divybot-6572256863--2591/validation.json b/.llm/runs/orch-divybot-6572256863--2591/validation.json new file mode 100644 index 0000000000..1932a1c44f --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/validation.json @@ -0,0 +1,250 @@ +{ + "schemaVersion": 1, + "recordedAt": "2026-11-02T09:59:47.581849+00:00", + "scope": "S3 runtime workspace-retention repair; final pushed-head CI required", + "denoVersion": "2.9.7", + "sourceHashes": { + ".llm/tools/validation/fixtures/aspire-surface-manifest.tsv": "43536d51c8e80b7c7a3d7f2d077a5eeb6ce66a68429450297775bdb375ca2ee1", + "docs/site/orchestration-runtime/how-to/add-a-plugin.md": "33e41b3cb8cd71bf9f08f79fd119ef8939380c3003d5b5fec049e353159a20da", + "packages/cli/e2e/src/application/gates/scaffold/documented-scaffold-contract.ts": "dbda6df948c94d60575e0f9d231924dff280ba15d3ec31c3405e8c5f0c53619d", + "packages/cli/e2e/src/application/gates/scaffold/runtime/behavior-gates.ts": "825f93d1f20e5656d596634aef2d6789f446d109dcc6e961c438315832f7adc7", + "packages/cli/e2e/src/application/gates/scaffold/verify-documented-scaffold.ts": "7e8a54b8a8d75c925bd0a89780184f5ea96056fdd2a76bef6074d29163b01759", + "packages/cli/e2e/src/domain/cli-surface.ts": "fb8547310ec32b969853989bf8f6de601e0eea7102c46ea1125ba5eac847c0f5", + "packages/cli/e2e/suites/scaffold/capability-suites.ts": "21f7e65fe1e44eef3f3a4483d8f013fc30546c513e9fb88a32a959b1bc08bff6", + "packages/cli/e2e/tests/application/gates/scaffold/documented-scaffold_test.ts": "05b4e4e1c8869daea905b357a0375e4b7d495a18df74c581a12dfc34a5eaff2f", + "packages/cli/e2e/tests/presentation/suite-registry_test.ts": "a3c0e2c43a103803b67c5bf9e1c86b1bb047b8c4b3b8fb2a9b263ac2c3dac08e", + "packages/cli/src/kernel/adapters/plugin/plugin-reference-reconciler.ts": "18abe860f359cc8657ca78ac26549376289c7c6e0934648a4c8571ad8032ba82", + "packages/cli/src/kernel/adapters/plugin/plugin-reference-reconciler_test.ts": "7698d18e1c022b0c9aaf42f54e315d819c59c076f6d495dda6042955e683152d", + "packages/cli/src/local/features/plugins/install/install-local-plugin-command.ts": "94320b7070d00c4c1968c5aa3ef1019b6a814f7ff0c614946b517a286bce8be9", + "packages/cli/src/local/features/plugins/install/install-local-plugin.ts": "34e93d9a1dd3d8d011f76deed3182a2cd3bd84e667b335c33d03bcb07facda96", + "packages/cli/src/public/domain/plugin-install-plan.ts": "0bc69eff45f51cf5674b80606a50cf783b777562bf23ee4ef967fd5be8527e74", + "packages/cli/src/public/features/plugins/install/install-plugin-command.ts": "c01a92b7c36ceb37576de134497aa69904662c2ec8ca042a437b550b32441159", + "packages/cli/src/public/features/plugins/install/install-plugin-input.ts": "5466ac4cbfb436693dc54258d9517c75706fd4de1b9fe533939e7553cced7669", + "packages/cli/src/public/features/plugins/install/install-plugin.ts": "a39a931a83320c2363ddd59d527dc976eaf9a9089437209df71a686412bb1a4f", + "packages/cli/src/public/features/plugins/install/plan-plugin-install.ts": "9da750de638f71d1d9fc91aa43b94120bf8e20ee76039bbee4e63e492f9a9025", + "packages/cli/src/public/features/plugins/install/plugin-app-references.ts": "9772918624a9911131821f9bcafce99153df1cf69280f1d1749843d94a12d877", + "packages/cli/src/public/features/plugins/install/plugin-app-references_test.ts": "0a58ff4b9852c5104fc50097409899d3c1647bb6accca5e0d800052d305bd57e", + "packages/mcp/src/infrastructure/docs/agent-docs-prose.generated.ts": "b02b55ff9428fb17a10383329ab2c68d9777d7f921994df84835738b3c474cf4", + "packages/mcp/src/publish-assets.generated.ts": "8d622405acf96dda5826007f2ce22d61e78263800586409f0bb2615f2f1e6e78", + "plugins/workers/bin/runtime.ts": "3038637fe89bc75f689e260e710a92fc7d79121984f07e7ec1937a133f0f5e18", + "plugins/workers/src/runtime/seed-sample.ts": "53d1256e91ea88d7b1ecb6fdc78cf033ff23f2727008c18ec4698f028f2bd677", + "plugins/workers/tests/runtime/seed-sample_test.ts": "7f9462dc0a2d69b1c200e401a237d1f51bf892ffb0859aeccaccfe043135db2e" + }, + "focusedTests": { + "exitCode": 0, + "durationMs": 18750, + "summary": { + "passed": 191, + "failed": 0, + "ignored": 0, + "totalResults": 191, + "uniqueFailures": 0 + }, + "failures": [] + }, + "scoped": { + "check": { + "selection": { + "filesSelected": 21, + "batches": 1, + "failedBatches": 0 + }, + "summary": { + "totalOccurrences": 0, + "uniqueOccurrences": 0, + "uniqueCodes": 0, + "uniquePaths": 0 + } + }, + "lint": { + "selection": { + "filesSelected": 21, + "batches": 1, + "failedBatches": 0 + }, + "summary": { + "totalOccurrences": 0, + "uniqueOccurrences": 0, + "uniqueRules": 0, + "uniquePaths": 0 + }, + "coverage": { + "filesSelected": 21, + "filesProcessed": 21, + "droppedFiles": [], + "refusals": [] + } + }, + "fmt": { + "summary": { + "filesSelected": 21, + "batches": 1, + "failedBatches": 0, + "findings": 0, + "ignoredFindings": 0 + }, + "coverage": { + "filesSelected": 21, + "filesProcessed": 21, + "droppedFiles": [], + "refusals": [] + } + } + }, + "rootTypeCheck": { + "filesSelected": 4206, + "failedBatches": 0 + }, + "firstRuntimeAttempt": { + "url": "https://github.com/rickylabs/netscript/actions/runs/41418574351", + "head": "f82ef33dac6c915d320b0ffd99be24dcc4559263", + "outcome": "FAIL", + "documentedGateDurationMs": 189693, + "seedControl": "PASS: job RED, actual streamed Activity PASS, resident worker preserved", + "finding": "Public execution DTO omits correlationId; use correlation-filtered endpoint; canonical fixture cleanup required" + }, + "finalRuntime": "UNPROVEN until the repaired exact-head CI run passes", + "repairs": [ + "Public by-correlation execution endpoint and canonical DTO fixture", + "Canonical runtime cleanup for an exact owned AppHost", + "Bounded read-side projection convergence", + "Explicit Aspire startup budget", + "Generated Aspire surface inventory refresh" + ], + "checkTasks": [ + { + "task": "check:desktop-native-fixture", + "exitCode": 0, + "durationMs": 150 + }, + { + "task": "check:emitted-samples", + "exitCode": 0, + "durationMs": 5416 + }, + { + "task": "check:streams-types", + "exitCode": 0, + "durationMs": 183 + }, + { + "task": "check:child-health-docs", + "exitCode": 0, + "durationMs": 296 + }, + { + "task": "check:mcp-export-corpus", + "exitCode": 0, + "durationMs": 7610 + }, + { + "task": "check:assets-barrel", + "exitCode": 0, + "durationMs": 2418 + }, + { + "task": "check:agent-docs-prose", + "exitCode": 0, + "durationMs": 14927 + }, + { + "task": "check:publish-assets", + "exitCode": 0, + "durationMs": 436 + }, + { + "task": "check:scaffold-versions", + "exitCode": 0, + "durationMs": 104 + }, + { + "task": "check:aspire-version-parity", + "exitCode": 0, + "durationMs": 246 + }, + { + "task": "check:netscript-jsr-specifiers", + "exitCode": 0, + "durationMs": 1769 + }, + { + "task": "check:aspire-host-ports", + "exitCode": 0, + "durationMs": 253 + }, + { + "task": "check:figma-names", + "exitCode": 0, + "durationMs": 570 + }, + { + "task": "check:review-threads", + "exitCode": 0, + "durationMs": 502 + }, + { + "task": "check:design-skill", + "exitCode": 0, + "durationMs": 102 + } + ], + "qualityGate": { + "gateId": "quality-gate", + "gitHead": "41fb51d1bcf48094b57265c87020654725ed2784", + "outcome": "PASS", + "exitCode": 0, + "durationMs": 13802, + "requestHash": "ea46f8883f3889ca95f69a9367b62984a4abb9fab1e0497d19f753172cd2b46f" + }, + "carrierChain": { + "tasks": [ + "gen:agent-docs-prose", + "gen:mcp-export-corpus", + "gen:assets-barrel", + "gen:publish-assets" + ], + "result": "PASS; owning check tasks pass and no generated drift" + }, + "independentReview": { + "verdict": "PASS", + "model": "claude-opus-5", + "effortRequested": "xhigh", + "effortAttestation": "not available", + "scope": "S1, S2 and S3 source/slice PASS; final exact-head live evidence still required", + "report": "s2-review.md", + "reports": [ + "s1-review.md", + "s2-review.md", + "s3-review.md" + ] + }, + "s3Repair": { + "focused": { + "passed": 31, + "failed": 0, + "ignored": 0, + "totalResults": 31, + "uniqueFailures": 0 + }, + "scopedFiles": 1, + "check": "PASS", + "lint": "PASS; coverage 1/1", + "fmt": "PASS; coverage 1/1", + "runtimeAttempt": { + "run": "https://github.com/rickylabs/netscript/actions/runs/41423746948", + "head": "650fb2ed00389105ebe6cb242a212c827f4c1309", + "outcome": "FAIL", + "seedControl": "PASS: missing seed handoff RED, real stream/HTML Activity PASS, resident worker preserved", + "cleanup": "PASS: exact AppHost stopped; no owned containers; foreign/unproven containers 0", + "failure": "Recursive generated workspace removal raised filesystem PermissionDenied after successful runtime cleanup", + "repair": "Retain generated scratch after canonical runtime cleanup; reduce success logging so all variant receipts survive bounded output" + }, + "sourceReview": "PASS; s3-review.md", + "qualityGate": { + "gitHead": "650fb2ed00389105ebe6cb242a212c827f4c1309", + "outcome": "PASS", + "exitCode": 0, + "durationMs": 13195 + } + } +} diff --git a/.llm/runs/orch-divybot-6572256863--2591/worklog.md b/.llm/runs/orch-divybot-6572256863--2591/worklog.md new file mode 100644 index 0000000000..5a1caccd62 --- /dev/null +++ b/.llm/runs/orch-divybot-6572256863--2591/worklog.md @@ -0,0 +1,142 @@ +# Worklog + +## Design + +1. Public surface: documented scaffold produces a completed sample after seed; stream install + accepts `--service` and links that service using persisted manifest consumer metadata. +2. Domain vocabulary: seed handoff, acceptance receipt, service consumer, documented scaffold gate. +3. Ports: existing SeedSamplePorts; filesystem watcher at the runtime edge; FileSystemPort and + existing Aspire command/gate boundaries. No new service or request-path work. +4. Constants: retain SAMPLE_JOB_ID and SEED_KEY_PREFIX; name the new documented runtime gate + in the existing GATE domain catalog. Reuse existing scaffold file constants. +5. Commit slices: S0 run bootstrap (these artifacts; reviewed assignment/baseline); S1 lifecycle + and install wiring plus focused regressions (workers runtime, CLI install and docs; structured + focused gates and independent review); S2 documented runtime acceptance/negative controls and + generated carriers (CLI E2E, carrier tasks; all check tasks and runtime CI); S3 review repairs + and final evidence if needed. Each slice updates this file and context-pack.md. +6. Deferred scope: visual styling, unrelated plugins and runtime redesign; not necessary to wire + the existing sample lifecycle and stream producer. +7. Contributor path: `plugins/workers/src/runtime/seed-sample.ts` for seed semantics; + `docs/site/orchestration-runtime/how-to/add-a-plugin.md` for the complete consumer walkthrough. + +## S0 + +Baseline clean; assignment file ignored. Prior memory and issue history read. Routing resolved +from the matrix JSON. Local clean setup demonstrates missing service edge; DB runtime commands +are unproven because Docker is unavailable. See research.md and memory-masked-runtime.md. +Reconcile: no implementation yet. Specific operator Refs/draft/no-merge policy controls delivery. + +## S1 evidence in progress + +- 108 focused install, reference reconciliation and worker runtime tests pass on Deno 2.9.7. +- Scoped check passes on 173 files. Scoped lint passes with 27/27 coverage. The format gate + selected two unchanged legacy test files; narrow final formatting to owned source files. +- Actual stream reinstall with --service orders persists orders->streams; subsequent reinstall + without the flag preserves it. No hardcoded stream-name branch was added to the CLI host. +- quality:gate passes with existing warnings. Independent review launched through the agentic + Claude print tool. Matrix primary muse_spark_1_3 launch failed before inference with + launcher-catalog-unavailable; declared fallback opus_5 requested at xhigh, observed claude-opus-5. +- Owned reproduction AppHost stopped through maint:teardown. Foreign/unknown AppHosts and + processes were reported and left untouched. Docker remains unavailable; no runtime pass claimed. + +## S1 independent repair + +The independent Opus review returned FAIL_FIX. Repaired late optional sample failure isolation, +startup readiness versus observer lifetime, bounded shutdown, symlink normalization, directory +rearming and explicit service reselection. Preserve manual appsettings links by retaining the +earlier installed service consumer set during planning. Tests now total 112 passing results. +The walkthrough adds restore and states that its noninteractive start detaches. Same evaluator +re-steered; S2 runtime proof remains unproven. No accepted product debt. + +## S1 terminal + +Independent same-session Opus repair review: PASS, all prior findings closed. See s1-review.md. +112 focused test/step results pass, changed-source wrappers pass, broader quality and doctrine pass. +The reviewer independently reran the focused tests and quality scans. Final runtime is not certified. +The review's lint/fmt caveat concerns raw root config; our scoped invocations explicitly use an +ignored config containing root rules without root selection exclusions. CLI coverage is verified +with that config; do not cite raw root fmt/lint as CLI evidence. The reviewed cosmetic constant +placement was corrected. No product behavior changed after the review. +Reconcile: S1 matches the declared surface. Next slice is the pristine documented runtime gate. + +## S2 candidate + +Added behavior.documented-scaffold before the main suite's init and repair fixtures. It reads the +actual documented block, executes three pristine Postgres setups, observes the resident worker +before seed, and requires real seed-correlated work plus the committed event in both stream and +Activity HTML. Independent negative controls disable only the handoff wire or service selection; +the final setup restores the exact documented steps. Cleanup uses scoped repo teardown and reports +foreign/unknown resources without changing them. SQLite keeps its existing provider-neutral gates. + +76 builder, registry, runner and new acceptance-contract tests PASS. Seven changed TypeScript +files pass scoped check/lint/fmt. quality:gate PASS. S2 independent review and final-head full +scaffold.runtime CI remain pending; this is a candidate commit, not a runtime sign-off. +Reconcile: declared scope maintained, no hand-written carriers and no accepted product debt. + +## S2 repair and first live feedback + +First CI attempt: run 41418574351, head f82ef33dac6c915d320b0ffd99be24dcc4559263. The new gate +ran two pristine variants in 189693ms. Disabling the seed handoff produced the expected job RED +while real stream/HTML Activity passed. Drop-link observed a completed job, but the stronger job +assertion incorrectly expected correlationId in the public DTO. Fixed by using the public +correlation-filtered endpoint and a fixture parsed through the actual public response schema. +This failed run is not final acceptance. + +The independent S2 review requested bounded projection convergence and explicit Aspire startup +budgeting; both are implemented with regression tests. Replaced general teardown enumeration with +the canonical runtime cleanup helper after CI enumerated no detached AppHosts. Main static init +now precedes this isolated gate so its cleanup path exists; all link/restart fixtures still follow. +The generated Aspire scan inventory was refreshed through its generator and parity passes. +All 191 focused results and 21 owned-source scoped wrappers pass; final CI and S2 repair review +are pending. No product runtime behavior changed in this repair, and no product debt was accepted. + +## S2 repaired candidate + +The API regression fixture now parses ExecutionRecordResponseSchema, confirming that correlationId +is absent. The runner queries executions by the seed's correlation key through the existing +public route and checks actual workspace work plus database-seed payload, progress and completion. +Canonical stopAndProbe cleanup targets the known AppHost directly and asserts no owned survivors; +successful disposable workspaces are removed. Main static init precedes the isolated scenario, +which still precedes all plugin/link/runtime repair fixtures. Nested control failures retain causes. +191 focused results and all 21 owned-source check/lint/fmt gates pass. Same-session repair review +and the new exact-head runtime CI are pending. Final quality/check evidence will bind the next head. + +## S2 independent sign-off and local gate completion + +Same-session cross-family repair review PASS; full report in s2-review.md. The reviewer traced +the public route, actual persisted result shape, environment merge and cleanup contracts, and +independently ran 106 focused tests and scoped validation. Reasoning effort is requested xhigh, +not independently attestable. Both source slices now have substantive independent sign-off. + +At reviewed source head `41fb51d1bcf48094b57265c87020654725ed2784`: all 15 root check tasks PASS, +four carrier generation tasks complete without drift, quality:gate durable receipt PASS, and +CLI/workers JSR audits PASS with existing warnings. The 191 focused results and 21-file scoped +checks remain current; no production source changed after them. The canonical cleanup proves exact +AppHost stop and no owned container survivors; it does not inventory all operating-system processes. + +Reconcile: declared write surface respected. This sign-off commit only records the independent +review and local evidence. Final-head one-pass CI, full remote-check completion and same-session +evidence review remain mandatory. Their final receipts belong on the PR and ignored final report +so the accepted source head stays fixed. No merge, issue closure or accepted product debt. + +## S3 live cleanup repair + +Exact-head CI 41423746948 at 650fb2e completed the missing-seed control, real Activity and +canonical cleanup, then hit PermissionDenied recursively deleting the disposable workspace. +Retain owned generated scratch instead of making database bind-mount permissions part of runtime +acceptance. No privileged deletion or foreign resource mutation. Per-command success logging was +reduced so bounded command evidence retains all variant receipts; failures still include the exact +command and captured diagnostics. The earlier 41423003834 Fresh/esbuild render failure remains +a separate failed attempt; later successful rendering does not erase it. + +Reconcile: only the existing declared E2E runner and run evidence changed. Production source and +carrier hashes are unchanged. Same independent evaluator must review this small cleanup repair +before sign-off, then a new final-head one-pass CI and evidence review remain required. + +S3 independent same-session Opus source review PASS in s3-review.md, with independent rerun of +31 focused tests and changed-file check/lint/fmt. Broader quality:gate PASS. The reviewer traced +the bind-mount generation chain and confirmed all assertion and canonical cleanup paths are +unchanged. Retained scratch costs three generated workspaces per run on a persistent machine; +CI runners are ephemeral. This is recorded verification residue, not accepted product debt. +Sign-off commit includes this review, source repair and resume state. Final pushed-head CI and +same-session evidence audit remain required; publish their results in the PR and atomic report. diff --git a/.llm/tools/validation/fixtures/aspire-surface-manifest.tsv b/.llm/tools/validation/fixtures/aspire-surface-manifest.tsv index 4f539180c7..7e02a616de 100644 --- a/.llm/tools/validation/fixtures/aspire-surface-manifest.tsv +++ b/.llm/tools/validation/fixtures/aspire-surface-manifest.tsv @@ -338,6 +338,7 @@ packages/cli/e2e/src/application/gates/scaffold/aspire-mcp/stdio-transport.ts e2 packages/cli/e2e/src/application/gates/scaffold/aspire-mcp/tools.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) packages/cli/e2e/src/application/gates/scaffold/consume-flow-b-stream.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) packages/cli/e2e/src/application/gates/scaffold/database-gates.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) +packages/cli/e2e/src/application/gates/scaffold/documented-scaffold-contract.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) packages/cli/e2e/src/application/gates/scaffold/durable-cli-parity.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) packages/cli/e2e/src/application/gates/scaffold/find-job-execute-identity_test.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) packages/cli/e2e/src/application/gates/scaffold/garnet-coexistence_test.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) @@ -394,6 +395,7 @@ packages/cli/e2e/src/application/gates/scaffold/validate-aspire-task-traces.ts e packages/cli/e2e/src/application/gates/scaffold/validate-flow-b-traces.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) packages/cli/e2e/src/application/gates/scaffold/verify-clean-clone-readme.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) packages/cli/e2e/src/application/gates/scaffold/verify-db-status-preserves-apphost.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) +packages/cli/e2e/src/application/gates/scaffold/verify-documented-scaffold.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) packages/cli/e2e/src/application/gates/scaffold/verify-endpoint-readiness.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) packages/cli/e2e/src/application/gates/scaffold/verify-live-db-endpoint.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) packages/cli/e2e/src/application/gates/scaffold/verify-mcp-endpoint-directory.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) @@ -446,6 +448,7 @@ packages/cli/e2e/tests/application/gates/resource-state-stream_test.ts e2e S2/S3 packages/cli/e2e/tests/application/gates/scaffold-gates_test.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) packages/cli/e2e/tests/application/gates/scaffold/auth-cookie-jar-gate_test.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) packages/cli/e2e/tests/application/gates/scaffold/behavior-plugins-health-gate_test.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) +packages/cli/e2e/tests/application/gates/scaffold/documented-scaffold_test.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) packages/cli/e2e/tests/application/gates/scaffold/generated-app-identity-source-policy_test.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) packages/cli/e2e/tests/application/gates/scaffold/outbound-webhook-adoption_test.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) packages/cli/e2e/tests/application/gates/scaffold/plugin-contract-gates_test.ts e2e S2/S3/S10 runtime verification (S2); 13.5.3 fixtures (S3); gate upgrades + agent.aspire-mcp-smoke (S10/S9) diff --git a/docs/site/orchestration-runtime/how-to/add-a-plugin.md b/docs/site/orchestration-runtime/how-to/add-a-plugin.md index aa616379a1..7552fd45f6 100644 --- a/docs/site/orchestration-runtime/how-to/add-a-plugin.md +++ b/docs/site/orchestration-runtime/how-to/add-a-plugin.md @@ -70,11 +70,44 @@ Repeat with the alias of each plugin you need. The package forms also work, for `netscript plugin install @netscript/plugin-workers --name workers` or an explicit `jsr:` specifier. +### Seeded workers and stream-backed Activity + +This complete walkthrough installs both samples before starting Aspire. `--service users` +persists the users service as a consumer of streams; the web app is linked by default. +Run these commands in order from an empty parent directory. This uses Aspire's non-interactive +start command, which detaches so the database commands run in the same terminal: + + +```sh +netscript init activity-demo --db postgres --service --service-name users --app-name dashboard --ci --yes --no-git +cd activity-demo +netscript plugin install workers --name workers --samples +netscript plugin install streams --name streams --samples --service users +aspire restore --apphost aspire/apphost.mts --non-interactive --nologo +aspire start --apphost aspire/apphost.mts --isolated --non-interactive --nologo +netscript db init --name init +netscript db generate +netscript db seed +netscript plugin doctor +``` + + +Open the dashboard app at the URL Aspire reports. Seeding publishes a durable handoff and the +already-running worker executes the sample health-check once; Background work shows its real +completion, progress and last run. No manual worker restart or job trigger is required. Reseeding +preserves the same request identity. Edit and save a seeded record to publish real Activity: +the feed uses the linked stream and shows the actor, change, record and time. An empty feed +before the first record mutation is expected. `--service` selects a plugin consumer, while +`--service-refs` selects services the plugin itself depends on. +Reinstalling with a different `--service` moves the previously managed service link. Omitting the +flag preserves it; links added directly to `appsettings.json` remain under your control. + {{ comp apiTable { caption: "netscript plugin install — options", columns: ["Option", "What it does"], rows: [ ["--name <name>", "Plugin workspace and config key, for example workers."], + ["--service <name>", "Link an enabled application service to this plugin's API; for Activity, select the record service when installing streams."], ["--project-root <path>", "Target a workspace other than the current directory."], ["--port <port>", "Override the plugin service port."], ["--db <engine> / --no-db", "Provision or target a database engine, or skip database wiring."], diff --git a/packages/cli/e2e/src/application/gates/scaffold/documented-scaffold-contract.ts b/packages/cli/e2e/src/application/gates/scaffold/documented-scaffold-contract.ts new file mode 100644 index 0000000000..0d87644141 --- /dev/null +++ b/packages/cli/e2e/src/application/gates/scaffold/documented-scaffold-contract.ts @@ -0,0 +1,170 @@ +import { z } from 'zod'; +import { assertReadyCapabilities } from './probe-app-home.ts'; + +/** Canonical walkthrough consumed by the runtime gate, rather than a second command recipe. */ +export const DOCUMENTED_SCAFFOLD_DOC = 'docs/site/orchestration-runtime/how-to/add-a-plugin.md'; +/** Faults run in independent workspaces before the restored documented path. */ +export const DOCUMENTED_SCAFFOLD_VARIANTS = ['skip-seed-handoff', 'drop-link', 'restored'] as const; +/** One deliberately broken or restored documented setup. */ +export type DocumentedScaffoldVariant = typeof DOCUMENTED_SCAFFOLD_VARIANTS[number]; + +/** Missing actual seed-correlated work is the seed negative control's only accepted failure. */ +export class SeedHandoffAcceptanceError extends Error {} +/** The rendered unlinked state is the link negative control's only accepted failure. */ +export class StreamLinkAcceptanceError extends Error {} + +/** Read the executable, argument-only shell block; unsupported shell syntax fails closed. */ +export function documentedScaffoldCommands(markdown: string): readonly (readonly string[])[] { + const block = markdown.match( + /\s*```sh\n([\s\S]*?)```\s*/, + ); + if (!block) throw new Error('The documented scaffold command block is missing'); + return block[1].trim().split('\n').map((line) => { + if (!/^[\w./ -]+$/.test(line)) throw new Error(`Unsupported documented shell syntax: ${line}`); + const words = line.trim().split(/\s+/); + if (!['netscript', 'aspire', 'cd'].includes(words[0])) { + throw new Error(`Unsupported documented command: ${words[0]}`); + } + return words; + }); +} + +const executionList = z.object({ + executions: z.array(z.object({ + id: z.string(), + jobId: z.string(), + status: z.string(), + progressPercent: z.number().nullable(), + completedAt: z.string().nullable(), + result: z.record(z.string(), z.unknown()).nullable(), + })), +}); + +/** Use the public correlation filter: execution DTOs deliberately omit correlationId. */ +export function seedExecutionUrl(baseUrl: string, seedId: string): URL { + const url = new URL( + '/api/v1/workers/executions/by-correlation/' + encodeURIComponent('scaffold-seed:' + seedId), + baseUrl, + ); + url.searchParams.set('limit', '50'); + return url; +} + +/** Require one completed real sample from the correlation-filtered response. */ +export function assertDocumentedSeedExecution(value: unknown): string { + const { executions } = executionList.parse(value); + const matches = executions.filter((execution) => execution.jobId === 'health-check'); + if (matches.length !== 1 || matches[0].status !== 'completed') { + throw new SeedHandoffAcceptanceError( + 'The post-seed health-check execution did not complete exactly once', + ); + } + const execution = matches[0]; + if ( + execution.progressPercent !== 100 || !execution.completedAt || + typeof execution.result?.workspaceEntries !== 'number' || + execution.result.workspaceEntries < 1 || + !z.object({ source: z.literal('database-seed') }).safeParse(execution.result?.payload).success + ) { + throw new Error('The seed job did not report real work, full progress and completion time'); + } + return execution.id; +} + +/** Require the actual stream projection, excluding the record-change fallback. */ +export function assertLinkedActivityHtml(html: string): void { + const section = activitySection(html); + if (section.includes('data-capability-state="installed-unwired"')) { + throw new StreamLinkAcceptanceError( + 'The Activity feed reports its record service is not linked', + ); + } + assertReadyCapabilities(section, ['streams']); + if (!section.includes('Latest events from the record activity stream.')) { + throw new Error('Activity did not render the linked record stream projection'); + } +} + +/** Record-table text cannot stand in for an event rendered inside Activity. */ +function activitySection(html: string): string { + const section = html.match(/]*data-capability="streams"[^>]*>[\s\S]*?<\/section>/) + ?.[0]; + if (!section) throw new Error('The rendered Activity section is missing'); + return section; +} + +const activityEvents = z.array(z.object({ + type: z.literal('record-activity'), + headers: z.object({ operation: z.literal('upsert') }), + value: z.object({ + id: z.string(), + verb: z.enum(['created', 'updated']), + recordId: z.string(), + reference: z.string(), + actor: z.object({ name: z.string(), kind: z.enum(['authenticated', 'anonymous']) }), + timestamp: z.iso.datetime(), + }), +})); + +/** Prove the committed API mutation reached the real stream and the rendered Activity list. */ +export function assertDocumentedActivity( + value: unknown, + recordId: string | number, + html: string, +): string { + assertLinkedActivityHtml(html); + const section = activitySection(html); + const event = activityEvents.parse(value).find(({ value }) => + value.verb === 'updated' && value.recordId === String(recordId) + ); + if ( + !event || !section.includes(event.value.reference) || + !section.includes(event.value.actor.name) || + !section.includes(event.value.timestamp) + ) { + throw new Error( + 'The committed record update is missing from the linked stream-backed Activity', + ); + } + return event.value.id; +} + +/** Read-side projection effects, separated from the single committed mutation. */ +export interface ActivityProjectionPorts { + readonly readHtml: () => Promise; + readonly readEvents: () => Promise; +} + +/** Bounded application-effect observation; an explicitly unlinked topology fails immediately. */ +export async function waitForDocumentedActivity( + ports: ActivityProjectionPorts, + recordId: string | number, + options: { + readonly attempts?: number; + readonly delayMs?: number; + readonly delay?: (milliseconds: number) => Promise; + } = {}, +): Promise { + const attempts = options.attempts ?? ACTIVITY_PROJECTION_ATTEMPTS; + const delayMs = options.delayMs ?? ACTIVITY_PROJECTION_DELAY_MS; + const delay = options.delay ?? + ((milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds))); + let lastFailure: unknown; + for (let attempt = 1; attempt <= attempts; attempt++) { + try { + const html = await ports.readHtml(); + assertLinkedActivityHtml(html); + return assertDocumentedActivity(await ports.readEvents(), recordId, html); + } catch (error) { + if (error instanceof StreamLinkAcceptanceError) throw error; + lastFailure = error; + } + if (attempt < attempts) await delay(delayMs); + } + throw new Error('The linked Activity projection did not converge within its bounded budget', { + cause: lastFailure, + }); +} + +const ACTIVITY_PROJECTION_ATTEMPTS = 30; +const ACTIVITY_PROJECTION_DELAY_MS = 1_000; diff --git a/packages/cli/e2e/src/application/gates/scaffold/runtime/behavior-gates.ts b/packages/cli/e2e/src/application/gates/scaffold/runtime/behavior-gates.ts index b15909d3b8..5d933ab130 100644 --- a/packages/cli/e2e/src/application/gates/scaffold/runtime/behavior-gates.ts +++ b/packages/cli/e2e/src/application/gates/scaffold/runtime/behavior-gates.ts @@ -100,6 +100,25 @@ export function createRuntimeBehaviorGates( database: DatabaseEngine = DATABASE.POSTGRES, ): readonly GateDefinition[] { return [ + commandGate( + GATE.BEHAVIOR_DOCUMENTED_SCAFFOLD, + 'Documented scaffold order completes seeded work and stream Activity with negative controls', + GATE_PHASE.BEHAVIOR, + (context) => [ + 'deno', + 'run', + '--allow-all', + `${context.project.repoRoot}/packages/cli/e2e/src/application/gates/scaffold/verify-documented-scaffold.ts`, + context.project.repoRoot, + context.project.cliEntrypoint, + `${context.project.smokeRoot}/documented-scaffold`, + ], + undefined, + 'capture', + 'The unmodified documented steps must complete seeded work and render the actual linked Activity stream.', + undefined, + 2_400_000, + ), commandGate( GATE.BEHAVIOR_BACKGROUND_CHILDREN_HEALTH, 'Background children report registry and dependency readiness', diff --git a/packages/cli/e2e/src/application/gates/scaffold/verify-documented-scaffold.ts b/packages/cli/e2e/src/application/gates/scaffold/verify-documented-scaffold.ts new file mode 100644 index 0000000000..7b50084231 --- /dev/null +++ b/packages/cli/e2e/src/application/gates/scaffold/verify-documented-scaffold.ts @@ -0,0 +1,330 @@ +/** Execute the documented scaffold order without the main suite's repair fixtures. @module */ +import { join, resolve } from '@std/path'; +import { buildStreamUrl } from '@netscript/plugin-streams-core'; +import { z } from 'zod'; +import { + assertDocumentedSeedExecution, + DOCUMENTED_SCAFFOLD_DOC, + DOCUMENTED_SCAFFOLD_VARIANTS, + documentedScaffoldCommands, + type DocumentedScaffoldVariant, + seedExecutionUrl, + SeedHandoffAcceptanceError, + StreamLinkAcceptanceError, + waitForDocumentedActivity, +} from './documented-scaffold-contract.ts'; +import { resolveResourceUrlsFromAppHost } from './generated-app-endpoint.ts'; +import { probeAppHome } from './probe-app-home.ts'; +import { probePluginResource } from './runtime/probe-plugin-resource.ts'; +import { verifyGeneratedCrudAcceptance } from './verify-live-db-endpoint.ts'; + +const COMMAND_CEILING_MS = 330_000; +const DEFAULT_ASPIRE_START_TIMEOUT_SECONDS = 300; +const seedRequest = z.object({ version: z.literal(1), seedId: z.string().uuid() }); +type Outcome = { readonly passed: true; readonly id: string } | { + readonly passed: false; + readonly error: unknown; +}; + +async function command(executable: string, args: readonly string[], cwd: string): Promise { + const startingAspire = executable === 'aspire' && args[0] === 'start'; + const startTimeout = Deno.env.get('ASPIRE_CLI_START_TIMEOUT') ?? + String(DEFAULT_ASPIRE_START_TIMEOUT_SECONDS); + const ceiling = startingAspire + ? Math.max(COMMAND_CEILING_MS, (Number(startTimeout) + 30) * 1_000) + : COMMAND_CEILING_MS; + const result = await new Deno.Command(executable, { + args: [...args], + cwd, + stdin: 'null', + stdout: 'piped', + stderr: 'piped', + signal: AbortSignal.timeout(ceiling), + ...(startingAspire ? { env: { ASPIRE_CLI_START_TIMEOUT: startTimeout } } : {}), + }).output(); + const stdout = new TextDecoder().decode(result.stdout); + if (!result.success) { + throw new Error( + `${executable} ${args.join(' ')} exited ${result.code}: ${ + new TextDecoder().decode(result.stderr).slice(-6000) + }\n${stdout.slice(-6000)}`, + ); + } + return stdout; +} + +async function responseJson(url: string | URL): Promise { + const response = await fetch(url, { signal: AbortSignal.timeout(10_000) }); + if (!response.ok) { + throw new Error(`${url}: HTTP ${response.status}: ${(await response.text()).slice(0, 1000)}`); + } + return await response.json(); +} + +async function outcome(probe: () => Promise): Promise { + try { + return { passed: true, id: await probe() }; + } catch (error) { + return { passed: false, error }; + } +} + +async function seedExecution(appHost: string, projectRoot: string): Promise { + const { seedId } = seedRequest.parse( + JSON.parse(await Deno.readTextFile(join(projectRoot, '.netscript/sample-seed.json'))), + ); + try { + // Bounded application-effect observation only; no trigger or restart repairs the setup. + await probePluginResource(appHost, 'workers-api', 'workers-executions'); + } catch (error) { + if ( + error instanceof Error && + error.message.includes('health-check execution has not completed yet') + ) { + throw new SeedHandoffAcceptanceError(error.message); + } + throw error; + } + const [url] = await resolveResourceUrlsFromAppHost(appHost, 'workers-api'); + return assertDocumentedSeedExecution(await responseJson(seedExecutionUrl(url, seedId))); +} + +async function activity(appHost: string, projectRoot: string): Promise { + const [usersUrl] = await resolveResourceUrlsFromAppHost(appHost, 'users'); + const mutation = await verifyGeneratedCrudAcceptance(usersUrl); + await probeAppHome(projectRoot, 'dashboard', appHost); + const [appUrl] = await resolveResourceUrlsFromAppHost(appHost, 'dashboard'); + const [streamsUrl] = await resolveResourceUrlsFromAppHost(appHost, 'streams'); + const streamUrl = new URL(buildStreamUrl('/scaffold/users/records', streamsUrl)); + streamUrl.searchParams.set('offset', '-1'); + return await waitForDocumentedActivity({ + readHtml: async () => { + const response = await fetch(appUrl, { + signal: AbortSignal.timeout(10_000), + headers: { accept: 'text/html' }, + }); + const html = await response.text(); + if (!response.ok || !html.includes(' responseJson(streamUrl), + }, mutation.representativeId); +} + +async function workerPid(appHost: string, cwd: string): Promise { + const snapshot = z.object({ + resources: z.array(z.object({ + displayName: z.string(), + properties: z.record(z.string(), z.unknown()), + })), + }).parse(JSON.parse( + await command('aspire', [ + 'describe', + '--apphost', + appHost, + '--format', + 'Json', + '--non-interactive', + '--nologo', + ], cwd), + )); + const workers = snapshot.resources.filter((resource) => resource.displayName === 'workers'); + const pid = workers.length === 1 ? workers[0].properties['executable.pid'] : undefined; + if (typeof pid !== 'number' || pid <= 0) { + throw new Error('The exact resident workers process has no PID'); + } + return pid; +} + +async function cleanup(repoRoot: string, projectRoot: string): Promise { + const receiptPath = join(projectRoot, '.netscript/e2e-cleanup.json'); + await command(Deno.execPath(), [ + 'run', + '--allow-read', + '--allow-write', + '--allow-run=aspire,docker', + join(repoRoot, 'packages/cli/e2e/src/application/gates/scaffold/runtime/evidence/cleanup.ts'), + join(projectRoot, 'aspire/apphost.mts'), + projectRoot, + 'true', + receiptPath, + ], projectRoot); + const receipt = z.object({ + evaluation: z.object({ + ownedContainers: z.array(z.unknown()), + ownedProcesses: z.array(z.unknown()), + foreignContainers: z.array(z.unknown()), + unprovenContainers: z.array(z.unknown()), + foreignProcesses: z.array(z.unknown()), + unprovenProcesses: z.array(z.unknown()), + }), + }).parse(JSON.parse(await Deno.readTextFile(receiptPath))); + const observed = receipt.evaluation; + if (observed.ownedContainers.length || observed.ownedProcesses.length) { + throw new Error('The documented workspace has owned runtime survivors'); + } + console.info( + JSON.stringify({ + cleanup: 'PASS', + exactAppHostStopped: true, + foreignOrUnknownLeftAlone: observed.foreignContainers.length + + observed.unprovenContainers.length + + observed.foreignProcesses.length + observed.unprovenProcesses.length, + }), + ); +} + +async function runVariant( + repoRoot: string, + cliEntrypoint: string, + parent: string, + variant: DocumentedScaffoldVariant, + commands: readonly (readonly string[])[], +): Promise { + const root = join(parent, variant); + await Deno.mkdir(root, { recursive: true }); + const projectRoot = join(root, 'activity-demo'); + const appHost = join(projectRoot, 'aspire/apphost.mts'); + console.info(`${variant}: executing the documented command block`); + let cwd = root; + let beforeSeedPid: number | undefined; + let appHostStarted = false; + let primaryFailure: { readonly error: unknown } | undefined; + try { + for (const words of commands) { + if (words[0] === 'cd') { + if (words.length !== 2 || words[1] !== 'activity-demo') { + throw new Error('The walkthrough must enter its new workspace'); + } + cwd = projectRoot; + continue; + } + let args = words.slice(1); + if (variant === 'drop-link' && args[0] === 'plugin' && args[2] === 'streams') { + const index = args.indexOf('--service'); + if (index < 0) throw new Error('The documented streams install lost its service link'); + args = [...args.slice(0, index), ...args.slice(index + 2)]; + } + if (words[0] === 'aspire' && args[0] === 'start' && variant === 'skip-seed-handoff') { + const runtime = join(projectRoot, 'workers/runtime.ts'); + const source = await Deno.readTextFile(runtime); + // Deliberate fault in the disposable scaffold, never in a source carrier. + const broken = source.replace(/^\s*seedHandoff: new URL\([^\n]*\),\n/m, ''); + if (broken === source) { + throw new Error('The generated seed handoff wire is missing before the control'); + } + await Deno.writeTextFile(runtime, broken); + } + if (words[0] === 'netscript' && args[0] === 'db' && args[1] === 'seed') { + await command('aspire', [ + 'wait', + 'workers', + '--status', + 'healthy', + '--timeout', + '180', + '--apphost', + appHost, + '--non-interactive', + '--nologo', + ], cwd); + beforeSeedPid = await workerPid(appHost, cwd); + } + if (words[0] === 'aspire' && args[0] === 'start') appHostStarted = true; + await command( + words[0] === 'netscript' ? Deno.execPath() : 'aspire', + words[0] === 'netscript' + ? [ + 'run', + '-A', + ...(cliEntrypoint.startsWith('jsr:@netscript/cli@') + ? ['--minimum-dependency-age=0'] + : []), + cliEntrypoint, + ...args, + ] + : args, + cwd, + ); + } + const seed = await outcome(() => seedExecution(appHost, projectRoot)); + const stream = await outcome(() => activity(appHost, projectRoot)); + const afterSeedPid = await workerPid(appHost, cwd); + if (beforeSeedPid === undefined || beforeSeedPid !== afterSeedPid) { + throw new Error('Workers restarted between seed and acceptance'); + } + if (variant === 'skip-seed-handoff') { + if (seed.passed || !(seed.error instanceof SeedHandoffAcceptanceError) || !stream.passed) { + throw new AggregateError( + [!seed.passed ? seed.error : undefined, !stream.passed ? stream.error : undefined].filter( + Boolean, + ), + `Seed control did not isolate the missing handoff (seed=${seed.passed}, activity=${stream.passed})`, + ); + } + } else if (variant === 'drop-link') { + if (!seed.passed || stream.passed || !(stream.error instanceof StreamLinkAcceptanceError)) { + throw new AggregateError( + [!seed.passed ? seed.error : undefined, !stream.passed ? stream.error : undefined].filter( + Boolean, + ), + `Link control did not isolate the missing stream link (seed=${seed.passed}, activity=${stream.passed})`, + ); + } + } else if (!seed.passed || !stream.passed) { + throw new AggregateError( + [!seed.passed ? seed.error : undefined, !stream.passed ? stream.error : undefined].filter( + Boolean, + ), + 'The restored documented scaffold failed acceptance', + ); + } + console.info( + JSON.stringify({ + variant, + verdict: 'PASS', + seed: seed.passed ? seed.id : 'RED: missing handoff', + activity: stream.passed ? stream.id : 'RED: missing link', + residentWorkerPreserved: true, + }), + ); + } catch (error) { + primaryFailure = { error }; + } + try { + if (appHostStarted) await cleanup(repoRoot, projectRoot); + } catch (error) { + if (primaryFailure) { + throw new AggregateError( + [primaryFailure.error, error], + 'Documented acceptance and owned cleanup failed', + ); + } + throw error; + } + if (primaryFailure) throw primaryFailure.error; + // Retain bind-mounted database data; runtime cleanup does not require deleting the workspace. +} + +if (import.meta.main) { + const [repoPath, cliPath, parentPath] = Deno.args; + if (!repoPath || !cliPath || !parentPath) { + throw new Error('Repository, CLI entrypoint and scratch parent are required'); + } + const repoRoot = resolve(repoPath); + const cliEntrypoint = cliPath.startsWith('jsr:') ? cliPath : resolve(repoRoot, cliPath); + const commands = documentedScaffoldCommands( + await Deno.readTextFile(join(repoRoot, DOCUMENTED_SCAFFOLD_DOC)), + ); + const parentRoot = resolve(parentPath); + await Deno.mkdir(parentRoot, { recursive: true }); + const parent = await Deno.makeTempDir({ dir: parentRoot, prefix: 'documented-' }); + for (const variant of DOCUMENTED_SCAFFOLD_VARIANTS) { + await runVariant(repoRoot, cliEntrypoint, parent, variant, commands); + } + console.info( + JSON.stringify({ documentedScaffold: 'PASS', variants: DOCUMENTED_SCAFFOLD_VARIANTS }), + ); +} diff --git a/packages/cli/e2e/src/domain/cli-surface.ts b/packages/cli/e2e/src/domain/cli-surface.ts index 5a2f7bc1f1..3d1ce02c8d 100644 --- a/packages/cli/e2e/src/domain/cli-surface.ts +++ b/packages/cli/e2e/src/domain/cli-surface.ts @@ -149,6 +149,7 @@ export const GATE = { RUNTIME_HEALTH_CREDENTIAL_REJECTED: 'runtime.health.credential-rejected', BEHAVIOR_APP_HOME: 'behavior.app-home', BEHAVIOR_RECORD_ACTIVITY: 'behavior.record-activity', + BEHAVIOR_DOCUMENTED_SCAFFOLD: 'behavior.documented-scaffold', BEHAVIOR_APP_DYNAMIC_ROUTE: 'behavior.app-dynamic-route', BEHAVIOR_APP_REFERENCE: 'behavior.app-reference', BEHAVIOR_ISLAND_SERVED_SURFACE: 'behavior.island-served-surface', diff --git a/packages/cli/e2e/suites/scaffold/capability-suites.ts b/packages/cli/e2e/suites/scaffold/capability-suites.ts index 0614e0996b..305453b241 100644 --- a/packages/cli/e2e/suites/scaffold/capability-suites.ts +++ b/packages/cli/e2e/suites/scaffold/capability-suites.ts @@ -64,6 +64,8 @@ export const RUNTIME_GATES = [ GATE.PREFLIGHT_DENO, GATE.PREFLIGHT_ASPIRE, GATE.SCAFFOLD_INIT, + // Static init gives the cleanup tail a valid AppHost path; no repair fixture has run. + GATE.BEHAVIOR_DOCUMENTED_SCAFFOLD, GATE.SCAFFOLD_SERVICE_CLIENT_ADD, GATE.SCAFFOLD_SERVICE_CLIENT_GENERATE, GATE.SCAFFOLD_AGENT_INIT, @@ -201,6 +203,8 @@ export const RUNTIME_GATES = [ // the Postgres merge-readiness suite while the reduced-container tier exercises // every provider-neutral runtime behavior. const POSTGRES_ONLY_RUNTIME_GATES = new Set([ + // The executable documentation explicitly selects Postgres; do not silently rewrite its commands. + GATE.BEHAVIOR_DOCUMENTED_SCAFFOLD, GATE.DATABASE_MIGRATION_ARTIFACTS, GATE.RUNTIME_CAPTURE_DB_ALLOCATION_FIRST, GATE.RUNTIME_CAPTURE_DB_ALLOCATION_SECOND, diff --git a/packages/cli/e2e/tests/application/gates/scaffold/documented-scaffold_test.ts b/packages/cli/e2e/tests/application/gates/scaffold/documented-scaffold_test.ts new file mode 100644 index 0000000000..9068aa4da4 --- /dev/null +++ b/packages/cli/e2e/tests/application/gates/scaffold/documented-scaffold_test.ts @@ -0,0 +1,228 @@ +import { ExecutionRecordResponseSchema } from '@netscript/plugin-workers-core/contracts/v1'; +import { assert, assertEquals, assertRejects, assertThrows } from '@std/assert'; +import { + assertDocumentedActivity, + assertDocumentedSeedExecution, + assertLinkedActivityHtml, + DOCUMENTED_SCAFFOLD_DOC, + documentedScaffoldCommands, + seedExecutionUrl, + SeedHandoffAcceptanceError, + StreamLinkAcceptanceError, + waitForDocumentedActivity, +} from '../../../../src/application/gates/scaffold/documented-scaffold-contract.ts'; +import { RUNTIME_GATES } from '../../../../suites/scaffold/capability-suites.ts'; +import { GATE } from '../../../../src/domain/cli-surface.ts'; + +const seedId = '9023b4e5-7889-4bb8-a8b9-06c1e237eb9a'; +const executionId = 'df39dd9c-72ce-4b0a-a8f3-e772947a96aa'; +// Parse the real public DTO: correlationId is intentionally removed by this contract. +const execution = ExecutionRecordResponseSchema.parse({ + id: executionId, + executionId, + concept: 'job', + jobId: 'health-check', + topic: 'default', + status: 'completed', + triggeredBy: 'manual', + triggeredAt: '2026-11-02T08:00:00.000Z', + startedAt: '2026-11-02T08:00:00.000Z', + completedAt: '2026-11-02T08:00:00.000Z', + exitCode: 0, + duration: 1, + error: null, + workerId: 'test-worker', + progressPercent: 100, + progressMessage: 'Workspace checked', + attempt: 1, + maxAttempts: 3, + correlationId: 'scaffold-seed:' + seedId, + result: { workspaceEntries: 3, payload: { source: 'database-seed' } }, +}); + +Deno.test('the runtime gate executes the real documented steps before any repair fixture', async () => { + const markdown = await Deno.readTextFile( + new URL(`../../../../../../../${DOCUMENTED_SCAFFOLD_DOC}`, import.meta.url), + ); + const commands = documentedScaffoldCommands(markdown); + assertEquals(commands.map((words) => words.slice(0, 3).join(' ')), [ + 'netscript init activity-demo', + 'cd activity-demo', + 'netscript plugin install', + 'netscript plugin install', + 'aspire restore --apphost', + 'aspire start --apphost', + 'netscript db init', + 'netscript db generate', + 'netscript db seed', + 'netscript plugin doctor', + ]); + assert(commands[0].includes('--service')); + assertEquals(commands[3].slice(-2), ['--service', 'users']); + assert(commands[5].includes('--non-interactive')); + assert( + RUNTIME_GATES.indexOf(GATE.BEHAVIOR_DOCUMENTED_SCAFFOLD) > + RUNTIME_GATES.indexOf(GATE.SCAFFOLD_INIT), + ); + assert( + RUNTIME_GATES.indexOf(GATE.BEHAVIOR_DOCUMENTED_SCAFFOLD) < + RUNTIME_GATES.indexOf(GATE.RUNTIME_STREAMS_STORAGE_FIXTURE), + ); + assert( + RUNTIME_GATES.indexOf(GATE.BEHAVIOR_DOCUMENTED_SCAFFOLD) < + RUNTIME_GATES.indexOf(GATE.RUNTIME_ASPIRE_RESTART_AFTER_DB), + ); +}); + +Deno.test('document command extraction rejects missing blocks and executable shell syntax', () => { + assertThrows(() => documentedScaffoldCommands('nothing here')); + assertThrows(() => + documentedScaffoldCommands( + '\n```sh\nnetscript db seed; true\n```\n', + ) + ); +}); + +Deno.test('seed acceptance uses the public correlation filter and requires completion with genuine work', () => { + assertEquals( + seedExecutionUrl('http://workers.invalid', seedId).pathname, + '/api/v1/workers/executions/by-correlation/scaffold-seed%3A' + seedId, + ); + assert(!('correlationId' in execution)); + assertEquals(assertDocumentedSeedExecution({ executions: [execution] }), executionId); + for ( + const executions of [[], [{ ...execution, status: 'running' }], [{ + ...execution, + jobId: 'unrelated', + }], [execution, execution]] + ) { + assertThrows( + () => assertDocumentedSeedExecution({ executions }), + SeedHandoffAcceptanceError, + ); + } + for ( + const change of [{ progressPercent: 0 }, { completedAt: null }, { + result: { workspaceEntries: 0 }, + }] + ) { + assertThrows(() => + assertDocumentedSeedExecution({ executions: [{ ...execution, ...change }] }) + ); + } +}); + +const event = { + type: 'record-activity', + headers: { operation: 'upsert' }, + value: { + id: 'event-1', + recordId: '42', + reference: 'REC-10482', + verb: 'updated', + actor: { name: 'Anonymous', kind: 'anonymous' }, + timestamp: '2026-11-02T08:00:00.000Z', + }, +}; +const html = '
' + + '

Latest events from the record activity stream.

Anonymous updated REC-10482' + + '
'; + +Deno.test('Activity waits through an empty projection without repeating the committed mutation', async () => { + let reads = 0; + let eventReads = 0; + const delays: number[] = []; + const id = await waitForDocumentedActivity( + { + readHtml: () => + Promise.resolve(++reads === 1 ? html.replace('state="ready"', 'state="empty"') : html), + readEvents: () => { + eventReads++; + return Promise.resolve([event]); + }, + }, + 42, + { + attempts: 3, + delay: (ms) => { + delays.push(ms); + return Promise.resolve(); + }, + }, + ); + assertEquals(id, 'event-1'); + assertEquals(reads, 2); + assertEquals(eventReads, 1); + assertEquals(delays, [1000]); +}); + +Deno.test('Activity unlinked state is terminal and never reads a stream or sleeps', async () => { + let reads = 0; + await assertRejects(() => + waitForDocumentedActivity( + { + readHtml: () => { + reads++; + return Promise.resolve(html.replace('state="ready"', 'state="installed-unwired"')); + }, + readEvents: () => Promise.reject(new Error('Unexpected stream read')), + }, + 42, + { delay: () => Promise.reject(new Error('Unexpected retry')) }, + ), StreamLinkAcceptanceError); + assertEquals(reads, 1); +}); + +Deno.test('Activity projection retry budget is finite', async () => { + let reads = 0; + await assertRejects( + () => + waitForDocumentedActivity( + { + readHtml: () => { + reads++; + return Promise.resolve(html.replace('state="ready"', 'state="empty"')); + }, + readEvents: () => Promise.resolve([]), + }, + 42, + { attempts: 2, delay: () => Promise.resolve() }, + ), + Error, + 'bounded budget', + ); + assertEquals(reads, 2); +}); + +Deno.test('Activity acceptance rejects the unlinked fallback and requires the real mutation in the stream', () => { + assertEquals(assertDocumentedActivity([event], 42, html), 'event-1'); + assertThrows( + () => + assertLinkedActivityHtml( + '
Record activity is not linked from the record service to this stream resource.
', + ), + StreamLinkAcceptanceError, + ); + assertThrows(() => assertDocumentedActivity([], 42, html)); + assertThrows(() => assertDocumentedActivity([event], 999, html)); + assertThrows( + () => + assertLinkedActivityHtml( + '
Latest record changes
', + ), + StreamLinkAcceptanceError, + ); + assertThrows(() => + assertDocumentedActivity( + [event], + 42, + '
Latest events from the record activity stream.
Anonymous REC-10482 2026-11-02T08:00:00.000Z', + ) + ); + assertThrows(() => assertLinkedActivityHtml(html.replace('state="ready"', 'state="empty"'))); + assertThrows(() => + assertLinkedActivityHtml( + '
Latest record changes
', + ) + ); +}); diff --git a/packages/cli/e2e/tests/presentation/suite-registry_test.ts b/packages/cli/e2e/tests/presentation/suite-registry_test.ts index 3e1769e64b..ee56f339fb 100644 --- a/packages/cli/e2e/tests/presentation/suite-registry_test.ts +++ b/packages/cli/e2e/tests/presentation/suite-registry_test.ts @@ -522,6 +522,7 @@ Deno.test('runtime database overrides preserve service health and the Postgres g } const postgresOnly = new Set([ + GATE.BEHAVIOR_DOCUMENTED_SCAFFOLD, GATE.DATABASE_MIGRATION_ARTIFACTS, GATE.RUNTIME_CAPTURE_DB_ALLOCATION_FIRST, GATE.RUNTIME_CAPTURE_DB_ALLOCATION_SECOND, @@ -559,6 +560,7 @@ Deno.test('runtime database overrides preserve service health and the Postgres g sqliteCapability.gates, runtimeCapability.gates.filter((gate) => !(new Set([ + GATE.BEHAVIOR_DOCUMENTED_SCAFFOLD, GATE.DATABASE_MIGRATION_ARTIFACTS, GATE.RUNTIME_CAPTURE_DB_ALLOCATION_FIRST, GATE.RUNTIME_CAPTURE_DB_ALLOCATION_SECOND, diff --git a/packages/cli/src/kernel/adapters/plugin/plugin-reference-reconciler.ts b/packages/cli/src/kernel/adapters/plugin/plugin-reference-reconciler.ts index 835782981e..98f5bff07c 100644 --- a/packages/cli/src/kernel/adapters/plugin/plugin-reference-reconciler.ts +++ b/packages/cli/src/kernel/adapters/plugin/plugin-reference-reconciler.ts @@ -24,6 +24,7 @@ interface ReferenceEntry { export async function reconcilePluginReferences( projectRoot: string, fs: FileSystemPort, + previousServiceConsumers: Readonly> = {}, ): Promise { const appsettingsPath = join(projectRoot, SCAFFOLD_FILES.APPSETTINGS); if (!await fs.exists(appsettingsPath)) return; @@ -76,6 +77,18 @@ export async function reconcilePluginReferences( // Discovery edges require an API resource; in-process plugins only retain consumer metadata. if (pluginEntry) { + // Revoke only earlier CLI-managed edges; appsettings-owned links remain intact. + for (const consumer of previousServiceConsumers[declaration.resourceConfigKey] ?? []) { + const service = services[consumer]; + if (service && !declaration.consumers.services.includes(consumer)) { + setPluginReferences( + service, + (service.PluginReferences ?? []).filter((reference) => + reference !== declaration.resourceConfigKey + ), + ); + } + } addConsumerReference(services, declaration.consumers.services, declaration.resourceConfigKey); addConsumerReference(apps, declaration.consumers.apps, declaration.resourceConfigKey); } diff --git a/packages/cli/src/kernel/adapters/plugin/plugin-reference-reconciler_test.ts b/packages/cli/src/kernel/adapters/plugin/plugin-reference-reconciler_test.ts index 90b3a953f4..63f2a2cbe8 100644 --- a/packages/cli/src/kernel/adapters/plugin/plugin-reference-reconciler_test.ts +++ b/packages/cli/src/kernel/adapters/plugin/plugin-reference-reconciler_test.ts @@ -2,6 +2,33 @@ import { assertEquals } from '@std/assert'; import { MemoryFileSystemAdapter } from '../scaffold/memory-fs.ts'; import { reconcilePluginReferences } from './plugin-reference-reconciler.ts'; +Deno.test('explicit service reselection revokes only earlier managed consumer edges', async () => { + const fs = new MemoryFileSystemAdapter(); + await fs.writeFile( + '/project/appsettings.json', + JSON.stringify({ + NetScript: { + Plugins: { 'event-relay': {}, other: {} }, + Services: { + catalog: { PluginReferences: ['event-relay', 'other'] }, + inventory: {}, + manual: { PluginReferences: ['event-relay'] }, + }, + }, + }), + ); + await writeThirdPartyDeclaration(fs); + const path = '/project/plugins/acme-deploy-events/scaffold.plugin.json'; + const manifest = JSON.parse(await fs.readFile(path)); + manifest.linking.consumers.services = ['inventory']; + await fs.writeFile(path, JSON.stringify(manifest)); + await reconcilePluginReferences('/project', fs, { 'event-relay': ['catalog'] }); + const { Services } = JSON.parse(await fs.readFile('/project/appsettings.json')).NetScript; + assertEquals(Services.catalog.PluginReferences, ['other']); + assertEquals(Services.inventory.PluginReferences, ['event-relay']); + assertEquals(Services.manual.PluginReferences, ['event-relay']); +}); + Deno.test('reconcilePluginReferences omits dangling dependencies and adds every producer edge', async () => { const fs = new MemoryFileSystemAdapter(); await writeAppsettings(fs, false); @@ -43,15 +70,21 @@ Deno.test('reconcilePluginReferences maps canonical dependencies to renamed inst const fs = new MemoryFileSystemAdapter(); await fs.writeFile( '/project/appsettings.json', - `${JSON.stringify({ - NetScript: { - Plugins: { - 'workers-api': { Enabled: true }, - 'durable-state': { Enabled: true }, + `${ + JSON.stringify( + { + NetScript: { + Plugins: { + 'workers-api': { Enabled: true }, + 'durable-state': { Enabled: true }, + }, + BackgroundProcessors: { jobs: { Enabled: true } }, + }, }, - BackgroundProcessors: { jobs: { Enabled: true } }, - }, - }, null, 2)}\n`, + null, + 2, + ) + }\n`, ); await writeDeclaration(fs, 'jobs', 'workers-api', ['streams'], [], 'workers'); await writeDeclaration(fs, 'durable-state', 'streams', [], [], 'streams'); @@ -69,18 +102,24 @@ Deno.test('reconcilePluginReferences uses configured modules and accepts service const fs = new MemoryFileSystemAdapter(); await fs.writeFile( '/project/appsettings.json', - `${JSON.stringify({ - NetScript: { - Plugins: { - 'workers-api': { Enabled: true }, - 'triggers-api': { Enabled: true }, - }, - BackgroundProcessors: { - workers: { Enabled: true }, - triggers: { Enabled: true }, + `${ + JSON.stringify( + { + NetScript: { + Plugins: { + 'workers-api': { Enabled: true }, + 'triggers-api': { Enabled: true }, + }, + BackgroundProcessors: { + workers: { Enabled: true }, + triggers: { Enabled: true }, + }, + }, }, - }, - }, null, 2)}\n`, + null, + 2, + ) + }\n`, ); await fs.writeFile( '/project/netscript.config.ts', @@ -112,39 +151,51 @@ Deno.test('reconcilePluginReferences wires a fixture third-party plugin to decla const fs = new MemoryFileSystemAdapter(); await fs.writeFile( '/project/appsettings.json', - `${JSON.stringify({ - NetScript: { - Plugins: { 'event-relay': { Enabled: true } }, - BackgroundProcessors: {}, - Services: { catalog: { Enabled: true }, inventory: { Enabled: true } }, - Apps: { dashboard: { Type: 'app' }, admin: { Type: 'app' } }, - }, - }, null, 2)}\n`, + `${ + JSON.stringify( + { + NetScript: { + Plugins: { 'event-relay': { Enabled: true } }, + BackgroundProcessors: {}, + Services: { catalog: { Enabled: true }, inventory: { Enabled: true } }, + Apps: { dashboard: { Type: 'app' }, admin: { Type: 'app' } }, + }, + }, + null, + 2, + ) + }\n`, ); await fs.writeFile( '/project/plugins/acme-deploy-events/scaffold.plugin.json', - `${JSON.stringify({ - schemaVersion: 1, - name: '@acme/deploy-events', - version: '1.0.0', - displayName: 'Deploy events', - description: 'Fixture third-party plugin for declared host linking.', - peerDependencies: {}, - capabilities: { - hasDatabaseMigrations: false, - hasRoutes: true, - hasBackgroundWorkers: false, - }, - scaffolder: { - export: './scaffold', - requiredPermissions: { net: [], read: [], write: [] }, - }, - linking: { - canonicalName: 'deploy-events', - resourceConfigKey: 'event-relay', - consumers: { services: ['catalog'], apps: ['dashboard'] }, - }, - }, null, 2)}\n`, + `${ + JSON.stringify( + { + schemaVersion: 1, + name: '@acme/deploy-events', + version: '1.0.0', + displayName: 'Deploy events', + description: 'Fixture third-party plugin for declared host linking.', + peerDependencies: {}, + capabilities: { + hasDatabaseMigrations: false, + hasRoutes: true, + hasBackgroundWorkers: false, + }, + scaffolder: { + export: './scaffold', + requiredPermissions: { net: [], read: [], write: [] }, + }, + linking: { + canonicalName: 'deploy-events', + resourceConfigKey: 'event-relay', + consumers: { services: ['catalog'], apps: ['dashboard'] }, + }, + }, + null, + 2, + ) + }\n`, ); await reconcilePluginReferences('/project', fs); @@ -159,14 +210,20 @@ Deno.test('third-party linking converges when consumers arrive later and cleans const fs = new MemoryFileSystemAdapter(); await fs.writeFile( '/project/appsettings.json', - `${JSON.stringify({ - NetScript: { - Plugins: { 'event-relay': { Enabled: true } }, - BackgroundProcessors: {}, - Services: {}, - Apps: {}, - }, - }, null, 2)}\n`, + `${ + JSON.stringify( + { + NetScript: { + Plugins: { 'event-relay': { Enabled: true } }, + BackgroundProcessors: {}, + Services: {}, + Apps: {}, + }, + }, + null, + 2, + ) + }\n`, ); await writeThirdPartyDeclaration(fs); @@ -182,7 +239,10 @@ Deno.test('third-party linking converges when consumers arrive later and cleans assertEquals(linked.Apps.dashboard.PluginReferences, ['event-relay']); delete linked.Plugins['event-relay']; - await fs.writeFile('/project/appsettings.json', `${JSON.stringify({ NetScript: linked }, null, 2)}\n`); + await fs.writeFile( + '/project/appsettings.json', + `${JSON.stringify({ NetScript: linked }, null, 2)}\n`, + ); await fs.remove('/project/plugins/acme-deploy-events'); await reconcilePluginReferences('/project', fs); const removed = JSON.parse(await fs.readFile('/project/appsettings.json')).NetScript; @@ -193,28 +253,34 @@ Deno.test('third-party linking converges when consumers arrive later and cleans async function writeThirdPartyDeclaration(fs: MemoryFileSystemAdapter): Promise { await fs.writeFile( '/project/plugins/acme-deploy-events/scaffold.plugin.json', - `${JSON.stringify({ - schemaVersion: 1, - name: '@acme/deploy-events', - version: '1.0.0', - displayName: 'Deploy events', - description: 'Fixture third-party plugin for declared host linking.', - peerDependencies: {}, - capabilities: { - hasDatabaseMigrations: false, - hasRoutes: true, - hasBackgroundWorkers: false, - }, - scaffolder: { - export: './scaffold', - requiredPermissions: { net: [], read: [], write: [] }, - }, - linking: { - canonicalName: 'deploy-events', - resourceConfigKey: 'event-relay', - consumers: { services: ['catalog'], apps: ['dashboard'] }, - }, - }, null, 2)}\n`, + `${ + JSON.stringify( + { + schemaVersion: 1, + name: '@acme/deploy-events', + version: '1.0.0', + displayName: 'Deploy events', + description: 'Fixture third-party plugin for declared host linking.', + peerDependencies: {}, + capabilities: { + hasDatabaseMigrations: false, + hasRoutes: true, + hasBackgroundWorkers: false, + }, + scaffolder: { + export: './scaffold', + requiredPermissions: { net: [], read: [], write: [] }, + }, + linking: { + canonicalName: 'deploy-events', + resourceConfigKey: 'event-relay', + consumers: { services: ['catalog'], apps: ['dashboard'] }, + }, + }, + null, + 2, + ) + }\n`, ); } @@ -241,16 +307,22 @@ async function writeAppsettings( if (includeStreams) plugins.streams = { Enabled: true }; await fs.writeFile( '/project/appsettings.json', - `${JSON.stringify({ - NetScript: { - Plugins: plugins, - BackgroundProcessors: existing?.BackgroundProcessors ?? { - workers: { Enabled: true }, - sagas: { Enabled: true }, - triggers: { Enabled: true }, + `${ + JSON.stringify( + { + NetScript: { + Plugins: plugins, + BackgroundProcessors: existing?.BackgroundProcessors ?? { + workers: { Enabled: true }, + sagas: { Enabled: true }, + triggers: { Enabled: true }, + }, + }, }, - }, - }, null, 2)}\n`, + null, + 2, + ) + }\n`, ); } @@ -264,14 +336,20 @@ async function writeDeclaration( ): Promise { await fs.writeFile( `/project/${canonicalName}/scaffold.plugin.json`, - `${JSON.stringify({ - officialSource: { - canonicalName: manifestCanonicalName, - serviceConfigKey, - dependencies, - pluginReferences, - }, - }, null, 2)}\n`, + `${ + JSON.stringify( + { + officialSource: { + canonicalName: manifestCanonicalName, + serviceConfigKey, + dependencies, + pluginReferences, + }, + }, + null, + 2, + ) + }\n`, ); } diff --git a/packages/cli/src/local/features/plugins/install/install-local-plugin-command.ts b/packages/cli/src/local/features/plugins/install/install-local-plugin-command.ts index d87f487dfb..630975c0c5 100644 --- a/packages/cli/src/local/features/plugins/install/install-local-plugin-command.ts +++ b/packages/cli/src/local/features/plugins/install/install-local-plugin-command.ts @@ -33,6 +33,7 @@ export function createLocalPluginInstallCommand( .arguments('') .option('--name ', 'Plugin name (kebab-case)') .option('--app ', 'Link an enabled web app (defaults to all enabled web apps)') + .option('--service ', 'Link an enabled application service to the plugin API') .option('--port ', 'Plugin port override') .option('--service-refs ', 'Comma-separated service references') .option('--plugin-refs ', 'Comma-separated plugin references') @@ -63,6 +64,7 @@ export function createLocalPluginInstallCommand( kind, pluginName, app: options.app, + service: options.service, port: options.port, serviceReferences: parseList(options.serviceRefs), pluginReferences: parseList(options.pluginRefs), diff --git a/packages/cli/src/local/features/plugins/install/install-local-plugin.ts b/packages/cli/src/local/features/plugins/install/install-local-plugin.ts index 23bba3e63a..6a2d435d50 100644 --- a/packages/cli/src/local/features/plugins/install/install-local-plugin.ts +++ b/packages/cli/src/local/features/plugins/install/install-local-plugin.ts @@ -124,6 +124,7 @@ export async function installLocalPlugin( const plan = await planPluginInstall(planningRequest, { fs: dependencies.fs, appConsumers: resolvedPlugin?.descriptor.manifest.linking?.consumers.apps, + serviceConsumers: resolvedPlugin?.descriptor.manifest.linking?.consumers.services, registry, }); const pluginOwned = resolvedPlugin === undefined || dependencies.processRunner === undefined @@ -243,7 +244,10 @@ export async function installLocalPlugin( if (request.dryRun !== true) { await compileInstalledPluginRegistries(plan.projectRoot, resolvedPlugin, dependencies); } - await reconcilePluginReferences(plan.projectRoot, dependencies.fs); + await reconcilePluginReferences(plan.projectRoot, dependencies.fs, { + [rendered.plugin.serviceConfigKey ?? rendered.plugin.configKey]: + plan.previousServiceConsumers ?? [], + }); const { written: browserAuthFiles, report: browserAuthReport } = await reconcileBrowserAuth( plan.projectRoot, dependencies.fs, diff --git a/packages/cli/src/public/domain/plugin-install-plan.ts b/packages/cli/src/public/domain/plugin-install-plan.ts index b2aa6d3784..f6a9b21159 100644 --- a/packages/cli/src/public/domain/plugin-install-plan.ts +++ b/packages/cli/src/public/domain/plugin-install-plan.ts @@ -22,6 +22,9 @@ export interface PluginInstallRequest { /** Enabled web application to link; omitted links eligible web applications. */ readonly app?: string; + /** Enabled application service that consumes this plugin's API. */ + readonly service?: string; + /** Optional service port override. */ readonly port?: number; @@ -75,6 +78,10 @@ export interface PluginInstallRequest { export interface PluginInstallPlan extends Omit { /** Enabled web application keys resolved before any installation writes. */ readonly appReferences: readonly string[]; + /** Enabled service consumers persisted in the plugin linking descriptor. */ + readonly serviceConsumers: readonly string[]; + /** Previously managed edges, retained so explicit reselection can revoke them safely. */ + readonly previousServiceConsumers?: readonly string[]; /** Plugin kind identifier. */ readonly kind: PluginKind; diff --git a/packages/cli/src/public/features/plugins/install/install-plugin-command.ts b/packages/cli/src/public/features/plugins/install/install-plugin-command.ts index a577422a0b..e2c20d8d69 100644 --- a/packages/cli/src/public/features/plugins/install/install-plugin-command.ts +++ b/packages/cli/src/public/features/plugins/install/install-plugin-command.ts @@ -33,6 +33,7 @@ export function createPluginInstallCommand( .arguments('') .option('--name ', 'Plugin name (kebab-case)') .option('--app ', 'Link an enabled web app (defaults to all enabled web apps)') + .option('--service ', 'Link an enabled application service to the plugin API') .option('--port ', 'Plugin port override') .option('--service-refs ', 'Comma-separated service references') .option('--plugin-refs ', 'Comma-separated plugin references') @@ -66,6 +67,7 @@ export function createPluginInstallCommand( kind, pluginName, app: options.app, + service: options.service, port: options.port, serviceReferences: parseList(options.serviceRefs), pluginReferences: parseList(options.pluginRefs), diff --git a/packages/cli/src/public/features/plugins/install/install-plugin-input.ts b/packages/cli/src/public/features/plugins/install/install-plugin-input.ts index d566f1e527..b78459f4a0 100644 --- a/packages/cli/src/public/features/plugins/install/install-plugin-input.ts +++ b/packages/cli/src/public/features/plugins/install/install-plugin-input.ts @@ -4,6 +4,7 @@ import type { PluginInstallRequest } from '../../../domain/plugin-install-plan.t export interface InstallPluginCommandInput { readonly name?: string; readonly app?: string; + readonly service?: string; readonly port?: number; readonly serviceRefs?: string; readonly pluginRefs?: string; diff --git a/packages/cli/src/public/features/plugins/install/install-plugin.ts b/packages/cli/src/public/features/plugins/install/install-plugin.ts index 2e244124c2..f3ce99f9d4 100644 --- a/packages/cli/src/public/features/plugins/install/install-plugin.ts +++ b/packages/cli/src/public/features/plugins/install/install-plugin.ts @@ -156,6 +156,7 @@ export async function installPlugin( const plan = await planPluginInstall(planningRequest, { fs: dependencies.fs, appConsumers: resolvedPlugin?.descriptor.manifest.linking?.consumers.apps, + serviceConsumers: resolvedPlugin?.descriptor.manifest.linking?.consumers.services, registry, }); const pluginOwned = resolvedPlugin === undefined || dependencies.processRunner === undefined @@ -269,7 +270,10 @@ export async function installPlugin( plugin: rendered.plugin, }); await compileInstalledPluginRegistries(plan.projectRoot, resolvedPlugin, dependencies); - await reconcilePluginReferences(plan.projectRoot, dependencies.fs); + await reconcilePluginReferences(plan.projectRoot, dependencies.fs, { + [rendered.plugin.serviceConfigKey ?? rendered.plugin.configKey]: + plan.previousServiceConsumers ?? [], + }); const { written: browserAuthFiles, report: browserAuthReport } = await reconcileBrowserAuth( plan.projectRoot, dependencies.fs, @@ -354,6 +358,7 @@ export async function persistPluginMetadata( consumers: { ...resolvedPlugin.descriptor.manifest.linking?.consumers, apps: plan.appReferences, + services: plan.serviceConsumers, }, }, } diff --git a/packages/cli/src/public/features/plugins/install/plan-plugin-install.ts b/packages/cli/src/public/features/plugins/install/plan-plugin-install.ts index a86838efc3..c1c2626bb0 100644 --- a/packages/cli/src/public/features/plugins/install/plan-plugin-install.ts +++ b/packages/cli/src/public/features/plugins/install/plan-plugin-install.ts @@ -1,4 +1,7 @@ -import { resolvePluginAppReferences } from './plugin-app-references.ts'; +import { + resolvePluginAppReferences, + resolvePluginServiceReferences, +} from './plugin-app-references.ts'; import { basename, dirname, join } from '@std/path'; import { validateResourceName } from '../../../../kernel/adapters/scaffold/workspace-writer.ts'; @@ -29,6 +32,8 @@ export interface PlanPluginInstallDependencies { /** Consumer defaults declared by the resolved package manifest. */ readonly appConsumers?: readonly string[]; + /** Service consumer defaults declared by the resolved package manifest. */ + readonly serviceConsumers?: readonly string[]; /** Plugin kind registry. */ readonly registry?: PluginKindRegistry; @@ -77,7 +82,18 @@ export async function planPluginInstall( dependencies.fs, dependencies.appConsumers, ), + serviceConsumers: await resolvePluginServiceReferences( + request, + dependencies.fs, + dependencies.serviceConsumers, + ), projectName, + previousServiceConsumers: request.service === undefined + ? undefined + : await resolvePluginServiceReferences( + { ...request, service: undefined }, + dependencies.fs, + ), dbDetection, sagaStoreBackend, configuredListenerPorts, diff --git a/packages/cli/src/public/features/plugins/install/plugin-app-references.ts b/packages/cli/src/public/features/plugins/install/plugin-app-references.ts index 7f23d9a95d..c92f661975 100644 --- a/packages/cli/src/public/features/plugins/install/plugin-app-references.ts +++ b/packages/cli/src/public/features/plugins/install/plugin-app-references.ts @@ -26,6 +26,39 @@ export async function resolvePluginAppReferences( ); } if (request.app !== undefined) return [request.app]; + return await readInstalledConsumerReferences(request, fs, 'apps') ?? declaredConsumers ?? apps; +} + +/** Explicit service consumers use the same persisted linking edges as package declarations. */ +export async function resolvePluginServiceReferences( + request: + & Pick + & Partial>, + fs: FileSystemPort, + declaredConsumers?: readonly string[], +): Promise { + const path = join(request.projectRoot, SCAFFOLD_FILES.APPSETTINGS); + const settings: { NetScript?: { Services?: Record } } = + await fs.exists(path) ? JSON.parse(await fs.readFile(path)) : {}; + if (request.service !== undefined) { + const service = settings.NetScript?.Services?.[request.service]; + if (!service || service.Enabled === false) { + throw new ScaffoldValidationError( + `--service "${request.service}" must name an enabled application service in NetScript.Services.`, + ); + } + return [request.service]; + } + return await readInstalledConsumerReferences(request, fs, 'services') ?? declaredConsumers ?? []; +} + +async function readInstalledConsumerReferences( + request: + & Pick + & Partial>, + fs: FileSystemPort, + section: 'apps' | 'services', +): Promise { if (request.overwrite && request.pluginName) { const configured = await readConfiguredPluginDirectories(request.projectRoot, fs); const directories = [ @@ -36,10 +69,11 @@ export async function resolvePluginAppReferences( for (const directory of new Set(directories)) { const manifestPath = join(directory, 'scaffold.plugin.json'); if (!await fs.exists(manifestPath)) continue; - const manifest: { linking?: { consumers?: { apps?: unknown } } } = JSON.parse( - await fs.readFile(manifestPath), - ); - const consumers = manifest.linking?.consumers?.apps; + const manifest: { linking?: { consumers?: { apps?: unknown; services?: unknown } } } = JSON + .parse( + await fs.readFile(manifestPath), + ); + const consumers = manifest.linking?.consumers?.[section]; if ( Array.isArray(consumers) && consumers.every((value): value is string => typeof value === 'string') @@ -48,5 +82,5 @@ export async function resolvePluginAppReferences( } } } - return declaredConsumers ?? apps; + return undefined; } diff --git a/packages/cli/src/public/features/plugins/install/plugin-app-references_test.ts b/packages/cli/src/public/features/plugins/install/plugin-app-references_test.ts index f8025cbc1c..cd42304f1c 100644 --- a/packages/cli/src/public/features/plugins/install/plugin-app-references_test.ts +++ b/packages/cli/src/public/features/plugins/install/plugin-app-references_test.ts @@ -1,6 +1,44 @@ import { assertEquals, assertRejects } from '@std/assert'; import { MemoryFileSystemAdapter } from '../../../../kernel/adapters/scaffold/memory-fs.ts'; -import { resolvePluginAppReferences } from './plugin-app-references.ts'; +import { + resolvePluginAppReferences, + resolvePluginServiceReferences, +} from './plugin-app-references.ts'; + +Deno.test('service consumer selection validates before writes and preserves explicit links on reinstall', async () => { + const fs = new MemoryFileSystemAdapter(); + await fs.writeFile( + '/project/appsettings.json', + JSON.stringify({ + NetScript: { Services: { orders: {}, off: { Enabled: false } } }, + }), + ); + const before = await fs.readFile('/project/appsettings.json'); + const request = { projectRoot: '/project', pluginName: 'streams', overwrite: true }; + assertEquals(await resolvePluginServiceReferences(request, fs), []); + assertEquals( + await resolvePluginServiceReferences({ ...request, service: 'orders' }, fs, ['other']), + ['orders'], + ); + assertEquals(await resolvePluginServiceReferences({ ...request, service: 'orders' }, fs), [ + 'orders', + ]); + for (const service of ['missing', 'off']) { + await assertRejects( + () => resolvePluginServiceReferences({ ...request, service }, fs), + Error, + 'must name an enabled application service', + ); + } + await fs.writeFile( + '/project/streams/scaffold.plugin.json', + JSON.stringify({ + linking: { consumers: { services: ['orders'] } }, + }), + ); + assertEquals(await resolvePluginServiceReferences(request, fs), ['orders']); + assertEquals(await fs.readFile('/project/appsettings.json'), before); +}); Deno.test('plugin app selection defaults to enabled web apps and supports an explicit app', async () => { const fs = new MemoryFileSystemAdapter(); diff --git a/packages/mcp/src/infrastructure/docs/agent-docs-prose.generated.ts b/packages/mcp/src/infrastructure/docs/agent-docs-prose.generated.ts index 357240552a..97f8a86b55 100644 --- a/packages/mcp/src/infrastructure/docs/agent-docs-prose.generated.ts +++ b/packages/mcp/src/infrastructure/docs/agent-docs-prose.generated.ts @@ -317,7 +317,7 @@ export const EMBEDDED_AGENT_DOCS_PAGES: readonly AgentDocsPage[] = [ ["pages/orchestration-runtime/cli-scaffold/index.md","H4sIAAAAAAAA/61Z244ctxF976+oQICtFaZ7YMcvkQMhC1l2FDuyspJgBAsDzSGrp+lhkx2SPb0N7McHVWRfZnWJAvvFnp3hpViXc06VHsHzn17CFxCkaBpnVFG8bXWAXhwRQuvGAK0bobYYg/S6j6CtjjUYMQVQbrQgYHT+FHohccdrY4sQRId8MN5FtCqAjjsQVsHYatnCES16EVFBow0GmNwAbrRVUbx3kfQoIgYQIF3XG4y4Az9Yq+0RDkKekA6dDXgKoRUeFbib189BOhu9kDHQ1YB3gvZDQH/WZKuA7z2GFhrvLBm5Y8t7Mxy1BY9HHaKfaJnCRgwmghSyRX4FLbwOvfYIzssWQ/QiamfJLegruG4ieoitiLsPu4O+3Fi9eXW+X9sQhTE1CKX48aIXB210nHbb1bMj87ZQg8dRe0w3bB5h1XabOtTkxLRKiSgOIiSDGuPGqigePYK35AzvDga79IacIBCcOWMoipeW3DrYEP0g40Bufzv1+CZd4bF3QUdHt+MZ/bREq0FBqyFE4WOAUccWFEodtLPhKQg4C6NV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IKU9dh9Fp+aKphdGDVqJyMztMnbRuXtSNHF2vyV4+58Ae7dPFrmc/c8Tggwu0/hSWYm7/kPPrc/udieFNm7Nm3biyj2wulSlGmc/ePOr4m/xlKvubqqoK3jrUcJnhxo/1QChAGHDTnfL3wKTmdBERWG8wU0nkEtEdNDX4G8NTBEExRxCyS61JMPJaEGAmxMwoLScOFW+pMZpL7472xNotpPLCBYW5Yd2TBEFseovyRRvCZWzs2QBtHV0bNBe9z77O4ax0WWQW3G5YMU4jYfa5xpIyEZdP26YAyHbC/YtUkKAPp9E5Y3WCIu0tq3L1fnLMIHNspj3VSl0vTOS79M3phZkDAkKTMD/MxWYszkX90pkTjgzg6INEQwDUbKwgcK/jRupGKP415dMgfIhqThrPMpFTdomGdTEj4tCju4UdtFdzDiwR/Ae7h72nIRpInEvDcF/dQliVc/Le4h5ulfVAgfNQNDQPgHpLq2rrn8adI+GrRDA/mQkkzfGR33lLmRXTKhyZCjz81U7qCe7gO4IbYDzFB8ZRGY2nWk4Q6w8KlZYnKynnZSAHUszAKFXvnRafjg/DCPaM943z9cEzMGMSzFLWZnbx7yVNzZ9HGsMWlQT8VStUgXa9nVn+oj/h12XyF6yivc8yRkZ5L4qqCF0rz3x00HtFMrACTLyzlL1CRkoURLRywpZzhg4nx6L3F8y0VMQTyAJCdw4S3GQ7qQE2A6NNjyTU+tLqn74mlaShGd6adfA1lazqXK99pGyu4vflQ2vw+mJrTKh25vyqKBRVo9rwp/nz3nKQNZvHvelrhfNkISRVJT/E0ck7jLS7+V3gX0ySwKPJwJI0J12ndrI1/50ywAtY2rI9y4wikUPodEPfGFovilv5dgwISIbSIn32PNLpc9Nr+Cqriv2AwmMqLGgAA","178b545a17f3128b70d570fd0aafb32e92ce4538e525a7b674fa9fffe7e293d2",6795], - ["pages/orchestration-runtime/how-to/add-a-plugin/index.md","H4sIAAAAAAAA/71b23LcOJJ951fkhiPGlqJITV8mYlf2Oka+TI9HPbZaUrtjw9HRhSKzirBYBBsApa4JPexH7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ZxLu/O9e8UnBF1HQhtsbDqBHyJ7gBV0QYLdA3xQUF+v8AiCOYRkQZK/m3UsnfyxXdaXmUO8vpiq7U7+9xRW0U2fB5MjwKKJNTf1VBNFRdxwqXbQPmaLm1Zezm87CM7mtSutOFwCCbBAlIWvWgybh0+NVZs2h47aAm1kHBX2snklokGlH7VOHSWWmaZji8Vgsnp+ZDwEZ0AfUCIQPrBzNzB/00sJ/q8yuMKvFIC6ZJrFtoj17u6gylhyr2SjcPpn5Er+QLaVWWRlpuRVh081BBPlDWlmbP/YpUBiNS7Up3QeRkW+qtq4housPB7x5LX8g2yfFPbZo0U999fjKMP5iAYfKYwJVy9cIoW53KRD9efj/Cjm69ULFHklO56vQppT9QVk9PTuS8Hzzl9Jk8I7cl6InlrsFdC0nDUEAcrllh15GeeOxoQNKrYHS+YBUCM2Z4yAhE5qhZxuwIsBFNB37tNR79w8qySN9hAtD0LYcNdsUQjxf8t4MWagWhBnuDf57uvj418QlDG7Ny5Op48UAuhwiI/FNuzQ3rg1Jr5dwT8TujvquSDhkr8xZdSJeVY3+5dZa3UsLfjo/jNZpGL7nclM2IqeF+TrzUCyGotx3qwJ67OXsBBgKNoNpDJNbbN2mGqzZJ3tmbQePNnys4KqQrV0PrLpmJlN5936FZA0Zgwr8L8OVB+35obvCv7PcOEh6aOm7MaPIl5x348Ha7uGe3PndfK848XmcCER50r+m2CylCTMm1tAN7dGgBMZymCzgYXw//v4ooYlLUD1zPH29oQ4ZuGBJuDDR0CZ+5qv2Wf/Pyv2dcln2XhOh0wcqs2eMiqWg+qmlO6UP4H0MR6b70jCc+7nJX3Wwd8OTxG5ztgL9OpKrHQoaNKOhy9XhhzV3cnw/pctNw8fH335Q8KrL/A/gFxuAANQAA","96244163a33972fa7630da96682620d688a6a61cad180d59bbdf45517bd26e1b",13568], + ["pages/orchestration-runtime/how-to/add-a-plugin/index.md","H4sIAAAAAAAA/71b23LcOJJ9r6/IDUeMLUWRmr5MxK7sdYx8mR6Pe2y1pHbHh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ImdEHohYAMUT8iM39QTn30U39+h4klHsKCsRFrA+4xSBds73qkd00396Z+QC/khqQqCysptyJsurnPIB9wawu7p3Mxu8GEVLvUXSQ52VV6q8kfSXcs/O5Z6TM5Jin/rGyTZ+raz0+G8QcNME6eDLhvyjrdbcdqnTZBQrEHYlOFavUp5f/ArJ6enEi9H3HK6RN5Rrol6JHjtkGvhZhhdCAeDcw4dZgnHjvqkfQydfvMWUXFTBYeLQKaOXCWyTp2+snC/sUjf1g6Fuo7ToAwfUtg/bqSiqdP57aVFmwFwQcHi/893n19TuIzhjZ26aWzKs6D5hABkX9Ka1G/PzC1Tuqe0N8pdW2decjkmbfChfwZUMovt2p5SyXx2/Fxau1p9IKrTdUMmBp7htLnMiCCOtfCD+zpF9oLMLHNB31p95BYb3fS9K02md7Za0FD89AlBBXNles+dRfLhEnvvu/QrBEjMOHfx41+95cb5SvnvYOEh6ZOBzMs+YKLFvHwdrq457Q+1wmdZh5arBAI97zX+Nhjn+kKZZ755tAZHdpAUqfxBg7q1/0vQYURE6d+4MO34dunvqM6f9+HLOEzH0G94d+DfJfqJ5MfMhGdG6zsmgM+0RDORzXNKb2P3+ImpPvSGk/uHSx8fb1V4MndbKjtIH4dUVUPJRi2wqDLRz1zZ2/T+bzPzU39JwVf/w3CUTn5P7OTYLNaPAAA","6110d630867e2c8eb9361781f9145eb19f747e3919455e8dfd444d300aa4002c",15450], ["pages/orchestration-runtime/how-to/author-a-plugin/index.md","H4sIAAAAAAAA/71czXIbOZK+8ylyrYglqWEV7R737iw19o5GVndr/KeQ1NO74XC4wCqQRKtYqAFQkumfiD7NeQ593PO8wt73UfwkG5kJoKpIyu2dnd059MjFApAA8vfLzDqA48attAEBddksVTUYXK2UBSNzVUuYN6osLAio5C3kjXV67d+bwe1KGgnKQalupJ2AW0lYi0otpHX4WL6ttXEW3MroZrmCrJALVclzGj5K03Sc8aBcV86oeeOUrvB1CdfSVLIEI0VhJyCqgp4uZSWNcLIAI5fKOrMBtxIO1uJa0rg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p0o2/CHqQsBN3ed7P8i4V0Ih6dqN+bOtkJP3hBTiGIPuS5LRU3a+z7NhdtYiyoGI9zw7RvTjGyi/HpsN/SxoeKEZ77GqtN9H37Hj0Kp5SrhjjbWSI8fAXXnjaHmRlEsBqAIhqI/yDpusG/+DbLuaW4/8oXut9cp5P3xhk8L5H//eTqfnIcPgJ+8k4Wist5OE5t1wndt19gnE8rxutUpQZmxIW5x1l/6eBWT8/vwmazQy00NvqwfIkj1oc+58dNahVosUPsR6+G2YlS3VbqHpD/fnfjI4+APAw7+0OO0iUi6rnhbtrhbYNNWczLDd74fwDzPGMNCGYvnzJ5H5xWyDUw1UhlCMeU7LT5TYExmuhWZXq4IL2h/yxD+sreLPCZBjMQGOkUtmVXRl4UQR1NZUwwxseko9AG9kG/RwMjaDgZX2neQ7PdwMdygrm/04hYa2wj+n6zR37+utdB5g/4Bfc6n7QzxUhHvJnbY7xTgUvWpTQf/DTXJxJQuVgAA","cc313d3122c11c18a45bcfafd5ea00080239a15354ced6ad3efb1821a301d614",22062], diff --git a/packages/mcp/src/publish-assets.generated.ts b/packages/mcp/src/publish-assets.generated.ts index 282e6c7dd7..9a61914a1e 100644 --- a/packages/mcp/src/publish-assets.generated.ts +++ b/packages/mcp/src/publish-assets.generated.ts @@ -306,7 +306,7 @@ export const MCP_EMBEDDED_DOCS_PROVENANCE: 'pages/web-layer/vite/index.md', 'pages/why/index.md', ], - sourceBytes: 3252338, + sourceBytes: 3254220, documentCount: 285, - sha256: '970ddf91e1ed69e0836001645ac30eb79737167b39d2ee88758342fb65019f50', + sha256: 'f95a80adb867a1650b99fd8a13376ba370eb70cc7d4d5a1013e56c56bae0b45f', }; diff --git a/plugins/workers/bin/runtime.ts b/plugins/workers/bin/runtime.ts index b0948bd82c..d456f3d892 100644 --- a/plugins/workers/bin/runtime.ts +++ b/plugins/workers/bin/runtime.ts @@ -7,8 +7,10 @@ // Register Redis/Garnet KV adapter before createWorkersServiceRuntime() calls getKv(). import '@netscript/kv/redis'; import { createQueue } from '@netscript/queue'; +import { deadline } from '@std/async'; + import type { JobMessage } from '@netscript/plugin-workers-core/runtime'; -import { dispatchSeedSample, readSeedSampleRequest } from '../src/runtime/seed-sample.ts'; +import { readSeedSampleRequest, watchSeedSample } from '../src/runtime/seed-sample.ts'; import { getKv } from '@netscript/kv'; import type { ChildHealthMonitor, ChildHealthSnapshot } from '@netscript/plugin/health'; import { createDefaultTaskExecutor } from '@netscript/plugin-workers-core/executor'; @@ -40,6 +42,8 @@ import { createWorkersServiceRuntime } from '../services/src/service-runtime.ts' import { createStreamMutationHook } from '../streams/server.ts'; import { Scheduler, Worker } from '../worker/mod.ts'; +const SEED_WATCH_SHUTDOWN_MS = 2_000; + /** * Register the project's generated jobs into a runtime, failing loudly on a partial load. * @@ -94,7 +98,7 @@ export type StartCombinedProcessOptions = & StartWorkerProcessOptions & StartSchedulerProcessOptions & Readonly<{ - /** Optional app-owned seed marker consumed after job registration, before listening. */ + /** App-owned seed marker consumed after registration, including later seed publications. */ seedHandoff?: URL; /** Startup health monitor owned by generated glue. */ health?: ChildHealthMonitor; @@ -152,33 +156,11 @@ export async function startCombinedProcess( await (await getKv()).get(['netscript', 'child-health', 'workers']); options.health?.dependenciesReady(); const poolRegistry = options.registry ?? generated?.registry; - if (options.seedHandoff) { - const marker = options.seedHandoff; - const kv = await getKv(); - const receiptKey = (seedId: string) => ['workers', 'seed-sample', seedId]; - await dispatchSeedSample({ - readRequest: () => readSeedSampleRequest(marker), - accepted: async (seedId) => (await kv.get(receiptKey(seedId)))?.value === true, - remember: (seedId) => kv.set(receiptKey(seedId), true), - job: async (id) => { - const job = await runtime.jobRegistry.get(id); - const handler = poolRegistry?.get(id); - return job - ? { - enabled: job.enabled, - topic: job.topic, - sample: Boolean(handler && Reflect.get(handler, 'scaffoldSample') === true), - } - : undefined; - }, - enqueue: async (message) => { - const queue = createQueue( - options.queueName ?? Deno.env.get('WORKERS_QUEUE') ?? 'jobs', - ); - await queue.enqueue(message); - }, - }); - } + const seedLifetime = new AbortController(); + const seedSignal = options.signal + ? AbortSignal.any([options.signal, seedLifetime.signal]) + : seedLifetime.signal; + let seedWatch: Promise | undefined; const taskExecutor = createDefaultTaskExecutor(); const scheduler = new Scheduler({ @@ -198,13 +180,50 @@ export async function startCombinedProcess( jobsDir: options.jobsDir ?? Deno.env.get('NETSCRIPT_JOBS_DIR') ?? './workers/jobs', workerPoolOptions: poolRegistry ? { registry: poolRegistry } : undefined, }); - await scheduler.start(); const runtimeHandle = Object.freeze({ scheduler, worker }); const stop = () => { void Promise.all([worker.stop(), scheduler.stop()]).catch(() => options.health?.failed()); }; options.signal?.addEventListener('abort', stop, { once: true }); try { + if (options.seedHandoff) { + const marker = options.seedHandoff; + const kv = await getKv(); + const receiptKey = (seedId: string) => ['workers', 'seed-sample', seedId]; + const ready = Promise.withResolvers(); + seedWatch = watchSeedSample( + marker, + { + readRequest: () => readSeedSampleRequest(marker), + accepted: async (seedId) => (await kv.get(receiptKey(seedId)))?.value === true, + remember: (seedId) => kv.set(receiptKey(seedId), true), + job: async (id) => { + const job = await runtime.jobRegistry.get(id); + const handler = poolRegistry?.get(id); + return job + ? { + enabled: job.enabled, + topic: job.topic, + sample: Boolean(handler && Reflect.get(handler, 'scaffoldSample') === true), + } + : undefined; + }, + enqueue: async (message) => { + const queue = createQueue( + options.queueName ?? Deno.env.get('WORKERS_QUEUE') ?? 'jobs', + ); + await queue.enqueue(message); + }, + }, + seedSignal, + ready.resolve, + ); + // Startup validates existing intent; later optional observer failures are reported. + void seedWatch.catch((error) => console.error('Seed handoff observer stopped.', error)); + await Promise.race([ready.promise, seedWatch]); + } + if (options.signal?.aborted) return runtimeHandle; + await scheduler.start(); options.onStarted?.(async () => { const health = await worker.readHealthStatus(); return { ...health.childHealth, deadLetters: health.deadLetters }; @@ -213,8 +232,15 @@ export async function startCombinedProcess( await worker.start(); return runtimeHandle; } finally { + seedLifetime.abort(); options.signal?.removeEventListener('abort', stop); await Promise.all([worker.stop(), scheduler.stop()]); + if (seedWatch) { + await deadline(seedWatch.catch(() => {}), SEED_WATCH_SHUTDOWN_MS) + .catch((error) => + console.error('Seed observer shutdown exceeded its drain budget.', error) + ); + } } } diff --git a/plugins/workers/src/runtime/seed-sample.ts b/plugins/workers/src/runtime/seed-sample.ts index 8bea491ce1..8645d32663 100644 --- a/plugins/workers/src/runtime/seed-sample.ts +++ b/plugins/workers/src/runtime/seed-sample.ts @@ -1,5 +1,6 @@ import type { JobMessage } from '@netscript/plugin-workers-core/runtime'; import { z } from 'zod'; +import { basename, dirname, fromFileUrl, join, resolve } from '@std/path'; /** Persistent request written by the scaffold seed, independent of runtime availability. */ export const seedSampleSchema: z.ZodObject<{ @@ -56,3 +57,64 @@ export async function readSeedSampleRequest(path: URL): Promise void = () => {}, + reportError: (error: unknown) => void = (error) => + console.error('Seed sample dispatch failed; intent remains pending.', error), +): Promise { + if (signal.aborted) return; + const markerPath = fromFileUrl(path); + let initial = true; + let rearm = true; + while (rearm && !signal.aborted) { + rearm = false; + await Deno.mkdir(dirname(markerPath), { recursive: true }); + const directory = await Deno.realPath(dirname(markerPath)); + const marker = join(directory, basename(markerPath)); + using watcher = Deno.watchFs(directory, { recursive: false }); + const close = () => watcher.close(); + signal.addEventListener('abort', close, { once: true }); + try { + if (signal.aborted) return; + if (initial) { + await dispatchSeedSample(ports); + initial = false; + onReady(); + } else { + await dispatchPublishedSeed(ports, reportError); + } + for await (const event of watcher) { + if (signal.aborted) break; + if ( + event.kind === 'remove' && event.paths.some((changed) => resolve(changed) === directory) + ) { + rearm = true; + break; + } + // Ignore private candidates and receipts; only published intent is consumable. + if (event.paths.some((changed) => resolve(changed) === marker)) { + await dispatchPublishedSeed(ports, reportError); + } + } + } finally { + signal.removeEventListener('abort', close); + } + } +} + +/** Optional sample failures preserve intent without taking down a healthy processor. */ +async function dispatchPublishedSeed( + ports: SeedSamplePorts, + reportError: (error: unknown) => void, +): Promise { + try { + await dispatchSeedSample(ports); + } catch (error) { + reportError(error); + } +} diff --git a/plugins/workers/tests/runtime/seed-sample_test.ts b/plugins/workers/tests/runtime/seed-sample_test.ts index f0c2416c1a..9b2ff2b85f 100644 --- a/plugins/workers/tests/runtime/seed-sample_test.ts +++ b/plugins/workers/tests/runtime/seed-sample_test.ts @@ -1,9 +1,231 @@ import { assert, assertEquals, assertRejects } from '@std/assert'; -import { dispatchSeedSample, type SeedSamplePorts } from '../../src/runtime/seed-sample.ts'; +import { + dispatchSeedSample, + readSeedSampleRequest, + type SeedSamplePorts, + watchSeedSample, +} from '../../src/runtime/seed-sample.ts'; +import { toFileUrl } from '@std/path'; import type { JobDefinition, JobMessage } from '@netscript/plugin-workers-core/runtime'; const seedId = '9023b4e5-7889-4bb8-a8b9-06c1e237eb9a'; +Deno.test('a running worker observes a later atomic seed handoff and stops its watcher on shutdown', async () => { + const root = await Deno.makeTempDir(); + const marker = toFileUrl(`${root}/.netscript/sample-seed.json`); + const controller = new AbortController(); + const ceiling = setTimeout(() => controller.abort(), 10_000); + const ready = Promise.withResolvers(); + const dispatched = Promise.withResolvers(); + const { ports, messages } = fixture(); + const watch = watchSeedSample(marker, { + ...ports, + readRequest: async () => { + const value = await readSeedSampleRequest(marker); + ready.resolve(); + return value; + }, + remember: async (id) => { + await ports.remember(id); + dispatched.resolve(); + }, + }, controller.signal); + try { + await Promise.race([ready.promise, watch]); + assertEquals(messages, []); + const candidate = `${root}/.netscript/sample-seed.pending.tmp`; + await Deno.writeTextFile(candidate, JSON.stringify({ version: 1, seedId })); + await Deno.link(candidate, `${root}/.netscript/sample-seed.json`); + const observed = await Promise.race([ + dispatched.promise.then(() => true), + watch.then(() => false), + ]); + assert(observed, 'An already-running worker missed the published seed handoff'); + assertEquals(messages.length, 1); + assertEquals(messages[0].idempotencyKey, `scaffold-seed:${seedId}`); + } finally { + controller.abort(); + clearTimeout(ceiling); + await watch; + await Deno.remove(root, { recursive: true }); + } +}); + +Deno.test({ + name: 'seed publications through a symlinked workspace reach the running watcher', + ignore: Deno.build.os === 'windows', // Creating symlinks requires an elevated Windows test host. + async fn() { + const root = await Deno.makeTempDir(); + await Deno.mkdir(`${root}/actual`); + await Deno.symlink(`${root}/actual`, `${root}/workspace`); + const marker = toFileUrl(`${root}/workspace/sample-seed.json`); + const controller = new AbortController(); + const ceiling = setTimeout(() => controller.abort(), 10_000); + const ready = Promise.withResolvers(); + const dispatched = Promise.withResolvers(); + const { ports, messages } = fixture(); + const watch = watchSeedSample(marker, { + ...ports, + readRequest: async () => { + const value = await readSeedSampleRequest(marker); + ready.resolve(); + return value; + }, + remember: async (id) => { + await ports.remember(id); + dispatched.resolve(); + }, + }, controller.signal); + try { + await Promise.race([ready.promise, watch]); + await Deno.writeTextFile(marker, JSON.stringify({ version: 1, seedId })); + const observed = await Promise.race([ + dispatched.promise.then(() => true), + watch.then(() => false), + ]); + assert(observed, 'Symlinked workspace seed was missed'); + assertEquals(messages.length, 1); + } finally { + controller.abort(); + clearTimeout(ceiling); + await watch; + await Deno.remove(root, { recursive: true }); + } + }, +}); + +Deno.test('seed watcher consumes existing intent and rejects malformed startup intent', async () => { + const root = await Deno.makeTempDir(); + const marker = toFileUrl(`${root}/sample-seed.json`); + const { ports, messages } = fixture(); + const controller = new AbortController(); + const ceiling = setTimeout(() => controller.abort(), 10_000); + const accepted = Promise.withResolvers(); + const watch = watchSeedSample(marker, { + ...ports, + remember: async (id) => { + await ports.remember(id); + accepted.resolve(); + }, + }, controller.signal); + try { + await Promise.race([accepted.promise, watch]); + controller.abort(); + await watch; + assertEquals(messages.length, 1); + await Deno.writeTextFile(marker, '{"version":99}'); + await assertRejects(() => + watchSeedSample(marker, { + ...ports, + readRequest: () => readSeedSampleRequest(marker), + }, new AbortController().signal) + ); + } finally { + controller.abort(); + clearTimeout(ceiling); + await Deno.remove(root, { recursive: true }); + } +}); + +Deno.test('a failed late dispatch stays pending and a new publication retries without stopping the observer', async () => { + const root = await Deno.makeTempDir(); + const marker = toFileUrl(`${root}/sample-seed.json`); + const controller = new AbortController(); + const ceiling = setTimeout(() => controller.abort(), 10_000); + const ready = Promise.withResolvers(); + const failed = Promise.withResolvers(); + const delivered = Promise.withResolvers(); + const { ports, messages, receipts } = fixture(); + let rejectEnqueue = true; + const errors: unknown[] = []; + const watch = watchSeedSample( + marker, + { + ...ports, + readRequest: () => readSeedSampleRequest(marker), + enqueue: async (message) => { + if (rejectEnqueue) throw new Error('transient queue failure'); + await ports.enqueue(message); + }, + remember: async (id) => { + await ports.remember(id); + delivered.resolve(); + }, + }, + controller.signal, + ready.resolve, + (error) => { + errors.push(error); + failed.resolve(); + }, + ); + try { + await Promise.race([ready.promise, watch]); + const request = JSON.stringify({ version: 1, seedId }); + await Deno.writeTextFile(marker, request); + assert(await Promise.race([failed.promise.then(() => true), watch.then(() => false)])); + assertEquals(receipts.size, 0); + rejectEnqueue = false; + await Deno.writeTextFile(marker, request); + assert(await Promise.race([delivered.promise.then(() => true), watch.then(() => false)])); + assertEquals(messages.length, 1); + assertEquals(receipts.size, 1); + assert(errors.length >= 1); + } finally { + controller.abort(); + clearTimeout(ceiling); + await watch; + await Deno.remove(root, { recursive: true }); + } +}); + +Deno.test('seed watcher rearms after its parent directory is removed', async () => { + const root = await Deno.makeTempDir(); + const directory = `${root}/.netscript`; + const marker = toFileUrl(`${directory}/sample-seed.json`); + const controller = new AbortController(); + const ceiling = setTimeout(() => controller.abort(), 10_000); + const ready = Promise.withResolvers(); + const delivered = Promise.withResolvers(); + const { ports, messages } = fixture(); + const watch = watchSeedSample( + marker, + { + ...ports, + readRequest: () => readSeedSampleRequest(marker), + remember: async (id) => { + await ports.remember(id); + delivered.resolve(); + }, + }, + controller.signal, + ready.resolve, + ); + using changes = Deno.watchFs(root, { recursive: false }); + const close = () => changes.close(); + controller.signal.addEventListener('abort', close, { once: true }); + try { + await Promise.race([ready.promise, watch]); + await Deno.remove(directory, { recursive: true }); + const recreated = (async () => { + for await (const event of changes) { + if (event.kind === 'create' && event.paths.includes(directory)) return true; + } + return false; + })(); + assert(await Promise.race([recreated, watch.then(() => false)])); + await Deno.writeTextFile(marker, JSON.stringify({ version: 1, seedId })); + assert(await Promise.race([delivered.promise.then(() => true), watch.then(() => false)])); + assertEquals(messages.length, 1); + } finally { + controller.abort(); + controller.signal.removeEventListener('abort', close); + clearTimeout(ceiling); + await watch; + await Deno.remove(root, { recursive: true }); + } +}); + function fixture() { const messages: JobMessage[] = []; const receipts = new Set();