Clarify trim-content principle: judge by user-path, not category

This commit is contained in:
2026-06-05 01:29:11 +03:00
parent 22f0556ef8
commit 3d38dd1411
+14 -6
View File
@@ -84,12 +84,20 @@ npm run format # Prettier
smaller bundle prove nothing about behavior: when a change touches what the user sees or smaller bundle prove nothing about behavior: when a change touches what the user sees or
does, confirm it by exercising the feature, not by the compiler alone. does, confirm it by exercising the feature, not by the compiler alone.
- **Trim content, not capability** — when narrowing a third-party import or build to cut - **Trim content, not capability** — when narrowing a third-party import or build to cut
size, remove optional _content_ (languages, locales, themes, icon sets), never the size, remove optional _content_, never the library's _features_. The smallest/lowest-level
library's _features_. The smallest/lowest-level entry point is seldom the right one — it entry point is seldom the right one — it often drops capabilities you meant to keep. Prefer
often drops capabilities you meant to keep. Prefer the entry that excludes the unwanted the entry that excludes the unwanted content while retaining behavior, and validate the
content while retaining behavior, and validate the behavior survived. (This bit us once: behavior survived. (This bit us once: importing Monaco's `editor.api` to drop unused
importing Monaco's `editor.api` to drop unused languages also stripped every editor languages also stripped every editor feature — see `docs/architecture/08`.)
feature — see `docs/architecture/08`.) - The line isn't "content vs. capability" by category — it's **"does any real user path
depend on this?"** Safe to drop: data no user path exercises (a date formatter's unused
locale tables, an icon set you never render, themes you don't ship). _Not_ safe, even
though it looks like "content": **human-language coverage** — font script subsets,
translatable strings — which is capability the moment the app is meant to be usable in
that language. Treat dropping it like dropping a feature. (This bit us a second time:
trimming IBM Plex to the latin subsets dropped Cyrillic — capability for an
internationally-usable app. We ship every script subset and precache them for offline;
`unicode-range` means the browser only downloads what a glyph needs anyway.)
- **Spec is the contract** — when in doubt, read `docs/spec/`. If the spec is wrong or - **Spec is the contract** — when in doubt, read `docs/spec/`. If the spec is wrong or
silent, raise it; change the spec deliberately rather than drifting from it. silent, raise it; change the spec deliberately rather than drifting from it.
- **Core-first** — for each feature, build the pure `src/core/` logic with tests before UI. - **Core-first** — for each feature, build the pure `src/core/` logic with tests before UI.