Imported from eshu-hq/eshu (
go/internal/projector/cloud/aws/iam/perform/AGENTS.md). Install upstream withnpx skills add eshu-hq/eshu --skill perform. Copyright stays with the author.
AGENTS.md — IAM CAN_PERFORM 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.../trust/AGENTS.mdfor the sibling CAN_ASSUME builder this family sits beside (same entity key, same trigger fact kind, disjointpolicy_sourcepredicate).docs/internal/design/1134-iam-can-perform.mdfor the CAN_PERFORM MVP design and the node-before-edge readiness gate this intent participates in.
Invariants
- Import
internal/projector/intent, never the root projector package. BuildIAMCanPerformMaterializationReducerIntentanchors to the earliest fact in original input order, across BOTHaws_iam_permissionandaws_resource_policy_permission, that qualifies (FirstAcrossKinds): anaws_iam_permissionfact whose payload decodes and carriespolicy_source"inline"or"attached_managed", or any decodableaws_resource_policy_permissionfact. A trust statement (policy_source == "trust") never qualifies — that fact kind's trust statements are the siblingtrustpackage's trigger, not this one's. Do not widen the predicate to accept"trust", narrow it to only one kind, or turn a decode failure into a returned error; each changesFactIDor drops a valid generation.- The payload decode goes through this package's own
factschema_decode_iam.go(decodeIAMCanPerformAWSIAMPermission,decodeIAMCanPerformAWSResourcePolicyPermission;sdk/go/factschemaplusinternal/factenvelopedirectly), never root's classified decode wrapper or the siblingtrustpackage'sdecodeAWSIAMPermissioncopy. This package's wrappers are named distinctly fromtrust's on purpose:scripts/verify-payload-usage-manifest.shrequires every decode seam undergo/internal/projectorto have a globally unique function name (it keys seams by bare identifier, not by (package, identifier)), so reusingdecodeAWSIAMPermissionhere fails the gate with a "declared in both ... factschema_decode_iam.go" error. Root imports this package to dispatch, so the reverse import cycles. Keep the file name on thefactschema_decode*.goconvention and keep thefactschema.FactKindAWSIAMPermission/factschema.FactKindAWSResourcePolicyPermissionreferences inside their function bodies;scripts/verify-payload-usage-manifest.shglobs that name and AST-scans the body to recognize the decode seam, and dropping either silently removes the fact kind from the projector's manifest coverage. iamCanPerformIdentityPolicySourcesduplicates the reducer'siamCanPerformPolicySourceInline/iamCanPerformPolicySourceAttachedManagedconstants on purpose so the projector does not import the reducer package for two strings. Change both together.- The entity key is
aws_resource_materialization:<scope>on purpose. It is NOT a family-distinct key: the reducer's edge handler resolves theGraphProjectionPhaseCanonicalNodesCommittedrow the AWS resource node builders publish under exactly this key, so CAN_PERFORM edges never project before the IAM principal/resource nodes commit. Renaming the key silently removes that gate. - Do not resolve grants, evaluate the closed action catalog, classify target
resource types, or pick edge labels here. The reducer's
DomainIAMCanPerformMaterializationhandler owns the bounded join, the readiness check, and theiam_can_perform_edge_writercall. - Do not move lookup construction, assembly, queue writes, retries, graph writes, or telemetry into this package.
- This is a
risk:schemagraph-write-adjacent surface (design doc §Status); do not widen the CAN_PERFORM trigger scope or honesty boundary without reading the design doc's Open Forks section first.
Verification
Use TDD. Run the focused child test, the root ordered fan-out parity and probe-count tests, package-doc verification, the payload-usage manifest gate, the projector package tree, and the golden-corpus gates selected by the changed paths.