googlefonts / googlefonts/fontc
Expectations and invariants around 'default location' are unclear
- Dominant language
- Rust
- Stars
- 193
- Forks
- 21
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 65
Description
`StaticMetadata` has a `default_location` field. It also owns the `VariationModel`, and this type also has a `default` field, which is a location, as well as a `locations` vec.
This is confusing.
- the `default_location` in `StaticMetadata` is not always the same as the `default` location in the model.
- the `default_location` may not exist in the `locations` vec.
- the locations vec can (for non-variable fonts) include an 'empty' location that isn't referenced anywhere?
Is any of this intentional? It would be nice if we could determine our invariants here, and enforce them. In particular, the following two properties seem desirable:
- the 'default' location should be defined in exactly one place
- the 'default' location should always be included in the overall `locations` vec
- the 'default' location for a non-variable font should always be empty.
Is there any reason that these conditions are not desired or enforceable?
(this all came about because I was working on #1262, and ran into a bunch of unexpected trouble and a bunch of failing tests when trying to look at the metrics for all locations)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing StaticMetadata.default_location and VariationModel.default and locations, then review the failing tests encountered through work on #1262. Determine and document the intended invariants, including ownership and inclusion of the default location and the non-variable-font case. Done means the invariants are agreed and enforceable without leaving the described inconsistencies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100