Skip to content
Myr

visibility.ts

This file

Path

packages/protocol/src/domain/visibility.ts

208 lines · 4.7 KiB · TypeScript

Last changed by

Merge build/comments-cli-protocol-checks into mainoscabrielbefore adoptionc86204f

History of this file

Take 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–80why, one step back
1import { Schema } from "effect";
23import {4 AreaName,5 CommitSha,6 DecisionId,7 EnvKey,8 Handle,9 LandedSha,10 LayerName,11 ProjectName,12 RepoName,13 RepoPath,14 SuiteRoot,15} from "../ids.ts";16import { Posture } from "../posture.ts";17import { AtLeastOne, Glob, NoneOrMore } from "./common.ts";1819export const Audience = Schema.Literals([20 "public",21 "contributors",22 "claimants",23 "maintainers",24 "team",25 "security",26 "sponsors",27 "personal",28 "platform",29]);3031export type Audience = typeof Audience.Type;3233export const Disclosure = Schema.Literals([34 "public",35 "sealed",36 "counted",37 "declared",38 "hidden",39 "writeOnly",40]);4142export type Disclosure = typeof Disclosure.Type;4344export const LayerKind = Schema.Literals([45 "checks",46 "agent-config",47 "env",48 "experiment",49 "notes",50 "fix",51 "session",52 "personal",53 "attachment",54 "source",55]);5657export type LayerKind = typeof LayerKind.Type;5859export const Members = Schema.Union([60 Schema.Literal("deciders"),61 Schema.NonEmptyArray(Handle),62]);6364export type Members = typeof Members.Type;6566export const Layer = Schema.Struct({67 audience: Audience,68 disclose: Disclosure,69 holds: Schema.NonEmptyArray(LayerKind),70 maxDays: Schema.optionalKey(Schema.Int),71 name: LayerName,72 readers: Members,73 reason: Schema.NonEmptyString,74 repo: Schema.optionalKey(RepoName),75 sunsetDays: Schema.optionalKey(Schema.Int),76 writers: Members,77});7879export type Layer = typeof Layer.Type;80

Merge build/comments-cli-protocol-checks into mainoscabrielbefore adoptionc86204f

lines 81–82why, one step back
81// A key that is no area name is refused, not dropped: a `Schema.Record`
82// keyed by `AreaName` would drop it silently, and the area's checks with 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 83–86why, one step back
83const Areas = Schema.Record(Schema.String, Schema.NonEmptyString)
84 .check(Schema.isPropertyNames(AreaName))85 .pipe(Schema.decodeTo(Schema.Record(AreaName, Glob)));86

Merge build/comments-cli-protocol-checks into mainoscabrielbefore adoptionc86204f

line 87why, one step back
87/** Held-back checks as the public config declares them; their paths and names stay in the layer. */

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 88–142why, one step back
88export const SealedChecks = Schema.Struct({
89 admit: Schema.optionalKey(90 Schema.Struct({91 greenOnMainRuns: AtLeastOne,92 redOnKnownBadAtLeast: AtLeastOne,93 })94 ),95 areas: Areas,96 attempts: Schema.Struct({97 perClaim: AtLeastOne,98 perPersonPerAreaPerWeek: AtLeastOne,99 }),100 canary: Schema.Boolean,101 commit: Schema.Literal("salted-sha256-merkle"),102 layer: LayerName,103 pin: Schema.Literal("claim"),104 result: Schema.Literal("area-bit"),105});106107export type SealedChecks = typeof SealedChecks.Type;108109export const VisibilityPolicy = Schema.Struct({110 checks: Schema.optionalKey(SealedChecks),111 env: Schema.Struct({ setters: Members }),112 flows: Schema.Struct({113 noWriteDown: Schema.Boolean,114 release: Members,115 }),116 layers: Schema.Array(Layer),117 notice: Schema.Struct({ narrowingDays: NoneOrMore }),118});119120export type VisibilityPolicy = typeof VisibilityPolicy.Type;121122export const SealedCheck = Schema.Struct({123 area: AreaName,124 author: Handle,125 clause: Schema.Struct({126 quote: Schema.NonEmptyString,127 ref: Schema.NonEmptyString,128 source: Schema.Literals(["ask", "doc"]),129 }),130 path: RepoPath,131});132133export type SealedCheck = typeof SealedCheck.Type;134135export const LayerManifest = Schema.Struct({136 checks: Schema.Array(SealedCheck),137 knownBad: Schema.Array(CommitSha),138 layer: LayerName,139});140141export type LayerManifest = typeof LayerManifest.Type;142

Merge build/comments-cli-protocol-checks into mainoscabrielbefore adoptionc86204f

line 143why, one step back
143/** A value set is recorded by who and when, never by the value. */

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 144–208why, one step back
144export const LedgerEntry = Schema.TaggedUnion({
145 Admitted: {146 area: AreaName,147 at: Schema.DateTimeUtcFromString,148 knownBadCaught: Schema.Int,149 mainRuns: Schema.Int,150 seq: Schema.Int,151 suite: SuiteRoot,152 },153 CommitmentPublished: {154 area: AreaName,155 at: Schema.DateTimeUtcFromString,156 authors: Schema.Int,157 checks: Schema.Int,158 seq: Schema.Int,159 suite: SuiteRoot,160 },161 CountChanged: {162 area: AreaName,163 at: Schema.DateTimeUtcFromString,164 count: Schema.Int,165 layer: LayerName,166 seq: Schema.Int,167 },168 LayerDeclared: {169 at: Schema.DateTimeUtcFromString,170 disclose: Disclosure,171 kinds: Schema.NonEmptyArray(LayerKind),172 layer: LayerName,173 seq: Schema.Int,174 },175 PostureChanged: {176 at: Schema.DateTimeUtcFromString,177 decision: DecisionId,178 from: Posture,179 seq: Schema.Int,180 to: Posture,181 },182 Released: {183 at: Schema.DateTimeUtcFromString,184 by: Handle,185 landing: LandedSha,186 layer: LayerName,187 paths: Schema.Int,188 seq: Schema.Int,189 },190 ValueSet: {191 at: Schema.DateTimeUtcFromString,192 by: Handle,193 key: EnvKey,194 seq: Schema.Int,195 },196});197198export type LedgerEntry = typeof LedgerEntry.Type;199200export const Ledger = Schema.Struct({201 entries: Schema.Array(LedgerEntry),202 layers: Schema.Array(Layer),203 posture: Posture,204 postureLabel: Schema.NonEmptyString,205 project: ProjectName,206});207208export type Ledger = typeof Ledger.Type;