Skip to content

feat(core-interfaces): add FluidReadonlyArray type - #27747

Open
jenn-le wants to merge 13 commits into
microsoft:mainfrom
jenn-le:add-fluid-readonly-array
Open

feat(core-interfaces): add FluidReadonlyArray type#27747
jenn-le wants to merge 13 commits into
microsoft:mainfrom
jenn-le:add-fluid-readonly-array

Conversation

@jenn-le

@jenn-le jenn-le commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Description

Add FluidReadonlyArray<T> to @fluidframework/core-interfaces as a TypeScript-version-independent equivalent of the built-in ReadonlyArray type, following the same pattern as the existing FluidReadonlyMap and FluidMap types.

This includes stable methods through ES2023 (at(), findLast(), findLastIndex()) but deliberately excludes newer copy-on-write methods (toReversed(), toSorted(), toSpliced(), with()) that our implementations do not yet provide. This ensures Fluid Framework types remain safe to implement without being broken by TypeScript updates that add new members to ReadonlyArray.

The type is introduced at @beta and re-exported from fluid-framework. It will be used in a follow-up PR to replace the extends ReadonlyArray<T> in ReadonlyArrayNode/TreeArrayNode.

Reviewer Guidance

Reviewer guidance wiki

  • The new FluidReadonlyArray interface is in packages/common/core-interfaces/src/fluidArray.ts
  • Shared type test utilities were extracted to src/test/types/typeTestUtils.ts (also used by existing fluidMapTypes.ts)
  • Type tests verify assignability relationships under the repo's ES2020 lib setting

Copilot AI review requested due to automatic review settings July 23, 2026 05:05
@jenn-le
jenn-le requested review from a team as code owners July 23, 2026 05:05
@github-actions github-actions Bot added area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: tools area: repo Repo related work area: website public api change Changes to a public API changeset-present base: main PRs targeted against main branch labels Jul 23, 2026
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

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

