Skip to content

Allow slashes in DataMarkerAttributes#7890

Merged
sffc merged 7 commits intounicode-org:mainfrom
sffc:attributes-with-slashes
Apr 21, 2026
Merged

Allow slashes in DataMarkerAttributes#7890
sffc merged 7 commits intounicode-org:mainfrom
sffc:attributes-with-slashes

Conversation

@sffc
Copy link
Copy Markdown
Member

@sffc sffc commented Apr 21, 2026

This is for multi-layered attributes, like "FR/long", which we may want for DisplayNames.

I made this with a heavily-prompted agent.

Changelog

icu_provider: allow slashes in DataMarkerAttributes

sffc and others added 4 commits April 20, 2026 22:14
- Modified DataMarkerAttributes::validate to allow '/' in attributes.
- Added a nested attribute example ("nested/part") to HelloWorldProvider.
- Added a doc-test for the nested attribute.

Co-authored-by: Gemini <176961590+gemini-code-assist[bot]@users.noreply.github.com>
- Relaxed assertion in FsDataProvider to allow forward slashes in attributes, with safety checks.
- Updated baked and blob test data for HelloWorldV1.

Co-authored-by: Gemini <176961590+gemini-code-assist[bot]@users.noreply.github.com>
- Updated DataMarkerAttributes::validate to disallow leading slashes and double slashes.
- Added unit tests for these new invariants.

Co-authored-by: Gemini <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@sffc sffc requested review from a team and Manishearth as code owners April 21, 2026 05:31
@sffc sffc requested a review from robertbastian April 21, 2026 05:33
- Defaulted prev_was_slash to true to simplify leading slash check.

Co-authored-by: Gemini <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Member

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

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

just a code review. not yet sure if we should support this but ... probably? I thought we didn't end up picking the nested attribute designs for DisplayNames, and I have a slight preference to only make this change when we actually need it. But maybe we need it now, and I'm not strongly opposed to doing this proactively.

Comment thread provider/fs/src/fs_data_provider.rs Outdated
Comment thread provider/core/src/request.rs
@sffc sffc requested a review from Manishearth April 21, 2026 06:13
@sffc
Copy link
Copy Markdown
Member Author

sffc commented Apr 21, 2026

just a code review. not yet sure if we should support this but ... probably? I thought we didn't end up picking the nested attribute designs for DisplayNames

We said that length and region could be nested in the attributes, but I had already implemented length on the key level and didn't go back to revisit it yet.

Comment thread provider/core/src/request.rs Outdated
#[repr(transparent)]
pub struct DataMarkerAttributes {
// Validated to be non-empty ASCII alphanumeric + hyphen + underscore
// Validated to be non-empty ASCII alphanumeric + hyphen + underscore + forward slash. Disallows leading and double slashes.
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.

it should also disallow trailing slashes

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.

I agree, otherwise this leads to multiple attributes with the same fs path.

Copy link
Copy Markdown
Member

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

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

If we have a current use case, sure. LGTM with the trailing slashes fixed

- Moved empty string check to the top of `validate`.
- Added comment to clarify trailing slash check.
- Added empty string as a valid test case.

Co-authored-by: Gemini <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@sffc sffc merged commit 8417390 into unicode-org:main Apr 21, 2026
34 checks passed
@sffc sffc deleted the attributes-with-slashes branch April 21, 2026 19:31
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.

3 participants