Skip to content

Commit 2b2f43c

Browse files
committed
Merge branch 'main' into odsp-dedupe-etag-conversion
2 parents b568194 + 0b24d03 commit 2b2f43c

File tree

287 files changed

+71028
-44774
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

287 files changed

+71028
-44774
lines changed

.changeset/spicy-grapes-leave.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@fluidframework/tree": minor
3+
"fluid-framework": minor
4+
"__section": tree
5+
---
6+
Fixed bug in sending of revert edits after an aborted transaction
7+
8+
Aborting a transaction used to put the tree in a state that would trigger an assert when sending some undo/redo edits to peers.
9+
This would prevent some undo/redo edits from being sent and would put the tree in a broken state that prevented any further edits.
10+
This issue could not have caused document corruption, so reopening the document was a possible remedy.
11+
Aborting a transaction no longer puts the tree in such a state, so it is safe to perform undo/redo edits after that.

PACKAGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ The dependencies between layers are enforced by the layer-check command._
183183

184184
| Packages | Layer Dependencies |
185185
| --- | --- |
186-
| - [@fluidframework/azure-client](/packages/service-clients/azure-client)</br>- [@fluidframework/odsp-client](/packages/service-clients/odsp-client)</br>- [@fluidframework/tinylicious-client](/packages/service-clients/tinylicious-client)</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp; | - [Core-Interfaces](#Core-Interfaces)</br>- [Driver-Definitions](#Driver-Definitions)</br>- [Container-Definitions](#Container-Definitions)</br>- [Core-Utils](#Core-Utils)</br>- [Telemetry-Utils](#Telemetry-Utils)</br>- [Driver-Utils](#Driver-Utils)</br>- [Other-Utils](#Other-Utils)</br>- [Driver](#Driver)</br>- [Loader](#Loader)</br>- [Runtime](#Runtime)</br>- [Framework](#Framework)</br>- [Routerlicious-Driver](#Routerlicious-Driver) |
186+
| - [@fluidframework/azure-client](/packages/service-clients/azure-client)</br>- [@fluidframework/odsp-client](/packages/service-clients/odsp-client)</br>- [@fluidframework/tinylicious-client](/packages/service-clients/tinylicious-client)</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp; | - [Core-Interfaces](#Core-Interfaces)</br>- [Driver-Definitions](#Driver-Definitions)</br>- [Container-Definitions](#Container-Definitions)</br>- [Core-Utils](#Core-Utils)</br>- [Client-Utils](#Client-Utils)</br>- [Telemetry-Utils](#Telemetry-Utils)</br>- [Driver-Utils](#Driver-Utils)</br>- [Other-Utils](#Other-Utils)</br>- [Driver](#Driver)</br>- [Loader](#Loader)</br>- [Runtime](#Runtime)</br>- [Framework](#Framework)</br>- [Routerlicious-Driver](#Routerlicious-Driver) |
187187

188188
### Examples
189189

packages/dds/tree/api-report/tree.alpha.api.md

Lines changed: 94 additions & 78 deletions
Large diffs are not rendered by default.

packages/dds/tree/api-report/tree.beta.api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,6 @@ export interface TreeViewBeta<in out TSchema extends ImplicitFieldSchema> extend
850850
// @public @sealed
851851
export class TreeViewConfiguration<const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
852852
constructor(props: ITreeViewConfiguration<TSchema>);
853-
protected readonly definitionsInternal: ReadonlyMap<string, TreeNodeSchema>;
854853
readonly enableSchemaValidation: boolean;
855854
readonly preventAmbiguity: boolean;
856855
readonly schema: TSchema;

packages/dds/tree/api-report/tree.legacy.beta.api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,6 @@ export interface TreeViewBeta<in out TSchema extends ImplicitFieldSchema> extend
862862
// @public @sealed
863863
export class TreeViewConfiguration<const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
864864
constructor(props: ITreeViewConfiguration<TSchema>);
865-
protected readonly definitionsInternal: ReadonlyMap<string, TreeNodeSchema>;
866865
readonly enableSchemaValidation: boolean;
867866
readonly preventAmbiguity: boolean;
868867
readonly schema: TSchema;

packages/dds/tree/api-report/tree.legacy.public.api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,6 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
585585
// @public @sealed
586586
export class TreeViewConfiguration<const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
587587
constructor(props: ITreeViewConfiguration<TSchema>);
588-
protected readonly definitionsInternal: ReadonlyMap<string, TreeNodeSchema>;
589588
readonly enableSchemaValidation: boolean;
590589
readonly preventAmbiguity: boolean;
591590
readonly schema: TSchema;

packages/dds/tree/api-report/tree.public.api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,6 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
585585
// @public @sealed
586586
export class TreeViewConfiguration<const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
587587
constructor(props: ITreeViewConfiguration<TSchema>);
588-
protected readonly definitionsInternal: ReadonlyMap<string, TreeNodeSchema>;
589588
readonly enableSchemaValidation: boolean;
590589
readonly preventAmbiguity: boolean;
591590
readonly schema: TSchema;

packages/dds/tree/src/codec/codec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,18 @@ export const FluidClientVersion = {
527527
* - FieldBatchFormatVersion v2
528528
*/
529529
v2_73: "2.73.0",
530+
531+
/**
532+
* Fluid Framework Client 2.74 and newer.
533+
* @remarks
534+
* New formats introduced in 2.74:
535+
* - SharedTreeSummaryFormatVersion v2
536+
* - DetachedFieldIndexSummaryFormatVersion v2
537+
* - SchemaSummaryFormatVersion v2
538+
* - EditManagerSummaryFormatVersion v2
539+
* - ForestSummaryFormatVersion v2
540+
*/
541+
v2_74: "2.74.0",
530542
} as const satisfies Record<string, MinimumVersionForCollab>;
531543

532544
/**

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ export {
8383
CursorMarker,
8484
isCursor,
8585
DetachedFieldIndex,
86+
type ReadOnlyDetachedFieldIndex,
87+
type DetachedFieldIndexCheckpoint,
8688
type ForestRootId,
8789
getDetachedFieldContainingPath,
8890
aboveRootPlaceholder,
@@ -102,7 +104,7 @@ export {
102104
cursorChunk,
103105
tryGetChunk,
104106
type ChunkedCursor,
105-
type DetachedFieldIndexFormatVersion,
107+
DetachedFieldIndexFormatVersion,
106108
getCodecTreeForDetachedFieldIndexFormat,
107109
} from "./tree/index.js";
108110

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

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,44 @@ import type {
3737
} from "./detachedFieldIndexTypes.js";
3838
import { makeDetachedFieldIndexCodec } from "./detachedFieldIndexCodecs.js";
3939

40+
/**
41+
* Readonly interface for {@link DetachedFieldIndex}.
42+
*/
43+
export interface ReadOnlyDetachedFieldIndex {
44+
/**
45+
* Creates a deep clone of this `DetachedFieldIndex`.
46+
*/
47+
clone(): DetachedFieldIndex;
48+
49+
/**
50+
* Returns a field key for the given ID.
51+
* This does not save the field key on the index. To do so, call {@link createEntry}.
52+
*/
53+
toFieldKey(id: ForestRootId): FieldKey;
54+
55+
/**
56+
* Returns the `ForestRootId` associated with the given id.
57+
* Returns undefined if no such id is known to the index.
58+
*/
59+
tryGetEntry(id: Delta.DetachedNodeId): ForestRootId | undefined;
60+
61+
/**
62+
* Returns the `ForestRootId` associated with the given id.
63+
* Fails if no such id is known to the index.
64+
*/
65+
getEntry(id: Delta.DetachedNodeId): ForestRootId;
66+
}
67+
68+
/**
69+
* Restores the originating DetachedFieldIndex to the state it was in when the checkpoint was created.
70+
* Can be invoked multiple times.
71+
*/
72+
export type DetachedFieldIndexCheckpoint = () => void;
73+
4074
/**
4175
* The tree index records detached field IDs and associates them with a change atom ID.
4276
*/
43-
export class DetachedFieldIndex {
77+
export class DetachedFieldIndex implements ReadOnlyDetachedFieldIndex {
4478
/**
4579
* A mapping from detached node ids to detached fields.
4680
*/
@@ -106,6 +140,25 @@ export class DetachedFieldIndex {
106140
return clone;
107141
}
108142

143+
/**
144+
* Creates a restorable checkpoint of the current state of the DetachedFieldIndex.
145+
*/
146+
public createCheckpoint(): DetachedFieldIndexCheckpoint {
147+
const clone = this.clone();
148+
return () => {
149+
this.purge();
150+
populateNestedMap(clone.detachedNodeToField, this.detachedNodeToField, true);
151+
populateNestedMap(
152+
clone.latestRelevantRevisionToFields,
153+
this.latestRelevantRevisionToFields,
154+
true,
155+
);
156+
this.rootIdAllocator = idAllocatorFromMaxId(
157+
clone.rootIdAllocator.getMaxId(),
158+
) as IdAllocator<ForestRootId>;
159+
};
160+
}
161+
109162
public *entries(): Generator<{
110163
root: ForestRootId;
111164
latestRelevantRevision?: RevisionTag;
@@ -201,26 +254,14 @@ export class DetachedFieldIndex {
201254
}
202255
}
203256

204-
/**
205-
* Returns a field key for the given ID.
206-
* This does not save the field key on the index. To do so, call {@link createEntry}.
207-
*/
208257
public toFieldKey(id: ForestRootId): FieldKey {
209258
return brand(`${this.name}-${id}`);
210259
}
211260

212-
/**
213-
* Returns the FieldKey associated with the given id.
214-
* Returns undefined if no such id is known to the index.
215-
*/
216261
public tryGetEntry(id: Delta.DetachedNodeId): ForestRootId | undefined {
217262
return tryGetFromNestedMap(this.detachedNodeToField, id.major, id.minor)?.root;
218263
}
219264

220-
/**
221-
* Returns the FieldKey associated with the given id.
222-
* Fails if no such id is known to the index.
223-
*/
224265
public getEntry(id: Delta.DetachedNodeId): ForestRootId {
225266
const key = this.tryGetEntry(id);
226267
assert(key !== undefined, 0x7aa /* Unknown removed node ID */);

0 commit comments

Comments
 (0)