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

Partially revert #23432 "Prefix ... no-unchecked-record-access..." #23486

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

jason-ha
Copy link
Contributor

@jason-ha jason-ha commented Jan 7, 2025

Partially revert "Prefix trivial issues when enabling no-unchecked-record-access for client packages (#23432)"

This reverts commit 88caebd where:

  1. ? was used to address linter defect. TypeScript appears to mostly ignore that these cases may lead to undefined result which is not accepted per type specifications. Use of ? is thus a behavior change that will shift point of failure away from where it could first be detected - revert those behavior changes. (Many of the test uses of ? in original change are permissible as there is a follow-up assertion that will fail. But those were not separated during revert.)

  2. T | undefined was used to address linter defect. TypeScript will narrow without undefined without noUncheckedIndexAccess enabled.

The only files that retained changes from original commit are:
packages/dds/merge-tree/src/test/beastTest.spec.ts
packages/drivers/odsp-driver/src/WriteBufferUtils.ts
packages/runtime/id-compressor/src/test/idCompressor.spec.ts
packages/tools/fetch-tool/src/fluidFetchSnapshot.ts

…cord-access for client packages (microsoft#23432)"

This reverts commit 88caebd where `?` was used to address linter defect. Many of the test uses of `?` in original change are permissible as there is a follow-up assertion that will fail. But those were not separated during revert.

Changes from original commit that used expected safe adjustments are retained.
@jason-ha jason-ha requested review from a team as code owners January 7, 2025 20:05
@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: sharedstring area: driver Driver related issues area: loader Loader related issues area: odsp-driver area: runtime Runtime related issues area: tests Tests to add, test infrastructure improvements, etc base: main PRs targeted against main branch labels Jan 7, 2025

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 18 changed files in this pull request and generated no comments.

Files not reviewed (13)
  • packages/dds/map/src/test/mocha/directory.spec.ts: Evaluated as low risk
  • packages/runtime/id-compressor/src/test/idCompressor.spec.ts: Evaluated as low risk
  • packages/runtime/runtime-utils/src/test/summaryUtils.spec.ts: Evaluated as low risk
  • packages/test/test-drivers/src/odspTestDriver.ts: Evaluated as low risk
  • packages/runtime/container-runtime/src/test/gc/gcStats.spec.ts: Evaluated as low risk
  • packages/drivers/odsp-driver/src/test/prefetchSnapshotTests.spec.ts: Evaluated as low risk
  • packages/drivers/routerlicious-driver/src/documentServiceFactory.ts: Evaluated as low risk
  • packages/dds/map/src/directory.ts: Evaluated as low risk
  • experimental/dds/attributable-map/src/mapKernel.ts: Evaluated as low risk
  • packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts: Evaluated as low risk
  • packages/drivers/routerlicious-driver/src/documentService.ts: Evaluated as low risk
  • packages/runtime/container-runtime/src/test/containerRuntime.spec.ts: Evaluated as low risk
  • packages/dds/map/src/mapKernel.ts: Evaluated as low risk
Comments suppressed due to low confidence (3)

packages/loader/driver-utils/src/test/summaryCompresssionTester.spec.ts:72

  • Direct property access without optional chaining may cause runtime errors if 'tree' is undefined. Ensure 'tree' is always defined or add appropriate checks.
).tree.header;

packages/loader/driver-utils/src/test/summaryCompresssionTester.spec.ts:94

  • Direct property access without optional chaining may cause runtime errors if 'tree' is undefined. Ensure 'tree' is always defined or add appropriate checks.
).tree.header;

packages/loader/driver-utils/src/test/summaryCompresssionTester.spec.ts:624

  • Direct property access without optional chaining may cause runtime errors if 'tree' is undefined. Ensure 'tree' is always defined or add appropriate checks.
return getHeaderHolder(summary).tree.header;
…rd-access for client packages (microsoft#23432)"

This reverts commit 88caebd where `T | undefined` was used to address linter defect. TypeScript will narrow without `undefined` without noUncheckedIndexAccess enabled. So remove ineffective pattern.

The only files that retained changes are:
  packages/dds/merge-tree/src/test/beastTest.spec.ts
  packages/drivers/odsp-driver/src/WriteBufferUtils.ts
  packages/runtime/id-compressor/src/test/idCompressor.spec.ts
  packages/tools/fetch-tool/src/fluidFetchSnapshot.ts
@jason-ha jason-ha requested a review from a team as a code owner January 7, 2025 21:53
Copy link
Contributor

@alexvy86 alexvy86 left a comment

Choose a reason for hiding this comment

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

Devtools 👍

Copy link
Contributor

@anthony-murphy anthony-murphy left a comment

Choose a reason for hiding this comment

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

merge-tree looks good

@jason-ha jason-ha enabled auto-merge (squash) January 8, 2025 01:43
@jason-ha jason-ha merged commit ca172e7 into microsoft:main Jan 8, 2025
32 checks passed
@jason-ha jason-ha deleted the no-unchecked-index-access/revert branch January 8, 2025 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds: sharedstring area: dds Issues related to distributed data structures area: driver Driver related issues area: loader Loader related issues area: odsp-driver area: runtime Runtime related issues area: tests Tests to add, test infrastructure improvements, etc base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants