Files
git.stella-ops.org/src/Concelier/__Libraries/StellaOps.Concelier.Exporter.TrivyDb/AGENTS.md
master 3a2100aa78 Add unit and integration tests for VexCandidateEmitter and SmartDiff repositories
- Implemented comprehensive unit tests for VexCandidateEmitter to validate candidate emission logic based on various scenarios including absent and present APIs, confidence thresholds, and rate limiting.
- Added integration tests for SmartDiff PostgreSQL repositories, covering snapshot storage and retrieval, candidate storage, and material risk change handling.
- Ensured tests validate correct behavior for storing, retrieving, and querying snapshots and candidates, including edge cases and expected outcomes.
2025-12-16 19:00:43 +02:00

2.7 KiB

AGENTS

Role

Exporter producing a Trivy-compatible database artifact for self-hosting or offline use. v0: JSON list + metadata; v1: integrate official trivy-db builder or write BoltDB directly; pack and optionally push via ORAS.

Scope

  • Read canonical advisories; serialize payload for builder or intermediate; write metadata.json (generatedAt, counts).
  • Output root: exports/trivy/; deterministic path components.
  • OCI/Trivy expectations: layer media type application/vnd.aquasec.trivy.db.layer.v1.tar+gzip; config media type application/vnd.aquasec.trivy.config.v1+json; tag (e.g., 2).
  • Optional ORAS push; optional offline bundle (db.tar.gz + metadata.json).
  • DI: TrivyExporter + Jobs.TrivyExportJob registered by TrivyExporterDependencyInjectionRoutine.
  • Export_state recording: capture digests, counts, start/end timestamps for idempotent reruns and incremental packaging.

Participants

  • Storage.Postgres.AdvisoryStore as input.
  • Core scheduler runs export job; WebService/Plugins trigger it.
  • JSON exporter (optional precursor) if choosing the builder path.

Interfaces & contracts

  • IFeedExporter.Name = "trivy-db"; ExportAsync(IServiceProvider, CancellationToken).
  • ConcelierOptions.packaging.trivy governs repo/tag/publish/offline_bundle.
  • Deterministic sorting and timestamp discipline (UTC; consider build reproducibility knobs).

In/Out of scope

In: assembling builder inputs, packing tar.gz, pushing to registry when configured. Out: signing (external pipeline), scanner behavior.

Observability & security expectations

  • Metrics: export.trivy.records, size_bytes, duration, oras.push.success/fail.
  • Logs: export path, repo/tag, digest; redact credentials; backoff on push errors.

Tests

  • Author and review coverage in ../StellaOps.Concelier.Exporter.TrivyDb.Tests.
  • Shared fixtures (e.g., PostgresIntegrationFixture, ConnectorTestHarness) live in ../StellaOps.Concelier.Testing.
  • Keep fixtures deterministic; match new cases to real-world advisories or regression scenarios.

Required Reading

  • docs/modules/concelier/architecture.md
  • docs/modules/platform/architecture-overview.md

Working Agreement

    1. Update task status to DOING/DONE in both correspoding sprint file /docs/implplan/SPRINT_*.md and the local TASKS.md when you start or finish work.
    1. Review this charter and the Required Reading documents before coding; confirm prerequisites are met.
    1. Keep changes deterministic (stable ordering, timestamps, hashes) and align with offline/air-gap expectations.
    1. Coordinate doc updates, tests, and cross-guild communication whenever contracts or workflows change.
    1. Revert to TODO if you pause the task without shipping changes; leave notes in commit/PR descriptions for context.