Skip to content
Myr

check.test.ts

This file

Path

apps/cli/test/local/check.test.ts

831 lines · 24.1 KiB · TypeScript

Last changed by

Merge build/maintainer-wording into mainoscabrielbefore adoption4c1a571

History of this file

Take it

1import { NodeServices } from "@effect/platform-node";2import { describe, expect, it, vi } from "@effect/vitest";3import { Fetch, FetchFailed } from "@repo/artifacts/fetch";4import { RepoHost } from "@repo/artifacts/repo-host";5import { RepoHostLocal } from "@repo/artifacts/repo-host/local";6import { Brand } from "@repo/brand";7import { PushTarget } from "@repo/gate/facts";8import type { PushFacts } from "@repo/gate/facts";9import { pushStages, runGate } from "@repo/gate/gate";10import { addedLines, treeDiff } from "@repo/git/tree-diff";11import { Client, Contracts } from "@repo/protocol/contracts";12import { ClaimView } from "@repo/protocol/domain/claim";13import { RefNameText } from "@repo/protocol/domain/common";14import { Envelope } from "@repo/protocol/envelope";15import {16  AskId,17  CommitSha,18  Handle,19  LandedSha,20  ProjectName,21  RepoName,22  RepoPath,23  keyOf,24  TreeSha,25} from "@repo/protocol/ids";26import { Person } from "@repo/protocol/principal";27import {28  ChecksFailed,29  NotClaimed,30  OutOfScope,31  Refusal,32  TouchedJudge,33  Weakened,34} from "@repo/protocol/refusal";35import { asTester, unanswered } from "@repo/protocol/testing";36import { gitOk } from "@repo/testkit/git";37import {38  Array,39  Cause,40  DateTime,41  Effect,42  Exit,43  FileSystem,44  Layer,45  Option,46  Path,47  Runtime,48  Schema,49} from "effect";50import { CliOutput } from "effect/cli";51import { RpcTest } from "effect/rpc";52import { TestConsole } from "effect/testing";5354import { ConfigBundlerBun, localPolicy } from "../../src/local/local-policy.ts";55import { program } from "../../src/main.ts";56import { OutputPlain } from "../../src/output.ts";57import { SignedOut } from "../signed-out.ts";58import {59  aCheckRepo,60  ask,61  checkFile,62  commit,63  handle,64  policyFile,65  policyText,66  project,67} from "./fixture.ts";68import type { CheckRepo } from "./fixture.ts";6970const noClaims = Layer.effect(Client)(RpcTest.makeClient(Contracts)).pipe(71  Layer.provide([72    Layer.mergeAll(73      unanswered,74      Contracts.toLayerHandler("status", () =>75        Effect.succeed({76          answers: [],77          claims: [],78          handle: Handle.make("tester"),79        })80      )81    ),82    asTester,83  ])84);8586const claimView = Schema.decodeUnknownSync(ClaimView);8788const claimedAt = (base: string) =>89  Layer.effect(Client)(RpcTest.makeClient(Contracts)).pipe(90    Layer.provide([91      Layer.mergeAll(92        unanswered,93        Contracts.toLayerHandler("status", () =>94          Effect.succeed({95            answers: [],96            claims: [97              claimView({98                ask,99                base,100                checkCommand: `true ${checkFile}`,101                claimant: handle,102                fork: `${keyOf(ProjectName.make(project))}--${ask}--${handle}`,103                lapsesAt: "2099-01-02T00:00:00.000Z",104                openedAt: "2026-10-07T12:00:00.000Z",105                project,106                remote: `https://platform.example.dev/${project}--${ask}--${handle}.git`,107                state: "live",108                warnsAt: "2099-01-01T00:00:00.000Z",109              }),110            ],111            handle: Handle.make(handle),112          })113        )114      ),115      asTester,116    ])117  );118119const unreachable = Layer.mock(Client)({});120121const services = (client: Layer.Layer<Client>) =>122  Layer.mergeAll(123    TestConsole.layer,124    CliOutput.layer(CliOutput.defaultFormatter({ colors: false })),125    client,126    OutputPlain,127    SignedOut128  ).pipe(Layer.provideMerge(NodeServices.layer));129130const run = (argv: readonly string[]) =>131  Effect.gen(function* () {132    const exit = yield* Effect.exit(program(argv));133134    return {135      err: (yield* TestConsole.errorLines).map(String),136      exit,137      out: (yield* TestConsole.logLines).map(String),138    };139  });140141const exitCodeOf = (exit: Exit.Exit<unknown, unknown>) =>142  Exit.isSuccess(exit) ? 0 : Runtime.getErrorExitCode(Cause.squash(exit.cause));143144const decodeJson = Schema.decodeEffect(Schema.fromJsonString(Schema.Json));145146const envelopeOf = (out: readonly string[]) =>147  Effect.gen(function* () {148    expect(out).toHaveLength(1);149150    return yield* decodeJson(out[0] ?? "");151  });152153const decodeEnvelope = Schema.decodeEffect(154  Schema.fromJsonString(Envelope(Schema.Unknown))155);156157const decodedOf = (out: readonly string[]) =>158  Effect.gen(function* () {159    expect(out).toHaveLength(1);160161    return yield* decodeEnvelope(out[0] ?? "");162  });163164const encodeRefusals = Schema.encodeEffect(Schema.Array(Refusal));165166const offline = Layer.succeed(Fetch)({167  fetch: (request) =>168    Effect.fail(new FetchFailed({ reason: "offline", url: request.url })),169});170171const gateSays = (repo: CheckRepo, head: string) =>172  Effect.gen(function* () {173    const fs = yield* FileSystem.FileSystem;174    const path = yield* Path.Path;175    const hosted = yield* fs.makeTempDirectoryScoped();176    const name = RepoName.make(keyOf(ProjectName.make(project)));177178    yield* gitOk(179      repo.root,180      "clone",181      "--bare",182      "--quiet",183      repo.root,184      path.join(hosted, `${name}.git`)185    );186187    const base = CommitSha.make(188      yield* gitOk(repo.root, "merge-base", "main", head)189    );190191    const policy = yield* localPolicy(repo.root, "main", {192      initializer: Handle.make(handle),193      project: ProjectName.make(project),194    }).pipe(Effect.provide(ConfigBundlerBun));195196    const fixA = yield* Effect.fromOption(197      Array.findFirst(policy.asks, ({ id }) => id === ask)198    );199200    const host = RepoHostLocal.layer({201      remoteBase: "http://unused",202      root: hosted,203    }).pipe(Layer.provide(offline));204205    const changes = yield* Effect.gen(function* () {206      const treeOf = (sha: string) =>207        RepoHost.use((repos) =>208          repos.readCommit(name, CommitSha.make(sha))209        ).pipe(210          Effect.flatMap(Effect.fromOption),211          Effect.map(({ tree }) => TreeSha.make(tree))212        );213214      const diff = yield* treeDiff(215        name,216        yield* treeOf(base),217        yield* treeOf(head)218      );219220      return { added: yield* addedLines(name, diff), diff };221    }).pipe(Effect.provide(host));222223    const now = yield* DateTime.now;224    const claimant = Handle.make(handle);225226    const facts: PushFacts = {227      addedLines: changes.added,228      ask: Option.some(fixA),229      base,230      changes: changes.diff,231      claim: Option.some({232        ask: AskId.make(ask),233        base,234        checkCommand: `${Brand.cli} check`,235        claimant,236        fork: RepoName.make(237          `${keyOf(ProjectName.make(project))}--${ask}--${handle}`238        ),239        lapsesAt: now,240        openedAt: now,241        project: ProjectName.make(project),242        remote: "https://platform.example.dev/fork.git",243        state: "live",244        warnsAt: now,245      }),246      claimsHeld: 1,247      head: CommitSha.make(head),248      landed: LandedSha.make(repo.main),249      layerPaths: new Set(),250      opensAsk: false,251      policy,252      pusher: Person.make({ handle: claimant }),253      ref: RefNameText.make("refs/heads/main"),254      scriptsChanged: false,255      target: PushTarget.ClaimFork({256        ask: AskId.make(ask),257        claimant,258        project: ProjectName.make(project),259      }),260    };261262    const refusals = yield* runGate(pushStages, facts).pipe(263      Effect.flatMap(Effect.fromOption)264    );265266    return { encoded: yield* encodeRefusals(refusals), refusals };267  });268269const stateOf = (root: string) =>270  Effect.gen(function* () {271    const fs = yield* FileSystem.FileSystem;272    const path = yield* Path.Path;273    const store = path.join(root, ".git");274275    return {276      config: yield* fs.readFileString(path.join(store, "config")),277      head: yield* gitOk(root, "rev-parse", "--symbolic-full-name", "HEAD"),278      index: yield* fs.readFile(path.join(store, "index")),279      refs: yield* gitOk(root, "for-each-ref"),280      store: (yield* fs.readDirectory(store)).toSorted(),281      worktrees: yield* gitOk(root, "worktree", "list", "--porcelain"),282    };283  });284285// What git exports to a hook it runs, such as pre-commit under `git commit -a`.286const inHook = (root: string) =>287  Effect.acquireRelease(288    Effect.sync(() => {289      vi.stubEnv("GIT_DIR", `${root}/.git`);290      vi.stubEnv("GIT_INDEX_FILE", `${root}/.git/index`);291      vi.stubEnv("GIT_CONFIG_PARAMETERS", "'core.bare'='false'");292    }),293    () => Effect.sync(() => vi.unstubAllEnvs())294  );295296const ratchet = "no-explicit-any";297298const countingLint = [299  "grep -rnow any packages | awk -F: '",300  '  BEGIN { printf "{\\"diagnostics\\":[" }',301  '  { printf "%s{\\"code\\":\\"typescript(no-explicit-any)\\",\\"filename\\":\\"%s\\"}", (NR > 1 ? "," : ""), $1 }',302  '  END { print "]}" }',303  "'",304  "exit 1",305  "",306].join("\n");307308const declaringRatchet = (repo: CheckRepo, command: string) =>309  Effect.gen(function* () {310    const sdk = `${Brand.cliPackage}/rules`;311312    yield* gitOk(repo.root, "checkout", "--quiet", "main");313    yield* gitOk(repo.root, "rm", "--quiet", policyFile);314315    return yield* commit(316      repo.root,317      {318        [`${Brand.configDir}/asks/${ask}.ask.ts`]: [319          `import { kinds, territory } from "${sdk}";`,320          "",321          "export default kinds.fix.ask({",322          `  path: "${checkFile}",`,323          '  territory: territory.package("a"),',324          '  want: "a is two",',325          "});",326          "",327        ].join("\n"),328        [`${Brand.configDir}/project.ts`]: [329          `import { check, kinds, project } from "${sdk}";`,330          "",331          "export default project({",332          "  kinds: [kinds.fix],",333          "  ratchets: {",334          `    "${ratchet}": check.ratchet.count("${command}", { rule: "typescript/no-explicit-any" }),`,335          "  },",336          '  run: { checks: {}, test: "true {path}" },',337          "});",338          "",339        ].join("\n"),340        "lint.sh": countingLint,341        "packages/a/src/a.ts": "export const a = (x: any, y: any) => 1;\n",342      },343      "Count explicit anys"344    );345  });346347const raisingInA = (repo: CheckRepo) =>348  Effect.gen(function* () {349    yield* gitOk(repo.root, "checkout", "--quiet", "-b", "raising", "main");350351    return yield* commit(352      repo.root,353      {354        "packages/a/src/a.ts":355          "export const a = (x: any, y: any, z: any) => 2;\n",356      },357      "Make a two, loosely"358    );359  });360361describe(`${Brand.cli} check`, () => {362  it.live(363    "prints the refusals the gateway would give the same head, in one envelope, and exits 65: the answer must change",364    () =>365      Effect.gen(function* () {366        const repo = yield* aCheckRepo;367368        const printed = yield* run([369          "check",370          "--dir",371          repo.root,372          "--ask",373          ask,374          "--offline",375          "--shape-only",376          "--json",377        ]).pipe(Effect.provide(services(unreachable)));378379        const expected = yield* gateSays(repo, repo.straying);380381        expect(exitCodeOf(printed.exit)).toBe(65);382        expect(printed.err.join("\n")).toContain(`made up for ${handle}`);383        expect(yield* envelopeOf(printed.out)).toStrictEqual({384          command: "check",385          ok: false,386          refusals: expected.encoded,387          v: 1,388        });389        // The ask's check file judges its answers, so editing it is390        // TouchedJudge as well as the place its skip was added.391        expect(expected.refusals).toStrictEqual([392          new OutOfScope({ paths: [RepoPath.make("packages/b/src/b.ts")] }),393          new TouchedJudge({ paths: [RepoPath.make(checkFile)] }),394          new Weakened({395            at: { line: 4, path: RepoPath.make(checkFile) },396            weakening: { marker: ".skip(" },397          }),398        ]);399      }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))400  );401402  it.live(403    "runs the lanes named on a head the gate takes, and reports each lane",404    () =>405      Effect.gen(function* () {406        const repo = yield* aCheckRepo;407408        yield* gitOk(repo.root, "checkout", "--quiet", "clean");409410        const argv = (lane: string) => [411          "check",412          "--dir",413          repo.root,414          "--ask",415          ask,416          "--offline",417          "--lane",418          lane,419          "--json",420        ];421422        const passed = yield* run(argv("ok")).pipe(423          Effect.provide(services(unreachable))424        );425426        expect(Exit.isSuccess(passed.exit)).toBeTruthy();427        expect(yield* envelopeOf(passed.out)).toMatchObject({428          command: "check",429          data: {430            ask,431            base: repo.main,432            head: repo.clean,433            lanes: [{ command: "true", lane: "ok", result: "passed" }],434            stage: "checks",435          },436          ok: true,437          v: 1,438        });439440        const failed = yield* run(argv("bad")).pipe(441          Effect.provide(services(unreachable))442        );443444        expect(Exit.isFailure(failed.exit)).toBeTruthy();445        expect(yield* decodedOf(failed.out)).toStrictEqual({446          command: "check",447          ok: false,448          refusals: [449            new ChecksFailed({450              lane: "bad",451              logRef: ChecksFailed.localRef("bad"),452              next: "false",453            }),454          ],455          v: 1,456        });457      }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))458  );459460  it.live(461    "leaves the repo, its config and its refs as they were, even when a git hook runs it",462    () =>463      Effect.gen(function* () {464        const repo = yield* aCheckRepo;465466        // A setup that writes git config, as an install's `prepare` script467        // does: it belongs to the temp clone the lanes run in.468        yield* gitOk(repo.root, "checkout", "--quiet", "main");469470        yield* commit(471          repo.root,472          {473            [policyFile]: (yield* policyText).replace(474              '"checks":',475              '"setup": "git config check.setup ran", "checks":'476            ),477          },478          "Set the lanes up"479        );480481        yield* gitOk(repo.root, "checkout", "--quiet", "clean");482483        const before = yield* stateOf(repo.root);484485        const printed = yield* inHook(repo.root).pipe(486          Effect.andThen(487            run([488              "check",489              "--dir",490              repo.root,491              "--ask",492              ask,493              "--offline",494              "--lane",495              "ok",496              "--json",497            ])498          ),499          Effect.provide(services(unreachable)),500          Effect.scoped501        );502503        expect(Exit.isSuccess(printed.exit)).toBeTruthy();504        expect(yield* stateOf(repo.root)).toStrictEqual(before);505      }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))506  );507508  it.live(509    "judges the claim the platform says the caller holds: none is NotClaimed",510    () =>511      Effect.gen(function* () {512        const repo = yield* aCheckRepo;513514        yield* gitOk(repo.root, "checkout", "--quiet", "clean");515516        const printed = yield* run([517          "check",518          "--dir",519          repo.root,520          "--ask",521          ask,522          "--json",523        ]).pipe(Effect.provide(services(noClaims)));524525        expect(Exit.isFailure(printed.exit)).toBeTruthy();526        expect(yield* decodedOf(printed.out)).toStrictEqual({527          command: "check",528          ok: false,529          refusals: [NotClaimed.of(AskId.make(ask))],530          v: 1,531        });532        expect(printed.err.join("\n")).not.toContain("made up");533      }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))534  );535536  it.live(537    "judges a lintToZero ask's lane by its count in the ask's territory, not by the lint's exit code, as the platform does",538    () =>539      Effect.gen(function* () {540        const repo = yield* aCheckRepo;541        const sdk = `${Brand.cliPackage}/rules`;542543        // One explicit `any` is left, in b: outside the ask's territory, so544        // the count in a is zero, while the lint exits 1 for it.545        const report = JSON.stringify({546          diagnostics: [547            {548              code: "typescript(no-explicit-any)",549              filename: "packages/b/src/b.ts",550            },551          ],552        });553554        yield* gitOk(repo.root, "checkout", "--quiet", "main");555        yield* gitOk(repo.root, "rm", "--quiet", policyFile);556557        yield* commit(558          repo.root,559          {560            [`${Brand.configDir}/asks/no-any-in-a.ask.ts`]: [561              `import { kinds, territory } from "${sdk}";`,562              "",563              "export default kinds.lintToZero.ask({",564              '  command: "sh lint.sh",',565              '  rule: "typescript/no-explicit-any",',566              '  territory: territory.package("a"),',567              '  want: "a types every value",',568              "});",569              "",570            ].join("\n"),571            [`${Brand.configDir}/project.ts`]: [572              `import { kinds, project } from "${sdk}";`,573              "",574              "export default project({",575              "  kinds: [kinds.lintToZero],",576              '  run: { checks: {}, test: "true {path}" },',577              "});",578              "",579            ].join("\n"),580            "lint.sh": `printf '%s\\n' '${report}'\nexit 1\n`,581          },582          "Ask for no explicit any in a"583        );584585        yield* gitOk(repo.root, "checkout", "--quiet", "-b", "typed");586        yield* commit(587          repo.root,588          { "packages/a/src/a.ts": "export const a: number = 2;\n" },589          "Type a"590        );591592        const printed = yield* run([593          "check",594          "--dir",595          repo.root,596          "--ask",597          "no-any-in-a",598          "--offline",599          "--json",600        ]).pipe(Effect.provide(services(unreachable)));601602        expect(yield* envelopeOf(printed.out)).toMatchObject({603          data: {604            lanes: [{ lane: "lintToZero", result: "passed" }],605            stage: "checks",606          },607          ok: true,608        });609      }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))610  );611612  it.live(613    "diffs from the claim's base, as the gateway does, even when the answer is committed on main",614    () =>615      Effect.gen(function* () {616        const repo = yield* aCheckRepo;617618        const expected = yield* gateSays(repo, repo.straying);619620        // A contributor who clones the project and commits the answer on621        // its main, as the zero-install flow does: main...HEAD is empty.622        yield* gitOk(repo.root, "checkout", "--quiet", "main");623        yield* gitOk(repo.root, "reset", "--quiet", "--hard", repo.straying);624625        const printed = yield* run([626          "check",627          "--dir",628          repo.root,629          "--ask",630          ask,631          "--shape-only",632          "--json",633        ]).pipe(Effect.provide(services(claimedAt(repo.main))));634635        expect(Exit.isFailure(printed.exit)).toBeTruthy();636        expect(yield* envelopeOf(printed.out)).toStrictEqual({637          command: "check",638          ok: false,639          refusals: expected.encoded,640          v: 1,641        });642      }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))643  );644645  it.live(646    "takes the ask from the claim fork's remote when none is named, and says so on stderr",647    () =>648      Effect.gen(function* () {649        const repo = yield* aCheckRepo;650651        yield* gitOk(repo.root, "checkout", "--quiet", "clean");652653        const printed = yield* run([654          "check",655          "--dir",656          repo.root,657          "--offline",658          "--shape-only",659          "--json",660        ]).pipe(Effect.provide(services(unreachable)));661662        expect(Exit.isSuccess(printed.exit)).toBeTruthy();663        expect(yield* envelopeOf(printed.out)).toStrictEqual({664          command: "check",665          data: {666            ask,667            base: repo.main,668            head: repo.clean,669            lanes: [],670            stage: "shape",671          },672          ok: true,673          v: 1,674        });675        expect(printed.err.join("\n")).toContain(`Checking the ask ${ask}`);676      }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))677  );678679  it.live(680    "refuses an answer that raises a ratchet's count from 2 to 3 in the ask's territory, as Weakened, before the push",681    () =>682      Effect.gen(function* () {683        const repo = yield* aCheckRepo;684685        yield* declaringRatchet(repo, "sh lint.sh");686        yield* raisingInA(repo);687688        const printed = yield* run([689          "check",690          "--dir",691          repo.root,692          "--ask",693          ask,694          "--offline",695          "--json",696        ]).pipe(Effect.provide(services(unreachable)));697698        expect(Exit.isFailure(printed.exit)).toBeTruthy();699        expect(yield* decodedOf(printed.out)).toStrictEqual({700          command: "check",701          ok: false,702          refusals: [703            new Weakened({704              weakening: { after: 3, before: 2, ratchet, territory: "a" },705            }),706          ],707          v: 1,708        });709      }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))710  );711712  it.live(713    "lets a raise a reasoned escape explains wait on a maintainer, as the platform does, and says so",714    () =>715      Effect.gen(function* () {716        const repo = yield* aCheckRepo;717718        yield* declaringRatchet(repo, "sh lint.sh");719        yield* gitOk(repo.root, "checkout", "--quiet", "-b", "escaping");720721        yield* commit(722          repo.root,723          {724            "packages/a/src/a.ts": [725              "// @ts-expect-error -- the codec boundary erases types",726              "export const a = (x: any, y: any, z: any) => 2;",727              "",728            ].join("\n"),729          },730          "Make a two, past a codec"731        );732733        const printed = yield* run([734          "check",735          "--dir",736          repo.root,737          "--ask",738          ask,739          "--offline",740          "--json",741        ]).pipe(Effect.provide(services(unreachable)));742743        expect(Exit.isSuccess(printed.exit)).toBeTruthy();744        expect(yield* envelopeOf(printed.out)).toMatchObject({745          data: {746            ratchets: [747              { after: 3, before: 2, ratchet, territory: "a" },748              { after: 0, before: 0, ratchet, territory: "b" },749            ],750          },751          ok: true,752        });753        expect(printed.err.join("\n")).toContain(754          `The ratchet ${ratchet} in a: 2 on the base, 3 here: a reasoned escape you add there asks a maintainer to raise it`755        );756      }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))757  );758759  it.live(760    "passes an answer that keeps every ratchet's count, and reports the counts",761    () =>762      Effect.gen(function* () {763        const repo = yield* aCheckRepo;764        const main = yield* declaringRatchet(repo, "sh lint.sh");765766        yield* gitOk(repo.root, "checkout", "--quiet", "-b", "keeping");767768        const head = yield* commit(769          repo.root,770          {771            "packages/a/src/a.ts": "export const a = (x: any, y: any) => 2;\n",772          },773          "Make a two"774        );775776        const printed = yield* run([777          "check",778          "--dir",779          repo.root,780          "--ask",781          ask,782          "--offline",783          "--json",784        ]).pipe(Effect.provide(services(unreachable)));785786        expect(Exit.isSuccess(printed.exit)).toBeTruthy();787        expect(yield* envelopeOf(printed.out)).toMatchObject({788          data: {789            base: main,790            head,791            ratchets: [792              { after: 2, before: 2, ratchet, territory: "a" },793              { after: 0, before: 0, ratchet, territory: "b" },794            ],795            stage: "checks",796          },797          ok: true,798        });799      }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))800  );801802  it.live(803    "says plainly that a ratchet it cannot count here is left to the platform, and does not fail on it",804    () =>805      Effect.gen(function* () {806        const repo = yield* aCheckRepo;807808        yield* declaringRatchet(repo, "not-installed-here --format json");809        yield* raisingInA(repo);810811        const printed = yield* run([812          "check",813          "--dir",814          repo.root,815          "--ask",816          ask,817          "--offline",818          "--json",819        ]).pipe(Effect.provide(services(unreachable)));820821        expect(Exit.isSuccess(printed.exit)).toBeTruthy();822        expect(yield* envelopeOf(printed.out)).toMatchObject({823          data: { stage: "checks" },824          ok: true,825        });826        expect(printed.err.join("\n")).toContain(827          `Could not count the ratchet ${ratchet} here`828        );829      }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))830  );831});