Skip to content

unicodedata: Simplify generate_name_lookups - #8817

Merged
youknowone merged 1 commit into
RustPython:mainfrom
joshuamegnauth54:clean-generate-names
Sep 25, 2026
Merged

youknowone merged 1 commit into
RustPython:mainfrom
joshuamegnauth54:clean-generate-names

Conversation

@joshuamegnauth54

@joshuamegnauth54 joshuamegnauth54 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor
  • Reuse helpers where appropriate
  • Implement a helper for data that doesn't follow the pattern of the rest of the Unicode files
  • Use BTreeMap, which is deduped by key and sorted instead of sorting a Vec
  • Closes #xxxx

One of checkbox below must be checked.

  • I did not use AI to write the code of this patch.
  • This PR follows our AI policy

Summary

Summary by CodeRabbit

  • Chores
    • Unicode name data is now generated in a consistent order, with duplicate names resolved using the most recently encountered entry. This keeps generated lookup data predictable while preserving the established behavior for duplicate names.

* Reuse helpers where appropriate
* Implement a helper for data that doesn't follow the pattern of the
  rest of the Unicode files
* Use BTreeMap, which is deduped by key and sorted instead of sorting
  a Vec
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: RustPython/RustPython/.coderabbit.yml

Review profile: CHILL

Plan: Advanced

Run ID: 357e5bba-878f-4efb-bf7d-80d730c7b5f5

📥 Commits

Reviewing files that changed from the base of the PR and between 0ebc657 and 8c566a0.

📒 Files selected for processing (1)
  • crates/unicode/build.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The Unicode build script adds raw-line iteration and a helper for writing static arrays. It collects aliases and named sequences in ordered maps, reads named sequences through the raw-line iterator, and schedules name lookup generation as a separate parser.

Changes

Unicode name lookup generation

Layer / File(s) Summary
Collect and generate name lookups
crates/unicode/build.rs
The build script reads named sequence lines through UnicodeLineReader::raw_iter, stores aliases and sequences in ordered maps, and writes entries in key order with write_slice_raw. Repeated keys overwrite earlier values. generate_name_lookups runs as a separately spawned parser.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Suggested reviewers: youknowone

Merge Risk: ⚪ Minimal · up to 8c566

The changed name-lookup generation preserves the inspected input handling and build completion behavior. No issue remains that should delay merging.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 8c566

The lookup tables remain build-time data, and the runtime lookup boundary is unchanged. No introduced security issue was established, but the available coverage does not support a minimal-risk conclusion.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — A changed generated mapping could affect runtime Unicode name lookup results, but the inspected change adds no service, tenant, credential, or privileged sink to that path.

Trust Boundaries and Controls

  • observed — Build-time input comes from vendored files, while runtime-supplied names are searched against compiled tables. The existing non-modern-data guard remains ahead of alias and sequence lookup.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: simplifying generate_name_lookups. It is concise and directly matches the pull request objectives.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codspeed

codspeed Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing joshuamegnauth54:clean-generate-names (8c566a0) with main (0ebc657)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@youknowone youknowone left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@youknowone
youknowone merged commit 05103e8 into RustPython:main Sep 25, 2026
22 checks passed
@joshuamegnauth54
joshuamegnauth54 deleted the clean-generate-names branch September 30, 2026 15:42
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.

2 participants