Based on the diff (744 lines, 11 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

Copilot AI left a comment

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.

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

@jenn-le
jenn-le force-pushed the add-fluid-readonly-array branch 2 times, most recently from 2583321 to 5cdf764 Compare July 23, 2026 18:10
@jenn-le jenn-le changed the title feat(core-interfaces): Add FluidReadonlyArray type feat(core-interfaces): add FluidReadonlyArray type Jul 23, 2026
@jenn-le
jenn-le force-pushed the add-fluid-readonly-array branch from 7e19418 to 2c8b5d2 Compare July 23, 2026 20:55
Add FluidReadonlyArray<T> as a TypeScript-version-independent equivalent
of ReadonlyArray, following the pattern of FluidReadonlyMap and FluidMap.
Includes stable methods through ES2023 (at, findLast, findLastIndex) but
excludes copy-on-write methods (toReversed, toSorted, toSpliced, with)
that our implementations do not yet provide.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jenn-le
jenn-le force-pushed the add-fluid-readonly-array branch from 2c8b5d2 to 49a0424 Compare July 23, 2026 20:56
Comment thread packages/common/core-interfaces/src/test/types/fluidArrayTypes.ts Outdated
Comment thread packages/common/core-interfaces/src/test/types/fluidArrayTypes.ts Outdated
Comment thread packages/common/core-interfaces/src/test/types/fluidArrayTypes.ts Outdated
Comment thread packages/common/core-interfaces/src/test/types/fluidArrayTypes.ts Outdated
Comment thread packages/common/core-interfaces/src/test/types/typeTestUtils.ts Outdated
Comment thread packages/common/core-interfaces/src/test/types/fluidArrayTypes.ts Outdated

@dannimad dannimad left a comment

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.

Wait for #27764 to be merged first

- Fix Symbol.unscopables to use [K in keyof (readonly any[])] matching native
- Change callback array params from FluidReadonlyArray<T> to readonly T[]
- Fix flatMap signature to match native exactly (mutable T[], This type param)
- Rewrite type tests using requireAssignableTo from @fluidframework/build-tools
- Remove negative assignability tests and delete custom typeTestUtils.ts
- Migrate fluidMapTypes.ts to use requireAssignableTo

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread .changeset/add-fluid-readonly-array.md Outdated
Comment thread .changeset/add-fluid-readonly-array.md Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread packages/common/core-interfaces/src/test/types/fluidArrayTypes.ts Outdated
Comment thread packages/common/core-interfaces/src/test/types/fluidArrayTypes.ts Outdated
Comment thread packages/common/core-interfaces/src/test/types/fluidMapTypes.ts
Comment thread packages/common/core-interfaces/src/test/types/fluidMapTypes.ts
Comment thread packages/common/core-interfaces/src/test/types/fluidMapTypes.ts Outdated
jenn-le and others added 3 commits July 27, 2026 13:09
- Update doc comment, changeset, and type test comment per Craig's feedback
- Use specific 'lib' terminology instead of 'TypeScript-version-independent'

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Remove iterator return-type checks (structural type makes them meaningless)
- Add lib-dependency disclaimers to FluidReadonlyMap assignability checks
- Add sanity-check disclaimers to native→Fluid assignability checks
- Point to API reports for validating FluidIterableIterator usage

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Remove backticks and package names from summary line
- Remove trailing period from summary
- Wrap body at sentence boundaries

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread .changeset/add-fluid-readonly-array.md Outdated
Comment thread packages/common/core-interfaces/src/fluidArray.ts Outdated
Comment thread packages/common/core-interfaces/src/fluidArray.ts
Comment thread packages/common/core-interfaces/src/fluidArray.ts
Comment thread packages/common/core-interfaces/src/fluidArray.ts Outdated
Comment thread packages/common/core-interfaces/src/fluidArray.ts Outdated

@Josmithr Josmithr left a comment

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.

Left a few docs suggestions 🤓

jenn-le and others added 7 commits July 28, 2026 17:01
Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com>
Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com>
Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com>
Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com>
Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com>
- Rewrite reduce/reduceRight descriptions with clearer Mozilla-style wording
- Remove blank line between changeset frontmatter and summary

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output

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-website@0.0.0 serve
> docusaurus serve --no-open

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

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

Crawling...

Stats:
  306247 links
    1957 destination URLs
    2213 URLs ignored
       0 warnings
       0 errors


@github-actions

Copy link
Copy Markdown
Contributor

Bundle size comparison

Base commit: b053be3ea64d10d431e2f5a44391b2d18a5bc505
Head commit: 0a11a0f28ffd49f4c9e50ba3c51746d9cb746318

Notable changes

  • 🔴 directory.js: parsed 66616 → 67117 (+501), gzip 18532 → 18866 (+334)
  • 748.js: removed (was parsed 58793, gzip 17827)
  • 🔴 map.js: parsed 46709 → 47212 (+503), gzip 14310 → 14461 (+151)
  • 985.js: removed (was parsed 44491, gzip 13726)
  • 578.js: added (parsed 58686, gzip 17657)
  • 252.js: added (parsed 44371, gzip 13732)
Per-bundle deltas

@fluid-example/bundle-size-tests

  • azureClient.js: parsed 620317 → 620407 (+90), gzip 165071 → 165524 (+453)
  • odspClient.js: parsed 593043 → 592695 (-348), gzip 159171 → 158650 (-521)
  • aqueduct.js: parsed 526806 → 527005 (+199), gzip 140956 → 141062 (+106)
  • fluidFramework.js: parsed 398444 → 398234 (-210), gzip 113068 → 112996 (-72)
  • sharedTree.js: parsed 387831 → 387631 (-200), gzip 110466 → 110410 (-56)
  • containerRuntime.js: parsed 305156 → 305105 (-51), gzip 83445 → 83558 (+113)
  • sharedString.js: parsed 175984 → 176464 (+480), gzip 49445 → 49815 (+370)
  • experimentalSharedTree.js: parsed 160798 → 160677 (-121), gzip 45804 → 46276 (+472)
  • matrix.js: parsed 159845 → 160309 (+464), gzip 45411 → 45807 (+396)
  • loader.js: parsed 145256 → 145473 (+217), gzip 39063 → 39233 (+170)
  • odspDriver.js: parsed 104329 → 103927 (-402), gzip 32625 → 32411 (-214)
  • 🔴 directory.js: parsed 66616 → 67117 (+501), gzip 18532 → 18866 (+334)
  • 748.js: removed (was parsed 58793, gzip 17827)
  • 🔴 map.js: parsed 46709 → 47212 (+503), gzip 14310 → 14461 (+151)
  • odspPrefetchSnapshot.js: parsed 45642 → 45649 (+7), gzip 15277 → 15249 (-28)
  • 985.js: removed (was parsed 44491, gzip 13726)
  • summarizerDelayLoadedModule.js: parsed 30749 → 30717 (-32), gzip 7753 → 7716 (-37)
  • socketModule.js: parsed 26476 → 26476 (0), gzip 7887 → 7903 (+16)
  • createNewModule.js: parsed 12480 → 12454 (-26), gzip 4786 → 4797 (+11)
  • summaryModule.js: parsed 3797 → 3789 (-8), gzip 1860 → 1857 (-3)
  • connectionState.js: parsed 724 → 909 (+185), gzip 429 → 500 (+71)
  • sharedTreeAttributes.js: parsed 666 → 854 (+188), gzip 433 → 508 (+75)
  • debugAssert.js: parsed 429 → 429 (0), gzip 299 → 299 (0)
  • FluidFramework-HashFallback.js: parsed 422 → 419 (-3), gzip 316 → 313 (-3)
  • 578.js: added (parsed 58686, gzip 17657)
  • 252.js: added (parsed 44371, gzip 13732)

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 area: repo Repo related work area: tools area: website base: main PRs targeted against main branch changeset-present public api change Changes to a public API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants