t81-foundation

CanonFS Interchange Example

This is the smallest golden RFC-00D1 example in the repo.

It shows a real host directory import into CanonFS, a real export back out to a host directory, and the built-in policy-profile surface that currently ships as the narrow v1 candidate contract.

If you want the single frozen v1 contract fixture set, start in:

For the current build-against boundary, pair this example with:

Current Build-Against Boundary

The current RFC-00D1 v1 candidate surface is intentionally narrow.

Treat the following as stable enough to build against today:

Still explicitly deferred from full v1 promotion:

Files

Run

From the repo root:

tmp_root="$(mktemp -d)"
canon_root="$tmp_root/.t81_canonfs"
export_root="$tmp_root/exported"

build/t81 canonfs import \
  examples/storage-and-canonfs/canonfs-interchange/input \
  --canonfs-root "$canon_root" \
  --json

Expected shape:

Export the returned manifest_ref back to a host directory:

manifest_ref="<manifest_ref from previous step>"

build/t81 canonfs export \
  "$manifest_ref" \
  --canonfs-root "$canon_root" \
  --out "$export_root" \
  --json

Expected shape:

You can verify the exported payloads directly:

cat "$export_root/alpha.txt"
cat "$export_root/nested/beta.txt"

Negative Path

This lane also supports explicit policy-profile denial without needing an extra policy file:

build/t81 canonfs import \
  examples/storage-and-canonfs/canonfs-interchange/input \
  --canonfs-root "$canon_root" \
  --policy-profile export-only \
  --json

Expected shape:

Built-In Policy Profiles

The current built-in profiles are intentionally narrow and deterministic:

The current profile surface is about pre-side-effect admission control, not rich content policy. In other words:

Built-in profiles and explicit policy files are conjunctive:

Policy Document Examples

This example directory also includes two small Axion policy files that work with the current CanonFS interchange lane:

Validate them directly:

build/t81 policy validate \
  examples/storage-and-canonfs/canonfs-interchange/policy-allow-alpha-only.apl \
  --json

build/t81 policy validate \
  examples/storage-and-canonfs/canonfs-interchange/policy-deny-all.apl \
  --json

build/t81 policy validate \
  examples/storage-and-canonfs/canonfs-interchange/policy-allow-example-inputs.apl \
  --json

Partial import using the checked-in alpha-only policy:

build/t81 canonfs import \
  examples/storage-and-canonfs/canonfs-interchange/input \
  --canonfs-root "$canon_root" \
  --policy examples/storage-and-canonfs/canonfs-interchange/policy-allow-alpha-only.apl \
  --json

Expected shape:

Policy denial through a checked-in file:

build/t81 canonfs import \
  examples/storage-and-canonfs/canonfs-interchange/input \
  --canonfs-root "$canon_root" \
  --policy examples/storage-and-canonfs/canonfs-interchange/policy-deny-all.apl \
  --json

Expected shape:

The same checked-in policy file can deny export under the default permissive profile once you already have a manifest or object ref:

build/t81 canonfs export \
  "$manifest_ref" \
  --canonfs-root "$canon_root" \
  --policy examples/storage-and-canonfs/canonfs-interchange/policy-deny-all.apl \
  --out "$export_root" \
  --json

Expected shape:

Policy allowlist using the checked-in example input hashes:

build/t81 canonfs import \
  examples/storage-and-canonfs/canonfs-interchange/input \
  --canonfs-root "$canon_root" \
  --policy examples/storage-and-canonfs/canonfs-interchange/policy-allow-example-inputs.apl \
  --json

Expected shape:

You can also see the same narrowing effect on export by first importing the directory under the permissive default, then exporting the returned manifest_ref with the alpha-only policy:

build/t81 canonfs export \
  "$manifest_ref" \
  --canonfs-root "$canon_root" \
  --policy examples/storage-and-canonfs/canonfs-interchange/policy-allow-alpha-only.apl \
  --out "$export_root" \
  --json

Expected shape:

Target-Side Export Failure

The current contract also distinguishes target-side export failures from source or policy failures. One small reproducible case is exporting a single-file CanonFS object to a path that already exists as a directory:

blocked_out="$tmp_root/already-a-directory"
mkdir -p "$blocked_out"

build/t81 canonfs export \
  "$hash" \
  --canonfs-root "$canon_root" \
  --out "$blocked_out" \
  --json

Expected shape:

Notes