Hybrid diff artifacts (source, symbols, normalized bytes)
Verified against commit
942a18727c(2026-09-26). Re-verify with:git grep -n "public sealed record\|public .* { get; init; }" -- src/Vulnerabilities/__Libraries/StellaOps.Vulnerabilities.BinaryArtifacts/DeltaSig/HybridDiffContracts.cs
Objective
A hybrid diff links three views of one patch so that a reviewer or a policy can check them against each other:
- source-level intent: a semantic edit script anchored to classes and functions;
- build-level mapping: symbol maps tied to a build identity;
- binary-level change: per-symbol deltas over normalized bytes.
Implementation
The contracts and the composer are in the closed BinaryArtifacts SDK, src/Vulnerabilities/__Libraries/StellaOps.Vulnerabilities.BinaryArtifacts/DeltaSig/:
| File | Content |
|---|---|
HybridDiffContracts.cs | SemanticEditScript, SymbolMap, SymbolPatchPlan, PatchManifest and the HybridDiffEvidence bundle |
HybridDiffComposer.cs | IHybridDiffComposer: builds the edit script from source diffs, builds a fallback symbol map from signatures, joins edits and symbols into a patch plan, builds the patch manifest, and computes the linking digests |
DeltaSigService.cs | Attaches HybridDiffEvidence to the v1 DeltaSigPredicate (hybridDiff) when DeltaSigRequest.IncludeHybridDiffEvidence is true (the default) |
DeltaSigRequest accepts optional SourceDiffs, OldSymbolMap and NewSymbolMap. When no symbol map is supplied, the composer synthesizes one from the generated signatures (AddressSource records the origin; the default is manifest).
Current constraints:
- Semantic edits are derived with deterministic text and symbol heuristics. There is no language-specific AST adapter.
- Delta verification is at boundary and hash level. There is no byte-level patch replay.
Artifact contracts
All four artifacts carry SchemaVersion, default 1.0.0.
Semantic edit script
SourceTreeDigest and Edits[]. Each SemanticEdit has StableId, EditType, NodeKind, NodePath, Anchor, and optional PreSpan, PostSpan (StartLine, EndLine), PreDigest, PostDigest.
Symbol map
BuildId, optional BinaryDigest, AddressSource, and Symbols[]. Each SymbolMapEntry has Name, Kind (default function), AddressStart, AddressEnd, Section (default .text) and optional SourceRanges[] (File, LineStart, LineEnd).
Symbol patch plan
BuildIdBefore, BuildIdAfter, EditsDigest, SymbolMapDigestBefore, SymbolMapDigestAfter, and Changes[]. Each SymbolPatchChange has Symbol, ChangeType, AstAnchors[], optional PreHash and PostHash, and DeltaRef.
Patch manifest
BuildId, NormalizationRecipeId and Patches[]. Each SymbolPatchArtifact has Symbol, AddressRange, DeltaDigest, and Pre and Post values of Size and Hash. The manifest does not carry an attestation reference.
Evidence bundle
HybridDiffEvidence carries the edit script, both symbol maps, the patch plan and the patch manifest, plus the digest of each: SemanticEditScriptDigest, OldSymbolMapDigest, NewSymbolMapDigest, SymbolPatchPlanDigest, PatchManifestDigest.
Verification
DeltaSigService.VerifyAsync recomputes each artifact digest and fails with DeltaSigVerificationStatus.HybridEvidenceMismatch when a digest or linkage does not match. A predicate without hybridDiff is verified without this step.
Policy
DeltaSigPolicyOptions (in IDeltaSigService.cs) adds hybrid controls to the function-count and byte budgets: RequireHybridEvidence, RequireAstAnchors, DeniedSymbolPrefixes, ProtectedSymbolPrefixes and MaxPatchManifestDeltaBytes. The hub-owned DeltaSigPolicyEvaluator.EvaluatePolicy (src/Vulnerabilities/__Libraries/StellaOps.Vulnerabilities.DeltaSig/Policy/) evaluates them. At the verified commit its only caller is DeltaSigServiceHybridPolicyTests. The stella binary delta-sig gate command applies its own function-count, byte and similarity checks.
Not implemented
The following parts of the original design have no implementation at the verified commit:
- storage of the four artifacts as linked evidence records;
- a release-orchestration step that assembles the artifacts from build output;
- verifier checks in Attestor or Doctor (re-normalization, dry-run delta application, AST-anchor reconciliation);
- a binary resolution API that projects
hybridDiffevidence. The resolution response that did so belonged to the withdrawnBinaryIndex.WebService.
Related documents
- DeltaSig v2 predicate
- Binary analysis architecture
- Hybrid diff patching (product)
- Scanner binary diff attestation
- Sprint record:
docs-archive/implplan/SPRINT_20260216_001_BinaryIndex_hybrid_diff_patch_pipeline.md
