Repository navigation
Description
A read-only cloud lister in behold, written in TypeScript, that behold index calls to fill the index straight from cloud APIs. This is tier 1 of #1025, the cloud source researched in #1023. It reads inventory and writes nothing to the cloud.
Wave 1. Moved from choudoufu on the maintainer's ruling (2026-10-26): the lister is generic, so it lives with its only caller.
Why not choudoufu's sweeps
choudoufu's sweeps answer an engine's question: which objects carry this estate's marker. An index asks a different one: what is in this account. Each cloud has an inventory API built for that, so behold calls those and needs nothing from choudoufu:
| Substrate | Inventory API | Note |
|---|---|---|
| AWS | Cloud Control ListResources, per type |
some types need a parent identifier; a type that cannot be listed is reported |
| Azure | Resource Graph, one query per scope | covers every ARM type with one call shape |
| GCP | Cloud Asset Inventory searchAllResources |
the API has to be enabled on the project; if it is not, say so and stop |
| Kubernetes | discovery, then LIST per served kind | through the k8s client behold already uses |
The engines keep their sweeps, and #1024's other children still read ownership from the markers that come back in the tags and labels.
What it does
It writes one record per resource, in the index's node schema (#1025, INTENTIUS/chant#4520):
- the substrate, the type as the cloud names it, and the region or location;
- every cloud ID the listing returns (ARN, ARM ID, GCP resource name, Kubernetes UID);
- the tags or labels, including any ownership markers left by choudoufu, plunge or chant;
- the properties the listing returns, unnormalized;
observedAt.
The scope comes from behold index flags: account, subscription, project or cluster; regions; types; a tag filter.
Also settles
From #1023, which now covers only edge derivation and false joins:
- Listing cost. Time and API calls to list an account, full and narrowed by region, type or tag. A tag filter finds only tagged resources, so say what full listing costs.
- Credentials. The narrowest read-only role or reader assignment for each cloud, written down so a person can create it.
Rules
- Read-only by construction. Only listing and get clients are built. There is no estate, no record store and no write call.
- No project or configuration is read. It works in an empty directory.
- A type it cannot list goes in the output's notes with the reason. It is never skipped silently.
- Secret-bearing properties are masked before anything is stored.
- Nothing is enabled for the person. Asset Inventory has to be enabled on a GCP project before it can be read, and enabling it is a change to the project. If it is off, the lister says so, prints the command that enables it, and lists nothing for that project. Tier 1's docs say the same.
Done when
- A test fails if any mutating API is reachable from the lister. Show it red first by adding one.
- A type with no lister appears in the notes with its reason.
- Each substrate lists against an emulator, or a recorded fixture where no emulator serves the inventory API, and the recorded output has the fields above. Which emulators serve these APIs is unchecked, so the first step is to find out. The maintainer runs anything against an emulator or a real cloud.
Part of #1024 (the graph query epic). Design: #1025.
Acceptance: verdict lines and recorded artifacts, never exit codes alone. Red-first only for new guards.
Activity
[-]index: a read-only lister over the public sweeps, for behold index[/-][+]index: a read-only cloud lister over each cloud's inventory API, for behold index[/+]lex00 commentedon Oct 26, 2026
Ruling for consolidation-graph (2026-10-26): "probably behold if its generic enough". It is generic: it reads each cloud's inventory API and uses none of the engines' sweeps, so it lives in behold, moved here from INTENTIUS/choudoufu#2283. It runs inside
behold index, so it needs no command name of its own. This also answers #1023 question 6.lex00 commentedon Oct 27, 2026
Which pinned emulators serve the inventory APIs
Read from source at the pinned images' commits. Nothing was run. The pins are choudoufu
live/floci-image(floci c688f52ee, per choudoufu 6a3b59036a),live/floci-gcp-image(floci-gcp 641e6e8, choudoufu c97e9f6283),live/floci-az-image(floci-az 7f079c2, choudoufu 07bc01f104) andlive/kind-node-image(kindest/node:v1.37.0).ListResourcessrc/main/java/io/github/hectorvent/floci/services/cloudcontrol/CloudControlJsonHandler.java:24-38(dispatch),:93-105(response),CloudControlService.java:282-312(per-type switch, thenCloudControlStoreLister)POST /providers/Microsoft.ResourceGraph/resourcessrc/main/java/io/floci/az/services/resourcegraph/ResourceGraphHandler.java:33-76,docs/services/resource-graph.mdsearchAllResources/cloudassetsrc/main/java/io/floci/gcp/services/cloudasset/CloudAssetController.java:17-40,CloudAssetService.java:79-112Details that change what an emulator run proves:
GetResourceis served (CloudControlJsonHandler.java:27,:40-50). It reads throughlistResources, then falls back to whatCreateResourcerecorded (CloudControlService.java:234-248). TheUnsupportedOperationanswer belongs to any other action (:35-36).ListResourcesignoresNextToken,MaxResultsandResourceModel, so paging and parent-identifier types are not exercised. A type floci does not model returns an empty list, not an error. The hand-written switch covers 25 types, and the store lister covers others by matching class names (CloudControlStoreLister.java:22-55). An emptylistedentry on floci is therefore weaker evidence than one on AWS. floci never answersUnsupportedActionExceptionorTypeNotFoundExceptionfor a list, so the lister's "no lister" note for AWS is covered by a fake, not by the emulator.where,in~,unionwith a subquery,project,order by), plus$top/$skipTokenpaging and lowercasetype, as Azure does.joinand other aggregations answer 400InvalidQuery, andfacetsis always empty./cloudasset/v1/...because/v1/projectsbelongs to IAM. A host-mode rewrite exists for acloudasset.*Host header (core/common/routing/ServiceRoutingFilter.java), so the endpoint to pass ishttp://localhost:4588/cloudasset. Only project scopes are served (folder and org answer UNIMPLEMENTED,CloudAssetService.java:114-121). Assets come from four sources: Compute, GCS, IAM and Pub/Sub (*AssetSource.java). The query subset islabels.K=V,labels.K:V,tagKeys,tagValuesandtagValueIds, joined withAND(AssetQuery.java:13-15), and there is no location term, so the lister filters locations itself. SERVICE_DISABLED is answered exactly as GCP answers it (403 PERMISSION_DENIED, ErrorInfo reasonSERVICE_DISABLED,core/common/ServiceUsageGate.java:20-100), but only withfloci-gcp.services.serviceusage.enforcement-enabled: true. That setting defaults to false (application.yml:166-169). The "API is off" path can therefore be shown on the emulator by starting it with enforcement on and leaving cloudasset out ofdefault-enabled, without any enable call.So every substrate can be listed against a pinned emulator. No recorded fixture is needed for any of the four. The unit's tests fake each API, with shapes taken from the files above. The emulator runs are the maintainer's.
lex00 commentedon Oct 27, 2026
Landed on integration/consolidation-graph
Merge commit
2a3190affb4485275eafdc798cce5be93fc8ccea(unit branchunit/cg-behold-1029,9ab1eb5e). Checked withnpm ciandnpx tsc --noEmitagainst published chant 0.124.52. The tests are written but have not been run.What it is
src/cloud-lister/, a library thatbehold index(#1026) calls. It adds no command (ruling of 2026-10-26).listCloud(scope, target, options)lists one substrate and one account, subscription, project or cluster (#1025 ruling Q6) and returns #1025'sListingResult:resources[](ListedResource):idin the ruled path style<substrate>/<scopeId>/<location>/<listedType>/<nativeId>(Q2), with%and/escaped in the first four parts only, so the native id stays verbatim andparseListedNodeIdgives the parts back. Each also carrieslistedType,location,nativeId,cloudIds,tags,propertiesas returned (masked),observedAt, and a nestedfactsholding onlymarkers,cloudIdsandobservedAt(Q1).ownership,ownedByandrecordVersionsstay absent.coverage[], one entry per (type, location) attempted:listed, or chant'sUnobservedReason(unsupported-kind,no-credentials,read-failed,filtered). Under a tag filter every entry readsfiltered."*"means every type or location. A reader that does not know the wildcard matches nothing and so reads not observed, which is the safe direction.notes[], typed by code:no-lister,needs-parent,api-disabled(withcommand),read-failed,no-credentials,default-types,tag-filter.cloudIdsuse chant#4520's ruled kinds: an ARN isarn, the Cloud Control identifier isimport-id, an ARM id (original and lowercased) or a GCP asset name isprovider-id, a GCP selfLink isself-link, and a Kubernetes UID isk8s-uid.markersuse chant#4520's shape withsource: "live", read from choudoufu'stofu-estate/tofu-address(escaped), then plunge'splunge-stack/plunge-urn(plain on tags, digest on labels), then chant's per-lexiconChannelKeys. When an object carries several, the first in that order wins. All tags stay intags.Per substrate:
ListResources, SigV4 signed by hand (sigv4.ts), paged withNextTokentypes: "*"lists 30 default types and adds a note. Global types (IAM, CloudFront, Route 53, Organizations, Global Accelerator) are listed once asglobal. The tag filter is applied after listing. UnsupportedAction and TypeNotFound giveno-lister, a ResourceModel error givesneeds-parent$skipTokenunion ResourceContainerssearchAllResourceson the project, pagedread-failed, and the note'scommandisgcloud services enable cloudasset.googleapis.com --project=<p>. Locations are filtered after the call. For floci-gcp the endpoint ishttp://localhost:4588/cloudassetcontinueclusterfor cluster-scoped kinds.types: "*"leaves out Events and Leases and adds a note.managedFieldsis dropped. A Secret'sdata,stringDataand last-applied annotation are masked whole.kubeTargetFromKubeconfigtakes a token, a token file or a client cert and key, and refusesexecandauth-providerThe goal's rules, and where they are enforced
WireCallthroughTransport.send, which runsassertReadCallfirst (guard.ts). The call is classified from the wire (method, path,X-Amz-Target) againstREAD_OPERATIONS:cloudcontrol:ListResources,resourcegraph:resources,cloudasset:searchAllResources,k8s:discovery,k8s:list. No Service Usage call is admitted, so enabling Asset Inventory cannot be reached.OriginRefusedotherwise.token: nullfor an anonymous floci-gcp) and throwsListerConfigErrorwithout them. No chain is consulted. Only a run with no endpoint may use the SDK chains (fromNodeProviderChain,DefaultAzureCredential,GoogleAuth). Those come from optional peer dependencies (@aws-sdk/credential-providers,@azure/identity,google-auth-library), imported lazily by a non-literal specifier, so behold's install and bundle do not grow. The lister reads no environment variable.SENSITIVE_KEY_PATTERNSare applied at every depth, including{Key, Value}pairs and tags, before the result exists. Published chant does not shipsensitive-keyyet, so the list is copied, andshape.test.tscompares it with chant's when the installed chant has the module.Tests (written, not run)
guard.test.tscovers this issue's first done-when item. The allowlist is pinned to exactly the five operations above and may name no write. 24 mutating calls are refused by the guard without reaching the fetcher, among them Cloud Control Create/Update/Delete/Cancel, ARM PUT/DELETE/provider actions, Service Usage:enableand:batchEnable,POST searchAllResources, Asset feeds and export, and k8s POST/PUT/PATCH/DELETE, watch, exec and proxy. Every call each lister makes against fakes classifies into the allowlist. A static scan finds no PUT, PATCH or DELETE, no Cloud Control target other thanListResources, no Service Usage host and no SDK client import. Red first: add"cloudcontrol:CreateResource"toREAD_OPERATIONS.aws, or amethod: "PUT"call to any lister, and it fails. That still needs a run.aws.test.ts,azure.test.ts,gcp.test.tsandkubernetes.test.tsrun each lister against fakes whose response shapes come from the pinned emulators' source. They cover paging, the fields above, masking, markers, the notes for a type with no lister (the second done-when item), tag-filter coverage, and that with an endpoint and no static credentials the run is refused and the chain counter stays at 0. The GCP disabled-API case asserts one call (the search) and nothing to Service Usage.aws.test.tschecks SigV4 against AWS'sget-vanillaknown answer.shape.test.tscovers ids, masking and markers.Also settled (from #1023)
docs/design/cloud-lister.mdcovers the narrowest grant per cloud (AWScloudformation:ListResourcesplus each type'shandlers.list.permissions, orReadOnlyAccess; AzureReader; GCProles/cloudasset.viewer; a k8s ClusterRole withlist), the API that must be enabled by hand, and listing cost as call counts derived from the code. Time per call is unmeasured.Still missing, or for a run
behold index(behold index <substrate>: fill an index from a cloud with no project, read-only #1026) or a small driver. My emulator comment above has the endpoints. On floci-gcp, the disabled-API path needsserviceusage.enforcement-enabled: true, with GOOGLE_APPLICATION_CREDENTIALS unset and CLOUDSDK_CONFIG empty under the goal's GCP rule. Unticked.sensitive-key,types.tsbecomes a re-export behindsrc/chant-release.ts, andmask.tsimports chant's list."*"as a coverage wildcard. The alternative was listing only (type, location) pairs that returned objects, which would make a type with zero objects read as not observed. The wildcard is safe for readers that do not know it. chant#4521 and index: what changed between two reads, drawn as an overlay #1028 should treat"*"as match-all.No acceptance box is ticked.
lex00 commentedon Oct 27, 2026
Note for consolidation-graph (2026-10-26): where the index command lives, weighed after the maintainer asked whether it belongs in chant ("chant index").
Already in chant: the store (chant#4519), typing listed resources (#4521), derived edges (#4522), the identity matcher (#4523), and the consumers
chant search --index(#4525),chant importfrom an index (#4524) and drift from an index (#4526). In behold: this lister, thebehold indexcommand (#1026, merged e98e04b), the graph pane (#1027) and the diff overlay (#1028). So the open part is only who reads the clouds' inventory APIs.chant indexthatbehold indexcalls.Maintainer's current lean: the index may belong in behold. Recommendation: keep it here; revisit when #4524-#4526 reach chant-only users.
lex00 commentedon Oct 27, 2026
Ruling for consolidation-graph (2026-10-26): behold is a control plane; every model lives in chant.
Question: should behold be only a control plane (it drives, shows and queries) with every model in chant?
Answer: Yes, move models now. Record the rule. In this session: the lister moves to chant as
chant index(behold index calls it), the index diff is computed in chant, behold's value-match.ts is retired in favour of chant's edge and identity passes, and the LadybugDB layout is generated from chant's schema.Context from the maintainer the same day: chant is the origin of the identity-marker model; choudoufu and plunge are engines for chant (and standalone); behold takes its model from chant and works standalone with Terraform only, Pulumi only, or cloud native only. This reverses the 2026-10-26 ruling that the lister lives in behold (behold#1029). behold keeps: the pane, kiosk and overlays, Cypher over a session projection, the MCP surface, chant Ops pass-through, the demos.
lex00 commentedon Oct 27, 2026
Ready for the maintainer (consolidation-graph, 2026-10-27)
behold main is 8b74db5, whose tree equals the epic-ready tested tip fd1dd6a. chant main is 47b8594e3.
Per the ruling at #1029 (comment) the lister moved to chant as
chant index(chant#4532), andbehold indexcalls it. The code is under packages/core/src/cloud-lister/ on chant main, with docs/design/cloud-lister.md. The emulator survey is #1029 (comment): every pinned emulator serves its substrate's inventory API.What epic-ready proved: chant's unit vitest at b6281ef154 passed with no failure under cloud-lister/, which includes guard.test.ts (the five-read allowlist, every mutating call refused, the origin pin, every call each lister makes on the allowlist) and the per-substrate tests with the no-lister notes. That covers done-when 1 and 2 as tests. I found no record that the guard was shown red first by adding a mutating call. That part of done-when 1 is unconfirmed.
Left: done-when 3, each substrate listing against its emulator, with the recorded output holding the fields in the body.
Commands: run sheet entries A1, C4, D4 and E1 in engine-wt/goals/consolidation-graph-1-runs.md.
lex00 commentedon Nov 16, 2026
Done-when 3: each substrate against its emulator
These are the old run sheet's four runs for this issue. They used chant
0.124.101from the behold worktree, and the stamp readschant-lister0.33.2. Each command ran under a scratch HOME.GOOGLE_APPLICATION_CREDENTIALSwas unset,CLOUDSDK_CONFIGwas empty and noAZURE_*orARM_*variable was set. The emulator runs pass--endpoint, and no real cloud was reached.C4: gcp on floci-gcp
The emulator is the digest in
live/floci-gcp-image, started withdocker run -d -p 127.0.0.1:14588:4588 -e FLOCI_GCP_DEFAULT_PROJECT_ID=behold-c4. I seeded it through its own HTTP endpoints with a bucket carrying labelstofu-estate=demoandenv=test, a network, a subnetwork, a disk, a VM labelledtofu-estate=demoandrole=web, and a Pub/Sub topic labelledenv=test.The notes list is empty, and the six nodes are the six seeded resources.
lexicongcp;substrategcpin the stamp scopelistedTypecompute.googleapis.com/Instance,kindGCP::Compute::Instanceus-central1-a(VM),us(bucket),global(network)provider-id,//compute.googleapis.com/projects/behold-c4/zones/us-central1-a/instances/behold-c4-vmtags{"role":"web","tofu-estate":"demo"}on the VM{"owner":"demo","encoding":"escaped","source":"live"}; the topic has noneattrskeepsassetType,displayName,location,name,project; the emulator'screateTimeand the bucket'supdateTimeare droppedfacts.observedAtand the stamp*/*entry,listedThe Pub/Sub topic has no location in the emulator's answer and the node gets
global.For the API-disabled path I started a second container with
-p 127.0.0.1:14589:4588 -e FLOCI_GCP_SERVICES_SERVICEUSAGE_ENFORCEMENT_ENABLED=true.cloudasset.googleapis.comis not in its default-enabled list, and it answers 403PERMISSION_DENIED. Nothing was enabled.The stored version,
20261116T192801Z-a6e83115d4f7.json, has verdictread-failedand no nodes. Its note is of kindapi-disabledand itscommandfield readsgcloud services enable cloudasset.googleapis.com --project=behold-c4.That command is the first thing wrong. The stored note holds it, but the CLI prints only the message, which tells the reader to run a command it never shows.
--jsonreducesnotesto plain strings and also leaves it out. The issue says the lister prints the command.D4: azure on floci-az
The emulator is the digest in
live/floci-az-image, started withdocker run -d -p 127.0.0.1:14577:4577 -e FLOCI_AZ_STORAGE_MODE=memory -e FLOCI_AZ_PARITY=azure. It ran over plain HTTP, so the TLS path was not exercised. A dummy bearer token and ARM PUTs seeded a resource group taggedtofu-estate=demo. The same calls added a virtual network with one subnet, taggedenv=testandtofu-estate=demo, and awesteuropestorage account taggedenv=test.lexiconazurelistedTypemicrosoft.network/virtualnetworks(lowercase, as Resource Graph returns it),kindMicrosoft.Network/virtualNetworkseastus,westeurope; the subnet has none in the listing and getsglobalprovider-identries per node, the ARM id as returned and its lowercased form{"env":"test","tofu-estate":"demo"}on the VNet{"owner":"demo","encoding":"escaped","source":"live"}attrs:addressSpace,subnets,accessTier,primaryEndpoints,sku,encryptionfacts.observedAtand the stamp*/*entry,listedThe resource group is the one node with no lexicon kind. It is kept with
unmappedKind: trueand a note naming the type, which is what the issue's rule for a type with no lister asks for. The seed held no secret-bearing property, so masking was not exercised on Azure. The Kubernetes run covers it.E1: kubernetes on a scratch kind cluster
k3d cluster createfailed twice here before any node started (failed to ensure tools node: failed to retrieve cluster: No nodes found for given cluster, with and without the image volume). On this machinedocker psomits containers that the Docker API lists, which is the likely cause. I used kind instead. The node image is the pin inlive/kind-node-image,kindest/node:v1.37.0, and the cluster isbehold-ladybug-e1. kind wrote its kubeconfig to a scratch file only. The namespacebehold-e1holds a Deploymentweblabelledtofu-estate=demoand a Serviceweb. It also holds a ConfigMapsettingslabelledenv=testandtofu-estate=demo, and a Secretcredswith a password and a token value.The run took 1.7 seconds. One of the 55 notes is
default-types(types "*"left outv1/Event,events.k8s.io/v1/Eventandcoordination.k8s.io/v1/Lease). The other 54 areambiguous-identity.lexiconk8s, scopekuberneteslistedTypeapps/v1/Deployment,kindK8s::Apps::Deploymentbehold-e1, orclusterfor cluster-scoped kindsk8s-uid,d67ca97d-99b1-4d06-aad8-dd3c6bc7005dfor the Deploymenttags{"app":"web","app.kubernetes.io/name":"web","tofu-estate":"demo"}{"owner":"demo","encoding":"escaped","source":"live"}; the Secret has no marker labelattrsholdsmetadataandspec(ordata); there is nostatusblockdatais{"password":"[REDACTED]","token":"[REDACTED]"}, and neither seeded value occurs in the stored filesfacts.observedAtand the stamplistedThe second thing wrong is the note volume. Fifty-four
ambiguous-identitynotes on a stock cluster bury the one note a reader wants. A node name matches both thev1/Nodeand thestorage.k8s.io/v1/CSINodeof that name, and a ClusterRole and ClusterRoleBinding pair namedkindnetorsystem:kube-schedulermatch each other the same way.A1: aws on floci
The emulator is the digest in
live/floci-image, on127.0.0.1:14566, seeded with the aws CLI. The full run is on #1026.lexiconaws, stamp scopeawslistedTypeandkindAWS::S3::Bucketus-east-1, orglobalfor the IAM roleimport-idladybug-a1-data; the table carries its ARNteam=databefore the read liststags{}, since floci'sListResourcesreturns no tagsattrsis what floci returns:BucketNamealone for a bucket,PathandRoleNamefor a rolefacts.observedAtand the stamplistedWithout
@intentius/chant-lexicon-awsbeside behold, the same run keeps all 17 as nodes of unknown kind with no derived edges, and says so in a note.Verdict
Each substrate lists against its emulator and the recorded output holds every field in the issue's list. Two properties are thinner than the issue says: GCP drops
createTimeandupdateTime, and Kubernetes keeps nostatus. One rule is not met as written: the GCP disabled-API note does not print thegcloud services enablecommand on the CLI. The disabled-API path itself lists nothing and enables nothing.The version files sit under
.scratch/listers/in the behold-ladybug worktree. The stores arestore-gcp,store-gcp-off,store-azandstore-k8s. Commands and output are inlogs/.lex00 commentedon Nov 17, 2026
The lister lives in chant as
chant index(chant#4532), andbehold indexcalls it. This issue closes with that pull request.The 2026-11-16 runs found two things in the chant lister. Both are fixed in the pull request for chant#4532.
gcloud services enablecommand but the command line printed only the message. It now prints the command under the note, and--jsonkeeps it innoteDetails.ambiguous-identitynotes on a stock kind cluster buried the useful one. A kind that repeats more than three times now prints as one line with a count and an example. The stored version and--jsonkeep every note. Identity matching is not changed here; chant#5250 makes it kind-aware.Done-when 1, red first. I added
"cloudcontrol:CreateResource"toREAD_OPERATIONS.awsand rannpx vitest run packages/core/src/cloud-lister/guard.test.ts. It failed like this:Then I changed the GCP lister's call to
method: "PUT", which failed like this:Both plants are reverted and not committed. After the revert it passes:
AWS on floci, from the chant build. A scratch floci (
ladybug-4532-floci, port 14532, dummy credentials) seeded with the aws CLI. It holds a VPC with a subnet and a security group, a bucket and a role.The stored version is
<XDG_DATA_HOME>/chant/index/cloud/aws/000000000000/dc89c2ad5774/20261117T042425Z-45dc93953b68.json, next to itsscope.json.lex00 commentedon Nov 17, 2026
This closes with chant#5273, which closed chant#4532. The lister is chant's
chant index, andbehold indexcalls it. The runs above met each done-when item on every substrate, and chant#5273 fixed the two things they found. A disabled-API note now prints its command, and repeated notes fold into one line.