Skip to content

Commit a21c066

Browse files
jatgargJatin Garg
andauthored
build(client): Tag asserts for release 2.52.0 (#25150)
build(client): Tag asserts for release 2.52.0 --------- Co-authored-by: Jatin Garg <[email protected]>
1 parent 2413de4 commit a21c066

File tree

7 files changed

+40
-49
lines changed

7 files changed

+40
-49
lines changed

packages/dds/map/src/mapKernel.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export class MapKernel {
214214
const optimisticValue = this.getOptimisticLocalValue(key);
215215
assert(
216216
optimisticValue !== undefined,
217-
"Should never iterate to a key with undefined optimisticValue",
217+
0xbf1 /* Should never iterate to a key with undefined optimisticValue */,
218218
);
219219
return { value: [key, optimisticValue], done: false };
220220
}
@@ -637,7 +637,7 @@ export class MapKernel {
637637
pendingClear !== undefined &&
638638
pendingClear.type === "clear" &&
639639
pendingClear === typedLocalOpMetadata,
640-
"Unexpected clear rollback",
640+
0xbf2 /* Unexpected clear rollback */,
641641
);
642642
for (const [key] of this.internalIterator()) {
643643
this.eventEmitter.emit(
@@ -658,10 +658,10 @@ export class MapKernel {
658658
assert(
659659
pendingEntry !== undefined &&
660660
(pendingEntry.type === "delete" || pendingEntry.type === "lifetime"),
661-
"Unexpected pending data for set/delete op",
661+
0xbf3 /* Unexpected pending data for set/delete op */,
662662
);
663663
if (pendingEntry.type === "delete") {
664-
assert(pendingEntry === typedLocalOpMetadata, "Unexpected delete rollback");
664+
assert(pendingEntry === typedLocalOpMetadata, 0xbf4 /* Unexpected delete rollback */);
665665
this.pendingData.splice(pendingEntryIndex, 1);
666666
// Only emit if rolling back the delete actually results in a value becoming visible.
667667
if (this.getOptimisticLocalValue(mapOp.key) !== undefined) {
@@ -676,7 +676,7 @@ export class MapKernel {
676676
const pendingKeySet = pendingEntry.keySets.pop();
677677
assert(
678678
pendingKeySet !== undefined && pendingKeySet === typedLocalOpMetadata,
679-
"Unexpected set rollback",
679+
0xbf5 /* Unexpected set rollback */,
680680
);
681681
if (pendingEntry.keySets.length === 0) {
682682
this.pendingData.splice(pendingEntryIndex, 1);
@@ -710,7 +710,7 @@ export class MapKernel {
710710
pendingClear !== undefined &&
711711
pendingClear.type === "clear" &&
712712
pendingClear === localOpMetadata,
713-
"Got a local clear message we weren't expecting",
713+
0xbf6 /* Got a local clear message we weren't expecting */,
714714
);
715715
} else {
716716
// Only emit for remote ops, we would have already emitted for local ops. Only emit if there
@@ -741,7 +741,7 @@ export class MapKernel {
741741
pendingEntry !== undefined &&
742742
pendingEntry.type === "delete" &&
743743
pendingEntry === localOpMetadata,
744-
"Got a local delete message we weren't expecting",
744+
0xbf7 /* Got a local delete message we weren't expecting */,
745745
);
746746
this.pendingData.splice(pendingEntryIndex, 1);
747747

@@ -779,12 +779,12 @@ export class MapKernel {
779779
const pendingEntry = this.pendingData[pendingEntryIndex];
780780
assert(
781781
pendingEntry !== undefined && pendingEntry.type === "lifetime",
782-
"Couldn't match local set message to pending lifetime",
782+
0xbf8 /* Couldn't match local set message to pending lifetime */,
783783
);
784784
const pendingKeySet = pendingEntry.keySets.shift();
785785
assert(
786786
pendingKeySet !== undefined && pendingKeySet === localOpMetadata,
787-
"Got a local set message we weren't expecting",
787+
0xbf9 /* Got a local set message we weren't expecting */,
788788
);
789789
if (pendingEntry.keySets.length === 0) {
790790
this.pendingData.splice(pendingEntryIndex, 1);

packages/dds/tree/src/core/tree/detachedFieldIndexCodecV2.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ class MajorCodec implements IJsonCodec<Major> {
2626
) {}
2727

2828
public encode(major: Major): EncodedRevisionTag | StableId {
29-
assert(major !== undefined, "Unexpected undefined revision");
29+
assert(major !== undefined, 0xbfb /* Unexpected undefined revision */);
3030
const id = this.revisionTagCodec.encode(major);
3131

3232
if (id !== "root" && id < 0) {
3333
/**
3434
* This code path handles the case where the major revision is not finalized.
3535
* This can happen the SharedTree is being attached to an already attached container.
3636
*/
37-
assert(major !== "root", "Major revision cannot be 'root'");
37+
assert(major !== "root", 0xbfc /* Major revision cannot be 'root' */);
3838
const long = this.idCompressor.decompress(major);
3939
return long;
4040
}
@@ -44,7 +44,7 @@ class MajorCodec implements IJsonCodec<Major> {
4444
public decode(major: EncodedRevisionTag | StableId): RevisionTag {
4545
assert(
4646
major === "root" || (typeof major === "string" && isStableId(major)) || major >= 0,
47-
"Expected root, stable, or final compressed id",
47+
0xbfd /* Expected root, stable, or final compressed id */,
4848
);
4949
if (typeof major === "string" && isStableId(major)) {
5050
return this.idCompressor.recompress(major);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export class SchematizingSimpleTreeView<
320320
assert(!slots.has(SimpleContextSlot), 0xa47 /* extra simple tree context */);
321321
assert(
322322
this.rootFieldSchema instanceof FieldSchemaAlpha,
323-
"all field schema should be FieldSchemaAlpha",
323+
0xbfa /* all field schema should be FieldSchemaAlpha */,
324324
);
325325
slots.set(
326326
SimpleContextSlot,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function createFromCursor<const TSchema extends ImplicitFieldSchema>(
4747
contextForNewNodes?: Context,
4848
): Unhydrated<TreeFieldFromImplicitField<TSchema>> {
4949
const context = contextForNewNodes ?? getUnhydratedContext(schema);
50-
assert(context.flexContext.isHydrated() === false, "Expected unhydrated context");
50+
assert(context.flexContext.isHydrated() === false, 0xbfe /* Expected unhydrated context */);
5151
const mapTrees = cursor === undefined ? [] : [unhydratedFlexTreeFromCursor(context, cursor)];
5252

5353
const rootFieldSchema = convertField(normalizeFieldSchema(schema));

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,14 @@ export function customFromCursor<TChild>(
142142
const storedKey = reader.getFieldKey();
143143
let key: string;
144144
if (!options.useStoredKeys) {
145-
const viewSchema = schema.get(type) ?? fail("missing schema for type in cursor");
145+
const viewSchema =
146+
schema.get(type) ?? fail(0xbff /* missing schema for type in cursor */);
146147
if (isObjectNodeSchema(viewSchema)) {
147148
const propertyKey = viewSchema.storedKeyToPropertyKey.get(storedKey);
148149
if (propertyKey === undefined) {
149150
assert(
150151
viewSchema.allowUnknownOptionalFields,
151-
"found unknown field where not allowed",
152+
0xc00 /* found unknown field where not allowed */,
152153
);
153154
// Skip unknown optional fields when using property keys.
154155
return;

packages/runtime/container-runtime/src/blobManager/blobManager.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ export class BlobManager {
668668
* @param metadata - op metadata containing storage and/or local IDs
669669
*/
670670
public reSubmit(metadata: Record<string, unknown> | undefined): void {
671-
assert(isBlobMetadata(metadata), "Expected blob metadata for a BlobAttach op");
671+
assert(isBlobMetadata(metadata), 0xc01 /* Expected blob metadata for a BlobAttach op */);
672672
const { localId, blobId } = metadata;
673673
// Any blob that we're actively trying to advance to attached state must have a
674674
// pendingBlobs entry. Decline to resubmit for anything else.
@@ -682,7 +682,10 @@ export class BlobManager {
682682
}
683683

684684
public processBlobAttachMessage(message: ISequencedMessageEnvelope, local: boolean): void {
685-
assert(isBlobMetadata(message.metadata), "Expected blob metadata for a BlobAttach op");
685+
assert(
686+
isBlobMetadata(message.metadata),
687+
0xc02 /* Expected blob metadata for a BlobAttach op */,
688+
);
686689
const { localId, blobId } = message.metadata;
687690
const pendingEntry = this.pendingBlobs.get(localId);
688691
if (pendingEntry?.abortSignal?.aborted) {

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

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ export const shortCodeMap = {
2424
"0x010": "Received out of order storage op when there is an unackd clear message",
2525
"0x011": "pendingMessageId is missing from the local client's operation",
2626
"0x012": "pendingMessageId is missing from the local client's operation",
27-
"0x013": "Received out of order op when there is an unackd clear message",
28-
"0x014": "pendingMessageId is missing from the local client's operation",
29-
"0x015": "pendingMessageId is missing from the local client's clear operation",
3027
"0x017": "Trying to add invalid handle!",
3128
"0x018": "Trying to insert handle into position with already valid handle!",
3229
"0x019": "SharedMatrix.openUndo() supports at most a single IUndoConsumer.",
@@ -213,7 +210,6 @@ export const shortCodeMap = {
213210
"0x120": "Undefined latency statistics for op (op send time)",
214211
"0x126": "Expected createSubRequest url to include a leading slash",
215212
"0x127": "dirty document event not set on replay",
216-
"0x12a": "Missing blob id on metadata",
217213
"0x12d": "Container Context should already be in attaching state",
218214
"0x12e": "Container Context should already be in attached state",
219215
"0x12f": "Container Runtime's summarize should always return a tree",
@@ -482,11 +478,6 @@ export const shortCodeMap = {
482478
"0x2f5": "op create references must be SlideOnRemove",
483479
"0x2f6": "SlideOnRemove references must be op created",
484480
"0x2f9": "Unexpected accept op, client not in expectedSignoffs",
485-
"0x2fa": "Unexpected pending message received",
486-
"0x2fb": "pendingMessageId does not match",
487-
"0x2fc": "Invalid localOpMetadata for clear",
488-
"0x2fd": "pendingMessageId does not match",
489-
"0x2fe": "Invalid localOpMetadata in submit",
490481
"0x304": "Id cannot contain slashes",
491482
"0x30e": "Id cannot contain slashes. DataStoreContext should have validated this.",
492483
"0x30f": "Channel context ID cannot contain slashes",
@@ -533,12 +524,9 @@ export const shortCodeMap = {
533524
"0x385": "For clarity and paranoid defense against adding future attachment states",
534525
"0x386": "Must have pending blob entry for uploaded blob",
535526
"0x387": "Must have pending blob entry for blob which failed to upload",
536-
"0x38b": "Resubmitted ops must have metadata",
537-
"0x38d": "blob must be uploaded before resubmitting BlobAttach op",
538527
"0x38f": "local online BlobAttach op with no pending blob entry",
539528
"0x390": "Must be attached to get GC data",
540529
"0x391": "Redirect table size must match BlobManager's local ID count",
541-
"0x394": "connect event delay must be cleared before propagating connect event",
542530
"0x395": "it's one and the same thing",
543531
"0x397": "Unexpected summary stage",
544532
"0x39b": "localSeq provided for non-local client",
@@ -698,8 +686,6 @@ export const shortCodeMap = {
698686
"0x509": "RuntimeAttributor must be initialized before getAttributionInfo can be called",
699687
"0x50a": "Attributor tree should have op attributor summary blob.",
700688
"0x50c": "freshness map out of sync",
701-
"0x50d": "local ID not available on reSubmit",
702-
"0x50e": "local ID not present in blob attach message",
703689
"0x510": "No data store with specified id",
704690
"0x511": "Only lz4 compression is supported",
705691
"0x512": "Expecting empty message",
@@ -1008,7 +994,6 @@ export const shortCodeMap = {
1008994
"0x744": "The size of the sequenceMap must have one element more than the trunk",
1009995
"0x745": "The size of the trunkMetadata must be the same as the trunk",
1010996
"0x746": "sequence id has been evicted",
1011-
"0x747": "forest must be empty",
1012997
"0x751": "Object returned is not a valid marker",
1013998
"0x752": "Keys in map must be sorted.",
1014999
"0x753": "Cluster insert to final_space is out of order.",
@@ -1050,9 +1035,6 @@ export const shortCodeMap = {
10501035
"0x786": "mismatched indexes",
10511036
"0x787": "mismatched keys",
10521037
"0x78d": "required value must not be missing",
1053-
"0x790": "stashed blob should be attached",
1054-
"0x791": "Connect event delay must be canceled before subsequent connect event",
1055-
"0x792": "Must have clientId when connecting",
10561038
"0x793": "start and end cannot be undefined because they were not passed in as undefined",
10571039
"0x794": "start and end cannot be undefined because they were not passed in as undefined",
10581040
"0x795": "Data store runtime entryPoint does not have request",
@@ -1379,7 +1361,6 @@ export const shortCodeMap = {
13791361
"0x9b4": "Unexpected flex node implementation",
13801362
"0x9b5": "Inheritance should work",
13811363
"0x9b6": "No error to clear",
1382-
"0x9b7": "anchor set must be empty",
13831364
"0x9b8": "Inconsistent data: missing detached node entry",
13841365
"0x9b9": "Inconsistent data: missing node entry in latestRelevantRevision",
13851366
"0x9ba": "Unable to delete unknown entry",
@@ -1590,8 +1571,6 @@ export const shortCodeMap = {
15901571
"0xaca": "invalid field kind",
15911572
"0xacb": "invalid schema kind",
15921573
"0xacc": "Unknown SharedTree change type.",
1593-
"0xacd": "invalid input",
1594-
"0xace": "invalid input",
15951574
"0xacf": "invalid input",
15961575
"0xad1": "Unknown Shared Tree change type.",
15971576
"0xad2": "Expected branch to be related to trunk",
@@ -1684,7 +1663,6 @@ export const shortCodeMap = {
16841663
"0xb2c": "Mark type: NoopMarkType should not be encoded.",
16851664
"0xb2d": "Unable to split mark due to lengths",
16861665
"0xb2e": "missing schema for type in cursor",
1687-
"0xb2f": "missing property key",
16881666
"0xb30": "missing schema for type in cursor",
16891667
"0xb31": "missing enum value",
16901668
"0xb32": "node is out of schema",
@@ -1819,13 +1797,6 @@ export const shortCodeMap = {
18191797
"0xbc7": "Leaf schema associated with non-leaf tree node.",
18201798
"0xbc8": "Invalid inner node type",
18211799
"0xbc9": "All implementations of TreeNodeSchemaCore must also implement TreeNodeSchemaCorePrivate",
1822-
"0xbcb": "Rolling back unexpected op",
1823-
"0xbcc": "Processing unexpected local clear op",
1824-
"0xbcd": "Resubmitting unexpected local clear op",
1825-
"0xbce": "Processing unexpected local delete op",
1826-
"0xbcf": "Resubmitting unexpected local delete op",
1827-
"0xbd0": "Processing unexpected local set op",
1828-
"0xbd1": "Resubmitting unexpected local set op",
18291800
"0xbd4": "local must have metadata",
18301801
"0xbd5": "must have property manager to ack",
18311802
"0xbd6": "must be more in the list",
@@ -1854,6 +1825,22 @@ export const shortCodeMap = {
18541825
"0xbee": "all field schema should be FieldSchemaAlpha",
18551826
"0xbef": "A conversion from a FieldKind to a FlexFieldKind should exist",
18561827
"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"
1828+
"0xbf1": "Should never iterate to a key with undefined optimisticValue",
1829+
"0xbf2": "Unexpected clear rollback",
1830+
"0xbf3": "Unexpected pending data for set/delete op",
1831+
"0xbf4": "Unexpected delete rollback",
1832+
"0xbf5": "Unexpected set rollback",
1833+
"0xbf6": "Got a local clear message we weren't expecting",
1834+
"0xbf7": "Got a local delete message we weren't expecting",
1835+
"0xbf8": "Couldn't match local set message to pending lifetime",
1836+
"0xbf9": "Got a local set message we weren't expecting",
1837+
"0xbfa": "all field schema should be FieldSchemaAlpha",
1838+
"0xbfb": "Unexpected undefined revision",
1839+
"0xbfc": "Major revision cannot be 'root'",
1840+
"0xbfd": "Expected root, stable, or final compressed id",
1841+
"0xbfe": "Expected unhydrated context",
1842+
"0xbff": "missing schema for type in cursor",
1843+
"0xc00": "found unknown field where not allowed",
1844+
"0xc01": "Expected blob metadata for a BlobAttach op",
1845+
"0xc02": "Expected blob metadata for a BlobAttach op"
18591846
};

0 commit comments

Comments
 (0)