Skip to content

Comments

refactor(libanki): modSchema documentation#20248

Merged
lukstbit merged 4 commits intoankidroid:mainfrom
david-allison:modschema
Feb 7, 2026
Merged

refactor(libanki): modSchema documentation#20248
lukstbit merged 4 commits intoankidroid:mainfrom
david-allison:modschema

Conversation

@david-allison
Copy link
Member

@david-allison david-allison commented Jan 28, 2026

Purpose / Description

This stems from a call to withCol { modSchema() } in ChangeNoteTypeViewModel removing the undo queues.

Further documentation of modSchema was requested.

Fixes

Approach

  • improve db.execute() to log the undo queue removal
  • combine modSchema and modSchemaNoCheck
  • A few general refactorings

How Has This Been Tested?

⚠️ Unit tests

Learning (optional, can help others)

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

**launchCatchingRequiringOneWaySync**
- This didn't belong in the DeckPicker

**userAcceptsSchemaChange()**
- extract to a more centralized location

**userAcceptsSchemaChange(col)**
- delete; unused
Removed dead code
Documented undo behaviour
Since we are no longer in Java, `ConfirmModSchemaException` is no longer
 a checked exception, so we can add in Anki's 'check' parameter

Also improves documentation of the method

Fixes 20246
… queue

Renamed to launchCatchingRequiringOneWaySyncDiscardUndo

For issue 20172
@david-allison david-allison added this to the 2.24 release milestone Jan 29, 2026
@david-allison david-allison added the Review High Priority Request for high priority review label Jan 30, 2026
Copy link
Contributor

@criticalAY criticalAY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy with it, don't see any issues

@criticalAY criticalAY added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Feb 5, 2026
Copy link
Member

@lukstbit lukstbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine.

*/
@LibAnkiAlias("mod_schema")
fun modSchema() {
fun modSchema(check: Boolean) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not enough to block on it:

I'm not sure I like the check parameter name, throwIfUnchanged feels like a better name(maybe with a default value of true as well).

@lukstbit lukstbit added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels Feb 7, 2026
@lukstbit lukstbit added this pull request to the merge queue Feb 7, 2026
Merged via the queue into ankidroid:main with commit 77f1586 Feb 7, 2026
19 checks passed
@github-actions github-actions bot removed Review High Priority Request for high priority review Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) labels Feb 7, 2026
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.

architecture: Reimplement & document 'schema change' code

3 participants