Skip to content

ADFA-519: Migrate to Windows self hosted runner - #48

Merged
alome007 merged 5 commits into
stagefrom
feature/ADFA-519
Mar 25, 2025
Merged

alome007 merged 5 commits into
stagefrom
feature/ADFA-519

Conversation

@alome007

Copy link
Copy Markdown
Contributor

This PR introduces building and uploading the APK to google drive and notifying the appropriate slack channel

@alome007
alome007 merged commit 73b42ad into stage Mar 25, 2025
@hal-eisen-adfa
hal-eisen-adfa deleted the feature/ADFA-519 branch July 4, 2025 16:40
jatezzz pushed a commit that referenced this pull request Jun 22, 2026
ADFA-519: Migrate to Windows self hosted runner
davidschachterADFA added a commit that referenced this pull request Oct 19, 2026
…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
hal-eisen-adfa added a commit that referenced this pull request Oct 23, 2026
)

* ADFA-6597: Find a tooltip through Tooltips' (categoryId, tag) index

Written as a join of Tooltips and TooltipCategories, the tooltip query
made SQLite scan all of Tooltips - 46,128 rows, 13 MB - for every
tooltip shown, because documentation.db carries no ANALYZE statistics
(EXPLAIN QUERY PLAN: "SCAN T"). Looking the category's id up first lets
the UNIQUE (categoryId, tag) index find the row: 6.2 ms -> 0.004 ms per
lookup on a desktop against the real database, same rows.

IN rather than =, so two categories sharing a name still come back as
duplicates, which getTooltip reports as before.

The buttons query still scans TooltipButtons (5.4 MB); that needs an
index in the database, which this change cannot add.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CMZQuXT3GT7nEct2w4tg3

* ADFA-6597: Test the tooltip query's arguments in the order the app binds them

From review of PR #2160:
- TooltipQueryTest bound the query's arguments itself, so it would pass
  whatever order getTooltip used, and this PR reversed that order. The
  SQL and its binding now live in queryTooltip, in TooltipQuery.kt,
  which getTooltip calls with named arguments and the test calls too.
  Swapping the binding fails two of the three tests.
- QUERY_TOOLTIP is marked @VisibleForTesting: only the plan test reads
  it. It is still a public static field in bytecode, as it was inside
  TooltipManager, and so still in the plugin-api jar.
- Drops @ConscryptMode(OFF). The Conscrypt leak it guarded against
  broke a TLS test in common; idetooltips has none.

A file of its own rather than top-level code in ToolTipManager.kt:
ktlint leaves ToolTipManager.kt unformatted while its only top-level
declaration, object TooltipManager, does not match the file name. A
second declaration there makes Spotless reformat all of the file's
~380 changed lines, burying this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CMZQuXT3GT7nEct2w4tg3

* ADFA-3305: Move plugin tooltip SQL out of PluginDocumentationManager

No behavior change. The four helpers that write and delete a plugin's
tooltips move, unchanged, to PluginTooltipTables.kt behind two internal
functions, writePluginTooltips and removePluginTooltips, so tests can
run them against an in-memory database without a Context. The manager
now maps each PluginTooltipEntry to its final text and resolved button
URIs before handing them over, inside the same transaction as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CMZQuXT3GT7nEct2w4tg3

* ADFA-3305: Read tooltips from documentation version 3's keyed tables

documentation.db version 3 (OfflineDocumentationTools'
migrate_tooltip_schema.py) stores the same tooltips in 5.2 MB less:

- Tooltips is a WITHOUT ROWID table keyed on (categoryId, tag) holding
  only the id, so the separate UNIQUE (categoryId, tag) index, a second
  copy of every tag, is gone. The text is in TooltipTexts, by id.
- TooltipButtons is keyed on (tooltipId, buttonNumberId), so a
  tooltip's buttons are one key range in display order instead of a
  scan and sort of the whole table. Each distinct description and uri
  is stored once, in TooltipButtonDescriptions and TooltipButtonUris.

queryTooltip joins TooltipTexts by id, and the new queryTooltipButtons
joins the two lookup tables. Tooltips has no rowid any more; it always
equalled id, so IDETooltipItem.rowId, which the debug dialog and the
feedback email show, now carries the id.

Both readers refuse a database declaring a version below 3, through
DatabaseVersionResolver.requireKeyedTooltips, with a message naming
the version, rather than fail on whichever old column a query meets.

