Skip to content

feat: add legacy beta map compatibility interfaces#27240

Open
jenn-le wants to merge 1 commit intomicrosoft:mainfrom
jenn-le:fluid-map-legacy
Open

feat: add legacy beta map compatibility interfaces#27240
jenn-le wants to merge 1 commit intomicrosoft:mainfrom
jenn-le:fluid-map-legacy

Conversation

@jenn-le
Copy link
Copy Markdown
Contributor

@jenn-le jenn-le commented May 6, 2026

Description

Adds legacy beta map compatibility interfaces for APIs that need to align with JavaScript Map while still using Fluid's map abstraction.

This change introduces FluidMapLegacy in @fluidframework/core-interfaces/legacy. It extends FluidMap and only adds the legacy/built-in Map-style members needed for compatibility: clear, delete returning boolean, set returning this, and a forEach callback typed with FluidMapLegacy.

This also adds IDirectoryBeta and ISharedMapBeta in @fluidframework/map/legacy. The existing IDirectory and ISharedMap interfaces are unchanged and continue to extend the built-in Map; the new beta variants provide an opt-in shape that consumes FluidMapLegacy.

Copilot AI review requested due to automatic review settings May 6, 2026 05:25
@jenn-le jenn-le requested review from a team as code owners May 6, 2026 05:25
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Hi! Thank you for opening this PR. Want me to review it?

Based on the diff (218 lines, 10 files), I've queued these reviewers:

  • Correctness — logic errors, race conditions, lifecycle issues
  • Security — vulnerabilities, secret exposure, injection
  • API Compatibility — breaking changes, release tags, type design
  • Performance — algorithmic regressions, memory leaks
  • Testing — coverage gaps, hollow tests

How this works

  • Adjust the reviewer set by ticking/unticking boxes above. Reviewer toggles alone don't trigger anything.

  • Tick Start review below to dispatch the review fleet.

  • After review finishes, tick Start review again to request another run — it auto-resets after each dispatch.

  • This comment updates as new commits land; your reviewer selections are preserved.

  • Start review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds new legacy/beta “Map-compatible” typing surfaces so legacy DDS APIs can align with JavaScript Map signatures while still participating in Fluid’s stable FluidMap abstraction shape.

Changes:

  • Introduces FluidMapLegacy<K, V> in @fluidframework/core-interfaces (legacy/beta) to preserve Map-style mutator returns (delete(): boolean, set(): this) and clear().
  • Adds IDirectoryBeta and ISharedMapBeta (legacy/beta) that replace the built-in Map inheritance with FluidMapLegacy via Omit<..., keyof Map<...>>.
  • Adds compile-time type tests and updates API reports + changeset to validate/ship the new legacy surfaces.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/dds/map/src/test/types/fluidMapLegacyTypes.ts Adds type-level assertions validating *Beta assignability to FluidMapLegacy and Map.
packages/dds/map/src/interfaces.ts Introduces IDirectoryBeta / ISharedMapBeta using FluidMapLegacy for map-like API shape.
packages/dds/map/src/index.ts Re-exports the new beta interfaces from the package surface (gated by @legacy @beta tags).
packages/dds/map/api-report/map.legacy.beta.api.md Updates legacy beta API report to include the new beta interfaces.
packages/common/core-interfaces/src/test/types/fluidMapTypes.ts Adds type-level assertions for FluidMapLegacy compatibility with FluidMap and Map.
packages/common/core-interfaces/src/index.ts Exports FluidMapLegacy from the package index (release-tag filtered into legacy typings).
packages/common/core-interfaces/src/fluidMap.ts Defines FluidMapLegacy<K, V> (legacy/beta) extending FluidMap with Map-style mutators.
packages/common/core-interfaces/api-report/core-interfaces.legacy.beta.api.md Updates legacy beta API report to include FluidMapLegacy.
packages/common/core-interfaces/api-report/core-interfaces.legacy.alpha.api.md Updates legacy alpha API report to include FluidMapLegacy (alpha rollup includes beta surfaces).
.changeset/lazy-lies-enjoy.md Adds changeset bumping @fluidframework/core-interfaces and @fluidframework/map for the new legacy/beta types.

IEventProvider,
IEventThisPlaceHolder,
} from "@fluidframework/core-interfaces";
// eslint-disable-next-line import-x/no-internal-modules
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is there a proper way to use beta APIs here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Import from internal

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> fluid-framework-docs-site@0.0.0 ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> fluid-framework-docs-site@0.0.0 serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> fluid-framework-docs-site@0.0.0 check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  288641 links
    1922 destination URLs
    2172 URLs ignored
       0 warnings
       0 errors


export interface IDirectoryBeta
// TODO: Use `unknown` instead (breaking change).
// eslint-disable-next-line @typescript-eslint/no-explicit-any
extends Omit<IDirectory, keyof Map<string, any>>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it would be cleaner to exclude "get" and "set" from the keys of map you are filtering out rather than restating them below.

Comment on lines +10 to +11
type requireTrue<_X extends true> = true;
type isAssignableTo<Source, Destination> = [Source] extends [Destination] ? true : false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For the use cases in this file, I think requireAssignableTo (which you can import from build-tools) is a better fit. Does basically the same thing in one step, and gives better error messages when it fails than this approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants