Skip to content

Commit 9957077

Browse files
Tag Asserts (#24892)
## Description Tag asserts for release
1 parent f553b51 commit 9957077

File tree

6 files changed

+30
-26
lines changed

6 files changed

+30
-26
lines changed

packages/dds/sequence/src/intervalCollection.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -699,18 +699,18 @@ function removeMetadataFromPendingChanges(
699699
): IntervalMessageLocalMetadata {
700700
const acked = (localOpMetadataNode as ListNode<IntervalMessageLocalMetadata>)?.remove()
701701
?.data;
702-
assert(acked !== undefined, "local change must exist");
702+
assert(acked !== undefined, 0xbbe /* local change must exist */);
703703
acked.endpointChangesNode?.remove();
704704
return acked;
705705
}
706706

707707
function clearEmptyPendingEntry(pendingChanges: PendingChanges, id: string) {
708708
const pending = pendingChanges[id];
709-
assert(pending !== undefined, "pending must exist for local process");
709+
assert(pending !== undefined, 0xbbf /* pending must exist for local process */);
710710
if (pending.local.empty) {
711711
assert(
712712
pending.endpointChanges?.empty !== false,
713-
"endpointChanges must be empty if not pending changes",
713+
0xbc0 /* endpointChanges must be empty if not pending changes */,
714714
);
715715
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
716716
delete pendingChanges[id];
@@ -868,7 +868,7 @@ export class IntervalCollection
868868
const { opName, value } = op;
869869
assert(
870870
(local === false && localOpMetadata === undefined) || opName === localOpMetadata?.type,
871-
"must be same type",
871+
0xbc1 /* must be same type */,
872872
);
873873
switch (opName) {
874874
case "add": {

packages/dds/tree/src/shared-tree/schematizingTreeView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ export function addConstraintsToTransaction(
528528
`Attempted to add a "nodeInDocument" constraint${revertText}, but the node is not currently in the document. Node status: ${nodeStatus}`,
529529
);
530530
}
531-
assert(node.isHydrated(), "In document node must be hydrated.");
531+
assert(node.isHydrated(), 0xbc2 /* In document node must be hydrated. */);
532532
if (constraintsOnRevert) {
533533
checkout.editor.addNodeExistsConstraintOnRevert(node.anchorNode);
534534
} else {

packages/dds/tree/src/shared-tree/treeAlpha.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ export const TreeAlpha: TreeAlpha = {
611611
return undefined;
612612
}
613613
case NodeKind.Leaf: {
614-
fail("Leaf schema associated with non-leaf tree node.");
614+
fail(0xbc3 /* Leaf schema associated with non-leaf tree node. */);
615615
}
616616
default: {
617617
unreachableCase(schema.kind);
@@ -637,7 +637,7 @@ export const TreeAlpha: TreeAlpha = {
637637

638638
for (let index = 0; index < sequence.length; index++) {
639639
const childFlexTree = sequence.at(index);
640-
assert(childFlexTree !== undefined, "Sequence child was undefined.");
640+
assert(childFlexTree !== undefined, 0xbc4 /* Sequence child was undefined. */);
641641
const childTree = getOrCreateNodeFromInnerUnboxedNode(childFlexTree);
642642
result.push([index, childTree]);
643643
}
@@ -653,20 +653,23 @@ export const TreeAlpha: TreeAlpha = {
653653
break;
654654
}
655655
case NodeKind.Object: {
656-
assert(isObjectNodeSchema(schema), "Expected object schema.");
656+
assert(isObjectNodeSchema(schema), 0xbc5 /* Expected object schema. */);
657657
for (const [propertyKey, fieldSchema] of schema.fields) {
658658
const storedKey = fieldSchema.storedKey;
659659
const flexField = flexNode.tryGetField(brand(String(storedKey)));
660660
if (flexField !== undefined) {
661661
const childTreeNode = tryGetTreeNodeForField(flexField);
662-
assert(childTreeNode !== undefined, "Expected child tree node for field.");
662+
assert(
663+
childTreeNode !== undefined,
664+
0xbc6 /* Expected child tree node for field. */,
665+
);
663666
result.push([propertyKey, childTreeNode]);
664667
}
665668
}
666669
break;
667670
}
668671
case NodeKind.Leaf: {
669-
fail("Leaf schema associated with non-leaf tree node.");
672+
fail(0xbc7 /* Leaf schema associated with non-leaf tree node. */);
670673
}
671674
default: {
672675
unreachableCase(schema.kind);

packages/dds/tree/src/simple-tree/core/treeNodeKernel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ export function splitInnerNodeType(
372372
): asserts innerNode is UnhydratedFlexTreeNode | HydratedFlexTreeNode {
373373
assert(
374374
innerNode instanceof UnhydratedFlexTreeNode || innerNode.isHydrated(),
375-
"Invalid inner node type",
375+
0xbc8 /* Invalid inner node type */,
376376
);
377377
}
378378

packages/dds/tree/src/simple-tree/core/treeNodeSchema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,11 @@ export function asTreeNodeSchemaCorePrivate(
419419
): TreeNodeSchemaCorePrivate {
420420
assert(
421421
"childAnnotatedAllowedTypes" in schema,
422-
"All implementations of TreeNodeSchemaCore must also implement TreeNodeSchemaCorePrivate",
422+
0xbc9 /* All implementations of TreeNodeSchemaCore must also implement TreeNodeSchemaCorePrivate */,
423423
);
424424
assert(
425425
Array.isArray((schema as TreeNodeSchemaCorePrivate).childAnnotatedAllowedTypes),
426-
"All implementations of TreeNodeSchemaCore must also implement TreeNodeSchemaCorePrivate",
426+
0xbca /* All implementations of TreeNodeSchemaCore must also implement TreeNodeSchemaCorePrivate */,
427427
);
428428
return schema as TreeNodeSchemaCorePrivate;
429429
}

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ export const shortCodeMap = {
322322
"0x1dd": "no epoch",
323323
"0x1de": "Not an ODSP resolved url",
324324
"0x1e2": "Caller must ensure 'isAttached()' before calling 'sendSetCellOp'.",
325-
"0x1e4": "Unexpected serializable type",
326325
"0x1e5": "Storage token should not be null",
327326
"0x1e6": "Epoch should be present in response",
328327
"0x1e7": "caching was not performed!",
@@ -752,11 +751,7 @@ export const shortCodeMap = {
752751
"0x543": "should be at selected child",
753752
"0x54c": "Container already disposed",
754753
"0x54d": "Removed segment that hasnt had its removal acked should be locally removed",
755-
"0x54e": "No segment found",
756-
"0x54f": "Invalid offset",
757754
"0x550": "Client should be defined when computing rebased position",
758-
"0x551": "Failed to store pending serialized interval info for this localSeq.",
759-
"0x552": "op metadata should be defined for local op",
760755
"0x553": "op metadata should be defined for local op",
761756
"0x554": "Last pending message cannot be a batch begin",
762757
"0x555": "No batch end found",
@@ -1732,9 +1727,6 @@ export const shortCodeMap = {
17321727
"0xb42": "Expected anchor node to be present",
17331728
"0xb45": "missing context",
17341729
"0xb46": "missing schema",
1735-
"0xb47": "UnhydratedFlexTreeNode does not implement anchorNode",
1736-
"0xb48": "unsupported",
1737-
"0xb49": "unsupported",
17381730
"0xb4a": "Expected removed to be set by edit",
17391731
"0xb4b": "encoder interface instead of shape written to stream",
17401732
"0xb4c": "missing shape",
@@ -1781,13 +1773,10 @@ export const shortCodeMap = {
17811773
"0xb79": "grouping disabled!",
17821774
"0xb7a": "Unexpected attempt to group an empty batch",
17831775
"0xb7b": "Flushing must not happen while incoming changes are being processed",
1784-
"0xb7c": "must have previous for change",
1785-
"0xb7d": "must have previous for delete",
17861776
"0xb7e": "Local value expected on rollback",
17871777
"0xb7f": "Expected a recorded refSeq when rolling back an op",
17881778
"0xb80": "Double disposed",
17891779
"0xb81": "disposed",
1790-
"0xb82": "Staged batches expected to have runtimeOp defined",
17911780
"0xb83": "Invalid delta manager",
17921781
"0xb84": "Staged batches should not have been submitted",
17931782
"0xb85": "Pending state mismatch, ack came in but next pending message is staged",
@@ -1833,7 +1822,6 @@ export const shortCodeMap = {
18331822
"0xbad": "Last remove should be the obliterate that is being resubmitted.",
18341823
"0xbae": "Last remove should be the obliterate that is being resubmitted.",
18351824
"0xbaf": "Expected only one local remove",
1836-
"0xbb0": "both start and end must be set or unset",
18371825
"0xbb1": "missing field has no default provider",
18381826
"0xbb2": "Invalid field kind",
18391827
"0xbb3": "invalid map tree: empty field",
@@ -1846,5 +1834,18 @@ export const shortCodeMap = {
18461834
"0xbba": "Unexpected message type submitted in Staging Mode",
18471835
"0xbbb": "Expected message type to be compatible with staging",
18481836
"0xbbc": "Unexpected message type to be rolled back",
1849-
"0xbbd": "pendingOpCount must be non-negative"
1837+
"0xbbd": "pendingOpCount must be non-negative",
1838+
"0xbbe": "local change must exist",
1839+
"0xbbf": "pending must exist for local process",
1840+
"0xbc0": "endpointChanges must be empty if not pending changes",
1841+
"0xbc1": "must be same type",
1842+
"0xbc2": "In document node must be hydrated.",
1843+
"0xbc3": "Leaf schema associated with non-leaf tree node.",
1844+
"0xbc4": "Sequence child was undefined.",
1845+
"0xbc5": "Expected object schema.",
1846+
"0xbc6": "Expected child tree node for field.",
1847+
"0xbc7": "Leaf schema associated with non-leaf tree node.",
1848+
"0xbc8": "Invalid inner node type",
1849+
"0xbc9": "All implementations of TreeNodeSchemaCore must also implement TreeNodeSchemaCorePrivate",
1850+
"0xbca": "All implementations of TreeNodeSchemaCore must also implement TreeNodeSchemaCorePrivate"
18501851
};

0 commit comments

Comments
 (0)