Tests run both queries against the version 3 DDL, including their
query plans (key searches, no scan, no sort), and the version check
for versions 2, 4 and none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CMZQuXT3GT7nEct2w4tg3

* ADFA-3305: Write plugin tooltips into documentation version 3's tables

PluginTooltipTables.kt now writes the version 3 tooltip tables:

- A tooltip's text goes into TooltipTexts first, whose AUTOINCREMENT id
  then keys the Tooltips row. The id is the one that insert returns:
  Tooltips is WITHOUT ROWID, and SQLite does not record its inserts as
  a rowid, so an insert into it returns the previous insert's rowid,
  not anything of its own.
- Each button's description and uri are looked up in, or added to,
  TooltipButtonDescriptions and TooltipButtonUris, 500 strings per
  query, so text a built-in button already uses is shared.
- A plugin's rows are deleted by category through subqueries, which
  also removes the old one-variable-per-tooltip IN list, and text no
  button names any more is deleted after every write and removal.
- Every insert throws on failure. db.insert returned -1 instead, so a
  failed insert left a tooltip without its buttons, or buttons on
  tooltip -1, and the transaction committed anyway.
- Both entry points refuse a database declaring a version below 3
  before writing anything.

Tests run against the version 3 DDL with one built-in tooltip: what a
plugin writes reads back through the app's queries; new ids are never
reused; a repeated tag keeps the later entry; text is shared and
cleaned up; removing every plugin leaves the tables exactly as they
were; 1,200 tooltips write and remove; a version 2 database is refused
untouched; and a failed insert into any of the six tables throws and
rolls back. plugin-manager's tests now use Robolectric, already in the
version catalog, for SQLiteDatabase.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CMZQuXT3GT7nEct2w4tg3

* ADFA-3305: Move getTooltip's row mapping into readTooltip

No behaviour change. The query, the row-count check and the mapping of
the row and its buttons to an IDETooltipItem move out of
TooltipManager.getTooltip into readTooltip beside queryTooltip, so tests
can run them without initializing TooltipManager, which reads the
installed app's Environment. Spotless reformatted the moved `when`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CMZQuXT3GT7nEct2w4tg3

* ADFA-3305: Name the refused database file in the tooltip error log

getTooltip reads the installed documentation.db or, when it is newer,
the /sdcard/Download debug override, and the log said neither: a
"declares documentation version 2" line left a developer guessing
which file to replace. The log now names the source and its path.

Review finding R2163-03.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CMZQuXT3GT7nEct2w4tg3

* ADFA-3305: Test the tooltip item readTooltip builds from a row

No test ran getTooltip's row mapping, though this branch renumbered its
columns and made rowId the id: with the summary read from the detail
column, all 12 idetooltips tests still passed. A tooltip whose id,
summary, detail and buttons all differ is now read back into the exact
item, so that mutant, a swapped detail and a wrong rowId each fail it.
Also covers the missing-tag and duplicate-category exceptions.

Review finding R2163-04.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CMZQuXT3GT7nEct2w4tg3

* ADFA-3305: Say what an update keeps and where version 2 still lives

docs/documentation-database.md said the database is extracted on install
and update; InstallationViewModel extracts it at first-time setup only,
so an update keeps the installed file, and a version 2 one then shows no
tooltips (accepted for ADFA-3305). It also said docdb-studio edits "this
same documentation.db" and validates TooltipButtons.uri: the master it
edits stays in version 2, and migrate_tooltip_schema.py converts a copy
for shipping, so docdb-studio and the docs/docdb scripts use the version
2 columns. The debug-override notes now say a version 2 file shows no
tooltips, and the ToolTipManager entry names readTooltip.
idetooltips/README.md cited a Room IDETooltipDatabase that does not
exist; the module reads documentation.db with raw SQLite.

Review finding R2163-05.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CMZQuXT3GT7nEct2w4tg3

* ADFA-3305: Decode compressed templates from documentation version 3

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

* ADFA-3305: Describe compressed templates in documentation-database.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CMZQuXT3GT7nEct2w4tg3

* ADFA-3305: Test that templates' non-ASCII text renders as UTF-8

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

* ADFA-3305: Say the dictionary is re-minted, and which pages are templated

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Hal Eisen <haleisen@appdevforall.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant