unicode-org / icu4x

Solving i18n for client-side and resource-constrained environments.
https://icu4x.unicode.org
Other
1.33k stars 173 forks source link

Continue testing public access to baked data APIs in CI #4443

Open sffc opened 8 months ago

sffc commented 8 months ago

Currently the testdata-legacy CI job fails when there is baked data that tries to access a pub(crate) API. It is the only CI that fails in this condition:

https://github.com/unicode-org/icu4x/pull/4435

...
2023-12-09T02:10:36.9768608Z [cargo-make] INFO - Running Task: testdata-legacy-test
...
2023-12-09T02:11:01.0717938Z error[E0624]: associated function `from_time_granularity` is private
2023-12-09T02:11:01.0719524Z   --> src/../data/baked/macros/datetime_buddhist_datelengths_v1.rs.data:2:1311
2023-12-09T02:11:01.0720440Z    |
2023-12-09T02:11:01.0721603Z 2  | ... pattern :: runtime :: PatternMetadata :: from_time_granularity (icu_datetime :: pattern :: TimeGranularity :: None) , } , long : icu_...
2023-12-09T02:11:01.0723009Z    |                                              ^^^^^^^^^^^^^^^^^^^^^ private associated function
2023-12-09T02:11:01.0723710Z    |
...

When we retire testdata we should continue testing for this condition, or else we may unintentionally land baked data APIs that don't work outside the crate.

CC @robertbastian

robertbastian commented 8 months ago

My initial instinct was that it's tested by https://github.com/unicode-org/icu4x/blob/main/docs/tutorials/crates/baked/src/main.rs, but that only tests a single key. It does serve as an example why the tutorials are not good semver tests though :)

robertbastian commented 8 months ago

2570

sffc commented 8 months ago

This isn't semver, though, being public API, it is certainly related. This is about making sure that we export as pub and not pub(crate) any APIs that databake-generated output needs.