Repository navigation
Description
The existing describeResources() plugin contract is entity-keyed: "given a chant entity, return its runtime state." It works for AWS, Temporal, K8s, GCP, Azure — every lexicon whose chant entities have a 1:1 cloud equivalent.
The remaining lexicons (helm, docker, flyway, slurm) emit authoring primitives (chart files, compose files, migration scripts, sbatch jobs) that don't have entity-level runtime state. The right query shape for them is context-keyed: "given an environment, list the artifacts that exist there."
This issue introduces the second contract and wires it through the state pipeline. Per-lexicon implementations follow in #52–#55.
Proposed contract
// In packages/core/src/lexicon.ts
listArtifacts?(options: {
environment: string;
// No entityNames/entities — this is a context-scan, not an entity lookup.
// Implementations may still read the entities map if it helps (e.g. Flyway
// discovers which envs to query) — passed via the same shape as
// describeResources for consistency.
entities: Map<string, { entityType: string; props: Record<string, unknown> }>;
}): Promise<Record<string, ArtifactMetadata>>;
interface ArtifactMetadata {
type: string; // e.g. "Helm::Release", "Docker::Container"
physicalId: string; // server-side identifier
status: string;
lastUpdated?: string;
attributes?: Record<string, unknown>;
}The shape is identical to ResourceMetadata; the conceptual difference is whether the lexicon implements describeResources (entity-keyed lookup) or listArtifacts (context scan). A lexicon may implement both if it has both shapes, but most implement one or the other.
State pipeline integration
StateSnapshot(packages/core/src/state/types.ts) gains an optionalartifacts?: Record<string, ArtifactMetadata>field alongsideresources.takeSnapshot()(packages/core/src/state/snapshot.ts) calls bothdescribeResources()andlistArtifacts()per plugin and merges into the snapshot.diffLive()(packages/core/src/state/live-diff.ts) handles the artifact case — nodeclaredaxis; onlyobservedThenvsobservedNow. New result categories:artifactsAdded,artifactsRemoved,artifactsChanged,artifactsUnchanged.runStateDiffLive(packages/core/src/cli/handlers/state.ts) renders artifacts in their own section (ARTIFACTS ADDED/REMOVED/CHANGED). Headers must be added toDRIFT_HEADERSinlexicons/temporal/src/op/activities/state.tssoWatchOp's drift detection scans for them.
Tasks
- Add
ArtifactMetadatatype alongsideResourceMetadatainpackages/core/src/lexicon.ts - Add
listArtifacts?()toLexiconPluginin the same file - Extend
StateSnapshotwith optionalartifactsfield - Update
takeSnapshot()to invoke both methods per plugin and merge results into the snapshot file - Update sensitive-data check in
validateResources(or a newvalidateArtifacts) to also scan artifact attributes - Update
diffLive()to handle the artifact-only case (no declared comparison) — emit a separateLiveArtifactDiffor extendLiveDiffResult - Update
runStateDiffLiverendering with anARTIFACTSsection per lexicon - Add new section headers to
DRIFT_HEADERSinlexicons/temporal/src/op/activities/state.tssoWatchOpcatches artifact changes - Extend
mockPlugin(packages/test-utils/src/mock-plugin.ts) with alistArtifacts?option matching the existingdescribeResources?pattern - Add a
staticListArtifacts(...)helper alongsidestaticDescribeResources(...)for test ergonomics - Tests covering the pipeline:
-
takeSnapshotcalls both methods when both are implemented -
takeSnapshotcalls onlylistArtifactswhen only that's implemented -
diffLiveartifacts case: added, removed, changed, unchanged - handler renders the artifacts section
-
WatchOp'sstateDiffactivity treats artifact section headers as drift
-
Done when
-
LexiconPlugin.listArtifacts()exists and is documented with JSDoc -
state snapshot <env>writesartifactsto the snapshot file alongsideresources -
state diff --liverenders an artifacts section per lexicon - Mock plugin factory supports
listArtifactsexactly like it supportsdescribeResources - All new tests pass; existing 1645+ tests still pass
Out of scope
- Per-lexicon implementations — that's helm: implement listArtifacts() — helm list -A -o json #52–slurm: implement listArtifacts() — partition state via sinfo #55.
listRecentRuns()or any other observation surface beyond list-and-diff.
Parent
Splits #50.
Activity
Merge pull request #57 from INTENTIUS/feat/list-artifacts-contract-is…