Skip to content
This repository was archived by the owner on Nov 6, 2026. It is now read-only.
This repository was archived by the owner on Nov 6, 2026. It is now read-only.

Verification-stack descriptor contract + deployer: repos declare their full stack, Factory brings it up #143

Open

Description

@khaliqgant

Part of Epic: Factory Verification & Environments (#141). Depends on the EnvironmentProvider (#142).

Why

The Factory can't hardcode how each repo's stack comes up — every feature repo is different. It needs a declarative contract: a repo says "here is my full verification stack and how to know it's healthy," and the Factory deploys it into a provisioned environment without repo-specific code. This is what lets any feature be brought up, not just the ones we hand-wire.

What

  1. Descriptor contract. Define a verification-stack descriptor a target repo checks in (e.g. .factory/verification-stack.yaml): stack source and deploy kind — primary Cloudflare (wrangler/SST Workers + Cloudflare Containers + D1/KV/R2/Queues/Hyperdrive bindings), with Helm/kustomize/manifests or a translatable docker-compose as the escape-hatch kinds for non-Cloudflare stacks (the same set the provider ([factory] EnvironmentProvider port + Cloudflare ephemeral-environment provider (Workers for Platforms + Containers); K8s/Daytona optional #142) supports). Plus: the set of services, required secrets/config (as references, never inline secrets), readiness/health probes per service, seed steps, and the exposed endpoints the E2E/load stages target. Ship a JSON Schema + typed loader (mirror src/config/schema.ts).
  2. Deployer. Given a descriptor + an Environment from [factory] EnvironmentProvider port + Cloudflare ephemeral-environment provider (Workers for Platforms + Containers); K8s/Daytona optional #142, deploy the stack into the environment (for the Cloudflare kind: deploy the Workers/Containers into the dispatch namespace and bind resources; for escape-hatch kinds: hand off to the K8s/Daytona provider), wait on readiness probes, run seed steps, and return resolved endpoints. Fail fast with clear diagnostics if a service never goes ready.
  3. Selection. Resolve the descriptor for the repo/branch under verification (default path + override), so the merge-gate (#145) can call deploy(descriptor, env) generically.

Keep it declarative and repo-owned: the Factory reads the contract; it does not embed per-repo stack knowledge.

Acceptance

  • verification-stack JSON Schema + typed loader; invalid descriptors fail closed with actionable errors.
  • Deployer brings up a Cloudflare stack (Workers + Containers) into a provisioned dispatch namespace, waits on readiness, runs seeds, returns endpoints; escape-hatch kinds route to the matching provider.
  • Missing-secret / never-ready service → clear failure, not a hang.
  • Exported from src/index.ts.

✅ End-to-end verification — Factory success criteria (REQUIRED)

"Compiles" is not done. Deploy a real multi-service stack from a descriptor into a real environment and hit its endpoints.

Run it

npm run build && npm test                  # schema/loader units (miniflare for the CF path)

CLOUDFLARE_API_TOKEN=... npx tsx test/e2e/stack-deployer.e2e.ts

The E2E must:

  1. Provision an environment (via [factory] EnvironmentProvider port + Cloudflare ephemeral-environment provider (Workers for Platforms + Containers); K8s/Daytona optional #142) — a real dispatch namespace.
  2. Load a fixture descriptor for a small multi-service Cloudflare stack (e.g. a Worker API + a Container Postgres) and deploy() it.
  3. Assert all services reach readiness per their probes, seeds run, and every declared endpoint returns healthy over HTTP.
  4. Negative case: a descriptor with an unsatisfiable readiness probe → deployer fails with a clear diagnostic within a bounded timeout (no hang, no false green).
  5. Tear down.

Deliverable

  • test/e2e/stack-deployer.e2e.ts + a fixture verification-stack descriptor, deploying a real Cloudflare stack into a dispatch namespace and health-gating it, one command in CI.

Anchor files

Activity

  1. added
    factory-ready
    on Jul 20, 2026
  2. added
    factory:in-progress
    on Jul 21, 2026
  3. kjgbot commented on Jul 21, 2026

    @kjgbot
    Contributor

    Factory observed pull request #1346 merge and completed this issue.

  4. khaliqgant commented on Aug 16, 2026

    @khaliqgant
    MemberAuthor

    Reopening: the evidence that closed this issue was invalid.

    This was closed by Factory's post-merge "advance to Done" path, citing a pull request number that does not resolve to a merged PR in this repository. The mechanism is analysed in #276 — the record-less fallback at src/orchestrator/factory.ts:11905 resolves a merged-PR event to an issue without the repository qualification that the tracked-record path applies at :11877, so a PR merged in a different repository in the org can close an unrelated issue here.

    A closure is a claim that the work is done. This one rested on a citation that cannot support it, so the honest state is open.

    This does not assert that the work is unfinished. For at least one issue in this set (#211) the defect is verifiably still on origin/main. For others the work may genuinely have landed. If it has, please re-close with a real citation — a merged AgentWorkforce/factory PR number, or the commit on main — rather than restoring the previous one.

    Reopened by factory-lead on Khaliq's instruction. See #276 for the full evidence table and the code path.

  5. khaliqgant commented on Aug 25, 2026

    @khaliqgant
    MemberAuthor

    Stale claim flag — factory:in-progress for 35 days with no owner

    Backlog-honesty note from the Factory lead. This issue has carried factory:in-progress since 2026-07-21, applied by Factory itself, with no assignee and no activity since 2026-08-16. Nothing is in progress.

    It is one of three in the same state — #221, #145 and #143 — all labelled on 2026-07-21, all owner-less. Three at once reads as a claim leak rather than three separate incidents: a lifecycle claim was recorded, the run behind it ended, and the claim was never released. The practical effect is that these are stranded — they wear an in-progress badge, so nothing re-offers them, and no one is working them.

    I am deliberately not removing the label. Dispatch is currently wedged (#372, confirmed in production), and a stale-looking label may still be load-bearing for Factory's own lifecycle state. Clearing claims by hand while the dispatcher is down risks leaving a confusing state on recovery. The label should be released by whatever owns lifecycle state, or by an explicit decision once dispatch is healthy.

    Flagging, not fixing. If this issue is still wanted, it needs an owner; if it is dead, it should be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    factory-readyfactory:in-progress

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions