Skip to content

The message unicode guard takes an allow list, read at the text seam too, and no entry on it can admit a character that draws nothing - #202

Merged
HackingGate merged 1 commit into
mainfrom
the-text-seam-unicode-guard-takes-an-allow-list-that-cannot-admit-an-invisible
Sep 20, 2026
Merged

HackingGate merged 1 commit into
mainfrom
the-text-seam-unicode-guard-takes-an-allow-list-that-cannot-admit-an-invisible

Conversation

@HackingGate

Copy link
Copy Markdown
Owner

Closes #200.

What is now true

allow = ["U+FF01", ...] is accepted on prevent-unusual-unicode, the
commit-msg and text guard. It is parsed with the codepoint half of the
allowance the file guard already has (unicode::parse_codepoint, extracted
from parse_allowance); a message has no path, so an entry carrying the
glob half is refused at load rather than read by nothing.

A listed codepoint is admitted past the whitelist. A codepoint is_invisible
refuses stays refused whatever the list says, and listing one is a load-time
refusal naming it (rule "prevent-unusual-unicode": allow lists U+200B ZERO WIDTH SPACE, which draws nothing ...), so the allowance cannot open the
zero-width and bidirectional hole the consumer's UPHOLD_ALLOW exec line
opened. The invisibility test is asked at judgement time as well as at load,
so a Rule that never met validate admits nothing by it either.

How the field reaches the text seam

No new plumbing. text-guards dispatches through guard::over_text to
every built-in rule in the effective policy, and hands text_refusal the
&Rule as declared, inherited or shadowed. message::unusual_unicode_in
now reads rule.allow() where before it read only the id. So a consumer
that writes [rule.prevent-unusual-unicode] allow = [...] beside its
[inherit] sets = ["commit-message-residue", "published-text"] has the
allowance honoured for a pull-request body and a push through
no-published-markers, and uphold guard --text - reads the same rule.

Docs

REFERENCE.md gets the parameter row and a paragraph under the guard: every
Unicode whitespace passes (is_whitespace, U+3000 included), script-vouched
punctuation passes since 1.17.0, and an invisible is never allowable. No
CJK-punctuation default is added.

Tests

  • guard::message::tests: a listed codepoint is admitted and an unlisted
    one is not (through the loader); an invisible on the list is refused at
    load and never admitted past it; a glob on a message allowance is refused
    at load.
  • tests/text_cli.rs: guard --text - with a fixture declaring
    allow = ["U+FF01"] passes a body carrying U+FF01, the same body without
    the allowance is refused, a body carrying U+200B is refused under both,
    and a policy listing U+200B is exit 2 at load.
  • tests/shim_cli.rs: the text-guards consultation honours the allowance
    declared on prevent-unusual-unicode for a -b body and still refuses
    U+200B.

cargo test: 28 suites, 901 passed, 0 failed. cargo clippy --all-targets -- -D warnings, uphold check, uphold scan and
build_reference.py --check clean; lefthook pre-commit, commit-msg and
pre-push all green.

…too, and no entry on it can admit a character that draws nothing

`allow = ["U+FF01", ...]` is accepted on `prevent-unusual-unicode`, parsed
with the codepoint half of the allowance the file guard already has. A
message has no path, so an entry carrying the file guard's glob half is
refused at load rather than read by nothing. A listed codepoint is admitted
past the whitelist; a codepoint `is_invisible` refuses stays refused whatever
the list says, and listing one is a load-time refusal naming it, so the
allowance cannot open the zero-width and bidirectional hole that switching
the whole rule off with `UPHOLD_ALLOW` opened.

The field travels to the text seam on its own. `text-guards` dispatches
through `over_text` to every built-in rule the effective policy holds, and
hands `text_refusal` the rule as declared, inherited or shadowed, so a
consumer that writes the allowance on `prevent-unusual-unicode` has it
honoured for a pull-request body and a push, and `guard --text -` reads the
same rule. The guard now reads `rule.allow()` where before it read only the
id, and that is the whole of the plumbing.

REFERENCE.md documents the field, that every Unicode whitespace (U+3000
included) and script-vouched punctuation already pass, and that an invisible
is never allowable. No CJK-punctuation default is added. The nine consumer
`allow = ["U+3000"]` lines were already redundant for U+3000 at the text
seam, since `is_whitespace` admits it with or without a list.

Closes #200
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 13 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 40fdb823-1de6-4caa-96ad-cf5f918b31d6

📥 Commits

Reviewing files that changed from the base of the PR and between 310ebab and 6e1550a.

📒 Files selected for processing (7)
  • docs/REFERENCE.md
  • src/config/rule.rs
  • src/guard/message.rs
  • src/guard/mod.rs
  • src/guard/unicode.rs
  • tests/shim_cli.rs
  • tests/text_cli.rs

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.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.66%. Comparing base (310ebab) to head (6e1550a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #202      +/-   ##
==========================================
+ Coverage   93.63%   93.66%   +0.02%     
==========================================
  Files          44       44              
  Lines       17057    17130      +73     
==========================================
+ Hits        15971    16044      +73     
  Misses       1086     1086              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@HackingGate
HackingGate merged commit ab694be into main Sep 20, 2026
11 checks passed
@HackingGate
HackingGate deleted the the-text-seam-unicode-guard-takes-an-allow-list-that-cannot-admit-an-invisible branch September 20, 2026 06:51
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.

prevent-unusual-unicode has no allow list at the text seam, so a consumer disables the whole guard with UPHOLD_ALLOW in its exec line

2 participants