bi-08 step 02 — Intrinsic sizing and result caching
Goal
Discover the second pass by needing it, then build the cache that makes layout incremental — and break it deliberately.
Tasks
- Implement
max-contentfor a subtree. Observe that you now need a pre-pass, and that it can nest. - Constraint-space key. Give each box a key derived from every input that affects its result: available inline size, writing mode, fragmentation state, and anything else your algorithm reads.
- Skip relayout when the key is unchanged. Measure the hit rate under (a) a window resize, (b) a single deep text change. Explain why the two differ so much.
- Break the key. Omit one input — available inline size is the instructive one. Find markup that now renders wrong. This is the demonstration that caching requires complete inputs, and the failure is silent.
- Mutate a published fragment and show a downstream consumer reading inconsistent geometry. This is the bug immutability prevents.
Done when
- Cache hit rates measured for two different change shapes
- Incomplete-key bug reproduced, with no error thrown
- You can state what makes a cache key complete