Commit 636add2
* feat(infra): own livestore-docs Netlify runtime env via OpenTofu (seeds #1244)
Re-home the livestore-docs Netlify env-var IaC into this repo under
`.infra/iac/netlify/` with OpenTofu, adopting the two already-live env vars
(`MXBAI_API_KEY`, `MXBAI_VECTOR_STORE_ID`) via `tofu import` so the config owns
them with zero recreation. `tofu plan` reports `No changes`.
Scope is env vars only: the site is referenced by literal `site_id`/`team_id`
(no `netlify_site` resource / data source), so OpenTofu can never mutate the
site, build settings, or deploys.
State backend: this repo is public and state holds the API key value, so state
is committed only as ciphertext via OpenTofu native state encryption
(PBKDF2/AES-GCM, `enforced = true`; passphrase in 1Password, injected at
runtime). The intended Cloudflare R2 `backend "s3"` is blocked — R2 is not
enabled on the LiveStore CF account (API code 10042, dashboard-only) — so native
encryption is the sanctioned fallback; `versions.tf` documents the R2 migration.
`MXBAI_API_KEY` declares `lifecycle { ignore_changes = [secret_values] }`
because the Netlify API treats secret values as write-only (never returned on
read/import), which would otherwise force a perpetual cosmetic diff.
Adds `dt infra:netlify:plan` / `dt infra:netlify:apply` tasks that inject
secrets via op-proxy/1Password (or env in CI) and run OpenTofu.
Seeds #1244 (LiveStore public domains -> Cloudflare-managed IaC single desired
state) by establishing the OpenTofu state + encryption + provider conventions.
Refs #1329.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
agent-session-id: c5481079-88d4-4406-b2bf-d31ff5588e67
agent-tool: Claude Code
agent-tool-version: 2.1.165
agent-model: claude-opus-4-8
agent-runtime-profile: /nix/store/ffppqrb9xkq0jamayzc05dwlm86yi5yk-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/f4bp1wnsfzypdxckkp0vyqcgw5xq4yp1-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b39be89
* Give infrastructure a VRS home and record the Netlify IaC tradeoffs
Adds context/03-delivery/04-infrastructure (LS.DEL.INFRA-*): declared
infrastructure, no recoverable secrets in-repo, 1Password as the single
credential source, adoption over recreation, org-owned accounts.
The requirements state the target, so this PR's own compromises are tracked
as deltas rather than written down to what the code happens to do:
DELTA-001 (state committed as ciphertext to a public repo, blocked on R2)
and DELTA-002 (hosting, DNS, CI runners and examples are undeclared).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
* Correct the write-only claim in the Netlify IaC decision record
Observed 2026-07-27: a secret Netlify env var returns its `dev` context in
plaintext while other contexts are masked. Masking-on-read is what makes the
value non-round-trippable, not a write-only guarantee.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
* Record the adoption-safety precondition in DELTA-001
Import writes non-secret values into state verbatim, so a credential a
provider holds as ordinary configuration must be moved to that provider's
secret mechanism before adoption, not after. Also drops an over-specific
observation from the decision record; the consequence is what matters.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
* Record that docs search is stale and the two surfaces are crossed
Observed 2026-07-27: one vector store exists, named for development, last
updated 2026-04-27 with 31 content files changed since. Both docs surfaces
read it, sync-docs.yml has failed at Setup pnpm on every push for ~3 months,
and MXBAI_VECTOR_STORE_ID_PROD names no existing store.
The dev/prod search split exists only in the write path: no surface reads a
store its own sync path writes. Adopting this into declared state before
repairing it would freeze the crossed wiring.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
* Replace the state-secrecy delta with the verified rule and its trigger
Decrypting the committed state on 2026-07-27 showed both imported resources
carry no secret material; the only value present is the non-secret vector
store id, already a literal in variables.tf. LS.DEL.INFRA-R02 is satisfied, so
DELTA-001 recorded a divergence that does not exist and is removed.
What replaces it is the rule it was groping at: state carries no secret, and
remote state is required *before* the first secret-bearing resource is
declared, not after — afterwards the commit is already permanent. R2's
account-level enablement constraint moves to .reference/ so #1244 inherits it,
including the ordering hazard that its own Cloudflare work would both trip the
trigger and provide the bucket.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
* Require the provider secret mechanism, and one index per surface
LS.DEL.INFRA-R06: a credential in a provider surface uses that provider's
secret facility, never ordinary configuration — plain config leaks into build
logs and read APIs, and is unsafe to adopt into declared state.
LS.DOCS.SEARCH-R03: a docs surface serves the index its own sync path writes.
Measured 2026-07-27: 24 of 101 content files differ between v0.4.0 and main,
so a shared index leaves one surface wrong about a quarter of the docs
whichever way it syncs.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
* Point the Netlify IaC at the production store and correct its docs
The production surface now has its own vector store, so the declared value
moves to it and the config states that the dev surface is deliberately not
managed here.
Corrects two claims the evidence contradicts. State does not hold the API key:
the resource is adopt-only, and decrypting the committed state shows the only
value present is the non-secret store id. And rotation does not run through
OpenTofu — applying one would write the key into permanently public history;
1Password is canonical.
R2 is reframed from a blocker to a trigger: state must leave the repo before
the first secret-bearing resource is declared, not on a schedule.
tofu plan reports No changes against the corrected wiring.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
* Record Netlify env-var behaviour and the applied search remediation
Netlify returns a secret variable's dev-context value in plaintext while
masking the others, reproduced on both docs sites — so the dev context is not
a safe place for a credential, and masking only guarantees a value cannot be
round-tripped. Non-secret values are returned verbatim, which is the concrete
reason behind LS.DEL.INFRA-R06.
Also corrects the search delta: its staleness claim rested on the store's
updated_at, which tracks metadata rather than file operations. The failing
sync runs are the real evidence.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
* Attribute the sync-docs repair to its own PR
The workflow fix ships as #1507 so a three-month
production defect is not gated on review of the state-backend design. Records
that main still passes the legacy store id to the production sync until that
merges.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
* Narrow the search delta to what is still unproven
Both surfaces now return results from their own store. What remains is that
the production sync path has never run successfully — the production store was
populated by hand — and that a failing sync still surfaces nowhere, which is
why the original bug survived three months.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
* Restore the string terminator lost in the merge resolution
Resolving the mono-wrappers.nix conflict by stripping markers dropped the
closing '' of docsSearchSync, so the IaC preamble's opening '' terminated it
instead and the shell body parsed as Nix. Caught by check:quick.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
* Govern both docs surfaces and check drift automatically
Extends the declaration from one site to both, keyed by surface, so the dev
site's env vars stop being undeclared. Adopting it is only safe now because its
API key was moved from plain configuration to Netlify's secret mechanism first
(LS.DEL.INFRA-R06) — importing it beforehand would have written a live
credential into state.
Adds infra:netlify:drift-check and a scheduled workflow that runs it. A
declaration nobody checks is documentation, not a control: nothing in the repo
ran plan, so drift was undetectable by design.
Proven end to end against the live account: import, plan reported real drift
(the dev store-id variable carried an undeclared post-processing scope), apply
converged it, and plan is clean. State still contains no secret after that
apply.
Also widens the ignore rules — `tofu state mv` writes
`terraform.tfstate.<ts>.backup`, which `*.tfstate.backup` did not match, so
those files sat untracked and one commit away from being added.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
* Adopt livestore.dev DNS records and docs domain settings
Extends the declaration from environment variables to the rest of what this
Netlify account actually governs: the eleven hand-authored records in the
livestore.dev zone, plus the custom domains of the two docs surfaces. Seventeen
resources, all adopted by import, plan reports No changes.
Scope is deliberately the hand-authored records only. The zone also holds
NETLIFY-type records that Netlify creates and owns from each site's domain
settings; the provider cannot express that type at all, so they are governed
through netlify_site_domain_settings rather than declared directly. There is no
netlify_dns_zone resource either — the zone is referenced by literal id so
OpenTofu can never create, replace, or delete it.
Most of these records serve a live Clerk instance with no consumer anywhere in
this repository. They are declared because they are load-bearing, not because
their purpose is understood.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
* Adopt the orphaned example domain claims
The web-todomvc-custom-elements example was removed from the repository, but
its two Netlify sites kept their livestore.dev domain claims, and a claim is
what makes Netlify publish the matching zone record. Adopted at current values
so the adoption changes nothing; releasing them is a separate diff.
This config owns the livestore.dev namespace, so a hostname under it is in
scope wherever it is driven from. An unowned claim is how the namespace
drifted in the first place.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
* Release the orphaned livestore.dev hostnames
Both custom-elements domain claims are released and Netlify withdrew the
records it had published for them; the record that had outlived its site claim
is deleted. Zero orphaned hostnames remain in the zone.
The release could not be expressed in the config. The provider cannot say "no
custom domain" — null is silently omitted and an empty string is rejected with
`Name is blank` — so it went through the Netlify API, and the config now
asserts the absence by declaring the resources without a domain. That keeps the
absence checked rather than merely achieved.
Chasing this surfaced two provider gaps worth recording rather than
rediscovering: a desired state the provider cannot reach would leave the
scheduled drift check permanently red, and NETLIFY-type records cannot be
declared at all, so a record orphaned from its claim is invisible to drift
detection.
Records LS.DEL.INFRA-DQ2: ten of the eleven hand-authored records serve a live
Clerk instance with no consumer anywhere in this repository.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
* Register the LS.DEL.INFRA namespace in the intent-layer ID table
The intent-layer test requires every ID namespace defined under context/ to
appear in the spec.md table that maps namespaces to owning directories. Adding
the infrastructure node introduced nine LS.DEL.INFRA-* ids without registering
the namespace, so test-unit failed with nine violations.
Worth noting for next time: check:quick does not run tests — its description
ends "without tests" — so this class of failure is invisible locally unless
test:unit or check:all is run.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
* Address review: reconcile scope docs, and see through the ignored attribute
Two review findings, both correct.
The canonical documents still described an env-vars-only blast radius after DNS
records and site domain settings were added, so an operator reading them would
have underestimated what infra:netlify:apply can modify. The decision record,
env.tf, README, and DELTA-002 now describe the real scope. The prod-safety
claim is restated as what it actually is: resources are declared, containers
are not — no site resource, no zone resource, no data sources — so destroying a
container is not expressible.
`ignore_changes = [secret_values]` suppresses the entire attribute, not only
the write-only values, so the context entries stopped being compared too.
Verified by deleting a live context: `tofu plan` reported `No changes`, while
docs search would have broken on the next build. The drift task now asserts the
ignored shape against the provider API after planning — still a secret, with
the expected scopes and contexts, on both surfaces. Confirmed it fails on that
injected drift and passes once restored. Only the values remain unverifiable,
which is inherent to write-only.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
agent-session-id: 05bdf052-d9c2-4930-bfef-1fd90b43680b
agent-tool: Claude Code
agent-tool-version: 2.1.220
agent-model: claude-opus-5
agent-runtime-profile: /nix/store/57hz15fbcg9c3hasm0ny3axd5pg33rh3-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/d9hvhhg1k9n3j20dgcch7sz3sg98l377-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@b785b9f
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 5d843e9 commit 636add2
24 files changed
Lines changed: 1395 additions & 5 deletions
File tree
- .github/workflows
- .infra/iac/netlify
- state
- context
- 03-delivery
- 04-infrastructure
- .decisions
- .delta
- .reference
- 04-docs/02-search
- .delta
- nix/devenv-modules/tasks/local
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments