@zabaca/zbc 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +174 -0
- package/package.json +6 -2
- package/src/commands/add.ts +13 -0
- package/src/commands/init.ts +1 -0
- package/src/engine/apply.ts +60 -21
- package/src/engine/destroy.ts +183 -14
- package/src/engine/discover.ts +1 -1
- package/src/engine/resolve.ts +56 -11
- package/src/utils/copy-template.ts +10 -0
- package/templates/apps/inbox/package.json +4 -2
- package/templates/apps/inbox/tsconfig.json +3 -1
- package/templates/apps/inbox/worker/api.ts +197 -0
- package/templates/apps/inbox/worker/commands.ts +299 -0
- package/templates/apps/inbox/worker/inbox-do.ts +53 -10
- package/templates/apps/inbox/worker/index.ts +15 -202
- package/templates/apps/inbox/worker/mcp.ts +49 -100
- package/templates/apps/walgit/CONTEXT.md +135 -0
- package/templates/apps/walgit/Dockerfile +40 -18
- package/templates/apps/walgit/README.md +518 -55
- package/templates/apps/walgit/e2e/README.md +100 -6
- package/templates/apps/walgit/e2e/harness.ts +262 -1
- package/templates/apps/walgit/e2e/live.ts +588 -0
- package/templates/apps/walgit/e2e/scenarios.ts +367 -5
- package/templates/apps/walgit/e2e/suite.ts +5 -5
- package/templates/apps/walgit/examples/watch.ts +209 -0
- package/templates/apps/walgit/package.json +12 -3
- package/templates/apps/walgit/registry.json +6 -11
- package/templates/apps/walgit/shared/capabilities.ts +189 -0
- package/templates/apps/walgit/shared/container-env.ts +114 -0
- package/templates/apps/walgit/shared/credentials.ts +81 -0
- package/templates/apps/walgit/shared/events.ts +277 -0
- package/templates/apps/walgit/shared/landing.ts +1241 -0
- package/templates/apps/walgit/shared/llms.ts +463 -0
- package/templates/apps/walgit/shared/outbox.ts +266 -0
- package/templates/apps/walgit/shared/policy.ts +59 -0
- package/templates/apps/walgit/shared/protocol.ts +197 -0
- package/templates/apps/walgit/shared/provenance.ts +154 -0
- package/templates/apps/walgit/shared/ref-cache.ts +181 -0
- package/templates/apps/walgit/shared/telemetry.ts +219 -0
- package/templates/apps/walgit/src/announce-main.ts +37 -0
- package/templates/apps/walgit/src/announce.ts +98 -0
- package/templates/apps/walgit/src/append-only.ts +112 -0
- package/templates/apps/walgit/src/cache.ts +172 -0
- package/templates/apps/walgit/src/cli.ts +493 -0
- package/templates/apps/walgit/src/compact.ts +25 -23
- package/templates/apps/walgit/src/delete-repo.ts +237 -0
- package/templates/apps/walgit/src/expire.ts +248 -0
- package/templates/apps/walgit/src/gc.ts +8 -16
- package/templates/apps/walgit/src/git-backend.ts +29 -0
- package/templates/apps/walgit/src/git.ts +78 -0
- package/templates/apps/walgit/src/hook-main.ts +259 -17
- package/templates/apps/walgit/src/hooks.ts +4 -3
- package/templates/apps/walgit/src/http.ts +237 -45
- package/templates/apps/walgit/src/instructions.ts +240 -0
- package/templates/apps/walgit/src/keys.ts +126 -0
- package/templates/apps/walgit/src/limits.ts +158 -0
- package/templates/apps/walgit/src/materialize.bench.ts +10 -10
- package/templates/apps/walgit/src/materialize.ts +48 -40
- package/templates/apps/walgit/src/mkdir-lock.ts +66 -0
- package/templates/apps/walgit/src/orphans.ts +2 -5
- package/templates/apps/walgit/src/pending.ts +201 -0
- package/templates/apps/walgit/src/push-cert.ts +254 -0
- package/templates/apps/walgit/src/push.ts +233 -46
- package/templates/apps/walgit/src/reconcile.ts +5 -8
- package/templates/apps/walgit/src/repo.ts +22 -77
- package/templates/apps/walgit/src/server.ts +148 -26
- package/templates/apps/walgit/src/signers.ts +577 -0
- package/templates/apps/walgit/src/store-env.ts +5 -4
- package/templates/apps/walgit/src/store.ts +47 -24
- package/templates/apps/walgit/src/usage.ts +404 -0
- package/templates/apps/walgit/src/verify.ts +171 -0
- package/templates/apps/walgit/src/wal-index.ts +189 -11
- package/templates/apps/walgit/tsconfig.json +8 -2
- package/templates/apps/walgit/tsconfig.worker.json +24 -0
- package/templates/apps/walgit/worker/events-do.ts +259 -0
- package/templates/apps/walgit/worker/index.ts +572 -0
- package/templates/apps/walgit/wrangler.jsonc +95 -0
- package/templates/apps/warehouse/package.json +1 -1
- package/templates/infra/modules/cloudflare/index.ts +93 -67
- package/templates/infra/modules/cloudflare-access/index.ts +3 -3
- package/templates/infra/modules/cloudflare-api/index.ts +144 -32
- package/templates/infra/modules/cloudflare-api/registry.json +1 -1
- package/templates/infra/modules/cloudflare-email/index.ts +103 -144
- package/templates/infra/modules/cloudflare-email/registry.json +1 -1
- package/templates/infra/modules/cloudflare-token/index.ts +10 -30
- package/templates/infra/modules/cloudflare-token/registry.json +1 -1
- package/templates/infra/modules/cloudflare-tunnel/index.ts +3 -3
- package/templates/infra/modules/cloudflare-zone/index.ts +2 -2
- package/templates/infra/modules/fly/index.ts +158 -35
- package/templates/infra/modules/host-file/index.ts +6 -7
- package/templates/infra/modules/provision-core/index.ts +21 -15
- package/templates/infra/modules/r2/index.ts +38 -55
- package/templates/infra/modules/r2/registry.json +1 -1
- package/templates/infra/modules/remote-provision/index.ts +1 -3
- package/templates/infra/modules/turso/index.ts +45 -7
- package/templates/infra/modules/vm-provision/index.ts +10 -3
- package/templates/infra/package.json +1 -1
- package/templates/infra/src/context.ts +115 -0
- package/templates/infra/src/define-module.ts +8 -2
- package/templates/infra/src/index.ts +11 -1
- package/templates/infra/src/types.ts +72 -3
- package/src/commands/add-registry.test.ts +0 -92
- package/src/commands/secret.test.ts +0 -717
- package/src/commands/vendor-mode.test.ts +0 -183
- package/src/infra-types.ts +0 -38
- package/src/utils/subtree.test.ts +0 -127
- package/templates/apps/inbox/worker/send-op.ts +0 -174
- package/templates/apps/walgit/entrypoint.sh +0 -59
- package/templates/apps/walgit/fly.toml +0 -52
- package/templates/apps/walgit/src/ssh-shell.ts +0 -36
- package/templates/apps/walgit/sshd_config +0 -38
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# walgit
|
|
2
|
+
|
|
3
|
+
A git host where object storage holds the write-ahead log and is the source of truth, and the bare repo on local disk is a disposable cache (ADR-0007 in the zbc repository, `docs/adr/`). Every term below is a consequence of that sentence, and each names a file under `src/`. It serves git smart-HTTP — the only transport — from a Cloudflare Container behind a thin Worker (ADR-0008 there too).
|
|
4
|
+
|
|
5
|
+
One context of several in the zbc repository — see its root `CONTEXT-MAP.md`. This glossary travels with the package, so a consumer who runs `zbc add walgit` gets the vocabulary along with the code.
|
|
6
|
+
|
|
7
|
+
**walgit is the mechanism, not a product.** A deployment of it may be a product — agentgit is one — but the rule in both directions is: _walgit may gain capabilities, never opinions_. Anything specific to one deployment must be expressible as instance configuration, or it does not belong in this package. Every capability here defaults to off.
|
|
8
|
+
|
|
9
|
+
## Language
|
|
10
|
+
|
|
11
|
+
**Shared Kernel** (`shared/`):
|
|
12
|
+
The runtime-neutral third directory beside `src/` (the container process) and `worker/` (the Cloudflare Worker). Its rule is one sentence — _`shared/` imports no runtime, and both halves may import it_ — and it is enforced rather than asserted: `shared/` is the only directory in both TypeScript programs, so a module there is typechecked against bun's ambient types and against the Workers runtime's (ADR-0010). It holds what both halves have to agree on exactly: the wire contract (`protocol.ts`), credential reading, limit reading and formatting, and the ref-event, telemetry and landing-page logic.
|
|
13
|
+
_Avoid_: common, util, lib — none of them says why a module qualifies
|
|
14
|
+
|
|
15
|
+
**Write-Ahead Log** (the WAL):
|
|
16
|
+
The ordered sequence of packfiles under `repos/<repo_id>/wal/`, and the source of truth for a repository. A push is not acknowledged until its entry is published to it. Object storage, not a filesystem and not a database — swappable through one adapter (`store.ts`).
|
|
17
|
+
_Avoid_: the bucket (names the backend, not the log), the archive
|
|
18
|
+
|
|
19
|
+
**Index**:
|
|
20
|
+
`index.json` — one object per repository carrying the sequence number, every WAL Entry, the **full ref state**, the Compaction Frontier and outstanding Tombstones. Refs live here rather than in a relational store, which is the point: there is no database to operate. Publishing a push means winning a conditional PUT on this object.
|
|
21
|
+
_Avoid_: the manifest, the metadata, the database
|
|
22
|
+
|
|
23
|
+
**WAL Entry**:
|
|
24
|
+
One packfile published to the log, by one push or by one compaction, identified by a monotonic `seq` and content-addressed by its sha256. Uploading a pack does not make it an entry — only the Index naming it does.
|
|
25
|
+
|
|
26
|
+
**Cache**:
|
|
27
|
+
The bare git repo on local disk. Disposable by definition: it can be deleted at any moment and rebuilt from the log, it is reconciled against the Index on every access, and nothing may be served from it that the log has not confirmed. Provisioned by `cache.ts`; git's own housekeeping is disabled on it, because a cache that repacks itself behind the log's back is a cache that disagrees with it.
|
|
28
|
+
_Avoid_: the repo (ambiguous with the repository the log describes), the replica, local state
|
|
29
|
+
|
|
30
|
+
**Reconcile**:
|
|
31
|
+
Force the Cache's refs to match the Index. Always one-directional — whatever the disk believes is discarded — and written as a single `packed-refs` file. A ref whose object is absent is reported rather than written: a stale clone is survivable, a broken one is not.
|
|
32
|
+
|
|
33
|
+
**Materialize** (walgit sense):
|
|
34
|
+
Rebuild a Cache from the Write-Ahead Log: download every WAL Entry above the Compaction Frontier, place its pack, then Reconcile. The container sleeps when idle and its disk is wiped on restart, so this is the normal path on ordinary first access after an idle pause, not disaster recovery.
|
|
35
|
+
_Disambiguate_: the zbc repository's warehouse uses the same word for a `dlt` extract plus `dbt run`. The two are unrelated; a bare "materialize" is ambiguous across that repo.
|
|
36
|
+
|
|
37
|
+
**Compaction**:
|
|
38
|
+
Repack a repository into a single WAL Entry that supersedes everything at or below the sequence number it started from, so a cold Materialize replays one entry however many pushes the repository has taken. A repack, never a rewrite: the history it encodes is identical, object for object, and refs are never touched.
|
|
39
|
+
|
|
40
|
+
**Compaction Frontier**:
|
|
41
|
+
The sequence number at or below which entries are superseded and no longer needed to restore. Materialize downloads from it forward; it only ever advances.
|
|
42
|
+
|
|
43
|
+
**Lease**:
|
|
44
|
+
The per-repository claim a node takes before compacting, so two nodes cannot both repack and both advance the frontier. It expires, because its holder is a process in a container the platform may stop at any moment — a lease only a graceful release could clear would wedge compaction for a repository permanently.
|
|
45
|
+
|
|
46
|
+
**Tombstone**:
|
|
47
|
+
A superseded WAL object recorded in the Index as scheduled for deletion, with the instant before which it must not be deleted. The delay is the whole mechanism: a compaction's compare-and-swap is instantaneous and a restore that read the Index a moment earlier is not.
|
|
48
|
+
|
|
49
|
+
**Orphan**:
|
|
50
|
+
A WAL object under a repository's prefix that the Index does not name — almost always a pack uploaded by a push that then lost the compare-and-swap, since rejecting at `reference-transaction` does not unwind the upload. Discovered by diffing the prefix against the Index rather than recorded at rejection time, and collected only once provably older than the slowest plausible restore.
|
|
51
|
+
_Avoid_: garbage (says nothing about why it is there), leaked object
|
|
52
|
+
|
|
53
|
+
## Ref events (ADR-0009)
|
|
54
|
+
|
|
55
|
+
**Ref Event**:
|
|
56
|
+
A message telling a subscriber that a watched ref is now at a given sha. Latest-state, never a replayed history: there is no cursor, no `since`, and no sequence number on the wire. A deletion is the same message with a null sha.
|
|
57
|
+
_Avoid_: notification (implies delivery to an endpoint, which is exactly what this is not), webhook
|
|
58
|
+
|
|
59
|
+
**Watch**:
|
|
60
|
+
A subscriber's declared interest — a repository, optionally narrowed to named refs. Omitting the refs means every ref in that repository. Capped per connection at 64 repositories and 256 refs each, with no wildcard across repositories.
|
|
61
|
+
|
|
62
|
+
**Handshake**:
|
|
63
|
+
The first exchange on a subscription, in which the subscriber is told current state for everything it watches. It is what makes connect and catch-up one operation, and what makes a dropped socket cost nothing but the reconnect.
|
|
64
|
+
|
|
65
|
+
**Fan-out**:
|
|
66
|
+
The `WalgitEvents` Durable Object holding every subscriber's socket and the ref state those subscriptions need. One globally, not one per repository: a hibernatable socket lives in exactly one Durable Object. It holds a derived cache and asks the container when it does not know — the Index remains the source of truth and gains no field for this.
|
|
67
|
+
_Avoid_: the hub, the broker
|
|
68
|
+
|
|
69
|
+
**Announce**:
|
|
70
|
+
The container telling the Fan-out that refs moved, over `/_walgit/announce`, from `post-receive` — after the compare-and-swap has won and the push is durable, never from `reference-transaction`, which would announce a push that then loses. Authenticated, off the push's latency path, and never able to fail a push.
|
|
71
|
+
|
|
72
|
+
**Coalesce Window**:
|
|
73
|
+
The 250 ms in which one socket gets at most one message for a given repository and ref. A second move inside it REPLACES the queued message rather than joining it, so what a subscriber receives when the window elapses is the newest sha, once. It is a rate bound and not a reaction to a slow reader: the Workers runtime reports no backlog for a socket (no `bufferedAmount`), so there is nothing to react to. Sound only because a Ref Event is latest-state.
|
|
74
|
+
_Avoid_: backpressure, throttling, debounce (each implies a reader being watched, or a message being dropped rather than superseded)
|
|
75
|
+
|
|
76
|
+
## Provenance (ADR-0011)
|
|
77
|
+
|
|
78
|
+
**Push Certificate**:
|
|
79
|
+
The small signed document a `git push --signed` carries: the pusher's claimed key, the pushee, the nonce this host issued, and every ref the push moves — with an SSH signature over all of it. A `receive-pack` capability, not a transport one, which is why it works with no SSH anywhere. Advertised if and only if the receiving repository has `receive.certNonceSeed`, so that one config key is the whole of "this deployment takes signed pushes".
|
|
80
|
+
_Avoid_: the signature (the certificate is the document; the signature is one field of it), the token
|
|
81
|
+
|
|
82
|
+
**Nonce Window**:
|
|
83
|
+
How stale the nonce in a Push Certificate may be and still be this host's — `receive.certNonceSlop`, written beside the seed at 300 seconds. Not a tuning knob: git derives the nonce from the second it was minted in, and a push over smart-HTTP is two requests that mint one each, so with git's default of zero only a round trip that stayed inside a single second reports `OK` and every other one reports `SLOP`. Unset, the capability works by luck — anonymous where it should be attributed, and refusing the owner on a name held by a Signer List. It is also the replay window for a captured certificate, so it is bounded rather than generous.
|
|
84
|
+
_Avoid_: nonce timeout, clock skew allowance (it measures the round trip, not a clock disagreement), grace period
|
|
85
|
+
|
|
86
|
+
**Signer**:
|
|
87
|
+
The key that signed a push, named by its fingerprint (`SHA256:…`). A key, never a user or an account — neither exists here, and either word would imply a registry walgit deliberately does not have.
|
|
88
|
+
_Avoid_: user, account, identity, owner (the last is reserved for a permission system that does not exist)
|
|
89
|
+
|
|
90
|
+
**Provenance**:
|
|
91
|
+
The recorded fact that a Signer moved a given ref — an optional map in the Index, ref → `{ signer, ts }`, written by the same compare-and-swap that publishes the push. Latest-state per ref like everything else here: there is no provenance history, because the audit trail of _content_ is the commit graph.
|
|
92
|
+
_Avoid_: identity, attribution log, audit trail
|
|
93
|
+
|
|
94
|
+
**Provenance Read**:
|
|
95
|
+
`GET /_walgit/provenance?repo=<id>` — the whole of reading Provenance back: one repository, the Index's map as it stands, `{}` when nothing has been signed. Behind exactly the credential a clone of that repository needs, so a public deployment answers anyone and a token-gated one answers nobody else; there is no second authorization model. Deliberately not a Ref Event — that wire is latest-state and says only that a ref moved and to what (ADR-0009), while Provenance has a different lifetime and a different reader.
|
|
96
|
+
_Avoid_: the provenance API, the audit endpoint
|
|
97
|
+
|
|
98
|
+
**Advertised capability**:
|
|
99
|
+
What the three agent-facing documents say a deployment can do, rendered from the thing that enforces it and never written as prose. The derivation has one owner — `shared/capabilities.ts`, whose `capabilitiesFrom(env)` returns the `Capabilities` that the plain-text `GET /`, the landing page and `/llms.txt` all render from, that `pre-receive` takes its size caps from (`limitsOf`), and that the Worker claims the event socket on. A capability with no field there is not advertised; a field added there fails to compile at every construction site until it is answered. Signing joins the size caps, the retention window and the stream under this rule: with no `WALGIT_PUSH_CERT_SEED`, none of the three mentions signing, keys or Provenance at all. Sharper here than for a cap, because a client asking to sign a host that does not advertise `push-cert` is refused by its OWN git — the agent finds out only after it has written the push. The stream is the same rule read across two variables: `events` is true only when `WALGIT_EVENTS_URL` and `WALGIT_EVENTS_TOKEN` are both set, because the token alone claims a socket the container's `post-receive` has nowhere to announce to — an advertised stream that never delivers.
|
|
100
|
+
|
|
101
|
+
Ownership is read at **two strengths**, and they are two fields rather than a rule anyone remembers. `namesCanRefuse` is `WALGIT_SIGNER_LISTS` alone and is what any sentence that only says what `pre-receive` refuses is rendered from, because the hook refuses on that flag by itself: on a deployment that sets it with no seed, a claimed name refuses *every* push, so "world-writable" is more wrong there rather than less. `namesCanBeClaimed` is that flag AND a seed, and is what any sentence that sends somebody off to **claim** a name is rendered from, since without a seed they would be claiming it with an unsigned push and locking themselves out. A renderer asks for the strength it needs and never combines the two flags itself.
|
|
102
|
+
|
|
103
|
+
They teach unevenly on purpose: `/llms.txt` teaches holding a name, the landing page argues for it in a section of its own, and the plain-text `GET /` teaches it nowhere. The terse document is read mid-task against a byte budget, and ownership's failure lands on our server, in our words, at the moment it is relevant (ADR-0012); all it carries is two corrections — the clause that stops it promising nothing is refused for being unsigned, and the access bullet that stopped promising every repository is world-writable.
|
|
104
|
+
_Avoid_: feature flag (there is no flag; the seed IS the capability), policy / facts (the three superseded types — `InstructionsPolicy`, `LandingFacts`, `LlmsFacts` — were one concept spelled three ways)
|
|
105
|
+
|
|
106
|
+
**Fail open**:
|
|
107
|
+
The rule the whole capability is built to: a missing, malformed or unverifiable certificate, a bad nonce, or a verifier that is absent or throws records no Signer and **accepts the push**. Provenance is metadata and must never become a new way for a push to fail — anonymous pushing is first-class and stays that way. It has exactly one exception, and it is confined to a repository that holds a Signer List (ADR-0012): there, an unestablished Signer refuses the push. Nowhere else is a push refused for who signed it. Writing an unusable list is refused on any repository, but that is a verdict about the file, not about the Signer.
|
|
108
|
+
|
|
109
|
+
## Ownership (ADR-0012)
|
|
110
|
+
|
|
111
|
+
**Signer List**:
|
|
112
|
+
The key fingerprints a repository names, written to `refs/walgit/signers` — a COMMIT whose tree holds a file called `signers`, one `SHA256:…` per line, blank lines and `#` comments ignored. That the mechanism is a ref is the whole design: claiming a free name is pushing it, granting is a commit that adds a line, revoking is a commit that removes one, and reading it is `git ls-remote`. A commit chain rather than a blob-valued ref, because a blob fails `merge-base --is-ancestor` with exit 128 and the append-only judge reads that as a rewrite — a blob list could be created once and never edited.
|
|
113
|
+
_Avoid_: allowed signers (that is OpenSSH's registry file, which walgit deliberately does not have), the ACL, the owner list
|
|
114
|
+
|
|
115
|
+
**Claim**:
|
|
116
|
+
The recorded fact that a repository holds a Signer List — an optional repo-level field in the Index carrying the resolved fingerprints and when they landed, written by the same compare-and-swap that publishes the push that moved the ref. The ref is authoritative and this is a derived copy, safe because it is written atomically with the ref, derived from bytes in the same push, and replayed with it by a restore. It exists so the refusal never has to read a git object: the Cache is disposable, and ownership cannot depend on it being materialized.
|
|
117
|
+
_Avoid_: owner, ownership record (both imply a permission system rather than a first-mover fact), ACL
|
|
118
|
+
|
|
119
|
+
**Unclaimed**:
|
|
120
|
+
A repository with no Signer List, which is every repository until someone writes one. Absence has one spelling — the field is absent from the Index and omitted from the read — so there is no second way to say it. Nothing is refused on an unclaimed name except a list walgit cannot record.
|
|
121
|
+
|
|
122
|
+
**Empty list** / **unreadable list**:
|
|
123
|
+
The two ways writing a list is refused, on claimed and unclaimed names alike, because both are about losing a name rather than defending one. An empty list — including a deletion of the ref — would leave the name claimable by the next stranger, so a compromised key could give it away rather than merely keep it. An unreadable one — not a commit, no `signers` file, a line that is not a fingerprint, or a file too large to read without risking a silent truncation — would leave an agent believing it holds a name it does not.
|
|
124
|
+
|
|
125
|
+
**The gate**:
|
|
126
|
+
The verdict that makes a Signer List mean anything: while a repository has one, a push not signed by a listed key is refused. Pure over three inputs — the Signer this push established, the list as it stood before it, and the ref changes — and reached in `pre-receive` before the pack is uploaded, so a refused push costs no object-store write. It leads the push's verdicts, ahead of append-only and the size caps, because every one of those is about WHAT was pushed and this one is about whether the pusher may push here at all.
|
|
127
|
+
It is asked **twice**, and it is the only verdict that is. `pre-receive` answers before the upload, which is where a refusal is free; the compare-and-swap that publishes asks it again against the Index it is committing onto, which is where the answer is true — a name that was free when a push was judged can be claimed while its pack uploads, and append-only would make that stranger-write permanent. The second asking reads the claim as it stood before this push applies its own, so the founding push still lands — and a push spanning several transactions is not judged by the list an earlier transaction of the same push installed. Append-only and the size caps are not re-asked, because they judge what was pushed, which cannot change underneath the push.
|
|
128
|
+
Its flag is `WALGIT_SIGNER_LISTS`, and it is turned on beside `WALGIT_PUSH_CERT_SEED`, never without it: the seed is what makes `git-receive-pack` advertise certificates at all, so with no seed every push to a claimed name is refused as unsigned and no client can sign its way out. The gate does not check for the seed, because refusing an unestablished Signer is exactly what stops breaking verification from being the way around it.
|
|
129
|
+
_Avoid_: authorization, permission check, access control (there are no accounts, no roles and nothing to grant but a line in a file)
|
|
130
|
+
|
|
131
|
+
**Not listed** / **unsigned** / **unverified**:
|
|
132
|
+
The three ways the gate refuses, and they are three rather than one because the thing to go and do differs: a key the list does not name, a push carrying no certificate, and a certificate walgit could not turn into a key. The last two are Fail open's one exception — told to sign, an agent that already signed re-sends the same failing signature forever.
|
|
133
|
+
|
|
134
|
+
**A grant governs the next push**:
|
|
135
|
+
The list that judges a push is the one that stood before it, so a push may move the list and a branch together and the list it installs applies from the following push. The founding push needs no exception written for it: an unclaimed name refuses nothing. The same sentence is why a revoked key is refused on its next push and keeps everything it already pushed — append-only still means append-only, and nothing here is retroactive.
|
|
@@ -1,33 +1,55 @@
|
|
|
1
|
-
# walgit's front door:
|
|
2
|
-
#
|
|
1
|
+
# walgit's front door: one Bun process serving smart-HTTP on :8080 out of
|
|
2
|
+
# /srv/walgit/repos, run as a Durable-Object-bound Cloudflare Container behind
|
|
3
|
+
# the Worker in worker/index.ts.
|
|
4
|
+
#
|
|
5
|
+
# ONE process, and no supervisor. The image used to run sshd and the HTTP
|
|
6
|
+
# server as a mutually-killing pair because SSH needed raw inbound TCP, which
|
|
7
|
+
# is what put walgit on Fly (docs/adr/0006 in the zbc repository). Cloudflare
|
|
8
|
+
# delivers HTTP and nothing else, so the SSH transport is gone and with it the
|
|
9
|
+
# only reason this container had two processes to supervise.
|
|
3
10
|
#
|
|
4
11
|
# The repos directory is ORDINARY CONTAINER FILESYSTEM on purpose — no volume,
|
|
5
12
|
# no mount. The bare repo on disk is a disposable cache rebuildable from the
|
|
6
13
|
# write-ahead log in object storage (see the walgit ADR, docs/adr/0007 in the
|
|
7
|
-
# zbc repository)
|
|
8
|
-
#
|
|
14
|
+
# zbc repository). Cloudflare wipes that disk completely on every restart,
|
|
15
|
+
# which is not a hazard here but the assumption the design was written against.
|
|
9
16
|
FROM oven/bun:1.3-alpine
|
|
10
17
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
# `git-daemon` is not optional and not about the daemon: on Alpine it is the
|
|
19
|
+
# package that carries `git-http-backend`, which the plain `git` package does
|
|
20
|
+
# not ship. Without it smart-HTTP fails as `git: 'http-backend' is not a git
|
|
21
|
+
# command` — which reaches the client as an empty CGI response, never as that
|
|
22
|
+
# message.
|
|
23
|
+
#
|
|
24
|
+
# `openssh-keygen` is the push path's signature verifier and nothing more: it is
|
|
25
|
+
# the ~200 KB package carrying `ssh-keygen` alone, with no client, no server and
|
|
26
|
+
# no daemon, and `ssh-keygen -Y check-novalidate -n git` is how walgit reads a
|
|
27
|
+
# push certificate's signer without a key registry (src/push-cert.ts). Its
|
|
28
|
+
# absence is not a build failure — provenance fails open, so an image without it
|
|
29
|
+
# accepts every push and records no Signer, silently. Which is why it is pinned
|
|
30
|
+
# into the image here rather than discovered at runtime.
|
|
31
|
+
RUN apk add --no-cache git git-daemon openssh-keygen
|
|
20
32
|
|
|
21
33
|
WORKDIR /app
|
|
34
|
+
# Only `aws4fetch` — the Worker-side deps (@cloudflare/containers, wrangler) are
|
|
35
|
+
# devDependencies precisely so `--production` leaves them out of this image.
|
|
22
36
|
COPY package.json ./
|
|
23
37
|
RUN bun install --production --no-save
|
|
38
|
+
# BOTH directories, and the second one is not optional: `src/` imports
|
|
39
|
+
# `../shared/` (the runtime-neutral kernel, docs/adr/0010 in the zbc
|
|
40
|
+
# repository), so an image with only `src/` builds cleanly and then dies on its
|
|
41
|
+
# first import. Cloudflare reports that as "Failed to start container: internal
|
|
42
|
+
# error connecting to the port" — the process never binds :8080 — so the cause
|
|
43
|
+
# is named here rather than left to be rediscovered from that message.
|
|
24
44
|
COPY src ./src
|
|
25
|
-
COPY
|
|
26
|
-
COPY entrypoint.sh /entrypoint.sh
|
|
27
|
-
RUN chmod +x /entrypoint.sh
|
|
45
|
+
COPY shared ./shared
|
|
28
46
|
|
|
29
47
|
ENV WALGIT_REPOS_DIR=/srv/walgit/repos \
|
|
30
48
|
PORT=8080
|
|
31
49
|
|
|
32
|
-
|
|
33
|
-
|
|
50
|
+
# The container runs as root and every repo on disk is written by this one
|
|
51
|
+
# process, so git never sees a repository owned by somebody else ("detected
|
|
52
|
+
# dubious ownership") and there is no account to drop to. The two-user dance
|
|
53
|
+
# the old image did existed only because sshd authenticated sessions as `git`.
|
|
54
|
+
EXPOSE 8080
|
|
55
|
+
CMD ["bun", "/app/src/server.ts"]
|