Skip to content
Myr

project-store.contract.ts

This file

Path

packages/project/test/project-store.contract.ts

774 lines · 22.9 KiB · TypeScript

Last changed by

Merge observability into mainoscabrielbefore adoption1985111

History of this file

Take it

1import { describe, expect, it } from "@effect/vitest";2import { CheckSpec } from "@repo/protocol/domain/check";3import { DecisionSubject } from "@repo/protocol/domain/decision";4import { ProjectEvent } from "@repo/protocol/domain/event";5import { LedgerEntry } from "@repo/protocol/domain/visibility";6import {7  AskId,8  CommitSha,9  Handle,10  LayerName,11  ProposalId,12  RepoPath,13} from "@repo/protocol/ids";14import { DateTime, Effect, Exit, Option, Schema, Struct } from "effect";15import type { Layer } from "effect";1617import type { ProjectEventInput } from "../src/events.ts";18import { ProjectStore } from "../src/project-store.ts";19import type { ProjectWrites } from "../src/project-store.ts";20import {21  AnswerRow,22  AskRow,23  AttemptRow,24  BudgetDayRow,25  ClaimRow,26  DecisionRow,27  EnvValueRow,28  LandingRow,29  LayerReadRow,30  LayerRow,31  LedgerRow,32  OutboxRow,33  ProjectRow,34  ProposalRow,35  PushEventRow,36  RatchetRow,37} from "../src/project-store/rows.ts";3839// Rows are written here encoded, as the store keeps them, and decoded once;40// a snapshot is compared encoded, so every field reads back as written.4142const at = (minute: number) =>43  `2026-10-07T12:${String(minute).padStart(2, "0")}:00.000Z`;4445const sha = (n: number) => n.toString(16).padStart(40, "0");4647const decoded = <A, I>(schema: Schema.Codec<A, I>, value: NoInfer<I>): A =>48  Schema.decodeSync(schema)(value);4950const decodedAll = <A, I>(51  schema: Schema.Codec<A, I>,52  values: readonly NoInfer<I>[]53) => values.map((value) => decoded(schema, value));5455const json = (text: string) =>56  Schema.decodeSync(Schema.fromJsonString(Schema.Json))(text);5758const askOf = (id: string) =>59  ({60    askedBy: "alice",61    blockedBy: [],62    brief: { want: "An empty date string is refused, not parsed as today" },63    check: CheckSpec.cases.RedThenGreen.make({64      path: RepoPath.make("test/parse.test.ts"),65    }),66    file: `asks/${id}.ask.ts`,67    id,68    kind: "fix",69    openedAt: at(0),70    openedIn: sha(1),71    project: "alice/datekit",72    state: "open",73    territory: { module: "core", paths: ["packages/core/**"] },74  }) satisfies (typeof AskRow)["Encoded"];7576const project = {77  createdAt: at(0),78  initializer: "alice",79  landed: sha(1),80  policy: { budget: { decisionsPerDay: 5 } },81  policyAt: sha(1),82  project: "alice/datekit",83  state: "live",84} satisfies (typeof ProjectRow)["Encoded"];8586const askA = askOf("empty-date");8788const askB = askOf("leap-day");8990// A lifecycle state's JSON with its keys out of order: the store keeps it91// byte for byte, since the service decodes it with the lifecycle's schema.92const claimState =93  '{"_tag":"Live","warnsAt":"2026-10-07T14:00:00.000Z","base":"0000000000000000000000000000000000000001"}';9495const answerState = '{"_tag":"Queued","requestId":"req-00000001"}';9697const claim = {98  ask: "empty-date",99  claimant: "bob",100  state: json(claimState),101  updatedAt: at(1),102} satisfies (typeof ClaimRow)["Encoded"];103104const answerOf = (state: Schema.Json) =>105  ({106    answerer: "bob",107    ask: "empty-date",108    head: sha(2),109    requestId: "req-00000001",110    state,111    updatedAt: at(2),112  }) satisfies (typeof AnswerRow)["Encoded"];113114const answer = answerOf(json(answerState));115116const queue = { active: "req-00000001", order: ["req-00000001"] };117118const outboxOf = (id: string) =>119  ({120    attempts: 0,121    body: { fork: "alice__datekit--empty-date--bob" },122    id,123    kind: "makeFork",124    notBefore: at(1),125  }) satisfies (typeof OutboxRow)["Encoded"];126127const firstOutbox = outboxOf("out-1");128129const secondOutbox = outboxOf("out-2");130131const landingOf = (n: number) =>132  ({133    assisted: [],134    author: "bob",135    credits: [{ handle: "alice", role: "Asked-by" }],136    landedAt: at(n),137    parent: sha(n),138    project: "alice/datekit",139    sha: sha(n + 1),140  }) satisfies (typeof LandingRow)["Encoded"];141142const proposal = {143  expiresAt: at(30),144  files: ["asks/time-zones.ask.ts"],145  id: "prop-000001",146  openedAt: at(3),147  project: "alice/datekit",148  proposer: "carol",149  state: "open",150  want: "Dates keep their time zone when formatted",151} satisfies (typeof ProposalRow)["Encoded"];152153const decision = {154  deciders: ["alice"],155  default: "decline",156  evidence: [{ label: "proposer", value: "carol" }],157  expiresAt: at(30),158  id: "dec-000001",159  openedAt: at(3),160  project: "alice/datekit",161  subject: DecisionSubject.cases.OpenProposal.make({162    proposal: ProposalId.make("prop-000001"),163  }),164} satisfies (typeof DecisionRow)["Encoded"];165166const budgetDay = {167  day: "2026-10-07",168  decider: "alice",169  finishes: 0,170  used: 1,171} satisfies (typeof BudgetDayRow)["Encoded"];172173const ratchet = {174  at: sha(1),175  count: 12,176  ratchet: "anyCount",177  territory: "packages/core",178} satisfies (typeof RatchetRow)["Encoded"];179180const pushEventOf = (eventId: string) =>181  ({182    after: sha(3),183    at: at(4),184    before: sha(2),185    eventId,186    ref: "refs/heads/main",187    repo: "alice__datekit--empty-date--bob",188  }) satisfies (typeof PushEventRow)["Encoded"];189190const declared = {191  admittedAt: at(6),192  landedSha: sha(7),193  name: "maintainers",194  repo: "alice__datekit--maintainers",195  saltRef: "c2FsdA==",196  suiteRoot: `sha256:${"ab".repeat(32)}`,197} satisfies (typeof LayerRow)["Encoded"];198199const proposedLayer = {200  name: "security",201  proposed: sha(8),202  repo: "alice__datekit--security",203} satisfies (typeof LayerRow)["Encoded"];204205const attempt = {206  area: "export",207  ask: "empty-date",208  claimant: "bob",209  count: 1,210  week: "2026-W41",211} satisfies (typeof AttemptRow)["Encoded"];212213const ledgerEntryOf = (seq: number) =>214  Schema.encodeSync(LedgerEntry)(215    LedgerEntry.cases.LayerDeclared.make({216      at: DateTime.makeUnsafe(at(seq)),217      disclose: "sealed",218      kinds: ["checks"],219      layer: LayerName.make("maintainers"),220      seq,221    })222  ) satisfies (typeof LedgerRow)["Encoded"];223224const envValue = {225  key: "SENTRY_AUTH_TOKEN",226  sealed: { ciphertext: "Y2lwaGVy", iv: "aXY=", keyVersion: 1 },227  setAt: at(9),228  setBy: "alice",229} satisfies (typeof EnvValueRow)["Encoded"];230231const readBy = (handle: string, minute: number) => ({232  at: DateTime.makeUnsafe(at(minute)),233  handle: Handle.make(handle),234  layer: LayerName.make("maintainers"),235  sha: CommitSha.make(sha(7)),236});237238const readRow = (handle: string, minute: number, seq: number) =>239  ({240    at: at(minute),241    handle,242    layer: "maintainers",243    seq,244    sha: sha(7),245  }) satisfies (typeof LayerReadRow)["Encoded"];246247// Events are written as the service hands them over: unnumbered.248249const claimed: ProjectEventInput = ProjectEvent.cases.Claimed.mapFields(250  Struct.omit(["seq"])251).make({252  ask: AskId.make("empty-date"),253  at: DateTime.makeUnsafe(at(1)),254  claimant: Handle.make("bob"),255});256257const pushed: ProjectEventInput = ProjectEvent.cases.Pushed.mapFields(258  Struct.omit(["seq"])259).make({260  ask: AskId.make("empty-date"),261  at: DateTime.makeUnsafe(at(2)),262  head: CommitSha.make(sha(2)),263});264265const pushes = (count: number) => Array.from({ length: count }, () => pushed);266267const everything: ProjectWrites = {268  answers: decodedAll(AnswerRow, [answer]),269  asks: decodedAll(AskRow, [askA, askB]),270  claims: decodedAll(ClaimRow, [claim]),271  events: [claimed, pushed],272  outbox: decodedAll(OutboxRow, [firstOutbox, secondOutbox]),273  project: decoded(ProjectRow, project),274  queue,275};276277const EncodedSnapshot = Schema.Struct({278  answers: Schema.Array(AnswerRow),279  asks: Schema.Array(AskRow),280  attempts: Schema.Array(AttemptRow),281  budgetDays: Schema.Array(BudgetDayRow),282  claims: Schema.Array(ClaimRow),283  decisions: Schema.Array(DecisionRow),284  envValues: Schema.Array(EnvValueRow),285  landings: Schema.Array(LandingRow),286  lastSeq: Schema.Int,287  layers: Schema.Array(LayerRow),288  ledger: Schema.Array(LedgerRow),289  outbox: Schema.Array(OutboxRow),290  project: Schema.OptionFromNullOr(ProjectRow),291  proposals: Schema.Array(ProposalRow),292  queue: Schema.Json,293  ratchets: Schema.Array(RatchetRow),294});295296const empty = {297  answers: [],298  asks: [],299  attempts: [],300  budgetDays: [],301  claims: [],302  decisions: [],303  envValues: [],304  landings: [],305  lastSeq: 0,306  layers: [],307  ledger: [],308  outbox: [],309  project: null,310  proposals: [],311  queue: null,312  ratchets: [],313};314315const loaded = Effect.gen(function* () {316  const store = yield* ProjectStore;317318  return yield* Schema.encodeEffect(EncodedSnapshot)(yield* store.load());319});320321const since = (seq: number, limit: number) =>322  ProjectStore.use((store) => store.eventsSince(seq, limit));323324const readsSince = (seq: number, limit: number) =>325  ProjectStore.use((store) => store.layerReadsSince(seq, limit)).pipe(326    Effect.flatMap(Schema.encodeEffect(Schema.Array(LayerReadRow)))327  );328329export const describeProjectStore = (330  adapter: string,331  layer: Layer.Layer<ProjectStore>332) => {333  describe(`ProjectStore over ${adapter}`, () => {334    it.effect("loads an empty snapshot before anything is written", () =>335      Effect.gen(function* () {336        expect(yield* loaded).toStrictEqual(empty);337        expect(yield* since(0, 10)).toStrictEqual([]);338      }).pipe(Effect.provide(layer))339    );340341    it.effect("loads every row a commit wrote, and numbers its events", () =>342      Effect.gen(function* () {343        const store = yield* ProjectStore;344345        expect(yield* store.commit(everything)).toStrictEqual({346          duplicatePushEvents: [],347          seqs: [1, 2],348        });349350        expect(yield* loaded).toStrictEqual({351          ...empty,352          answers: [answer],353          asks: [askA, askB],354          claims: [claim],355          lastSeq: 2,356          outbox: [firstOutbox, secondOutbox],357          project,358          queue,359        });360361        expect(yield* since(0, 10)).toStrictEqual([362          { event: { ...claimed, seq: 1 }, seq: 1 },363          { event: { ...pushed, seq: 2 }, seq: 2 },364        ]);365      }).pipe(Effect.provide(layer))366    );367368    it.effect("keeps a lifecycle state's JSON byte for byte", () =>369      Effect.gen(function* () {370        const store = yield* ProjectStore;371372        yield* store.commit(everything);373374        const snapshot = yield* store.load();375376        expect(377          snapshot.claims.map((written) => JSON.stringify(written.state))378        ).toStrictEqual([claimState]);379        expect(380          snapshot.answers.map((written) => JSON.stringify(written.state))381        ).toStrictEqual([answerState]);382      }).pipe(Effect.provide(layer))383    );384385    it.effect(386      "loads landings, proposals, decisions, budget days and ratchets",387      () =>388        Effect.gen(function* () {389          const store = yield* ProjectStore;390391          yield* store.commit({392            budgetDays: decodedAll(BudgetDayRow, [budgetDay]),393            decisions: decodedAll(DecisionRow, [decision]),394            landings: decodedAll(LandingRow, [landingOf(1), landingOf(2)]),395            proposals: decodedAll(ProposalRow, [proposal]),396            ratchets: decodedAll(RatchetRow, [ratchet]),397          });398399          expect(yield* loaded).toStrictEqual({400            ...empty,401            budgetDays: [budgetDay],402            decisions: [decision],403            landings: [landingOf(2), landingOf(1)],404            proposals: [proposal],405            ratchets: [ratchet],406          });407        }).pipe(Effect.provide(layer))408    );409410    it.effect("replaces a row written again under its key, in its place", () =>411      Effect.gen(function* () {412        const store = yield* ProjectStore;413414        const later = answerOf(415          json('{"_tag":"Merging","requestId":"req-00000001"}')416        );417418        const renamed = {419          ...askA,420          brief: { want: "An empty date is refused" },421        };422423        const released = { ...claim, state: json('{"_tag":"Released"}') };424        const spent = { ...budgetDay, used: 2 };425        const lowered = { ...ratchet, count: 11 };426        const retried = { ...firstOutbox, attempts: 1 };427428        yield* store.commit({429          ...everything,430          budgetDays: decodedAll(BudgetDayRow, [budgetDay]),431          ratchets: decodedAll(RatchetRow, [ratchet]),432        });433434        yield* store.commit({435          answers: decodedAll(AnswerRow, [later]),436          asks: decodedAll(AskRow, [renamed]),437          budgetDays: decodedAll(BudgetDayRow, [spent]),438          claims: decodedAll(ClaimRow, [released]),439          outbox: decodedAll(OutboxRow, [retried]),440          project: decoded(ProjectRow, { ...project, landed: sha(9) }),441          queue: { order: [] },442          ratchets: decodedAll(RatchetRow, [lowered]),443        });444445        expect(yield* loaded).toStrictEqual({446          ...empty,447          answers: [later],448          asks: [renamed, askB],449          budgetDays: [spent],450          claims: [released],451          lastSeq: 2,452          outbox: [retried, secondOutbox],453          project: { ...project, landed: sha(9) },454          queue: { order: [] },455          ratchets: [lowered],456        });457      }).pipe(Effect.provide(layer))458    );459460    it.effect("writes nothing for a push event it has already seen", () =>461      Effect.gen(function* () {462        const store = yield* ProjectStore;463        const first = decodedAll(PushEventRow, [pushEventOf("evt-1")]);464465        expect(yield* store.commit({ pushEvents: first })).toStrictEqual({466          duplicatePushEvents: [],467          seqs: [],468        });469470        // The replay carries a push event not seen yet, and the seen one twice:471        // it still writes nothing, that new push event included.472        expect(473          yield* store.commit({474            ...everything,475            pushEvents: decodedAll(PushEventRow, [476              pushEventOf("evt-1"),477              pushEventOf("evt-2"),478              pushEventOf("evt-1"),479            ]),480          })481        ).toStrictEqual({ duplicatePushEvents: ["evt-1"], seqs: [] });482483        expect(yield* loaded).toStrictEqual(empty);484        expect(yield* since(0, 10)).toStrictEqual([]);485486        expect(487          yield* store.commit({488            events: [pushed],489            pushEvents: decodedAll(PushEventRow, [pushEventOf("evt-2")]),490          })491        ).toStrictEqual({ duplicatePushEvents: [], seqs: [1] });492      }).pipe(Effect.provide(layer))493    );494495    it.effect("keeps a push event sent twice in one commit once", () =>496      Effect.gen(function* () {497        const store = yield* ProjectStore;498499        const twice = decodedAll(PushEventRow, [500          pushEventOf("evt-1"),501          pushEventOf("evt-1"),502        ]);503504        expect(yield* store.commit({ pushEvents: twice })).toStrictEqual({505          duplicatePushEvents: [],506          seqs: [],507        });508        expect(yield* store.commit({ pushEvents: twice })).toStrictEqual({509          duplicatePushEvents: ["evt-1"],510          seqs: [],511        });512      }).pipe(Effect.provide(layer))513    );514515    it.effect("reads events after a sequence number, up to a limit", () =>516      Effect.gen(function* () {517        const store = yield* ProjectStore;518519        yield* store.commit(everything);520521        expect(yield* since(1, 10)).toStrictEqual([522          { event: { ...pushed, seq: 2 }, seq: 2 },523        ]);524        expect(yield* since(0, 1)).toStrictEqual([525          { event: { ...claimed, seq: 1 }, seq: 1 },526        ]);527        expect(yield* since(2, 10)).toStrictEqual([]);528      }).pipe(Effect.provide(layer))529    );530531    it.effect("keeps only the newest 500 events", () =>532      Effect.gen(function* () {533        const store = yield* ProjectStore;534535        yield* store.commit({ events: pushes(500) });536537        const { seqs } = yield* store.commit({ events: pushes(5) });538539        expect(seqs).toStrictEqual([501, 502, 503, 504, 505]);540541        const kept = yield* store.eventsSince(0, 1000);542543        expect(kept.length).toBe(500);544        expect(kept.map((event) => event.seq).slice(0, 2)).toStrictEqual([545          6, 7,546        ]);547        expect((yield* store.load()).lastSeq).toBe(505);548      }).pipe(Effect.provide(layer))549    );550551    it.effect("drops acknowledged outbox entries from the next load", () =>552      Effect.gen(function* () {553        const store = yield* ProjectStore;554555        yield* store.commit(everything);556        yield* store.ackOutbox(["out-1", "out-unknown"]);557558        expect((yield* loaded).outbox).toStrictEqual([secondOutbox]);559      }).pipe(Effect.provide(layer))560    );561562    it.effect(563      "names the outbox entries an ack took, so of two acks of one entry only the first takes it",564      () =>565        Effect.gen(function* () {566          const store = yield* ProjectStore;567568          yield* store.commit(everything);569570          expect([571            yield* store.ackOutbox(["out-1", "out-unknown"]),572            yield* store.ackOutbox(["out-1"]),573            yield* store.ackOutbox([]),574          ]).toStrictEqual([["out-1"], [], []]);575        }).pipe(Effect.provide(layer))576    );577578    it.effect(579      "loads landings newest first, the later write first on a tie",580      () =>581        Effect.gen(function* () {582          const store = yield* ProjectStore;583          const earlier = landingOf(1);584          const first = landingOf(5);585          const second = { ...landingOf(5), sha: sha(40) };586587          yield* store.commit({588            landings: decodedAll(LandingRow, [first, earlier]),589          });590          yield* store.commit({ landings: decodedAll(LandingRow, [second]) });591592          expect((yield* loaded).landings).toStrictEqual([593            second,594            first,595            earlier,596          ]);597        }).pipe(Effect.provide(layer))598    );599600    it.effect("finds a landing older than the snapshot's newest 50", () =>601      Effect.gen(function* () {602        const store = yield* ProjectStore;603        const landings = Array.from({ length: 51 }, (_, n) => landingOf(n + 1));604605        yield* store.commit({ landings: decodedAll(LandingRow, landings) });606607        const snapshot = yield* loaded;608609        expect(snapshot.landings.length).toBe(50);610        expect(snapshot.landings[0]).toStrictEqual(landingOf(51));611        expect(snapshot.landings.at(-1)).toStrictEqual(landingOf(2));612613        const oldest = yield* store.landing(CommitSha.make(sha(2)));614615        expect(616          yield* Schema.encodeEffect(Schema.OptionFromNullOr(LandingRow))(617            oldest618          )619        ).toStrictEqual(landingOf(1));620        expect(621          Option.isNone(yield* store.landing(CommitSha.make(sha(999))))622        ).toBe(true);623      }).pipe(Effect.provide(layer))624    );625626    it.effect(627      "counts every landing, past the snapshot's newest 50, each sha once",628      () =>629        Effect.gen(function* () {630          const store = yield* ProjectStore;631          const before = yield* store.landingCount();632633          const landings = Array.from({ length: 51 }, (_, n) =>634            landingOf(n + 1)635          );636637          yield* store.commit({ landings: decodedAll(LandingRow, landings) });638          yield* store.commit({639            landings: decodedAll(LandingRow, [landingOf(51)]),640          });641642          expect([before, yield* store.landingCount()]).toStrictEqual([0, 51]);643        }).pipe(Effect.provide(layer))644    );645646    it.effect(647      "loads layers, attempts, ledger entries and write-only values, each replaced under its key",648      () =>649        Effect.gen(function* () {650          const store = yield* ProjectStore;651652          yield* store.commit({653            attempts: decodedAll(AttemptRow, [attempt]),654            envValues: decodedAll(EnvValueRow, [envValue]),655            layers: decodedAll(LayerRow, [declared, proposedLayer]),656            ledger: decodedAll(LedgerRow, [ledgerEntryOf(1), ledgerEntryOf(2)]),657          });658659          expect(yield* loaded).toStrictEqual({660            ...empty,661            attempts: [attempt],662            envValues: [envValue],663            layers: [declared, proposedLayer],664            ledger: [ledgerEntryOf(1), ledgerEntryOf(2)],665          });666667          const counted = { ...attempt, count: 2 };668          const reset = { ...envValue, setAt: at(10), setBy: "carol" };669          const admitted = { ...proposedLayer, landedSha: sha(8) };670671          yield* store.commit({672            attempts: decodedAll(AttemptRow, [counted]),673            envValues: decodedAll(EnvValueRow, [reset]),674            layers: decodedAll(LayerRow, [admitted]),675            ledger: decodedAll(LedgerRow, [ledgerEntryOf(3)]),676          });677678          expect(yield* loaded).toStrictEqual({679            ...empty,680            attempts: [counted],681            envValues: [reset],682            layers: [declared, admitted],683            ledger: [ledgerEntryOf(1), ledgerEntryOf(2), ledgerEntryOf(3)],684          });685        }).pipe(Effect.provide(layer))686    );687688    it.effect(689      "numbers the layer read log and reads it after a number, out of the snapshot",690      () =>691        Effect.gen(function* () {692          const store = yield* ProjectStore;693694          yield* store.commit({695            layerReads: [readBy("alice", 11), readBy("okonkwo", 12)],696          });697          yield* store.commit({ layerReads: [readBy("alice", 13)] });698699          expect(yield* readsSince(0, 10)).toStrictEqual([700            readRow("alice", 11, 1),701            readRow("okonkwo", 12, 2),702            readRow("alice", 13, 3),703          ]);704          expect(yield* readsSince(1, 1)).toStrictEqual([705            readRow("okonkwo", 12, 2),706          ]);707          expect(yield* loaded).toStrictEqual(empty);708        }).pipe(Effect.provide(layer))709    );710711    it.effect("keeps an import's source with its row", () =>712      Effect.gen(function* () {713        const store = yield* ProjectStore;714715        const imported = {716          ...project,717          importedFrom: {718            branch: "master",719            url: "https://github.com/dtolnay/anyhow",720          },721        } satisfies (typeof ProjectRow)["Encoded"];722723        yield* store.commit({ project: decoded(ProjectRow, imported) });724725        expect((yield* loaded).project).toStrictEqual(imported);726      }).pipe(Effect.provide(layer))727    );728729    it.effect("keeps a claim's pinned suite with its row", () =>730      Effect.gen(function* () {731        const store = yield* ProjectStore;732733        const pinned = {734          ...claim,735          pinned: { at: sha(7), suite: `sha256:${"ab".repeat(32)}` },736        } satisfies (typeof ClaimRow)["Encoded"];737738        yield* store.commit({ claims: decodedAll(ClaimRow, [pinned]) });739740        expect((yield* loaded).claims).toStrictEqual([pinned]);741      }).pipe(Effect.provide(layer))742    );743744    it.effect(745      "leaves the previous state whole when a commit fails part-way",746      () =>747        Effect.gen(function* () {748          const store = yield* ProjectStore;749750          yield* store.commit(everything);751752          const before = yield* loaded;753754          // `attempts` must be an integer: the last row written breaks it, after755          // the rows and events before it were already written.756          const failed = yield* Effect.exit(757            store.commit({758              asks: decodedAll(AskRow, [askOf("time-zones")]),759              events: [pushed],760              outbox: [761                decoded(OutboxRow, outboxOf("out-3")),762                { ...decoded(OutboxRow, outboxOf("out-4")), attempts: 0.5 },763              ],764              project: decoded(ProjectRow, { ...project, landed: sha(9) }),765            })766          );767768          expect(Exit.isFailure(failed)).toBe(true);769          expect(yield* loaded).toStrictEqual(before);770          expect(yield* since(2, 10)).toStrictEqual([]);771        }).pipe(Effect.provide(layer))772    );773  });774};