Skip to content

[Repo Assist] Fix code scanning alerts: interpolated string format specifiers and unsafe option access#4421

Merged
dbrattli merged 2 commits into
mainfrom
repo-assist/codescan-1144-1512-1125-format-safety-a5757dfd33fbd98d
Mar 19, 2026
Merged

[Repo Assist] Fix code scanning alerts: interpolated string format specifiers and unsafe option access#4421
dbrattli merged 2 commits into
mainfrom
repo-assist/codescan-1144-1512-1125-format-safety-a5757dfd33fbd98d

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Fixes four open code scanning alerts reported by the Ionide analyzer:

  • Alert 1144/1145 (State.fs line 50): Added %s format specifiers to interpolated string holes for path and error.Message. Without explicit format specifiers, the F# interpolated string produces an untyped string conversion; adding %s makes the intent and types explicit.

  • Alert 1512 (Python/Replacements.fs line 2500): Added %A format specifier for a Fable.Type discriminated union value in an error message. %A is the correct specifier for arbitrary F# values.

  • Alert 1125 (Rust/Fable2Rust.fs line 1644): Replaced the .IsSome && .Value pattern — which the analyzer flags as unsafe option unwrapping — with Option.exists, which is both idiomatic and avoids the potential for a None.Value exception if the guard condition were ever refactored.

Changes

File Alert(s) Change
src/Fable.Transforms/State.fs 1144, 1145 %s prefix on {path} and {error.Message}
src/Fable.Transforms/Python/Replacements.fs 1512 %A prefix on {t} (Fable.Type value)
src/Fable.Transforms/Rust/Fable2Rust.fs 1125 nameOpt.IsSome && isRefScoped ctx nameOpt.ValuenameOpt |> Option.exists (isRefScoped ctx)

Test plan

  • All changes are non-functional (format specifiers have no runtime effect; Option.exists is semantically equivalent to .IsSome && .Value when IsSome is true)
  • CI build and tests should pass without changes to expected output
  • Code scanning alerts 1144, 1145, 1512, and 1125 should be resolved after merge

🤖 Generated with [Claude Code]((claude.com/redacted)

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

…nsafe option unwrapping

- Add %s/%A format specifiers to interpolated strings in State.fs and
  Python/Replacements.fs (resolves alerts 1144, 1145, 1512)
- Replace `.IsSome && .Value` option pattern with `Option.exists` in
  Rust/Fable2Rust.fs for `makeRefForPatternMatch` (resolves alert 1125)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added automation Automated changes repo-assist Created by Repo Assist labels Mar 19, 2026
@MangelMaxime MangelMaxime marked this pull request as ready for review March 19, 2026 15:04
@github-actions

Copy link
Copy Markdown
Contributor Author

Python Type Checking Results (Pyright)

Metric Value
Total errors 18
Files with errors 4
Excluded files 4
New errors ✅ No
Excluded files with errors (4 files)

These files have known type errors and are excluded from CI. Remove from pyrightconfig.ci.json as errors are fixed.

File Errors Status
temp/tests/Python/test_applicative.py 12 Excluded
temp/tests/Python/test_hash_set.py 3 Excluded
temp/tests/Python/test_nested_and_recursive_pattern.py 2 Excluded
temp/tests/Python/fable_modules/thoth_json_python/encode.py 1 Excluded

@dbrattli dbrattli merged commit 396c4b5 into main Mar 19, 2026
25 checks passed
@dbrattli dbrattli deleted the repo-assist/codescan-1144-1512-1125-format-safety-a5757dfd33fbd98d branch March 19, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation Automated changes repo-assist Created by Repo Assist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant