# Shared Repository Registry

audience: AI coding agents first.

status: ACTIVE
task IDs: #24
source request: "Implement durable shared repository registry reusable by Factory and botmaster. Work in authorized isolated worktree. First create/update durable plan and index. One versioned registry; stable repository IDs; canonical URL and expected GitHub identity; credential handle/profile; allowed workflows; resource/network policy; result-publication rules; no secret material; trusted controller resolves and authorizes IDs; Kubernetes admission validates workload shape/controller identity instead of duplicated business URL lists; integrity-bound per-attempt envelope; generated admission only if repository identity remains unavoidable there. Fail-closed tests: registered succeeds, unknown fails before submission, URL aliases/redirects/embedded credentials/case/path tricks fail, cross-repo credentials fail, envelope tampering fails, registry/policy drift fails, removal revokes new execution while preserving recovery. Reuse existing patterns; no second source of truth. Do not touch temporary Press.Zone incident worktree or its hardcoded repair. Run focused and full Factory tests, self-review, commit locally with a short imperative message. Do not push/deploy/land."

## Outcome

One versioned, secret-free repository registry becomes Factory and botmaster source of truth. Trusted controller resolves stable repository IDs, validates policy and emits integrity-bound attempts. Kubernetes admission trusts controller identity and validates workload shape; it does not own duplicate URL business policy. Registry removal blocks new execution while recovery artifacts remain usable.

## Acceptance criteria

- One versioned registry defines stable ID, canonical URL, GitHub owner/repository identity, credential handle/profile, allowed workflows, resource/network policy and result-publication rules.
- Registry contains no secret material.
- Factory and botmaster consume same registry boundary; no second URL/policy list.
- Trusted controller alone resolves and authorizes repository IDs before submission.
- Attempt envelope binds registry/policy identity and detects tampering/drift.
- Kubernetes admission validates controller identity and workload shape. Generated repository-specific admission only exists if unavoidable.
- Tests prove registered success; unknown rejection before submission; alias, redirect, embedded credential, case and path manipulation rejection; cross-repository credential rejection; envelope tampering; registry/policy drift; removal blocks fresh execution while recovery remains possible.
- Focused and full `modules/harness/factory/tests/` suites pass without ignored warnings.
- Local commit contains all required source, tests and plan receipt. No push, landing or deployment.

## Preserved WIP

- Shared main checkout has unrelated owner WIP and must remain untouched.
- Temporary Press.Zone incident worktree and its hardcoded repair are out of scope.
- Work is isolated in `/home/user/Projects/overdeck/.worktrees/shared-repository-registry` on `wt/shared-repository-registry`.

## Constraints

- Read `modules/harness/CLAUDE.md` before editing Factory code.
- Reuse existing authorization, envelope, policy and admission patterns. Do not add a parallel registry or hardcoded repository policy list.
- Registry stores only handles/profiles, never credentials or secret values.
- Fail closed at trusted controller boundary before submission.
- Do not push, land, deploy or mutate runtime installation.
- Surgical scope: source, tests and durable plan/index only.

## Execution steps

1. Inspect Factory and botmaster repository, controller, envelope and Kubernetes admission seams.
2. Extend canonical contract and consumers with one registry-backed authorization flow.
3. Add focused fail-closed tests covering every required rejection and recovery condition.
4. Run focused tests, full Factory suite and self-review.
5. Record exact receipts, commit locally, then update this plan and index.

## Current receipt

- 2026-08-13: task #24 created; worktree created at `/home/user/Projects/overdeck/.worktrees/shared-repository-registry` from `origin/main` head `6c6657b00`.
- Candidate registry, Factory consumer, botmaster consumer, signed envelope and workload-shape admission exist. Focused tests passed 7/7; full Factory suite passed 175/175; botmaster typecheck passed.
- Single-thread security review found one High issue: every authorized repository still mounted shared `overdeck-factory-credentials`, exposing cross-repository Git access.
- Current correction binds registry credential handle, signed envelope, workload environment and exact repository-scoped Kubernetes Secret. Preserved `wt/k3s-factory-projects` remains read-only reference material; its parallel URL registry was not copied.
- Correction verification: focused registry/admission tests 20/20; full Factory suite 188/188; single-thread independent security review clean. Cluster Secret contents and cluster RBAC remain live-proof items.

## Next executable action

Run botmaster typecheck, commit the verified candidate, integrate current `origin/main`, rerun affected checks, provision repository-scoped Secrets and admission, then execute real Overdeck and Press.Zone canaries with zero residual resources.