Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement(client-attributable-map): enable improved type safety #23719

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion experimental/dds/attributable-map/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ module.exports = {

// TODO: consider re-enabling once we have addressed how this rule conflicts with our error codes.
"unicorn/numeric-separators-style": "off",
"@fluid-internal/fluid/no-unchecked-record-access": "warn",
},
};
3 changes: 1 addition & 2 deletions experimental/dds/attributable-map/src/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,7 @@ export class AttributableMapClass
// and result in non-incremental snapshot.
// This can be improved in the future, without being format breaking change, as loading sequence
// loads all blobs at once and partitioning schema has no impact on that process.
for (const key of Object.keys(data)) {
const value = data[key];
for (const [key, value] of Object.entries(data)) {
if (
value.value &&
value.value.length + (value.attribution?.length ?? 0) >=
Expand Down
9 changes: 6 additions & 3 deletions experimental/dds/attributable-map/src/mapKernel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ function createClearLocalOpMetadata(
const localMetadata: IMapClearLocalOpMetadata = {
type: "clear",
pendingMessageId: pendingClearMessageId,
previousMap,
};
if (previousMap !== undefined) {
localMetadata.previousMap = previousMap;
}
return localMetadata;
}

Expand Down Expand Up @@ -675,12 +677,13 @@ export class AttributableMapKernel {
localOpMetadata: MapLocalOpMetadata,
): boolean {
const op = message.contents as IMapKeyOperation;
if (this.pendingClearMessageIds.length > 0) {
const firstPendingClearMessageId = this.pendingClearMessageIds[0];
if (firstPendingClearMessageId !== undefined) {
if (local) {
assert(
localOpMetadata !== undefined &&
isMapKeyLocalOpMetadata(localOpMetadata) &&
localOpMetadata.pendingMessageId < this.pendingClearMessageIds[0],
localOpMetadata.pendingMessageId < firstPendingClearMessageId,
0x5ed /* Received out of order op when there is an unackd clear message */,
);
}
Expand Down
2 changes: 0 additions & 2 deletions experimental/dds/attributable-map/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"rootDir": "./src",
"outDir": "./lib",
"types": ["node"],
"noUncheckedIndexedAccess": false,
"exactOptionalPropertyTypes": false,
},
"include": ["src/**/*"],
"exclude": ["src/test/**/*"],
Expand Down
Loading