Files
git.stella-ops.org/docs/features/unchecked/cli/baseline-selection-logic.md

38 lines
2.4 KiB
Markdown

# Baseline Selection Logic (Last Green / Previous Release)
## Module
Cli
## Status
IMPLEMENTED
## Description
Compare feature infrastructure exists with services and CLI builder. The specific baseline selection logic (last green verdict, previous release tag) and its visibility to users may be partially implemented.
## What's Implemented
- **Compare Command Builder**: `src/Cli/StellaOps.Cli/Commands/Compare/CompareCommandBuilder.cs` -- `CompareCommandBuilder` (internal static class)
- Sprint: SPRINT_4200_0002_0004_cli_compare
- Implements `stella compare --base <digest> --target <digest>` with options: `--output table|json|sarif`, `--output-file <path>`, `--include-unchanged`
- Requires explicit `--base` and `--target` digest arguments (manual selection)
- **Delta Scan**: `src/Cli/StellaOps.Cli/Commands/Scan/DeltaScanCommandGroup.cs` -- delta scan with baseline comparison
- **VEX Gen Baseline**: `src/Cli/StellaOps.Cli/Commands/VexGenCommandGroup.cs` -- `--baseline <sealId>` option for facet drift baseline; defaults to latest seal for image
- **Seal Store**: `IFacetSealStore.GetLatestSealAsync()` for retrieving most recent baseline
## What's Missing
- **Automatic "last green" selection**: No command or flag like `--baseline last-green` that automatically selects the most recent scan digest with a passing verdict
- **Previous release tag resolution**: No `--baseline previous-release` that resolves the previous release tag from SCM/registry metadata
- **Baseline suggestion in output**: Compare results do not suggest a recommended baseline when none is specified
- **UI baseline picker**: Web UI does not surface baseline selection with "last green" / "previous release" presets
## Implementation Plan
- Add `--baseline-strategy last-green|previous-release|explicit` option to compare and delta-scan commands
- Implement `IBaselineResolver` service with strategies for "last green verdict" (query verdict store for latest pass) and "previous release" (query registry for previous tag)
- Wire baseline resolver into `CompareCommandBuilder` and `DeltaScanCommandGroup`
- Add baseline suggestion panel to Web UI compare view
- Add tests for each baseline strategy
## Related Documentation
- Compare command: `src/Cli/StellaOps.Cli/Commands/Compare/CompareCommandBuilder.cs`
- Delta scan: `src/Cli/StellaOps.Cli/Commands/Scan/DeltaScanCommandGroup.cs`
- VEX gen baseline: `src/Cli/StellaOps.Cli/Commands/VexGenCommandGroup.cs`