Repository navigation
ADFA-3305: Read compressed templates from documentation version 3 - #2164
davidschachterADFA wants to merge 4 commits into
Conversation
From documentation version 3 every Templates row is Brotli-compressed against the database's CompressionDictionary, like a brotli Content row. No column says so: the release build compresses every template, and nothing on the device writes Templates. - DatabaseTemplateLoader passes each row's bytes through a decode before Pebble sees them, so included templates are covered too. A decode failure is logged with the template's name and the database's path, and fails the page with a message that names the template but no file, since that message reaches HTTP responses. - DocumentationContentSource decodes with the active database's codec when the database declares major >= 3 (expectsCompressedTemplates). Below 3, and with no version, templates are read as plain UTF-8 as before: an app update never replaces the installed database, so a 2.x file keeps rendering its templated pages. The answer is read once per database, before the engine runs, and cleared on every swap. - An internal constructor takes the decode, so :common's tests, which have no brotli4j desktop native, can stand one in; CompressedTemplateTest in :app covers the real decode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018CMZQuXT3GT7nEct2w4tg3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018CMZQuXT3GT7nEct2w4tg3
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
|
@coderabbitai review |
❌ Action failedReview failed.
|
|
@coderabbitai full review |
❌ Action failedReview failed. |
Independent Claude review (head 2bb16a6)The change does what its body says. There is one way into a template,
The findings are a test gap on the line the PR rewrote, and stale text in the docs and the body.
R2164-01. The PR rewrote
Read as ISO-8859-1, a U+00A0 (bytes C2 A0) renders as "Â" plus a no-break space on every page that includes one of those 631 templates, and the suite stays green. Fix: in R2164-02. Line 85 says R2164-03. The body has two figures that don't match the databases:
Fix: name the file each figure comes from, or use these. Checked and sound
🤖 Generated with Claude Code |
640 of the 3.0.0 build's 1,126 templates hold non-ASCII text, most of them U+00A0, but every template in the tests was ASCII: reading the decoded bytes as ISO-8859-1 at DatabaseTemplateLoader.kt:105 left all 66 :common documentation tests and 62 :app localWebServer tests passing, while a real page would show "A-circumflex" before each no-break space. Six tests now render text with U+00A0, U+2014 and U+2026, plain and decoded: two in the loader's tests, two through DocumentationContentSource with a stand-in decode, and two in :app through the real Brotli decode. The page tests compare bytes. All six fail with ISO_8859_1 at line 105 (the one line both paths share), and the four page tests also fail with the rendered output encoded as ISO_8859_1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018CMZQuXT3GT7nEct2w4tg3
…ated documentation-database.md said CompressionDictionary was "trained once ... never retrained", but OfflineDocumentationTools' remint_dictionary.py (on its main since ADFA-5153) retrains it and recompresses every brotli Content row, and from version 3 every template too (ODT #48). Now that templates depend on the dictionary, the rule a reader needs is that a re-mint is safe only when it carries every row and template across. The content source's entry called the templated rows "the Kotlin doc set's pages"; a 2.x database also templates the i/ pages, and the 3.0.0 build the a/ pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018CMZQuXT3GT7nEct2w4tg3
Response to the reviewAll three findings are addressed (2bb16a6..f2178d7).
🤖 Generated with Claude Code |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
git rev-parse --short HEAD
fd -t f '^(DatabaseTemplateLoader|DocumentationContentSource|DatabaseTemplateLoaderTest|DocumentationContentSourceTest|CompressedTemplateTest)\.kt$' | while IFS= read -r file; do
printf '\n--- %s ---\n' "$file"
ast-grep outline "$file" || true
rg -n -C 8 'UTF_8|ISO_8859_1|00[Aa]0|2014|2026|non.ASCII|[—…]|assertArrayEquals|assertContentEquals' "$file" || true
done
printf '\n--- Documentation ---\n'
sed -n '65,115p' docs/documentation-database.md
printf '\n--- Current PR description ---\n'
gh pr view 2164 --repo appdevforall/CodeOnTheGo --json headRefOid,body --jq '{headRefOid,body}'Length of output: 52367
I did not run the tests or mutation checks. The passing results remain your reported results, not an independent verification. The failed full-review response gives no cause. It does not establish that CodeRabbit is unavailable for this PR. I have not triggered another review. Thanks for clarifying the dictionary re-minting requirement. ✏️ Learnings added
🧠 Learnings used
If you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! You are interacting with an AI system. |
|
Merge-order note for #2162 and #2164. Whichever of the two merges second needs a small fix, or it won't compile.
Found while building a local integration of #2163, #2164, #2161 and #2162 for the ADFA-3305 phone test. With these two changes it compiles, and its pages passed the phone check with the item-B database. 🤖 Generated with Claude Code |
ADFA-3305
Reads Brotli-compressed templates from documentation version 3. Builds on #2163, so it targets
fix/ADFA-3305-tooltip-schema, and ships with it: version 3.0.0 now means keyed tooltips and compressed templates, written by OfflineDocumentationTools' ship-time steps.Why
The ADFA-3305 conversion of the
a/class pages adds about 1,000 templates (12 MB as text). Measured on the full database with every template compressed and the dictionary re-minted, it saves 7.47 MB of file and 7.55 MB of.br. The app reads templates as plain text today.Change
DatabaseTemplateLoaderpasses each row's bytes through a decode before Pebble sees them, soincluded templates are covered too. A decode failure is logged with the template's name and the database's path, and fails the page withCannot decode template '<name>', a message with no file name, since it reaches HTTP responses.DocumentationContentSourcedecodes with the active database's codec when it declares major >= 3 (expectsCompressedTemplates). Below 3, and with no version, templates are read as plain UTF-8, as today: an app update never replaces the installed database, and the installed 2.x file renders 3,490 pages through templates. The answer is read once per database, before the engine runs, and cleared on every swap.Templates.:common's tests have no brotli4j desktop native.docs/documentation-database.mdupdated.Tests
CompressedTemplateTest(new,:app, real Brotli), 7 tests::common:DatabaseTemplateLoaderTest+3 (decode applied, failure wrapped by name, failure logged with the database) andDocumentationContentSourceTest+7.WebServerTestbookshelf test pins the no-version plain path.:commondocumentation 66,:applocalWebServer 62,:idetooltips12,:plugin-managerall passing.spotlessCheckclean.:app:assembleV8Debugbuilds.Not covered
Device check
On 2026-10-19 (Pixel 6 Pro, Android 17), this build with the ship-time database from OfflineDocumentationTools'
steps (3.0.0, compressed templates) as the debug override:
through compressed templates and includes; ten pages gave the same text as on the earlier schema-3 database.
Load times from the app's log: 11-451 ms; R.styleable (still HTML) 1,992 ms.
errors. Swapping back brought the 3.0.0 pages back.
:common(56) and:app(19) tests pass there.Release
Merge with #2163, and ship in the same switch as the 3.0.0 database.
🤖 Generated with Claude Code
https://claude.ai/code/session_018CMZQuXT3GT7nEct2w4tg3