Skip to content

Commit 099b87b

Browse files
Tag asserts for 2.51 (#25052)
## Description Tag asserts for 2.51
1 parent df08e4c commit 099b87b

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed

packages/dds/tree/src/simple-tree/api/schemaCompatibilityTester.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export class SchemaCompatibilityTester {
184184
if (canUpgrade) {
185185
assert(
186186
allowsRepoSuperset(this.policy, stored, toStoredSchema(this.viewSchemaRoot)),
187-
"View schema must be a superset of the stored schema to allow upgrade",
187+
0xbf2 /* View schema must be a superset of the stored schema to allow upgrade */,
188188
);
189189
}
190190

packages/dds/tree/src/simple-tree/discrepancies.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ function getStoredNodeSchemaType(nodeSchema: TreeNodeStoredSchema): SchemaFactor
168168
if (nodeSchema instanceof LeafNodeStoredSchema) {
169169
return LeafNodeStoredSchema;
170170
}
171-
fail("Invalid stored node schema type");
171+
fail(0xbe8 /* Invalid stored node schema type */);
172172
}
173173

174174
function doesNodeKindMatchStoredNodeKind(
@@ -286,7 +286,7 @@ function* getNodeDiscrepancies(
286286
case NodeKind.Object: {
287287
assert(
288288
isObjectNodeSchema(view),
289-
"schema with node kind of object must implement ObjectNodeSchema",
289+
0xbe9 /* schema with node kind of object must implement ObjectNodeSchema */,
290290
);
291291
const fields: SimpleKeyMap | undefined = view.flexKeyMap;
292292
const differences = Array.from(
@@ -305,7 +305,7 @@ function* getNodeDiscrepancies(
305305
case NodeKind.Array: {
306306
assert(
307307
isArrayNodeSchema(view),
308-
"schema with node kind of array must implement ArrayNodeSchema",
308+
0xbea /* schema with node kind of array must implement ArrayNodeSchema */,
309309
);
310310
const fields: SimpleKeyMap = new Map([
311311
[
@@ -338,7 +338,7 @@ function* getNodeDiscrepancies(
338338
case NodeKind.Map: {
339339
assert(
340340
isMapNodeSchema(view),
341-
"schema with node kind of map must implement MapNodeSchema",
341+
0xbeb /* schema with node kind of map must implement MapNodeSchema */,
342342
);
343343

344344
yield* getFieldDiscrepancies(
@@ -352,7 +352,7 @@ function* getNodeDiscrepancies(
352352
case NodeKind.Record: {
353353
assert(
354354
isRecordNodeSchema(view),
355-
"schema with node kind of record must implement RecordNodeSchema",
355+
0xbec /* schema with node kind of record must implement RecordNodeSchema */,
356356
);
357357

358358
yield* getFieldDiscrepancies(
@@ -366,7 +366,7 @@ function* getNodeDiscrepancies(
366366
case NodeKind.Leaf: {
367367
assert(
368368
view instanceof LeafNodeSchema,
369-
"schema with node kind of leaf must implement LeafNodeSchema",
369+
0xbed /* schema with node kind of leaf must implement LeafNodeSchema */,
370370
);
371371
// TODO: leafKind seems like a bad name
372372
const viewValue = view.leafKind;
@@ -429,7 +429,10 @@ function* getFieldDiscrepancies(
429429
// TODO: This is a temporary workaround until the comparison logic is redesigned.
430430
viewKindIsSequence = false,
431431
): Iterable<FieldDiscrepancy> {
432-
assert(view instanceof FieldSchemaAlpha, "all field schema should be FieldSchemaAlpha");
432+
assert(
433+
view instanceof FieldSchemaAlpha,
434+
0xbee /* all field schema should be FieldSchemaAlpha */,
435+
);
433436
const [viewExtra, storedExtra] = findExtraAllowedTypes(
434437
view.annotatedAllowedTypesNormalized.types,
435438
stored.types,
@@ -446,7 +449,7 @@ function* getFieldDiscrepancies(
446449

447450
const viewKind =
448451
convertFieldKind.get(view.kind) ??
449-
fail("A conversion from a FieldKind to a FlexFieldKind should exist");
452+
fail(0xbef /* A conversion from a FieldKind to a FlexFieldKind should exist */);
450453

451454
// This checks if the field kind in the view schema is not compatible with the stored schema.
452455
// We cannot detect if the view schema is a sequence using the kind property so it is passed in separately.
@@ -503,7 +506,7 @@ function* computeObjectNodeDiscrepancies(
503506
if (storedSchema === undefined) {
504507
const viewKind =
505508
convertFieldKind.get(fieldSchema.kind) ??
506-
fail("A conversion from a FieldKind to a FlexFieldKind should exist");
509+
fail(0xbf0 /* A conversion from a FieldKind to a FlexFieldKind should exist */);
507510
yield {
508511
identifier,
509512
fieldKey,
@@ -627,7 +630,7 @@ export function comparePosetElements<T>(
627630
for (const extension of realizer) {
628631
const aIndex = extension.get(a);
629632
const bIndex = extension.get(b);
630-
assert(aIndex !== undefined && bIndex !== undefined, "Invalid realizer");
633+
assert(aIndex !== undefined && bIndex !== undefined, 0xbf1 /* Invalid realizer */);
631634
if (aIndex < bIndex) {
632635
hasLessThanResult = true;
633636
} else if (aIndex > bIndex) {

packages/runtime/test-runtime-utils/src/assertionShortCodesMap.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ export const shortCodeMap = {
807807
"0x5c1": "local attribution keys should never be put in summaries",
808808
"0x5c2": "trackable is invalid as it is not in a rooted merge tree.",
809809
"0x5c8": "Unexpected kind",
810-
"0x5c9": "Incremental Schema during update should be a allow a superset of the final schema",
810+
"0x5c9": "Incremental Schema during update should allow a superset of the final schema",
811811
"0x5cf": "Must allocate at least one ID",
812812
"0x5d0": "Returned r11s snapshot is malformed. No trees!",
813813
"0x5d1": "Returned r11s snapshot is malformed. No blobs!",
@@ -1514,7 +1514,6 @@ export const shortCodeMap = {
15141514
"0xa6f": "Pending changes must exist for rollback when collaborating",
15151515
"0xa70": "Pending changes must not exist when not collaborating",
15161516
"0xa71": "must have local change to ack",
1517-
"0xa72": "Invalid realizer",
15181517
"0xa73": "The typeField must be present in new JSON content",
15191518
"0xa74": "Expected object schema",
15201519
"0xa75": "the field must be an array node",
@@ -1697,7 +1696,6 @@ export const shortCodeMap = {
16971696
"0xb38": "Existing stored key should always map to a property key",
16981697
"0xb39": "missing schema",
16991698
"0xb3c": "missing schema for type in cursor",
1700-
"0xb3d": "tree adapter for stored adapter.output should not be never",
17011699
"0xb3f": "missing schema from context",
17021700
"0xb40": "missing simple-tree context",
17031701
"0xb41": "missing context",
@@ -1846,5 +1844,16 @@ export const shortCodeMap = {
18461844
"0xbe4": "expected reverse mapping and thus a string value",
18471845
"0xbe5": "expected reverse mapping and thus a key that is a normalized number",
18481846
"0xbe6": "New schema must allow all documents allowed by old schema",
1849-
"0xbe7": "entryPoint must be of type TreeRootDataObject"
1847+
"0xbe7": "entryPoint must be of type TreeRootDataObject",
1848+
"0xbe8": "Invalid stored node schema type",
1849+
"0xbe9": "schema with node kind of object must implement ObjectNodeSchema",
1850+
"0xbea": "schema with node kind of array must implement ArrayNodeSchema",
1851+
"0xbeb": "schema with node kind of map must implement MapNodeSchema",
1852+
"0xbec": "schema with node kind of record must implement RecordNodeSchema",
1853+
"0xbed": "schema with node kind of leaf must implement LeafNodeSchema",
1854+
"0xbee": "all field schema should be FieldSchemaAlpha",
1855+
"0xbef": "A conversion from a FieldKind to a FlexFieldKind should exist",
1856+
"0xbf0": "A conversion from a FieldKind to a FlexFieldKind should exist",
1857+
"0xbf1": "Invalid realizer",
1858+
"0xbf2": "View schema must be a superset of the stored schema to allow upgrade"
18501859
};

0 commit comments

Comments
 (0)