Lineage Smart-Diff UI Architecture

Sprint: SPRINT_20251229_001_FE_lineage_smartdiff_overview Last Updated: 2025-12-29

1. Overview

The Lineage Smart-Diff feature provides a comprehensive UI for visualizing SBOM lineage graphs, comparing artifact versions, and explaining security state changes between builds.

1.1 Completion Status

AreaCompletionNotes
Lineage Graph SVG95%Full DAG visualization with lanes, pan/zoom, nodes
Hover Cards85%Basic info displayed; needs CGS integration
SBOM Diff View90%3-column diff exists; needs row expanders
VEX Diff View90%Status change display; needs reachability gates
Compare Mode85%Three-pane layout exists; needs explainer timeline
Export Dialog80%Basic export; needs audit pack format
Proof Tree75%Merkle tree viz; needs confidence breakdown
Reachability Diff60%Basic view; needs gate visualization

2. UI Data Contracts

2.1 CGS/Lineage API Integration

// Lineage Graph Response
interface LineageGraph {
  artifact: string;
  nodes: LineageNode[];
  edges: LineageEdge[];
  metadata: {
    totalNodes: number;
    maxDepth: number;
    generatedAt: string;
  };
}

interface LineageNode {
  id: string;
  artifactDigest: string;
  artifactRef: string;
  sequenceNumber: number;
  createdAt: string;
  source: string;
  parentDigests: string[];
  badges: {
    newVulns: number;
    resolvedVulns: number;
    signatureStatus: 'valid' | 'invalid' | 'unknown';
    reachabilityStatus: 'analyzed' | 'pending' | 'unavailable';
  };
  replayHash: string;
  cgsHash?: string;
}

interface LineageEdge {
  fromDigest: string;
  toDigest: string;
  relationship: 'parent' | 'build' | 'base' | 'derived';
}

2.2 Diff Response Schema

interface LineageDiffResponse {
  fromDigest: string;
  toDigest: string;
  sbomDiff: {
    added: ComponentDiff[];
    removed: ComponentDiff[];
    versionChanged: VersionChange[];
    licenseChanged: LicenseChange[];
  };
  vexDiff: VexDelta[];
  reachabilityDiff: ReachabilityDelta[];
  replayHash: string;
  generatedAt: string;
}

interface ComponentDiff {
  purl: string;
  name: string;
  version: string;
  ecosystem: string;
  license?: string;
  scope: 'runtime' | 'development' | 'optional';
}

interface VersionChange {
  purl: string;
  name: string;
  fromVersion: string;
  toVersion: string;
  changeType: 'upgrade' | 'downgrade' | 'patch';
}

interface VexDelta {
  cveId: string;
  purl: string;
  fromStatus: VexStatus;
  toStatus: VexStatus;
  justification?: string;
  effectiveAt: string;
}

interface ReachabilityDelta {
  cveId: string;
  purl: string;
  fromReachable: boolean;
  toReachable: boolean;
  paths?: string[][];
}

3. Explainer Timeline Requirements

3.1 Engine Steps

The explainer timeline shows the sequence of analysis steps:

StepDescriptionVisual Cue
SBOM ParseInitial SBOM ingestionDocument icon
Component MatchCVE-to-component matchingLink icon
VEX LookupVEX document resolutionShield icon
ReachabilityCall graph analysisGraph icon
Policy GatePolicy rule evaluationGate icon
VerdictFinal determinationCheckmark/X

3.2 Data Binding

interface ExplainerStep {
  stepId: string;
  stepType: 'sbom_parse' | 'component_match' | 'vex_lookup' | 
            'reachability' | 'policy_gate' | 'verdict';
  timestamp: string;
  duration: number;
  status: 'success' | 'warning' | 'error';
  inputs: Record<string, unknown>;
  outputs: Record<string, unknown>;
  evidence?: {
    type: string;
    hash: string;
    downloadUrl?: string;
  };
}

4. Node Diff Table UX

4.1 Expander Pattern

Each diff row can expand to show:

4.2 Visual Design

┌─────────────────────────────────────────────────────────────┐
│ Component          │ Before        │ After         │ Status│
├─────────────────────────────────────────────────────────────┤
│ ▶ lodash          │ 4.17.20       │ 4.17.21       │ ↑     │
│   └─ CVE-2021-23337 (fixed in 4.17.21)                     │
│   └─ License: MIT                                           │
├─────────────────────────────────────────────────────────────┤
│ ▶ axios           │ 0.21.1        │ 0.21.4        │ ↑     │
├─────────────────────────────────────────────────────────────┤
│ ▶ express         │ -             │ 4.18.2        │ + NEW │
└─────────────────────────────────────────────────────────────┘

5. Reachability Gate Diff UI

5.1 Visual Cues

Gate StatusIconColor
ReachableRed
Not ReachableGreen
Unknown?Gray
ChangedOrange

5.2 Path Display

When reachability changes, show the call path:

entrypoint.ts → handler.ts → vulnerable_fn.ts → lodash.get()

6. Audit Pack Export UI

6.1 Export Options

OptionDescriptionDefault
Include SBOMsBoth before/after SBOMs
Include DiffComponent/VEX/reachability diff
Include AttestationsDSSE envelopes
Include EvidenceSupporting evidence files
Sign BundleSign with tenant key

6.2 Manifest Schema

{
  "version": "1.0",
  "generatedAt": "2025-12-29T10:00:00Z",
  "artifactA": { "digest": "sha256:...", "name": "...", "createdAt": "..." },
  "artifactB": { "digest": "sha256:...", "name": "...", "createdAt": "..." },
  "contents": [
    { "type": "sbom", "filename": "before.cdx.json", "sha256": "..." },
    { "type": "sbom", "filename": "after.cdx.json", "sha256": "..." },
    { "type": "diff", "filename": "diff.json", "sha256": "..." },
    { "type": "attestation", "filename": "attestations.dsse.json", "sha256": "..." }
  ],
  "merkleRoot": "sha256:...",
  "summary": {
    "componentsAdded": 5,
    "componentsRemoved": 2,
    "vexUpdates": 3,
    "attestationCount": 2
  }
}

7. Copy-Safe Workflow

7.1 Pinned Explanation UX

Operators can “pin” explanations for ticket export:

  1. Click pin icon on any verdict/finding
  2. Explanation captures current state with hash
  3. Export as Markdown/JSON for JIRA/ServiceNow

7.2 Ticket Export Format

## Security Finding Report

**Artifact**: myorg/myapp:v1.2.3 (sha256:abc123...)
**Generated**: 2025-12-29T10:00:00Z
**Replay Hash**: sha256:def456...

### Finding: CVE-2021-23337 in lodash

| Field | Value |
|-------|-------|
| Status | Not Affected |
| Reason | Not Reachable |
| Evidence | Call graph analysis |
| VEX ID | VEX-2025-001 |

### Verification

To reproduce this verdict:

stella verdict replay --hash sha256:def456…

8. Confidence Breakdown Charts

8.1 Metrics Sources

MetricSourceWeight
SBOM CompletenessScanner analysis30%
VEX CoverageVEX Hub aggregation25%
Reachability DepthCall graph analysis25%
Attestation CountSigstore/local20%

8.2 Visualization

9. Component Inventory

9.1 Lineage Feature Components

ComponentLocationStatus
LineageGraphComponentlineage-graph.component.tsComplete
LineageNodeComponentlineage-node.component.tsComplete
LineageEdgeComponentlineage-edge.component.tsComplete
LineageHoverCardComponentlineage-hover-card.component.tsNeeds CGS
LineageMiniMapComponentlineage-minimap.component.tsComplete
LineageControlsComponentlineage-controls.component.tsComplete
LineageSbomDiffComponentlineage-sbom-diff.component.tsNeeds expanders
LineageVexDiffComponentlineage-vex-diff.component.tsNeeds gates
LineageCompareComponentlineage-compare.component.tsNeeds timeline
LineageExportDialogComponentlineage-export-dialog.component.tsNeeds audit pack