Skip to content

Commit 2cf3df3

Browse files
ADFA-3305: Say which tools here write Templates
The new paragraph on compressed templates sat right above "Nothing that currently builds or writes to the database in this repository knows about any of that", which it contradicts (review R48-04). That paragraph also said the bookshelf plugin populates Templates and that nothing here handles them. It now says what #50's 9825433 says, in the same words where they apply to this branch: populate_db.py, sync_javadoc_json_to_db.py and load_android_json_db.py write Templates, verify_android_json_db.py reads them, and from 3.0.0 the re-mint and verifier recompress and compare them. Only Bookshelf and BookCategories come from the plugin system; appdevforall/bookshelf-plugin is archived (gh repo view). The check-tools row is corrected the same way: check-tools reads no Templates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018CMZQuXT3GT7nEct2w4tg3
1 parent d586eb3 commit 2cf3df3

1 file changed

Lines changed: 14 additions & 16 deletions

File tree

‎CLAUDE.md‎

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ actively depends on them.** Its `/pr/bs` endpoint builds a JSON "bookshelf" payl
103103
and renders it with the Pebble template engine. More generally, any `Content` row with a non-zero
104104
`templateId` gets its stored (decompressed) content run through the matching row in `Templates` as
105105
a Pebble template before being served. This is a real, current feature of the shipped server, not
106-
a placeholder. Note this repo does now write to `Templates`: `populate_db.py` upserts `page.peb`
107-
and `nav.peb` there (and points every page it inserts at them via `templateId`), so the table is
108-
no longer read-only from this side.
106+
a placeholder.
109107

110108
In a database whose newest `DocumentationDatabaseVersion` row declares major 3 or later, every
111109
`Templates` row is stored Brotli-compressed against the shared dictionary, with no per-row marker
@@ -114,24 +112,24 @@ plain templates. `remint_dictionary.py` and `verify_remint_dictionary.py` read t
114112
the app does: from major 3 on they sample, recompress and verify the templates together with the
115113
`Content` rows, and below it they leave the templates exactly as stored.
116114

117-
**Nothing that currently builds or writes to the database in this repository knows about any of
118-
that — and that's expected.** `Templates`/`Bookshelf`/`BookCategories` are populated by a separate
119-
plugin system, not by anything in this repo: App Dev For All supports plugins that write into the
120-
documentation database, including the bookshelf feature specifically —
121-
[appdevforall/bookshelf-plugin](https://github.com/appdevforall/bookshelf-plugin). So the absence
122-
of any `Templates`/`Bookshelf`/`BookCategories` handling here is not a gap to fill; it's out of
123-
scope for this repo. (A repo-wide search for `Templates`, `Bookshelf`, `BookCategories`, or `PUCC`
124-
turns up zero matches outside `WebServer.kt` itself, which is consistent with that division of
125-
responsibility. `templateId` itself is a different story - `populate_db.py` and
126-
`insert_optimized_media.py` both read/write it directly, since it's a plain column on `Content`
127-
they populate; it's only the `Templates` table and the plugin system that reference it that stay
128-
out of scope.) Concretely, relative to the schema above:
115+
**This repo writes `Templates`, but not `Bookshelf` or `BookCategories`.** `populate_db.py`
116+
(`page.peb`, `nav.peb`), `sync_javadoc_json_to_db.py` (`javadoc.peb`) and `load_android_json_db.py`
117+
(the `android-*.peb` templates) write rows there and point the pages they write at them via
118+
`templateId`; `verify_android_json_db.py` reads them; and `remint_dictionary.py` and
119+
`verify_remint_dictionary.py` recompress and compare them from 3.0.0 on (above).
120+
`insert_optimized_media.py` reads and writes `templateId` too.
121+
`Bookshelf` and `BookCategories` come from App Dev For All's plugin system, which writes into the
122+
documentation database - the bookshelf feature from
123+
[appdevforall/bookshelf-plugin](https://github.com/appdevforall/bookshelf-plugin), now archived on
124+
GitHub. Nothing here writes them, except that `Content`'s `AddBook` trigger adds a `Bookshelf` row
125+
for each `.pdf` path inserted (see `migrate_content_to_dictionary_brotli.py`). Concretely, relative
126+
to the schema above:
129127

130128
| Piece | What it thinks the schema is | Consequence |
131129
| --- | --- | --- |
132130
| `scripts/DocumentationDatabase.py` (used by `scripts/ingest.py`, and hence by `.github/workflows/publish-doc-db.yaml`) | `Content` / `Languages` / `ContentTypes` only, plus an optional `ide_tooltip_table`. Its constructor explicitly **raises `ValueError`** if it opens a DB containing any table outside that whitelist. | **This will refuse to open the current production `documentation.db` at all** — it will list `Tooltips`, `TooltipCategories`, `TooltipButtons`, `TooltipButtonNumbers`, `LastChange`, `Templates`, `BookCategories`, `Bookshelf`, and every `PUCC_*` table as "unexpected." This is the single biggest blocker to reusing this script as-is. |
133131
| `docdb-studio/SCHEMA.md` / `AGENTS.md` (states the schema is "locked," no migrations) | `Content` (no `templateId`, no `UNIQUE(path)`), `Tooltips`, `TooltipButtons`, `TooltipCategories`, `TooltipButtonNumbers`, `LastChange` (with a *different* shape: `documentationSet`/`changeTime`/`who` — this part does match current), plus a legacy `ide_tooltip_table`. Missing `templateId`, `Templates`, `BookCategories`, `Bookshelf`, `PUCC_*`. | Closest of the three documented schemas to reality, but still out of date. `docdb_studio.py`'s own "never change the schema" policy is itself now stale, since the live schema has already changed underneath it. |
134-
| `check-tools/README.md`'s embedded schema (and by extension the mental model behind `check-tools/db_health_checker.py`) | `Content` (no `templateId`, no `UNIQUE(path)`), `Tooltips`, `TooltipButtons`, `TooltipCategories`, `TooltipButtonNumbers`, and a *third* variant of `LastChange` (`now`/`who`). No `Templates`/`Bookshelf`/`BookCategories`/`PUCC_*`. | The health checker's required-table check still passes (it only checks that its known tables exist, not that no others do). Since `Templates`/`Bookshelf`/`BookCategories` are out of scope for this repo (see above), this is not being treated as something to fix right now. |
132+
| `check-tools/README.md`'s embedded schema (and by extension the mental model behind `check-tools/db_health_checker.py`) | `Content` (no `templateId`, no `UNIQUE(path)`), `Tooltips`, `TooltipButtons`, `TooltipCategories`, `TooltipButtonNumbers`, and a *third* variant of `LastChange` (`now`/`who`). No `Templates`/`Bookshelf`/`BookCategories`/`PUCC_*`. | The health checker's required-table check still passes (it only checks that its known tables exist, not that no others do). Since `Bookshelf`/`BookCategories` are written outside this repo (see above) and check-tools reads no `Templates`, this is not being treated as something to fix right now. |
135133

136134
There also appear to be **two unrelated tooltip storage formats** in this repo's history, and it's
137135
worth being deliberate about which one is current:

0 commit comments

Comments
 (0)