Skip to content

fix(client-presence): move validated State objects to internal #24888

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jason-ha
Copy link
Contributor

Some validation related type remain exposed as the *Raw types reference them.

@Copilot Copilot AI review requested due to automatic review settings June 21, 2025 01:29
@jason-ha jason-ha requested review from a team as code owners June 21, 2025 01:29
@jason-ha jason-ha requested a review from tylerbutler June 21, 2025 01:29
@github-actions github-actions bot added base: main PRs targeted against main branch area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct changeset-present public api change Changes to a public API labels Jun 21, 2025
Copy link
Contributor

@Copilot 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

This pull request refactors the creation of presence State objects by moving validated (raw) state implementations to an internal API.

  • Refactors factory functions to use StateFactoryInternal instead of StateFactory.
  • Updates test imports and usage accordingly.
  • Adjusts API definitions and documentation in the public API reports.

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/framework/presence/src/test/schemaValidation.spec.ts Test updates to import and use StateFactoryInternal instead of the public API.
packages/framework/presence/src/test/latestValueManager.spec.ts Updated test cases using StateFactoryInternal for latest state creation.
packages/framework/presence/src/test/latestMapValueManager.spec.ts Updated test cases using StateFactoryInternal for latestMap state creation.
packages/framework/presence/src/stateFactory.ts Refactored exports to expose internal state factory methods and updated documentation comments.
packages/framework/presence/src/latestValueManager.ts Adjusted factory function overloads and error handling for validator usage.
packages/framework/presence/src/latestMapValueManager.ts Updated overload signatures and helper function for argument casting.
packages/framework/presence/src/index.ts Modified type re-exports to remove deprecated types from the public API.
packages/framework/presence/api-report/* Synchronized API report documentation with internal state changes.
.changeset/green-poets-run.md Removed changeset details reflecting breaking changes to the validator parameter.
Comments suppressed due to low confidence (6)

packages/framework/presence/src/latestValueManager.ts:329

  • [nitpick] Consider adding a TODO or inline comment noting the planned timeline for validator support to aid future maintenance.
	}

packages/framework/presence/src/test/schemaValidation.spec.ts:14

  • [nitpick] Ensure test cases fully cover the new StateFactoryInternal usage, particularly in scenarios where validator behavior might be extended in the future.
import { StateFactoryInternal } from "../stateFactory.js";

packages/framework/presence/src/stateFactory.ts:28

  • Update the documentation comment to clearly indicate that StateFactory re-exports internal APIs to prevent accidental exposure of raw validated state behaviors.
export const StateFactory: {

packages/framework/presence/src/latestMapValueManager.ts:680

  • [nitpick] Add an inline comment in or above the usableArgsType function to clarify its purpose for casting validator arguments, improving maintainability.
	const validator = usableArgsType(args)?.validator;

packages/framework/presence/src/index.ts:51

  • Verify that deprecating the export of LatestMapArguments and LatestArguments does not adversely affect existing consumers, and update migration guides as necessary.
	// LatestMapArguments,

Some validation related type remain exposed as the *Raw types reference them.
@jason-ha jason-ha force-pushed the presence/hide-validator-state-objects branch from fc23770 to b5e7b85 Compare June 21, 2025 01:43
Comment on lines -15 to -22
/**
* Factory for creating a {@link Latest} or {@link LatestRaw} State object.
*/
export const StateFactoryInternal = {
latest,

/**
* Factory for creating a {@link LatestMap} or {@link LatestMapRaw} State object.
*/
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 comments didn't actually go anywhere. Moved to remarks in overall variable.

Copy link
Contributor

🔗 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:
  225447 links
    1710 destination URLs
    1941 URLs ignored
       0 warnings
       0 errors


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 changeset-present public api change Changes to a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant