atproto_lexicon/diff
Semantic diff over two LexiconDocs (old vs new), classifying every
change as breaking or non-breaking for consumers of records written
under the old schema. This is the substrate for the drift gate:
diff says what changed and where, severity says whether it breaks,
describe renders a one-line summary for CI output.
Types
One semantic change, located by a mechanical path into the document,
e.g. ["main", "record", "properties", "title"].
pub type Change {
Change(path: List(String), kind: ChangeKind)
}
Constructors
-
Change(path: List(String), kind: ChangeKind)
pub type ChangeKind {
DocAdded
DocRemoved
DuplicateDocId(id: String)
IdChanged(old: String, new: String)
RevisionChanged(
old: option.Option(Int),
new: option.Option(Int),
)
DescriptionChanged
DefAdded
DefRemoved
DefTypeChanged(old: String, new: String)
RecordKeyChanged(old: String, new: String)
FieldAdded
RequiredFieldAdded
FieldRemoved
FieldMadeRequired
FieldMadeOptional
FieldMadeNullable
FieldMadeNonNullable
TypeChanged(old: String, new: String)
UnionVariantRemoved(ref: String)
UnionVariantAddedOpen(ref: String)
UnionVariantAddedClosed(ref: String)
UnionClosed
UnionOpened
EnumAdded
EnumRemoved
EnumValueRemoved(value: String)
EnumValueAdded(value: String)
ConstAdded
ConstChanged
ConstRemoved
ConstraintTightened(constraint: String)
ConstraintLoosened(constraint: String)
FormatChanged(old: String, new: String)
AcceptNarrowed(value: String)
AcceptWidened(value: String)
KnownValuesChanged
DefaultChanged
EncodingChanged(old: String, new: String)
BodyAdded
BodyRemoved
SchemaAdded
SchemaRemoved
ErrorAdded
ErrorRemoved
}
Constructors
-
DocAdded -
DocRemoved -
DuplicateDocId(id: String) -
IdChanged(old: String, new: String) -
RevisionChanged(old: option.Option(Int), new: option.Option(Int)) -
DescriptionChanged -
DefAdded -
DefRemoved -
DefTypeChanged(old: String, new: String) -
RecordKeyChanged(old: String, new: String) -
FieldAdded -
RequiredFieldAdded -
FieldRemoved -
FieldMadeRequired -
FieldMadeOptional -
FieldMadeNullable -
FieldMadeNonNullable -
TypeChanged(old: String, new: String) -
UnionVariantRemoved(ref: String) -
UnionVariantAddedOpen(ref: String) -
UnionVariantAddedClosed(ref: String) -
UnionClosed -
UnionOpened -
EnumAdded -
EnumRemoved -
EnumValueRemoved(value: String) -
EnumValueAdded(value: String) -
ConstAdded -
ConstChanged -
ConstRemoved -
ConstraintTightened(constraint: String) -
ConstraintLoosened(constraint: String) -
FormatChanged(old: String, new: String) -
AcceptNarrowed(value: String) -
AcceptWidened(value: String) -
KnownValuesChanged -
DefaultChanged -
EncodingChanged(old: String, new: String) -
BodyAdded -
BodyRemoved -
SchemaAdded -
SchemaRemoved -
ErrorAdded -
ErrorRemoved
pub type Severity {
Breaking
NonBreaking
}
Constructors
-
Breaking -
NonBreaking
Values
pub fn describe(change: Change) -> String
Render a change as a one-line summary for CI output.
pub fn diff(
old: ast.LexiconDoc,
new: ast.LexiconDoc,
) -> List(Change)
Diff a single document pair, old vs new, under the same id.
pub fn diff_all(
old: List(ast.LexiconDoc),
new: List(ast.LexiconDoc),
) -> List(Change)
Diff two sets of documents keyed by id; paths gain the doc id prefix.
Duplicate ids within either input list are reported explicitly rather than
silently collapsed; the rest of the diff then proceeds against the first
occurrence of each id, matching split_keyed’s lookup semantics.
pub fn severity(kind: ChangeKind) -> Severity
Whether a change breaks consumers of records written under the old schema.