@@ -28,22 +28,13 @@ use sha2::{Digest, Sha256};
2828use crate :: net:: { ETagCache , Http , NetError } ;
2929use crate :: product:: { Branch , Catalog , CatalogEntry , ProductCode } ;
3030
31- /// Manifest schema this build understands.
31+ /// Manifest schema this build understands. A newer one is refused: the last
32+ /// good cached art beats half-understood theming.
3233///
33- /// A manifest declaring a newer schema is refused rather than parsed
34- /// optimistically: the cached art from the last good fetch is a better answer
35- /// than half-understood theming.
36- ///
37- /// **2** made `logo` and `background` optional, so a product can be themed
38- /// with nothing but its square mark. Battle.net hand-offs, Diablo,
39- /// Hearthstone, StarCraft, are never drawn with a logo or a background by
40- /// this launcher, but they do want a mark in the product bar and the browse
41- /// list, and under schema 1 that was unreachable without inventing a wordmark
42- /// and a background for each of them.
43- ///
44- /// The bump is deliberate and not merely additive: a schema-1 client reading
45- /// a manifest whose entries omit `logo` fails to parse the *whole* document,
46- /// so it must be told to keep its cached copy instead.
34+ /// **2** made `logo` and `background` optional, so a Battle.net hand-off can
35+ /// be themed with just its square mark. Not merely additive: a schema-1 client
36+ /// fails to parse the whole document when an entry omits `logo`, so it must
37+ /// be told to keep its cache.
4738pub const SCHEMA_VERSION : u32 = 2 ;
4839
4940/// File name of the manifest within its base URL or fixture directory.
@@ -176,18 +167,11 @@ impl Manifest {
176167
177168 /// The theme of this product's *line*: Classic's for Classic PTR.
178169 ///
179- /// The step between a product's own entry and `default`. A PTR is the
180- /// same game as the branch it tracks, so when the manifest does not name
181- /// it, the game it belongs to is a far better answer than whatever
182- /// `default` happens to be: without this, Era PTR and Classic PTR both
183- /// wore retail's logo and backdrop, because retail is what `default`
184- /// points at.
185- ///
186- /// For the head itself, or a head the manifest does not name, the first
187- /// other branch that has a theme. Forever's head is `wowf`, and a
188- /// manifest naming `wowf` would make 1.0.0-beta.3 and older install it
189- /// into a literal `wowf/` (they do not know the code), so its art stays
190- /// on `wow_classic_beta` and the live product borrows it from there.
170+ /// Between a product's own entry and `default`; without it both PTRs wore
171+ /// retail's art. For a head the manifest does not name, the first other
172+ /// branch with a theme: Forever's head is `wowf`, and naming `wowf` in the
173+ /// manifest would make 1.0.0-beta.3 and older install into a literal
174+ /// `wowf/`, so its art stays on `wow_classic_beta`.
191175 fn head_theme ( & self , code : & ProductCode ) -> Option < & Theme > {
192176 let line = code. line ( ) ;
193177 let head = line. head ( ) ;
@@ -355,22 +339,12 @@ impl Store {
355339
356340 /// Delete cached art that `keep` does not name.
357341 ///
358- /// Published art is content-addressed upstream, the filename carries the
359- /// first bytes of its sha256, so every image that changes arrives under
360- /// a *new* URL, and the cache file for the old one is never written to
361- /// again. Without this, a few megabytes are stranded on disk per art
362- /// revision, forever.
363- ///
364- /// Deliberately narrow about what it will remove: only direct children,
365- /// only names that look like something [`Store::cache_name`] produced,
366- /// and never the manifest. A cache directory is still someone's disk, and
367- /// a prune that mis-fires there is far worse than the leak it fixes.
368- ///
369- /// **Each kept file keeps its `.etag` sidecar too.** Missing that was a
370- /// real bug: every pass deleted every validator, so the next revalidation
371- /// had nothing to send, re-downloaded art it already had, and the UI
372- /// swapped pictures that had not changed, which looks like the page
373- /// flickering a second after each product switch.
342+ /// Art is content-addressed upstream, so every revision arrives under a new
343+ /// URL and the old cache file would be stranded forever. Narrow on
344+ /// purpose: direct children only, names [`Store::cache_name`] could have
345+ /// produced, never the manifest. **Each kept file keeps its `.etag`
346+ /// sidecar**: deleting those once made every revalidation re-download and
347+ /// swap unchanged pictures, a flicker after each product switch.
374348 pub fn prune ( & self , keep : & [ String ] ) -> usize {
375349 let mut wanted: std:: collections:: HashSet < String > =
376350 std:: collections:: HashSet :: with_capacity ( keep. len ( ) * 2 ) ;
@@ -544,18 +518,10 @@ impl Pipeline {
544518
545519 /// Resolve branding from what is already on disk, touching no network.
546520 ///
547- /// A warm cache holds the exact bytes the UI is about to draw, so making
548- /// it wait on a revalidation round trip before painting buys nothing but
549- /// a few hundred milliseconds of unthemed dashboard. This hands back the
550- /// last good art at once; [`Pipeline::resolve_with`] follows behind and
551- /// swaps in whatever actually changed.
552- ///
553- /// `None` whenever the cache cannot fully answer, a missing manifest, an
554- /// unthemed product, an image not fetched yet, or one that no longer
555- /// matches its checksum. Partial branding is not a thing the UI can draw,
556- /// so a half-warm cache simply waits for the network like a cold one.
557- ///
558- /// Blocking file IO: call it off the thread that is drawing.
521+ /// The warm cache paints at once; [`Pipeline::resolve_with`] follows and
522+ /// swaps in whatever changed. `None` unless the cache can answer fully
523+ /// (manifest, theme, every image present and matching its checksum):
524+ /// partial branding cannot be drawn. Blocking IO: call it off the UI thread.
559525 pub fn cached ( & self , code : & ProductCode ) -> Option < Branding > {
560526 let manifest = self . cached_manifest ( ) ?;
561527 let theme = manifest. theme ( code) ?;
0 commit comments