Skip to content

fix(html): read the chunk index from a checked optional - #1254

Merged
andiwand merged 1 commit into
mainfrom
fix/chunk-optional-tidy
Oct 24, 2026
Merged

andiwand merged 1 commit into
mainfrom
fix/chunk-optional-tidy

Conversation

@andiwand

@andiwand andiwand commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Refs #764.

Summary

The tidy job on main fails since #1253:

src/odr/internal/html/text_file.cpp:154:20: error: unchecked access to optional value [bugprone-unchecked-optional-access,-warnings-as-errors]

write checked chunk_of(path).has_value() and then dereferenced a second call, *chunk_of(path). clang-tidy 18 cannot see that the two calls give the same value. write now keeps the optional in a local, checks it, and dereferences it. mimetype checks the cheap parse first, as write now does.

This fix was ready for #1253, but #1253 was merged before the push.

Test

  • 281 C++ tests for html, text and http pass.
  • The local clang-tidy 22 does not flag the old code, so the tidy job of this PR is the check.

🤖 Generated with Claude Code

clang-tidy 18 refused `*chunk_of(path)` with
bugprone-unchecked-optional-access, because the check before it was on a
second call. `write` now keeps the optional in a local and checks it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YHNzLmVv1mFWfPitHASucN
@andiwand
andiwand merged commit 24f2785 into main Oct 24, 2026
27 checks passed
@andiwand
andiwand deleted the fix/chunk-optional-tidy branch October 24, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant