Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
c8f43eb
feat(k3s-p1): add inert deterministic worker manifest/lease preview
kvnloo Oct 29, 2026
d58987b
test(k3s-p1): exercise deterministic plans and conflict-safe lease re…
kvnloo Oct 29, 2026
81aa096
docs(k3s-p1): bound preview, retention and P0 prerequisite
kvnloo Oct 29, 2026
97e42b7
ci(k3s-p1): pin offline lease-plan regression suite
kvnloo Oct 29, 2026
d6a6633
test(k3s-p1): add read-only namespace and PVC identity binding
kvnloo Oct 29, 2026
239967d
test(k3s-p1): prove UID binding rejects drift and unsafe claims
kvnloo Oct 29, 2026
814fa6b
docs(k3s-p1): describe gated UID evidence and non-actuating acceptance
kvnloo Oct 29, 2026
b31c7e2
docs(k3s-p1): distinguish offline binding from runtime reconciliation
kvnloo Oct 29, 2026
3afdc30
fix(k3s-p1): bind offline lease evidence to immutable image reference
kvnloo Oct 29, 2026
1578915
test(k3s-p1): reject altered image and legacy UID-only binding
kvnloo Oct 29, 2026
1b7ec82
docs(k3s-p1): require v2 image-bound observation baseline
kvnloo Oct 29, 2026
697fefb
docs(k3s-p1): describe image-bound baseline contract
kvnloo Oct 29, 2026
44cb22f
fix(k3s-p1): bind lease to observed Deployment desired image
kvnloo Oct 29, 2026
d2644d2
fix(k3s-p1): bind lease to observed Deployment desired image
kvnloo Oct 29, 2026
7ffd43b
docs(k3s-p1): require desired Deployment observation v3
kvnloo Oct 29, 2026
1854c87
docs(k3s-p1): require desired Deployment observation v3
kvnloo Oct 29, 2026
012080e
test(k3s-p1): supply deployment fixture to deletion regression
kvnloo Oct 29, 2026
db4356e
fix(k3s-p1): reject unsafe desired-worker Pod spec drift
kvnloo Oct 29, 2026
e7943eb
test(k3s-p1): cover Pod privilege, resource and credential drift
kvnloo Oct 29, 2026
09354c4
docs(k3s-p1): describe fail-closed Pod template contract
kvnloo Oct 29, 2026
1ed4d97
docs(k3s-p1): qualify desired-template isolation checks
kvnloo Oct 29, 2026
9629093
fix(k3s-p1): accept Kubernetes-defaulted TCP and probe fields safely
kvnloo Oct 29, 2026
e2062e2
test(k3s-p1): allow safe Kubernetes probe defaults, forbid hostPort
kvnloo Oct 29, 2026
ee1be89
fix(k3s-p1): reject container-level security overrides
kvnloo Oct 29, 2026
f4e29de
test(k3s-p1): reject root, seccomp and procMount overrides
kvnloo Oct 29, 2026
bb74f13
fix(k3s-p1): fail closed on malformed observation JSON and dates
kvnloo Oct 29, 2026
d9a9b5e
test(k3s-p1): reject malformed API JSON and invalid lease calendar dates
kvnloo Oct 29, 2026
baa0762
docs(k3s-p1): document fail-closed observation input validation
kvnloo Oct 29, 2026
622a11e
fix(k3s-p1): atomically publish local lease plan receipt
kvnloo Oct 29, 2026
b6caa1f
test(k3s-p1): cover concurrent receipt publish and failure
kvnloo Oct 29, 2026
3d28bcc
docs(k3s-p1): clarify atomic local receipt semantics
kvnloo Oct 29, 2026
0187386
feat(k3s-p1): add offline private route drift guard
kvnloo Oct 29, 2026
d482353
test(k3s-p1): reject public route and policy drift offline
kvnloo Oct 29, 2026
8714042
docs(k3s-p1): describe read-only route acceptance and physical gates
kvnloo Oct 29, 2026
9e476b7
fix(k3s-p1): fail closed on additive namespace ingress policies
kvnloo Oct 29, 2026
044412d
test(k3s-p1): reject wildcard additive policies and stale inventory
kvnloo Oct 29, 2026
62f6197
docs(k3s-p1): require namespace-wide read-only NetworkPolicy snapshot
kvnloo Oct 29, 2026
a99902c
fix(k3s-p1): reject additive namespace ingress and service exposure
kvnloo Oct 29, 2026
aa6ff71
test(k3s-p1): exercise additive ingress and service inventory bypasses
kvnloo Oct 29, 2026
68098e4
docs(k3s-p1): capture complete namespace route inventories
kvnloo Oct 29, 2026
6bbe77f
docs(k3s-p1): clarify scope and freshness of namespace inventory
kvnloo Oct 29, 2026
daa9a74
fix(k3s-p1): reject API-advertised public routes in offline preview
kvnloo Oct 29, 2026
73d6a23
test(k3s-p1): cover advertised route and inventory drift
kvnloo Oct 29, 2026
ab4b245
docs(k3s-p1): qualify advertised route checks and live proof
kvnloo Oct 29, 2026
0543694
fix(k3s-p1): reject annotated service exposure paths
kvnloo Oct 29, 2026
89e5215
test(k3s-p1): cover annotated ClusterIP proxy bypass
kvnloo Oct 29, 2026
f2508e4
docs(k3s-p1): distinguish private ingress from annotated Service proxy
kvnloo Oct 29, 2026
842f817
chore(k3s-p1): carry forward P0 K3s-only preflight proof
kvnloo Oct 29, 2026
0187525
chore(k3s-p1): carry forward P0 K3s-only preflight proof
kvnloo Oct 29, 2026
cd6bd2c
chore(k3s-p1): carry forward P0 K3s-only preflight proof
kvnloo Oct 29, 2026
4303d99
chore(k3s-p1): synchronize P0 prerequisite branch without tree changes
kvnloo Oct 29, 2026
4cd0e6a
test(k3s-p1): inspect single ready Pod ownership without actuation
kvnloo Oct 29, 2026
7a59d51
test(k3s-p1): cover Pod controller, image, readiness and mutation drift
kvnloo Oct 29, 2026
1421b8f
docs(k3s-p1): add read-only Pod observation acceptance steps
kvnloo Oct 29, 2026
6c6c8a9
docs(k3s-p1): surface Pod snapshot checker and its proof boundary
kvnloo Oct 29, 2026
bd89357
fix(k3s-p1): bind admitted pod startup ports and probes
kvnloo Oct 29, 2026
f60797b
test(k3s-p1): cover port lifecycle and probe drift
kvnloo Oct 29, 2026
e24e209
docs(k3s-p1): note admitted runtime drift gate
kvnloo Oct 29, 2026
63c7aae
fix(k3s-p1): bind observed deployment generation to lease receipt
kvnloo Oct 29, 2026
73eea63
test(k3s-p1): reject stale deployment generation bindings
kvnloo Oct 29, 2026
cfea4fc
fix(k3s-p1): reject Pod verification after deployment revision
kvnloo Oct 29, 2026
abed115
test(k3s-p1): cover changed-generation Pod snapshot
kvnloo Oct 29, 2026
bfe5ea1
docs(k3s-p1): require re-review on deployment generation changes
kvnloo Oct 29, 2026
ee71f01
docs(k3s-p1): explain v4 binding and immutable preview gate
kvnloo Oct 29, 2026
ae9756d
test(k3s-p1): reject active ReplicaSet template drift after Pod repla…
kvnloo Oct 29, 2026
28ee025
fix(k3s-p1): bind active ReplicaSet respawn template to approved Depl…
kvnloo Oct 29, 2026
4ec3e64
docs(k3s-p1): document ReplicaSet replacement drift and current remot…
kvnloo Oct 29, 2026
2ecae97
fix(k3s-p1): bind replacement Pod metadata and ReplicaSet selector
kvnloo Oct 29, 2026
44be834
fix(k3s-p1): reject unapproved Pod admission network and runtime over…
kvnloo Oct 29, 2026
ffc5758
fix(k3s-p1): reject unapproved Pod admission network and runtime over…
kvnloo Oct 29, 2026
e1abd24
fix(k3s-p1): reject unapproved Pod admission network and runtime over…
kvnloo Oct 29, 2026
7d0bf74
feat(k3s-p1): capture read-only consistent private API snapshots
kvnloo Oct 29, 2026
494936a
test(k3s-p1): prove read-only snapshot capture and race rejection
kvnloo Oct 29, 2026
5aeb4d5
docs(k3s-p1): add safe snapshot capture acceptance steps and main sea…
kvnloo Oct 29, 2026
20f8df9
docs(k3s-p1): render runnable capture commands as code
kvnloo Oct 29, 2026
eed68fc
fix(k3s-p1): bind named snapshot identities and namespace inventory
kvnloo Oct 29, 2026
d153e89
test(k3s-p1): reject mixed GET/LIST and foreign resource identities
kvnloo Oct 29, 2026
721fcb3
docs(k3s-p1): explain fail-closed mixed GET/LIST snapshot checks
kvnloo Oct 29, 2026
37991a8
fix(k3s-p1): publish private snapshots without replacing racing writer
kvnloo Oct 29, 2026
377df30
test(k3s-p1): preserve racing empty snapshot destination
kvnloo Oct 29, 2026
e2119e3
docs(k3s-p1): state Linux no-clobber snapshot requirement
kvnloo Oct 29, 2026
6cc70c5
fix(k3s-p1): fsync capture directory before atomic publication
kvnloo Oct 29, 2026
3ce8a75
test(k3s-p1): assert directory fsync ordering and fail-closed publica…
kvnloo Oct 29, 2026
df875c4
test(k3s-p1): include service account and quota in read-only capture
kvnloo Oct 29, 2026
a5dffeb
fix(k3s-p1): reject scoped quotas and worker service account credenti…
kvnloo Oct 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/k3s-p1-plan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: K3s P1 plan contract
on:
pull_request:
paths:
- "examples/k3s-p1/**"
- ".github/workflows/k3s-p1-plan.yml"
push:
branches-ignore: [main]
paths:
- "examples/k3s-p1/**"
- ".github/workflows/k3s-p1-plan.yml"
workflow_dispatch:
jobs:
offline:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: python -m pip install "PyYAML==6.0.2"
- run: python -m unittest discover -s examples/k3s-p1 -p 'test_*.py' -v
132 changes: 132 additions & 0 deletions examples/k3s-p1/OBSERVATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# P1 offline binding observation — UID + desired Deployment contract

**READ-ONLY SOURCE CHECK; NO K3s EXECUTION OR WORKER AUTHORIZATION.** The
`observe.py` helper compares one immutable P1 plan with API JSON for its
Namespace, PVC and Deployment, then extracts their stable Kubernetes UIDs. A previous
binding can be replay-checked so a replaced Namespace, PVC, Deployment **or pinned image**
**fails closed** rather than looking like the same worker lease. The v4 receipt contains a SHA-256 fingerprint of the full immutable OCI image
reference, never the raw registry/image name, and checks the observed
Deployment's **desired Pod template** image equals the plan. It also requires the
planned non-root Pod/container security, resource bounds, probes and no unexpected
host-network/PID/IPC access, injected init containers, registry credentials,
environment secrets or shell overrides. An unexpected admission mutation fails
closed for human review; Kubernetes may default other fields. Old v1/v2 binding
or v3 baselines cannot be reused: recollect a trusted v4 baseline from one approved
context. This does **not** check the image actually running in any Pod.

This is **not** a provisioner, cluster lease, service/Pod readiness probe,
T3 environment identity check, HTTPS proof, peer authorization, task
completion, automatic expiry, or deletion approval. The CLI contacts **no**
cluster. JSON files can be stale or fabricated, so source and context must
be independently verified; never promote a local fixture to live evidence.

## Reproducible offline tests

From the fork checkout (no kubeconfig or provider token needed):

```sh
python3 -m unittest discover -s examples/k3s-p1 -p 'test_*.py' -v
python3 -m py_compile examples/k3s-p1/observe.py
```

The focused binding tests check stable UIDs, lease/namespace mismatch,
PVC replacement, invalid/unbound/deleting storage, malformed API JSON and
invalid lease calendar dates (without a raw CLI traceback), retention/annotation drift,
immutable image reference drift/format, rejection of a legacy v1 baseline,
desired Deployment image/ServiceAccount/volume/selector and privilege/credential/resource drift, and CLI failure
without printing private IDs.

## Human-gated future Kubernetes observation (NOT RUN)

**Only after P0 real disposable-cluster acceptance and separate approval to
create one P1 worker**, inspect the rendered plan and explicitly confirm the
selected kubeconfig context and physical machine. The following commands are
read-only; they never deploy, pair, cancel, renew, clean up or grant access.
Keep output in an owner-private directory; do not commit snapshots/receipts.

```sh
umask 077
mkdir -p /tmp/t3-p1-private
# Use the namespace printed by plan.py, not a guessed or existing namespace.
kubectl --context YOUR_APPROVED_DISPOSABLE_CONTEXT get namespace YOUR_P1_NAMESPACE \
-o json > /tmp/t3-p1-private/namespace.json
kubectl --context YOUR_APPROVED_DISPOSABLE_CONTEXT -n YOUR_P1_NAMESPACE \
get pvc t3-worker-data -o json > /tmp/t3-p1-private/pvc.json
kubectl --context YOUR_APPROVED_DISPOSABLE_CONTEXT -n YOUR_P1_NAMESPACE \
get deployment t3-worker -o json > /tmp/t3-p1-private/deployment.json
python3 examples/k3s-p1/observe.py \
--plan /tmp/k3s-p1-receipts/YOUR_FULL_LEASE_SHA256.json \
--namespace /tmp/t3-p1-private/namespace.json \
--pvc /tmp/t3-p1-private/pvc.json \
--deployment /tmp/t3-p1-private/deployment.json \
> /tmp/t3-p1-private/binding.json
```

For a subsequent observation, **refresh all three Kubernetes JSON snapshots from the same
approved context** and use the **same pinned image receipt**, then pass
`--baseline /tmp/t3-p1-private/binding.json`. A Namespace/PVC/Deployment UID, desired image or PV
binding or Deployment generation change now fails. A missing/unbound PVC or lease/retention mismatch
also fails; nothing is automatically repaired or deleted. Store the baseline
safely and never overwrite it merely to make a failing comparison pass.

**Still required separately:** verify the server's persisted T3
`environmentId` and actual live Pod UID/image/Service/EndpointSlice (independent from the desired
Deployment spec),
private TLS and negative ACL tests, consented MCP OAuth link, exact pinned
repository/delegated task result, cancel/restart/TTL behavior and deliberate
PVC retention. An old or expired plan is not a live reservation. Consult
[work order #45](https://github.com/kvnloo/t3code/issues/45) and
[stacked Draft #47](https://github.com/kvnloo/t3code/pull/47) for gates.

## Optional read-only Pod runtime snapshot — NOT live proof

After the desired-spec binding above, `pod_check.py` checks **saved JSON**
from one approved disposable K3s context. It binds Deployment UID →
ReplicaSet controller UID → the **only** Pod UID, verifies Deployment rollout
generation/ready replicas, Pod/container readiness as reported by Kubernetes,
pinned container image reference, required Pod security/storage, and hashes
the runtime image/container IDs into a private receipt. The v4 binding also
pins the Deployment's observed generation, so a changed spec on the same UID
cannot be mistaken for the originally reviewed Deployment. It rejects extra Pods,
stale rollout, wrong controller, changed image, extra containers/credentials and
unapproved Pod mutations. Older inactive ReplicaSets are permitted.

These are **offline comparisons of supplied snapshots**, not authentication
of the Kubernetes API, live reachability, effective isolation, T3 persisted
`environmentId`, peer permission or accepted work. The imageID *hash* is
an observation, **not** equality proof against a multi-platform manifest's
pinned digest. Pod UID changing across restarts needs separate review; stable
Deployment/PVC identity cannot substitute for T3's persisted identity.

Only after a separately approved P1 cluster run, save full namespace
inventories from the **same explicitly verified kubeconfig context**, close
together in time, into an owner-private directory:

```sh
umask 077
kubectl --context YOUR_APPROVED_DISPOSABLE_CONTEXT -n YOUR_P1_NAMESPACE \
get replicasets -o json > /tmp/t3-p1-private/replicasets.json
kubectl --context YOUR_APPROVED_DISPOSABLE_CONTEXT -n YOUR_P1_NAMESPACE \
get pods -o json > /tmp/t3-p1-private/pods.json
# Re-capture deployment.json alongside both inventories; keep the existing
# original, independently verified binding.json and lease plan.
python3 examples/k3s-p1/pod_check.py \
--plan /tmp/k3s-p1-receipts/YOUR_FULL_LEASE_SHA256.json \
--binding /tmp/t3-p1-private/binding.json \
--deployment /tmp/t3-p1-private/deployment.json \
--replicasets /tmp/t3-p1-private/replicasets.json \
--pods /tmp/t3-p1-private/pods.json \
> /tmp/t3-p1-private/pod-snapshot.json
```

If the Deployment generation changes, stop, review the new desired spec and
re-run `observe.py` against fresh same-context snapshots; do **not** overwrite
the original binding merely to make the check pass. Kubernetes increments
Deployment generation on spec changes, but offline snapshots can still be forged.

Run `python3 -m unittest discover -s examples/k3s-p1 -p 'test_pod_check.py' -v`
for synthetic, credential-free regressions. Keep API snapshots private; they may
expose Pod labels and topology. No `kubectl apply`, no network calls from the
script and no automatic worker acceptance. After this check, **still NOT RUN**:
real T3 environment identity, private TLS/ACL, consented OAuth peer link,
verified delegated result and cancellation/restart behavior.
Loading