Imported from eshu-hq/eshu (
go/internal/projector/cloud/runtime/drift/aws/AGENTS.md). Install upstream withnpx skills add eshu-hq/eshu --skill aws. Copyright stays with the author.
AGENTS.md — AWS cloud-runtime-drift projector intent guidance
Read first
README.mdanddoc.goin this directory.../../../../AGENTS.mdand../../../../README.mdfor projector-wide invariants.../../../../intent/AGENTS.mdfor the neutral builder contract.../../../../scope_generation_intents.gofor root-owned assembly order; this probe runs first, immediately after the package-source-correlation probe and before the multi-cloud-runtime-drift probe.go/internal/reducer/awscloud/aws_cloud_runtime_drift.goandaws_cloud_runtime_drift_writer.gofor what the reducer does with the intent this package enqueues: the bounded ARN join, correlation-rule classification, and the durable candidate write.
Invariants
- Import
internal/projector/intent, never the root projector package. Root imports this package to dispatch, so the reverse import cycles. BuildReducerIntenttriggers on the mere presence of anaws_resourcefact and anchors to the earliest one in original input order (FirstOfKind). It does not inspect any Terraform-state or Terraform-config fact — the reducer's evidence loader owns that join, not the trigger.- The entity key is
aws_cloud_runtime_drift:<scope>. It is deliberately NOTaws_resource_materialization:<scope>— this domain has no canonical-nodes readiness dependency on another AWS builder's phase publication, unlike the AWS cloud-image and workload-cloud builders. SourceSystemis the shared two-tierprojectorintent.SourceSystem: a trimmedSourceRef.SourceSystem, falling back to a trimmedCollectorKind. The pre-extraction root helper (awsCloudRuntimeDriftSourceSystem) had the identical two-tier body.- Do not decode the payload, run the ARN join, or classify drift here. The reducer handler owns the evidence load, correlation-rule classification, and the durable write; an unscanned or unmanaged resource is a reducer-side classification outcome, not a trigger-side decision.
- Do not move lookup construction, assembly, queue writes, retries, graph writes, or telemetry into this package.
Common changes
- Changing the reason string or the entity key. Both are asserted
verbatim by the package tests and by the root fan-out parity fixture
(
../../../../scope_generation_intents_fanout_parity_test.go); change them together. - Changing the trigger kind. This is a correctness decision, not a
cleanup: gating on anything other than bare
aws_resourcepresence changes when the reducer gets a chance to re-run its ARN join and re-classify drift, including retraction cases. Update the root dispatch tests in../../../../aws_cloud_runtime_drift_projection_test.goin the same change.
Failure modes
- A route-serves-data registry citation was checked and found absent.
go/internal/mcp/route_serves_data_registry.goandroute_serves_data_registry_routes.gocite several other projector files by full path and read them for a marker string; neither cites this file or its pre-extraction root path (go/internal/projector/aws_cloud_runtime_drift_intents.go) — verified with a positive control against the registry's cloud-inventory citations, which do cite by path.TestRouteServesDataRegistryingo/internal/mcp/is still run on every change to this family as a regression guard, not because a citation was found. docs/public/observability/telemetry-coverage.mdcarries no row citing the pre-extraction file path either — checked before the move; nothing to repoint.- This family shared two test fixtures with 18 other root test files
before the extraction.
intentForDomain(14 dependents) andawsResourceEnvelope(4 dependents) both lived in the pre-extraction root test file. They moved to a new root file,../../../../reducer_intent_test_helpers_test.go, rather than into this package — they are dispatch-level fixtures forbuildProjection, a root-only function this package cannot call. Do not re-introduce a copy of either helper here; the child's own tests build fixtures locally (resourceEnvelopeinreducer_intent_test.go), matching theaws/cloud/imageprecedent. - The pre-extraction root test file also covered an unrelated family.
aws_cloud_runtime_drift_intents_test.gocarried the only dispatch-level test coverage for theaws_resource_materializationbuilder, which at that time was still the root fileaws_resource_materialization_intents.go. That coverage moved into a new root file matching the builder's own name, and survives today as../../../../aws_resource_materialization_projection_test.go— the builder itself was extracted into../aws/resource/shortly afterwards, also under #6057, and the root file was renamed to match the dispatch-level role it kept. awsCloudRuntimeDriftSourceSystemhad two other root callers at extraction time, not one:aws_resource_materialization_intents.go(since extracted into../../../../aws/resource/materialization_intents.go) andobservabilitycoveragematerialization/materialization_intents.go. Both were repointed toprojectorintent.SourceSystemin the same commit that moved this file, so the helper's definition could be dropped instead of duplicated. A future reader who finds a compile error referencingawsCloudRuntimeDriftSourceSystemin root should repoint the caller toprojectorintent.SourceSystem, not resurrect the helper.
Anti-patterns
- Do not add a package-local source-system helper; the two-tier
projectorintent.SourceSystemIS the pre-extraction behavior here. - Do not import the root
projectorpackage. Root imports this package to dispatch, and the reverse direction is an import cycle. - Do not widen the export surface past
BuildReducerIntent. Every sibling family in this series exports exactly one builder and no types.
Changes needing ADR review
- Adding a decode seam. This family triggers on fact presence alone; families
that need one keep a local decode call against
sdk/go/factschemarather than importing root's wrapper, and that split is a design decision rather than a local call. - Changing
reducer.DomainAWSCloudRuntimeDrift, theaws_resourcetrigger, theaws_cloud_runtime_drift:<scope>entity key, or the two-tier source-system label. All are contract surface the reducer handler and the fan-out parity fixture assert against.
Verification
Use TDD. Run the focused child tests, the root dispatcher tests in
../../../../aws_cloud_runtime_drift_projection_test.go, the root ordered fan-out
parity and probe-count tests, go test ./internal/mcp/ -run TestRouteServesDataRegistry, package-doc verification, the projector package
tree, telemetry coverage, and the golden-corpus gates selected by the changed
paths.