Cheap performance wins, partial: compile the CLI with bytecode, answer a push before its Answer Workflow is admitted, read a listing's postures and descriptions at once, warm the web's dev server, and keep a project's header a minute between tabs
Before adoption: this commit came in with the history the project adopted, so no landing records it.
The CLI binary is compiled with --bytecode --format=esm, so a start skips parsing the whole bundle: at a load of ~45, --version 139 -> 49 ms, --help 135 -> 48 ms and the agent hook 147 -> 50 ms (medians of 15), with --help, the hook, a local `check` that unpacks the embedded sdk, and the OpenTUI screen of `today --tui` giving the same output; the binary grows 100.7 -> 112.2 MB. The barrel import of @effect/platform-bun stays: the package exports no subpaths. A Project DO answers a push before the Answer Workflow is created: an answer's start row runs through the new `Background` port (default inline, so every test sees it done when the call returns; the DO's adapter forks a detached fiber of its own runtime and hands its end to waitUntil). The row stays in the store until the start returns, in-flight ids are skipped by a settle meanwhile and by the alarm, a failed start is logged and tried again with backoff, and the row is acked once, pinned by a new Project DO test. Not measured on a stage. `withProjectFacts` reads a listing's standing postures and descriptions with Effect.all at concurrency 2, for the platform's listProjects and the web's dev world alike. The platform's `/` already answers `public, max-age=60`; `s-maxage` was not added, as the web's cache-headers.ts refuses it with its reason. The web's dev server warms src/server.ts and the routes: at a load of 50-60, the first project page went 24.5 s -> 5.6 s (measured once each; the earlier run at lower load took 10.8 s without the warmup). The project layout's header loader gets staleTime 60 s, so a move between tabs within a minute reads the six facts again no more; a cold entry at a new proposal then a tab within a minute shows no header until the next read (noted in route.tsx). The overview's watch({ since: 0 }) is left as is: the whole log feeds askStates, recentLandings and the stamps, so a bound would change the page.
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Partial: `bun run fix` is clean; after the last lint-driven edits the touched suites and `bun run typecheck` were not run again (before them: packages/project, apps/platform, apps/cli version and packages/config release tests passed).
Diff stats
15 files+389 added−29 removed
- tests:+179 added−1 removed
- other:+210 added−28 removed
Provenance
- Commit
9a3d263- Tree
adec613- Author
oscabriel <oscarhernandeziv@gmail.com>- Committer
oscabriel <oscarhernandeziv@gmail.com>- Parent
07f14ad
15 files changed+389 added−29 removed
modified:apps/cli/test/version.test.ts+2 added
114 unmodified linesExpand all11511611711811912012112212312439 unmodified lines114 unmodified linesExpand all }) ).toStrictEqual([ "build", "--compile", "--bytecode", "--format=esm", "--minify", "--define", 'import.meta.env.CLI_BUILD_VERSION="9.9.9-test"', "--target=bun-linux-x64",39 unmodified linesmodified:apps/cli/build.ts+4 added
38 unmodified lines39 readonly version: string;40 }) => [41 "build",42 "--compile",43+ // Bytecode: the binary starts by loading its bundle, and a bytecode cache44+ // skips the parse of the whole bundle each start. ESM is what bytecode takes.45+ "--bytecode",46+ "--format=esm",47 "--minify",48 ...Object.entries(versionDefine(input.version)).flatMap(([key, value]) => [49 "--define",50 `${key}=${value}`,362 unmodified linesadded:apps/platform/src/adapters/background.ts+19 added
12345678910111213141516171819import { Background } from "@repo/project/background";import { Effect, Fiber, Layer } from "effect";
/** `DurableObjectState.waitUntil`, which takes a `Promise<any>`. */export interface BackgroundHost { readonly waitUntil: (promise: Promise<unknown>) => void;}
/** * A fiber of the DO's own runtime, which lives on past the call that forked * it; `waitUntil` names the fiber's end to the runtime as the call's own work. */export const DoBackground = (host: BackgroundHost) => Layer.succeed(Background, { run: (work) => Effect.map(Effect.forkDetach(work), (fiber) => { host.waitUntil(Effect.runPromise(Fiber.await(fiber))); }), });modified:apps/platform/src/handlers.ts+4 added-5 removed
10 unmodified lines11 whyOf,12 } from "@repo/project/code";13 import type { CodeProject } from "@repo/project/code";14 import { envSchemaMethod } from "@repo/project/deciders";15-import { landedProjectOf, withDescriptions } from "@repo/project/description";15+import { landedProjectOf } from "@repo/project/description";16 import { FrontPage } from "@repo/project/front-page";17+import { withProjectFacts } from "@repo/project/listing";18 import { GatewayUrl } from "@repo/project/project";19 import type { ProjectApi } from "@repo/project/project";20 import { Projects } from "@repo/project/projects";20-import { withStandingPosture } from "@repo/project/standing-posture";21 import { Contracts, EnvSchemaOf } from "@repo/protocol/contracts";22 import type { AnswerView } from "@repo/protocol/domain/answer";23 import type { ClaimView } from "@repo/protocol/domain/claim";24 import type { Decision, Today } from "@repo/protocol/domain/decision";249 unmodified lines274 listPaths: ({ at, project }) =>275 code(project, (of) => pathsOf(of, Option.fromUndefinedOr(at))),276 listProjects: () =>277 frontPage.projects().pipe(278- Effect.flatMap(withStandingPosture),279- Effect.provideService(Projects, projects),278 Effect.flatMap((listed) =>281- withDescriptions(listed, (project) =>279+ withProjectFacts(listed, (project) =>280 Effect.map(projects.get(project), (api) =>281 landedProjectOf(api, project)282 )283 )284 ),285+ Effect.provideService(Projects, projects),286 Effect.provideService(RepoHost, host),287 Effect.map((listed) => ({ projects: listed }))288 ),289 listRefs: ({ project }) => code(project, refsOf),112 unmodified linesmodified:apps/platform/src/project-do.ts+14 added-1 removed
7 unmodified lines8 9 import { DoAlarms } from "./adapters/alarms.ts";10 import type { AlarmStorage } from "./adapters/alarms.ts";11 import { AnswerRunsWorkflow } from "./adapters/answer-runs-workflow.ts";12+import { DoBackground } from "./adapters/background.ts";13+import type { BackgroundHost } from "./adapters/background.ts";14 import { decodeEnv } from "./platform.ts";15 import type { InvalidEnv, PlatformConfig } from "./platform.ts";16 import { telemetryOf, workerPorts } from "./ports.ts";17 import type { CallRequest, ExitEncoded } from "./project-calls.ts";14 unmodified lines32 );33 34 export const doPorts = (input: {35 readonly config: PlatformConfig;36+ readonly host: BackgroundHost;37 readonly storage: AlarmStorage;38 readonly name: Option.Option<ProjectName>;39 }) =>40 Layer.mergeAll(41 workerPorts(input.config),42 DoAlarms(input.storage),43+ DoBackground(input.host),44 Option.match(input.name, {45 onNone: () => Nameless,46 onSome: (project) => AnswerRunsWorkflow(input.config.ANSWER, project),47 }),12 unmodified lines60 return Layer.effect(61 Shell,62 projectShell({63 name: Option.getOrUndefined(name),60- ports: doPorts({ config, name, storage: ctx.storage }),64+ ports: doPorts({65+ config,66+ host: {67+ waitUntil: (promise) => {68+ ctx.waitUntil(promise);69+ },70+ },71+ name,72+ storage: ctx.storage,73+ }),74 // The storage itself, not `storage.sql`: transactions run through it.75 sql: SqliteClient.layer({ storage: ctx.storage }),76 })77 ).pipe(Layer.provideMerge(telemetryOf(config)));63 unmodified linesmodified:apps/platform/test/project-do.test.ts+91 added-1 removed
4 unmodified lines5 import { RequestId } from "@repo/protocol/ids";6 import { UnknownProject } from "@repo/protocol/refusal";7 import { advanceTo, at } from "@repo/testkit/clock";8 import { untouchable } from "@repo/testkit/untouchable";9-import { Context, DateTime, Effect, Layer, Option } from "effect";9+import { Context, DateTime, Deferred, Effect, Layer, Option } from "effect";10 11 import { AnswerRunsWorkflow } from "../src/adapters/answer-runs-workflow.ts";12+import type { AnswerWorkflow } from "../src/adapters/answer-runs-workflow.ts";13+import { DoBackground } from "../src/adapters/background.ts";14 import { decodeEnv } from "../src/platform.ts";15 import { doPorts, Project } from "../src/project-do.ts";16 import { generate } from "../src/workflows/generated.ts";17 import { fakeEnv } from "./fake-env.ts";109 unmodified lines127 }).pipe(Effect.provide(world))128 );129 130 it.effect(131+ "answers a push before the Answer Workflow is admitted: the start's row stays until the start returns, an alarm meanwhile starts nothing, and the row is acked once",132+ () =>133+ Effect.gen(function* () {134+ yield* advanceTo(noon);135+136+ const admitted = yield* Deferred.make<undefined>();137+ const { instances, workflow } = answerWorkflow();138+ const pending: Promise<unknown>[] = [];139+140+ // Admission takes as long as the test says, as a Workflow's does.141+ const slow: AnswerWorkflow = {142+ ...workflow,143+ create: (input) =>144+ Effect.runPromise(145+ Effect.andThen(Deferred.await(admitted), () =>146+ Effect.promise(() => workflow.create(input))147+ )148+ ),149+ };150+151+ const host = {152+ waitUntil: (promise: Promise<unknown>) => {153+ pending.push(promise);154+ },155+ };156+157+ const shell = yield* shellOver(":memory:").pipe(158+ Effect.provide(159+ Layer.mergeAll(160+ AnswerRunsWorkflow(slow, project),161+ Layer.succeed(Instances, instances),162+ DoBackground(host)163+ )164+ )165+ );166+167+ const call = through(shell);168+ const { landed } = yield* opening(call);169+170+ yield* call("claim", [bob, parseIso]);171+172+ const head = yield* Pusher.use((git) =>173+ git.push(forkOf(bob), Option.some(landed), fixedFiles)174+ );175+176+ const requestId = RequestId.make("req-fix0002");177+ const answer = { ask: parseIso, base: landed, head, requestId };178+ const receipt = yield* call("submitAnswer", [bob, answer]);179+180+ // The push is answered while the Workflow's admission is still awaited.181+ const answered = {182+ outcome: receipt.outcome._tag,183+ pending: pending.length,184+ tries: yield* instances.tries,185+ };186+187+ yield* shell.alarm();188+189+ const alarmed = yield* instances.tries;190+191+ yield* Deferred.succeed(admitted);192+ yield* Effect.promise(() => Promise.all(pending));193+194+ const made = yield* instances.made;195+196+ yield* shell.alarm();197+198+ const replay = yield* call("submitAnswer", [bob, answer]);199+200+ expect(answered).toStrictEqual({201+ outcome: "Checking",202+ pending: 1,203+ tries: 0,204+ });205+ expect(alarmed).toBe(0);206+ expect(made).toStrictEqual([207+ { id: requestId, params: { project, requestId } },208+ ]);209+ expect(replay).toStrictEqual(receipt);210+ expect({211+ restarts: yield* instances.restarts,212+ tries: yield* instances.tries,213+ }).toStrictEqual({ restarts: [], tries: 1 });214+ }).pipe(Effect.provide(world))215+ );216+217+ it.effect(218 "takes a nameless DO's name from the project its storage holds, and dies with neither",219 () =>220 Effect.gen(function* () {221 yield* advanceTo(noon);122 unmodified lines344 345 const ports = yield* Layer.build(346 doPorts({347 config,348+ host: untouchable("host"),349 name: Option.some(project),350 storage: untouchable("storage"),351 })352 );5 unmodified linesmodified:apps/web/src/dev/handlers.ts+4 added-5 removed
9 unmodified lines10 treeOf,11 whyOf,12 } from "@repo/project/code";13 import type { CodeProject } from "@repo/project/code";14-import { landedProjectOf, withDescriptions } from "@repo/project/description";14+import { landedProjectOf } from "@repo/project/description";15 import { FrontPage } from "@repo/project/front-page";16+import { withProjectFacts } from "@repo/project/listing";17 import type { ProjectApi } from "@repo/project/project";18 import { Projects } from "@repo/project/projects";18-import { withStandingPosture } from "@repo/project/standing-posture";19 import { Contracts, EnvSchemaOf } from "@repo/protocol/contracts";20 import type { AnswerView } from "@repo/protocol/domain/answer";21 import type { ClaimView } from "@repo/protocol/domain/claim";22 import type { Decision, Today } from "@repo/protocol/domain/decision";222 unmodified lines245 listPaths: ({ at, project }) =>246 code(project, (of) => pathsOf(of, Option.fromUndefinedOr(at))),247 listProjects: () =>248 frontPage.projects().pipe(249- Effect.flatMap(withStandingPosture),250- Effect.provideService(Projects, projects),249 Effect.flatMap((listed) =>252- withDescriptions(listed, (project) =>250+ withProjectFacts(listed, (project) =>251 Effect.map(projects.get(project), (api) =>252 landedProjectOf(api, project)253 )254 )255 ),256+ Effect.provideService(Projects, projects),257 Effect.provideService(RepoHost, host),258 Effect.map((listed) => ({ projects: listed }))259 ),260 listRefs: ({ project }) => code(project, refsOf),112 unmodified linesmodified:apps/web/src/routes/$owner/$project/route.tsx+10 added
127 unmodified lines128 </ProjectFrame>129 );130 };131 132+/**133+ * How long the header's facts stand before a move between the project's pages134+ * reads them again: without it the router reads the six facts on every move.135+ * A reader who enters at a page with no header of its own (a new proposal)136+ * and moves to a tab within this time sees the frame without a header until137+ * the next read.138+ */139+export const HEADER_STALE_MS = 60_000;140+141 // One header for every page of a project, and the page's side column (`staticData.column`) under it, so both142 // stay mounted as the reader moves between the project's pages.143 export const Route = createFileRoute("/$owner/$project")({144 staticData: { shell: "project" },145 params: projectParams,146 loader: headerLoader((project) => projectHeader({ data: project })),147+ staleTime: HEADER_STALE_MS,148 component: ProjectLayout,149 });modified:apps/web/vite.config.ts+9 added-1 removed
93 unmodified lines94 // The Worker's own code is minified like the browser's: about a third95 // of its bytes. Its source maps go up with each deploy96 // (`upload_source_maps` in wrangler.jsonc), so a stack trace in the97 // Worker's logs still names the source.98- environments: { ssr: { build: { minify: true, sourcemap: true } } },98+ environments: {99+ ssr: {100+ build: { minify: true, sourcemap: true },101+ // The first page waited on Vite transforming the Worker's modules on102+ // demand (ten to twenty-five seconds, by the machine's load);103+ // transformed as the dev server starts, it waits on a fraction.104+ dev: { warmup: ["./src/server.ts", "./src/routes/**/*.tsx"] },105+ },106+ },107 };108 });added:packages/project/src/background.ts+18 added
1+import { Context } from "effect";2+import type { Effect } from "effect";3+4+export interface BackgroundApi {5+ /** Runs the work, which a call asked for, once the call can answer. */6+ readonly run: (work: Effect.Effect<void>) => Effect.Effect<void>;7+}8+9+/**10+ * The start of an answer run waits on a Workflow's admission, which a push's11+ * reply need not: a host that lives on past a call (a Durable Object) runs it12+ * in a fiber of its own. The default runs the work inline, so the start is13+ * done when the call returns.14+ */15+export const Background = Context.Reference<BackgroundApi>(16+ "project/Background",17+ { defaultValue: () => ({ run: (work) => work }) }18+);added:packages/project/src/listing.ts+30 added
1+import type { RepoHost } from "@repo/artifacts/repo-host";2+import type { ProjectListing } from "@repo/protocol/domain/front-page";3+import type { ProjectName } from "@repo/protocol/ids";4+import { Array as Arr, Effect } from "effect";5+6+import { withDescriptions } from "./description.ts";7+import type { LandedProject } from "./description.ts";8+import type { Projects } from "./projects.ts";9+import { withStandingPosture } from "./standing-posture.ts";10+11+/**12+ * A listing with each project's own posture and its description: two reads,13+ * each of its own kept record and then of the projects it finds stale, made14+ * at once, since neither waits on the other's answer.15+ */16+export const withProjectFacts = <E>(17+ listed: readonly ProjectListing[],18+ landedOf: (project: ProjectName) => Effect.Effect<LandedProject, E>19+): Effect.Effect<readonly ProjectListing[], never, Projects | RepoHost> =>20+ Effect.map(21+ Effect.all(22+ [withStandingPosture(listed), withDescriptions(listed, landedOf)],23+ { concurrency: 2 }24+ ),25+ ([postured, described]) =>26+ Arr.zipWith(described, postured, (listing, { posture }) => ({27+ ...listing,28+ posture,29+ }))30+ );modified:packages/project/src/outbox.ts+7 added-1 removed
126 unmodified lines127 readonly done: readonly string[];128 readonly retry: readonly OutboxRow[];129 }130 131+/** The row tried again later, with the next backoff. */131-const later = (row: OutboxRow, now: DateTime.Utc): OutboxRow => ({132+export const later = (row: OutboxRow, now: DateTime.Utc): OutboxRow => ({133 ...row,134 attempts: row.attempts + 1,135 notBefore: DateTime.addDuration(now, backoff(row.attempts)),136 });137 138+const START: OutboxBody["_tag"] = "StartAnswer";139+140+/** An answer's start, which runs once the call that wrote it can answer (see `Background`). */141+export const isStart = (row: OutboxRow) => row.kind === START;142+143 interface Decoded {144 readonly body: OutboxBody;145 readonly row: OutboxRow;146 }148 unmodified linesmodified:packages/project/src/project.ts+89 added-15 removed
193 unmodified lines194 import { isStep } from "./answer-runs/steps.ts";195 import { openDecision } from "./attention/decisions.ts";196 import { recordOf } from "./attention/record.ts";197 import { capFor, capped, mayClaim, standing } from "./attention/vouch.ts";198+import { Background } from "./background.ts";199 import {200 ClaimCommand,201 ClaimEffect,202 ClaimState,66 unmodified lines269 splitFamily,270 } from "./migrate.ts";271 import {272 isDue,273+ isStart,274+ later,275 measuredRow,276 outboxRow,277 OutboxBody,278 projectedRows,1567 unmodified lines1846 const visibility = yield* ProjectVisibility;1847 const envPort = yield* ProjectEnv;1848 const draftRuns = yield* DraftRuns;1849 const metrics = yield* Metrics;1850+ const background = yield* Background;1851 const lock = yield* Semaphore.make(1);1852 const repo = RepoName.make(keyOf(name));1853 1854 const withPorts = <A, E>(effect: Effect.Effect<A, E, ProjectPorts>) =>254 unmodified lines2109 2110 return outbox;2111 });2112 2113+ // An answer's start runs in the background (see `Background`): its row2114+ // stays in the store until the start returns, so a settle meanwhile (the2115+ // alarm's, or one the start itself makes) skips it, and a shell that lost2116+ // the fiber runs the row again, which the run's id dedupes.2117+ const starting = yield* Ref.make<ReadonlySet<string>>(new Set());2118+2119+ const notStarting = (rows: readonly OutboxRow[]) =>2120+ Effect.map(Ref.get(starting), (ids) =>2121+ rows.filter((row) => !ids.has(row.id))2122+ );2123+2124 const armAlarm = Effect.gen(function* () {2125 const h = yield* hydrate;2126+ const outbox = yield* notStarting(h.outbox);2127 2128 const deadlines = [2129 ...h.claims.flatMap(({ state }) => Option.toArray(deadlineOf(state))),2130 ...deciderDeadlines(h),2115- ...h.outbox.map(({ notBefore }) => notBefore),2131+ ...outbox.map(({ notBefore }) => notBefore),2132 ];2133 2134 if (Array.isReadonlyArrayNonEmpty(deadlines)) {2135 yield* alarms.set(Array.min(deadlines, DateTime.Order));2136 }2137 });2138 2139+ const runRows = (2140+ queue: AnswerQueue,2141+ rows: Array.NonEmptyReadonlyArray<OutboxRow>,2142+ now: DateTime.Utc2143+ ) =>2144+ Effect.gen(function* () {2145+ const ran = yield* withPorts(2146+ runOutbox(rows, queue, now, store.ackOutbox)2147+ ).pipe(2148+ Effect.provideService(DraftRuns, draftRuns),2149+ Effect.provideService(Metrics, metrics)2150+ );2151+2152+ yield* store.ackOutbox(ran.done);2153+2154+ if (Array.isReadonlyArrayNonEmpty(ran.retry)) {2155+ yield* lock.withPermits(1)(store.commit({ outbox: ran.retry }));2156+ }2157+ });2158+2159+ const startLater = (2160+ queue: AnswerQueue,2161+ row: OutboxRow,2162+ now: DateTime.Utc2163+ ) =>2164+ runRows(queue, [row], now).pipe(2165+ Effect.catchCause((cause) =>2166+ Cause.hasInterruptsOnly(cause)2167+ ? Effect.interrupt2168+ : Effect.logWarning(2169+ "the answer's start failed: it is tried again",2170+ cause2171+ ).pipe(2172+ Effect.andThen(2173+ lock.withPermits(1)(2174+ store.commit({ outbox: [later(row, now)] })2175+ )2176+ )2177+ )2178+ ),2179+ Effect.ensuring(2180+ Ref.update(2181+ starting,2182+ (ids) => new Set([...ids].filter((id) => id !== row.id))2183+ )2184+ ),2185+ Effect.andThen(armAlarm)2186+ );2187+2188 const settle = (queue: AnswerQueue, rows: readonly OutboxRow[]) =>2189 Effect.gen(function* () {2190 const now = yield* DateTime.now;2191 2192+ const due = yield* notStarting(2127- const due = Array.dedupeWith(2128- rows.filter((row) => isDue(row, now)),2129- (one, other) => one.id === other.id2193+ Array.dedupeWith(2194+ rows.filter((row) => isDue(row, now)),2195+ (one, other) => one.id === other.id2196+ )2197 );2198 2132- if (Array.isReadonlyArrayNonEmpty(due)) {2133- const ran = yield* withPorts(2134- runOutbox(due, queue, now, store.ackOutbox)2135- ).pipe(2136- Effect.provideService(DraftRuns, draftRuns),2137- Effect.provideService(Metrics, metrics)2138- );2199+ const settled = due.filter((row) => !isStart(row));2200 2140- yield* store.ackOutbox(ran.done);2201+ if (Array.isReadonlyArrayNonEmpty(settled)) {2202+ yield* runRows(queue, settled, now);2203+ }2204 2142- if (Array.isReadonlyArrayNonEmpty(ran.retry)) {2143- yield* lock.withPermits(1)(store.commit({ outbox: ran.retry }));2144- }2205+ // Answer runs go last: they may run long, and settle their own rows.2206+ const starts = due.filter(isStart);2207+2208+ if (Array.isReadonlyArrayNonEmpty(starts)) {2209+ yield* Ref.update(2210+ starting,2211+ (ids) => new Set([...ids, ...starts.map(({ id }) => id)])2212+ );2213+2214+ yield* Effect.forEach(2215+ starts,2216+ (row) => background.run(startLater(queue, row, now)),2217+ { discard: true }2218+ );2219 }2220 2221 yield* armAlarm;2222 });3375 unmodified linesadded:packages/project/test/listing.test.ts+86 added
1+import { describe, expect, it } from "@effect/vitest";2+import { RepoHost } from "@repo/artifacts/repo-host";3+import type { ProjectListing } from "@repo/protocol/domain/front-page";4+import { ProjectName } from "@repo/protocol/ids";5+import { untouchable } from "@repo/testkit/untouchable";6+import {7+ DateTime,8+ Deferred,9+ Duration,10+ Effect,11+ Fiber,12+ Layer,13+ Logger,14+ Ref,15+} from "effect";16+import { TestClock } from "effect/testing";17+18+import { withProjectFacts } from "../src/listing.ts";19+import type { ProjectApi } from "../src/project.ts";20+import { Projects } from "../src/projects.ts";21+22+const datekit = ProjectName.make("alice/datekit");23+24+const landedAt = DateTime.makeUnsafe("2026-10-08T12:00:00Z");25+26+describe(withProjectFacts, () => {27+ it.effect(28+ "reads each project's posture and its description at once: neither read waits on the other's answer",29+ () =>30+ Effect.gen(function* () {31+ const described = yield* Deferred.make<undefined>();32+ const steps = yield* Ref.make<readonly string[]>([]);33+34+ const seen = (step: string) =>35+ Ref.update(steps, (before) => [...before, step]);36+37+ // The posture's read ends only once the description's has begun: one38+ // read after the other would wait forever.39+ const api = untouchable<ProjectApi>("ProjectApi", {40+ standing: () =>41+ seen("posture").pipe(42+ Effect.andThen(Deferred.await(described)),43+ Effect.as({ posture: "open" as const, seen: 1 })44+ ),45+ });46+47+ const projects = Layer.succeed(48+ Projects,49+ Projects.of({50+ create: () => Effect.die("a listing makes no project"),51+ get: () => Effect.succeed(api),52+ })53+ );54+55+ const listed: readonly ProjectListing[] = [56+ { landedAt, openAsks: 2, posture: "openCore", project: datekit },57+ ];58+59+ const facts = withProjectFacts(listed, () =>60+ seen("description").pipe(61+ Effect.andThen(Deferred.succeed(described)),62+ Effect.andThen(Effect.fail("the repo is not read here"))63+ )64+ ).pipe(65+ Effect.timeout(Duration.seconds(5)),66+ Effect.provide(projects),67+ Effect.provideService(RepoHost, untouchable("RepoHost")),68+ Effect.provide(Logger.layer([]))69+ );70+71+ const fiber = yield* Effect.forkChild(facts);72+73+ yield* TestClock.adjust(Duration.seconds(10));74+75+ const result = yield* Fiber.join(fiber);76+77+ expect((yield* Ref.get(steps)).toSorted()).toStrictEqual([78+ "description",79+ "posture",80+ ]);81+ expect(result).toStrictEqual([82+ { landedAt, openAsks: 2, posture: "open", project: datekit },83+ ]);84+ })85+ );86+});modified:packages/project/package.json+2 added
3 unmodified lines4 "type": "module",5 "exports": {6 "./claim": "./src/claim.ts",7 "./landing": "./src/landing.ts",8+ "./listing": "./src/listing.ts",9 "./project-store": "./src/project-store.ts",10 "./project-store/rows": "./src/project-store/rows.ts",11 "./project-store/memory": "./src/project-store/memory.ts",12 "./project-store/sqlite": "./src/project-store/sqlite.ts",5 unmodified lines18 "./project": "./src/project.ts",19 "./alarms": "./src/alarms.ts",20 "./alarms/memory": "./src/alarms/memory.ts",21 "./answer-runs": "./src/answer-runs.ts",22+ "./background": "./src/background.ts",23 "./answer-runs/inline": "./src/answer-runs/inline.ts",24 "./projection": "./src/projection.ts",25 "./projection/memory": "./src/projection/memory.ts",26 "./front-page": "./src/front-page.ts",33 unmodified lines