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

Support rebasing ops for testing. Part 1, the mock. #16163

Closed
wants to merge 39 commits into from

Conversation

andre4i
Copy link
Contributor

@andre4i andre4i commented Jun 27, 2023

Description

Adding a mock to support the new states added with #16176. This will be further integrated into the test pipeline via the fuzz testing harness.

@github-actions github-actions bot added area: runtime Runtime related issues base: main PRs targeted against main branch labels Jun 27, 2023
@github-actions github-actions bot added the public api change Changes to a public API label Jun 27, 2023
@github-actions github-actions bot added the area: dds Issues related to distributed data structures label Jun 27, 2023
@andre4i andre4i changed the title Rebase consistency test harness. Work in progress Support rebasing ops in the runtime mocks. Work in progress Jun 27, 2023
@andre4i andre4i changed the title Support rebasing ops in the runtime mocks. Work in progress Support rebasing ops for testing. Part 1, the mock. Jun 29, 2023
@andre4i andre4i marked this pull request as ready for review June 29, 2023 15:31
@andre4i andre4i requested review from a team as code owners June 29, 2023 15:31
// @public
export class MockContainerRuntimeFactoryForRebasing extends MockContainerRuntimeFactory {
// (undocumented)
createContainerRuntime(dataStoreRuntime: MockFluidDataStoreRuntime, overrides?: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just create() is good :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From MockContainerRuntimeFactory

export class MockContainerRuntimeFactoryForRebasing extends MockContainerRuntimeFactory {
// (undocumented)
createContainerRuntime(dataStoreRuntime: MockFluidDataStoreRuntime, overrides?: {
minimumSequenceNumber?: number;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I can see why you might want to create shape like that for last arg, I'd rather switch to this form when it's needed. Optional inside of optional is not great design pattern :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all existing code and I agree it can be refactored into a better shape. However, I don't believe this change should address that.

// (undocumented)
processOneMessage(): void;
// (undocumented)
processSomeMessages(count: number): void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you merge these 3 APIs into one? with count being optional (meaning all)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's outside the scope of this change. These methods are coming from MockContainerRuntimeFactory

@andre4i andre4i marked this pull request as ready for review July 6, 2023 18:40
@andre4i andre4i requested a review from a team as a code owner July 6, 2023 18:40
@@ -430,6 +435,17 @@ export class MockFluidDataStoreRuntime
"fluid:MockFluidDataStoreRuntime",
);
public quorum = new MockQuorumClients();
public containerRuntime?: MockContainerRuntime;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest we comment / document members as if it was public code. It's not very clear what is the purpose and semantics around this member.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are all part of the public API and currently undocumented.

@@ -430,6 +435,17 @@ export class MockFluidDataStoreRuntime
"fluid:MockFluidDataStoreRuntime",
);
public quorum = new MockQuorumClients();
public containerRuntime?: MockContainerRuntime;
private readonly deltaConnections: MockDeltaConnection[] = [];
public createDeltaConnection?(): MockDeltaConnection {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, why is it "?" ? I.e. it's actual implementation, it's not optional declaration.

Copy link
Contributor Author

@andre4i andre4i Jul 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Back-compat. This is a public API so if it's not optional it will break back-compat (we'd need to do the whole typeValidation->broken thing).

@msfluid-bot
Copy link
Collaborator

@fluid-example/bundle-size-tests: +230 Bytes
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 455.11 KB 455.11 KB No change
connectionState.js 680 Bytes 680 Bytes No change
containerRuntime.js 244.54 KB 244.54 KB No change
loader.js 151.23 KB 151.23 KB No change
map.js 47.19 KB 47.19 KB No change
matrix.js 147.86 KB 147.86 KB No change
odspDriver.js 93.68 KB 93.68 KB No change
odspPrefetchSnapshot.js 44.51 KB 44.51 KB No change
sharedString.js 164.77 KB 164.77 KB No change
sharedTree2.js 242.72 KB 242.95 KB +230 Bytes
Total Size 1.71 MB 1.71 MB +230 Bytes

Baseline commit: dd316cf

Generated by 🚫 dangerJS against a69c719

@andre4i andre4i requested a review from Abe27342 July 18, 2023 22:39
@andre4i andre4i marked this pull request as draft July 19, 2023 18:00
@andre4i
Copy link
Contributor Author

andre4i commented Jul 19, 2023

back to the drawing board with this, I believe it may be feasible to include this logic in the existing mock.

public processAllMessages() {
// Increase the sequence number between batches
this.sequenceNumber++;
this.processSomeMessages(this.messages.length);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong, we should evacuate the whole queue at this point (even if the queue grows while it's being evacuated).

@andre4i
Copy link
Contributor Author

andre4i commented Jul 20, 2023

Closing this in favor of #16460

@andre4i andre4i closed this Jul 20, 2023
andre4i added a commit that referenced this pull request Jul 25, 2023
## Description

Adding a mock to support the new states added with
#16176. This will be
further integrated into the test pipeline via the fuzz testing harness.

Another (arguably better) approach to
#16163
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds: sharedstring area: dds Issues related to distributed data structures area: runtime Runtime related issues base: main PRs targeted against main branch public api change Changes to a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants