live.test.ts
This file
Path
apps/platform/test/visibility/live.test.ts
66 lines · 2.4 KiB · TypeScript
Last changed by
Merge build/comments-platform into mainoscabrielbefore adoptionddf09e8
History of this fileTake it
The walk stopped after 200 commits: lines older than 678c8b8 point at it.
Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 1–42why, one step back1import { describe, expect, it } from "@effect/vitest";2import { Fetch } from "@repo/artifacts/fetch";3import { RepoHost } from "@repo/artifacts/repo-host";4import { RepoHostMemory } from "@repo/artifacts/repo-host/memory";5import { RepoName } from "@repo/protocol/ids";6import { fakeArtifactsBinding } from "@repo/testkit/fake-artifacts-binding";7import { untouchable } from "@repo/testkit/untouchable";8import { LayerRepos } from "@repo/visibility/layer-repos";9import { Effect, Exit, Layer } from "effect";1011import { decodeEnv } from "../../src/platform.ts";12import { workerPorts } from "../../src/ports.ts";13import { layerRepos } from "../../src/visibility/layer-repos.ts";14import { fakeEnv } from "../fake-env.ts";1516const remoteBase = "https://artifacts.test";1718const freshHost = Effect.provide(Effect.service(RepoHost), RepoHostMemory);1920const noFetch = Layer.succeed(Fetch, untouchable<Fetch["Service"]>("Fetch"));2122describe("the visibility cartridge, plugged in", () => {23 it.effect(24 "builds over the stage's ports from the decoded env, touching no binding",25 () =>26 Effect.gen(function* () {27 const config = yield* decodeEnv(fakeEnv()).pipe(Effect.orDie);2829 const built = yield* Effect.exit(30 Effect.scoped(Layer.build(workerPorts(config)))31 );3233 expect(Exit.isSuccess(built)).toBeTruthy();34 })35 );3637 it.effect(38 "reaches the layer repos through ARTIFACTS_PRIVATE, never the public namespace",39 () =>40 Effect.gen(function* () {41 const publicHost = yield* freshHost;42 const privateHost = yield* freshHost;Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8
line 43why, one step back43 const layer = RepoName.make("alice__datekit--maintainers");Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 44–52why, one step back4445 yield* privateHost.create(layer);4647 const config = yield* decodeEnv({48 ...fakeEnv(),49 ARTIFACTS: fakeArtifactsBinding(publicHost, { remoteBase }),50 ARTIFACTS_PRIVATE: fakeArtifactsBinding(privateHost, { remoteBase }),51 }).pipe(Effect.orDie);52Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8
line 53why, one step back53 yield* publicHost.create(RepoName.make("alice__datekit"));Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 54–57why, one step back5455 const found = yield* LayerRepos.use((repos) =>56 Effect.all({57 layer: Effect.exit(repos.remote(layer)),Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8
line 58why, one step back58 public: Effect.exit(repos.remote(RepoName.make("alice__datekit"))),Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 59–66why, one step back59 })60 ).pipe(Effect.provide(layerRepos(config).pipe(Layer.provide(noFetch))));6162 expect(Exit.isSuccess(found.layer)).toBeTruthy();63 expect(Exit.isFailure(found.public)).toBeTruthy();64 })65 );66});