Skip to content

docs(witan-infra): write the witan-infra spec and ADR 0013 - #694

Open
blarghmatey wants to merge 3 commits into
mainfrom
witan-infra-spec
Open

blarghmatey wants to merge 3 commits into
mainfrom
witan-infra-spec

Conversation

@blarghmatey

@blarghmatey blarghmatey commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

What are the relevant tickets?

N/A (witan task tk-write-the-witan-infra-design-spec-docs-design-wi-3ef30c, project wp-witan-infra-digital-twin-of-running-infrastructu-544088)

Description (What does it do?)

witan-infra, a planned third witan layer that maps running infrastructure (IaC state, Kubernetes, trace topology, cloud inventory) and joins it to the code and memory layers, had an August task plan but no spec, and its gating spikes had not run. They ran on 2026-11-19 against all 330 Pulumi stacks and omnigraph 0.15.0. This adds the spec written from their results and ADR 0013, which keeps the whole estate in one graph with the fixed id infra.

Where the spikes changed the August plan:

  • Edges carry properties in omnigraph 0.15, so the reconciler merges first and deletes second; readers never see an empty slice, and no branches are needed.
  • Collectors write per-source Sighting rows and the reconciler projects objects from them, so two collectors describing one object cannot null each other's fields.
  • Attribution (resource to service) runs over the whole graph every run, in Phase 2 rather than Phase 4. The measured hit rate is 94.1% of per-service production resources, mostly from a project-to-service map that becomes explicit config.
  • No enums in the schema, so adding a role is a package release rather than a cluster schema change.
  • The collector reads state straight from S3 with read-only access and keeps fields on an allowlist; plain export never decrypts.
  • By the omnigraph 0.15 server source, a graph bound to no Cedar bundle is readable by any token holder, so infra always gets its own bundle.

Two decisions are left open in the spec, each with a recommendation: who may read the infra graph, and the MITODL service set. A third is settled: witan-code and witan-infra never import each other, and the code_impact deployment block is filled through an entry-point enricher in witan_core.

Implementation details

The spec lives with the other specs in docs/internals/design/ (the task title still says docs/design/). The ADR is in mcp/servers/witan/docs/adr/ and mirrored into docs/explanation/decisions/ by just docs-gen; both are added to the zensical.toml nav. The merge-then-reap write was checked on a local omnigraph 0.15.0 store and is recorded as witan memory pat-merge-then-reap-replace-a-graph-slice-on-omnigra-29430c. The key-based delete the reconciler prefers (delete … where <key> in $keys with a list parameter) is untested at batch size; the spec makes that Phase 2's first test, with the run-stamped form as the verified fallback.

The secret-handling spike also inventoried plaintext credentials sitting in IaC state outside any secret wrapper. That inventory is deliberately not in this public repo.

How can this be tested?

Docs only. just docs-check and just docs-build pass, and markdownlint passes on both files. An independent reviewer checked the spec's numbers and code anchors against the spike findings and the code at origin/main, then re-checked the rewritten write path; the second pass's findings (miss counting on skipped stacks, the scope of the diff delete, leftover bookkeeping fields, fencing the deletes on the lease) were fixed after it and have not been re-reviewed. Reviewers: the write path (section 10) and the open decisions (section 16) are where judgement is needed.

https://claude.ai/code/session_01FGZebE22D7F3QQjRpu6AUr

witan-infra (a third witan layer mapping running infrastructure) had a task
plan from August but no spec, and its gating spikes had not run. They ran on
2026-11-19 against all 330 Pulumi stacks and omnigraph 0.15.0, and this writes
the spec from their results, plus ADR 0013 for the one decision with real
alternatives: one graph with the fixed id `infra`.

The spikes changed the plan in several places: edges carry properties in 0.15,
so the write path merges first and deletes second instead of leaving an empty
window; collectors write per-source sightings and the reconciler projects
objects from them, so two collectors cannot null each other's fields;
attribution moves to the reconciler and runs over the whole graph each run;
the schema uses no enums; and an unbound graph turns out to be read-open, not
default-deny.

The inventory of plaintext credentials the secret-handling spike found in IaC
state is deliberately left out of this public repo.

Claude-Session: https://claude.ai/code/session_01FGZebE22D7F3QQjRpu6AUr
Copilot AI balanced review requested due to automatic review settings November 19, 2026 22:30

@agent-optibot agent-optibot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Documents the proposed witan-infra layer and its single fixed graph.

  • Adds: the witan-infra design spec covering graph schema, collectors, attribution, coverage, security, and phased delivery.
  • Adds: ADR 0013 choosing one infra graph with a fixed identifier.
  • Changes: the documentation navigation to include the witan-infra spec and ADR 0013.
Details for reviewers

Risks

  • The preferred batch key-delete query is untested; Phase 2 must use the verified run-stamped fallback if it fails.
  • State access can expose plaintext credentials because the inventory found credentials outside secret wrappers.
  • The spec leaves graph-read permissions, code_impact integration, and the MITODL service set unresolved.

Core files: docs/internals/design/witan-infra-spec.md, mcp/servers/witan/docs/adr/0013-one-infra-graph-with-a-fixed-id.md, docs/explanation/decisions/0013-one-infra-graph-with-a-fixed-id.md

Unchanged

  • The design remains proposed and does not add the witan-infra implementation.
  • The spec keeps three owner decisions open with recommendations.

Summary of 8ee0dbc · React 👍 or 👎 on my comments to tune what I raise · Commands · Review config

@agent-optibot agent-optibot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Status: Needs Changes 🔧

Blocking Issues:

  • Fence sighting writes as well as deletes so expired runs cannot overwrite newer state.
  • Replace wildcard stack-output value rules with exact, validated allowlist entries.
  • Use authorized reads rather than export for the impact traversal fallback.
  • Spec's chunked-delete fencing is unimplementable with current change_many API

📌 Reviewed up to the latest commit · ⏱️ Review completed in 4 minutes

  • 🔄 re-review this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved critical flaws let expired runs overwrite newer sightings, conflate dependencies across environments, and cause authorized impact queries to fail when the fallback requires forbidden export access.

6 open issues
What changed in this PR

This documentation-only PR defines witan-infra as a planned third layer joining running infrastructure to witan’s code and memory layers, informed by the November gating spikes.

Changes:

  • Adds the design spec covering collectors, identity, secret filtering, reconciliation, tools, authorization, and implementation phases.
  • Proposes ADR 0013: one estate-wide infra graph with a dedicated authorization bundle.
  • Publishes the mirrored ADR and adds navigation entries for both documents.
File Description
zensical.toml Adds navigation links for the spec and ADR.
mcp/​servers/​witan/​docs/​adr/​0013-one-infra-graph-with-a-fixed-id.md Defines the proposed single-graph topology and its tradeoffs.
docs/​internals/​design/​witan-infra-spec.md Specifies the infrastructure layer’s design and delivery plan.
docs/​explanation/​decisions/​0013-one-infra-graph-with-a-fixed-id.md Mirrors the ADR into the documentation site.

Review effort: Balanced

Review on #694 found holes the first draft left open. A run that loses its
lease could still overwrite a newer run's sightings through an unfenced merge,
so sightings now carry the lease epoch and a scope whose sightings disagree
with its latest complete run is re-collected. Chunked deletes cannot be fenced
with today's change_many, so Phase 2 makes it return its commit id.

The allowlist dropped the tags the attribution ladder reads and every route
field, and kept stack output values by key suffix; it now keeps configured tag
keys and reviewed Ingress/ApisixRoute route fields, and stack output values
only for reviewed (project, key) pairs. The unbounded impact walk used export,
which readers are denied, so it reads instead. Observed service edges carry the
environments they were seen in, infra_impact takes an environment, and the
recall seed spells out the `:entity` suffix _resolve_topic needs.

Claude-Session: https://claude.ai/code/session_01FGZebE22D7F3QQjRpu6AUr
…t each other

The owner settled the first open decision: the code_impact deployment block is
filled through a ResultEnricher protocol and entry-point group in witan_core,
so neither server package depends on the other. The spec now states it as
decided under the enrichment section, with the two rejected options and why.

Claude-Session: https://claude.ai/code/session_01FGZebE22D7F3QQjRpu6AUr
@Ardiea Ardiea self-assigned this Nov 24, 2026

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants