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

Add all referenced fluid API to fluid-framework rollup package #20554

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

CraigMacomber
Copy link
Contributor

Description

This adds exports to the fluid-framework package until all the imports from fluid framework are gone from its API report.

This would avoid errors where using some APIs (ex: exporting them from packages in apps) may warn about types not being namable, or being unable to explicitly type some values without additional imports.

Additionally this puts the transitively reachable portion of our public API in one place where it can be reviewed.

Reviewer Guidance

The review process is outlined on this wiki page.

It is unclear to me what the policy is for which things should be exported from fluid-framework, so I'm not sure if this change is a fix or violating some decision that was made. Clarification on this would be valuable.

@github-actions github-actions bot added area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct dependencies Pull requests that update a dependency file public api change Changes to a public API base: main PRs targeted against main branch labels Apr 9, 2024
Comment on lines 8 to 11
import { FieldSchemaUnsafe as FieldSchemaUnsafe_2 } from './typesUnsafe.js';
import { FluidObject } from '@fluidframework/core-interfaces';
import { IChannel } from '@fluidframework/datastore-definitions';
import type { IErrorBase } from '@fluidframework/core-interfaces';
import { IEvent } from '@fluidframework/core-interfaces';
import { IEventProvider } from '@fluidframework/core-interfaces';
import { IFluidHandle } from '@fluidframework/core-interfaces';
import { IFluidLoadable } from '@fluidframework/core-interfaces';
import { ISharedObjectKind } from '@fluidframework/shared-object-base';
import { FluidObject as FluidObject_2 } from '@fluidframework/core-interfaces';
import { IFluidHandle as IFluidHandle_2 } from '@fluidframework/core-interfaces';
import { IFluidLoadable as IFluidLoadable_2 } from '@fluidframework/core-interfaces';
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 strange/broken. API extractor bug? Rollup issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

This does seem problematic (wonder how it would affect generated doc pages). Any workaround? If we enforce consistently importing from /internal everywhere in our repo for example?

@CraigMacomber CraigMacomber marked this pull request as ready for review April 12, 2024 21:25
@CraigMacomber
Copy link
Contributor Author

https://learn.microsoft.com/en-us/azure/azure-fluid-relay/concepts/version-compatibility#compatibility-table is relevant as we document our compat in terms of the fluid-framework package, so rolling these all up into one place robustly avoids the issue of what the implacied support/compat of the packages referenced by fluid-framework is. It also reduces the risk of mismatched point releases since fluid-framework gains a direct dependency on the packages it implicitly depends on.

Copy link
Contributor

@ChumpChief ChumpChief left a comment

Choose a reason for hiding this comment

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

I think the main thing is that we need to clarify our support promise for these - I had been assuming we'd add them and fully support them (as they are accessible from the public API surface), so if we're saying it's something more nuanced as the @alpha tagging implies I think we need to get that written down.

@@ -64,6 +24,194 @@ export enum AttachState {
Detached = "Detached"
}

// @alpha
Copy link
Contributor

Choose a reason for hiding this comment

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

I think everything in this file needs to be @public to ensure we have a clear support promise (these are part of the API surface we intend you to use), otherwise it's kind of muddy. @DLehenbauer WDYT?

Or else we probably need something concrete about what "exported but @alpha" means -- available but no breaking change promise? available with full support promise?

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 don't think our policy with respect to public vs alpha stuff is specific to this package, so I don't think this is the place to do that. I have separate work to document what we mean by supported and breaking changes, which can cover things like relying on undocumented behavior or non-public API not being supported and thus not being covered by our no breaking changes policy and what ever more formal policy we have for support.

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 also don't see this PR as making any changes to what we support. For example before this PR IFluidHandle was referenced, and changing it could break users of this package. That is still true, users just don't have to depend on another package if they want to save a handle in a typed variable.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ChumpChief - The @alpha tag is how we get Fluid Framework 1.0 types to show up under the 'fluid-framework/legacy' path. (It's the same as how we use @alpha elsewhere.)

The message to customers is that '/legacy' types are supported, but not recommended for new designs. We'll mark the types as @deprecated when we have a way for customers to migrate their data forward to SharedTree.

export interface AttributionPolicy {
attach: (client: Client) => void;
detach: () => void;
// (undocumented)
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably all these should be documented too - obv a lot so not in this PR necessarily, but we should open some work items and consider them for 2.0.

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 see this PR as a way to make these issues more discoverable, so I think we should specifically not block it on trying to fix these issues, and instead merge this PR before farming out work to fix issues like this.

Comment on lines 8 to 11
import { FieldSchemaUnsafe as FieldSchemaUnsafe_2 } from './typesUnsafe.js';
import { FluidObject } from '@fluidframework/core-interfaces';
import { IChannel } from '@fluidframework/datastore-definitions';
import type { IErrorBase } from '@fluidframework/core-interfaces';
import { IEvent } from '@fluidframework/core-interfaces';
import { IEventProvider } from '@fluidframework/core-interfaces';
import { IFluidHandle } from '@fluidframework/core-interfaces';
import { IFluidLoadable } from '@fluidframework/core-interfaces';
import { ISharedObjectKind } from '@fluidframework/shared-object-base';
import { FluidObject as FluidObject_2 } from '@fluidframework/core-interfaces';
import { IFluidHandle as IFluidHandle_2 } from '@fluidframework/core-interfaces';
import { IFluidLoadable as IFluidLoadable_2 } from '@fluidframework/core-interfaces';
Copy link
Contributor

Choose a reason for hiding this comment

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

This does seem problematic (wonder how it would affect generated doc pages). Any workaround? If we enforce consistently importing from /internal everywhere in our repo for example?

export type {
EventEmitterEventType,
TypedEventEmitter,
// It is unclear why ae-forgotten-export requires this since its not referenced.
Copy link
Contributor

Choose a reason for hiding this comment

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

TypedEventEmitter references it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you search the API report for it there are no usages so it should not need to be imported. This is entangled with the strangeness that the above two types are not getting inclined in the report like everything else (if that was fixed, then this would be referenced). I'll update the comments to make that more clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comments have been updated.

@@ -250,6 +692,226 @@ export interface IDisposable {
[disposeSymbol](): void;
}

// @public
export interface IDisposable_2 {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems unfortunate that IDisposable and IDisposable_2 are different? Is there something we can do to disambiguate these more nicely, merge them, etc.?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have existing internal work items about that, see https://dev.azure.com/fluidframework/internal/_workitems/edit/6591/ which I have also just updated.

@msfluid-bot
Copy link
Collaborator

@fluid-example/bundle-size-tests: +2.99 KB
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 454 KB 454.27 KB +275 Bytes
azureClient.js 550.34 KB 550.62 KB +290 Bytes
connectionState.js 680 Bytes 680 Bytes No change
containerRuntime.js 257.08 KB 257.33 KB +258 Bytes
fluidFramework.js 344.1 KB 344.67 KB +580 Bytes
loader.js 132.83 KB 132.83 KB No change
map.js 41.15 KB 41.4 KB +256 Bytes
matrix.js 143.32 KB 143.58 KB +264 Bytes
odspClient.js 518.83 KB 519.12 KB +290 Bytes
odspDriver.js 97.23 KB 97.23 KB No change
odspPrefetchSnapshot.js 42.1 KB 42.1 KB No change
sharedString.js 161.05 KB 161.32 KB +270 Bytes
sharedTree.js 344.1 KB 344.67 KB +580 Bytes
Total Size 3.16 MB 3.17 MB +2.99 KB

Baseline commit: 350c06a

Generated by 🚫 dangerJS against 9445be5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct base: main PRs targeted against main branch dependencies Pull requests that update a dependency file public api change Changes to a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants