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

Enable noUncheckedIndexedAccess for ODSP driver (#21664) #23068

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

Conversation

RishhiB
Copy link
Contributor

@RishhiB RishhiB commented Nov 12, 2024

Enable noUncheckedIndexedAccess for ODSP driver
The property noUncheckedIndexedAccess is being enabled to improve type
safety by making the TypeScript compiler assume all arrays are sparse,
which requires runtime validation or non-null assertions for indexed
access. This aims to catch potential issues with type changes and ensure
API semver compliance

AB#8216

Enable noUncheckedIndexedAccess for ODSP driver
The property noUncheckedIndexedAccess is being enabled to improve type
safety by making the TypeScript compiler assume all arrays are sparse,
which requires runtime validation or non-null assertions for indexed
access. This aims to catch potential issues with type changes and ensure
API semver compliance

[AB#8216](https://dev.azure.com/fluidframework/235294da-091d-4c29-84fc-cdfc3d90890b/_workitems/edit/8216)
@github-actions github-actions bot added base: main PRs targeted against main branch area: driver Driver related issues area: odsp-driver labels Nov 12, 2024
@jikim-msft
Copy link
Contributor

If non-null assertion is happening so frequently (based on the numerous TODO comments in the changes), I believe it is worth investigating and fixing the root cause issue (for example in compactSnapshotParser.ts).

@RishhiB RishhiB marked this pull request as draft November 12, 2024 18:35

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 17 changed files in this pull request and generated no suggestions.

Files not reviewed (12)
  • packages/drivers/odsp-driver/tsconfig.json: Language not supported
  • packages/drivers/odsp-driver/src/WriteBufferUtils.ts: Evaluated as low risk
  • packages/drivers/odsp-driver/src/compactSnapshotParser.ts: Evaluated as low risk
  • packages/drivers/odsp-driver/src/compactSnapshotWriter.ts: Evaluated as low risk
  • packages/drivers/odsp-driver/src/ReadBufferUtils.ts: Evaluated as low risk
  • packages/drivers/odsp-driver/src/fetchSnapshot.ts: Evaluated as low risk
  • packages/drivers/odsp-driver/src/odspDelayLoadedDeltaStream.ts: Evaluated as low risk
  • packages/drivers/odsp-driver/src/odspSummaryUploadManager.ts: Evaluated as low risk
  • packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts: Evaluated as low risk
  • packages/drivers/odsp-driver/src/odspSnapshotParser.ts: Evaluated as low risk
  • packages/drivers/odsp-driver/src/createNewUtils.ts: Evaluated as low risk
  • packages/drivers/odsp-driver/src/localOdspDriver/localOdspDeltaStorageService.ts: Evaluated as low risk
Comments skipped due to low confidence (4)

packages/drivers/odsp-driver/src/odspUrlHelper.ts:114

  • The non-null assertion on joinSessionMatch[5] may be problematic if joinSessionMatch[5] can be null or undefined. Ensure joinSessionMatch[5] is always defined before this point.
const driveId = joinSessionMatch[3] ?? joinSessionMatch[5]!;

packages/drivers/odsp-driver/src/odspUrlHelper.ts:116

  • The non-null assertion on joinSessionMatch[4] may be problematic if joinSessionMatch[4] can be null or undefined. Ensure joinSessionMatch[4] is always defined before this point.
const itemId = joinSessionMatch[4]!;

packages/drivers/odsp-driver/src/odspUrlHelper.ts:126

  • The non-null assertion on joinSessionMatch[2] may be problematic if joinSessionMatch[2] can be null or undefined. Ensure joinSessionMatch[2] is always defined before this point.
const driveId = joinSessionMatch[2]!;

packages/drivers/odsp-driver/src/odspUrlHelper.ts:128

  • The non-null assertion on joinSessionMatch[3] may be problematic if joinSessionMatch[3] can be null or undefined. Ensure joinSessionMatch[3] is always defined before this point.
const itemId = joinSessionMatch[3]!;

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: driver Driver related issues area: odsp-driver base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants