Skip to content

fix: resolve unsafe optional chaining lint error in affinity-fingerprint test - #1357

Closed
github-actions[bot] wants to merge 1 commit into
cchp-gateway-portingfrom
claude-fix-pr-1356-29960136683
Closed

fix: resolve unsafe optional chaining lint error in affinity-fingerprint test#1357
github-actions[bot] wants to merge 1 commit into
cchp-gateway-portingfrom
claude-fix-pr-1356-29960136683

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

CI Auto-Fix

Original PR: #1356
Failed CI Run: Non-Main Branch CI/CD

Fixes Applied

File Fix Type
tests/unit/proxy/affinity-fingerprint.test.ts:583 Replaced unsafe contents[1]?.parts with contents[1].parts lint (noUnsafeOptionalChaining)

The biome rule lint/correctness/noUnsafeOptionalChaining flagged (otherUri.contents[1]?.parts as ...)[1] because if the optional chaining short-circuits to undefined, the subsequent [1] index access throws a TypeError. The test fixture explicitly defines contents[1] as a non-null object, so the optional chaining was both unnecessary and unsafe. Switching to direct member access is behavior-preserving for this test.

Not Auto-Fixable

The biome config also emits 2 infos (not errors, do not fail CI):

  • biome.json schema version mismatch (2.4.16 vs CLI 2.5.5) — requires running biome migrate
  • linter.recommended field deprecated in favor of preset — requires running biome migrate

These are informational and do not block the pipeline.

Verification

  • bun run lint passes (exit code 0 after CI's format step)
  • All 42 tests in affinity-fingerprint.test.ts pass
  • No logic changes — single mechanical ?. to . fix

Auto-generated by Claude AI

Greptile Summary

This PR removes a redundant ?. optional chain in a single test assertion, fixing a biome noUnsafeOptionalChaining lint error. The test fixture at the mutation site unconditionally defines contents[1] as a non-null object, so the removal is behavior-preserving.

  • Replaced otherUri.contents[1]?.parts with otherUri.contents[1].parts in the test for the computeFingerprintChain gemini path — eliminates the lint error with no semantic change.
  • No production code was touched; all 42 tests in the file are expected to pass unchanged.

Confidence Score: 5/5

Safe to merge — single mechanical character change in a test file with no production code impact.

The change removes one ?. operator from a test assertion where the fixture guarantees the object is present. The fix is verified by the existing test suite and purely eliminates a lint warning with no behavioral difference.

No files require special attention.

Important Files Changed

Filename Overview
tests/unit/proxy/affinity-fingerprint.test.ts Removed unsafe optional chaining on contents[1]?.parts at line 583; the test fixture guarantees contents[1] is non-null, so the change is behavior-preserving and fixes the biome lint error.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Test fixture: contents[1] is a non-null object"] --> B{"Optional chaining used?"}
    B -- "Before fix: contents[1]?.parts" --> C["biome lint error: noUnsafeOptionalChaining"]
    B -- "After fix: contents[1].parts" --> D["Direct access — safe, lint passes"]
    D --> E["All 42 tests pass unchanged"]
Loading

Reviews (1): Last reviewed commit: "fix: resolve unsafe optional chaining li..." | Re-trigger Greptile

…int test

The biome rule lint/correctness/noUnsafeOptionalChaining flagged
`contents[1]?.parts[1]` as unsafe: if the optional chaining short-circuits
to undefined, the subsequent `[1]` index access throws TypeError. The test
data guarantees contents[1] is defined, so direct access is correct.

CI Run: https://github.com/ding113/claude-code-hub/actions/runs/29960089110
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant