Skip to content

Commit each court's code deletes with its reload - #468

Open
nonprofittechy wants to merge 1 commit into
mainfrom
fix/atomic-court-code-updates
Open

nonprofittechy wants to merge 1 commit into
mainfrom
fix/atomic-court-code-updates

Conversation

@nonprofittechy

@nonprofittechy nonprofittechy commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Problem

CodeUpdater.updateAll deletes the rows of every changed court up front, then reloads courts one at a time. The first court's commit also commits all of those deletes. Until each later court reloads, it has its old installedversion but no rows. That can take minutes during the nightly refresh.

  • If a court's Tyler policy request fails, it isn't reloaded, so it stays empty until the next run.
  • Anything that uses installedversion to tell whether a court changed sees "unchanged" for a court that is actually empty.

replaceAll / replaceSome have a similar problem. They empty every court's tables but keep each court's installedversion. A court reloaded at the same Tyler version then looks unchanged. replaceSome X empties every court but reloads only X, and the other courts keep their versions, so refresh never reloads them.

Change

  • updateAll: delete each court's tables right before reloading it. The delete, the new rows and the new installedversion now commit together.
  • replaceSome: delete installedversion first. Each court gets its version back as it reloads. Courts that aren't reloaded have no version, so the next refresh picks them up. getVersionsToUpdate already treats a missing version as "needs update".

The timing and logging lines for the old up-front delete loop are gone.

Testing

Compiles, and spotless is clean. There's no automated test, because this path downloads from Tyler. It's worth watching the next nightly refresh logs after deploy.

This came up while building #469, which relies on installedversion matching what's actually loaded. It's independent and can merge on its own.

🤖 Generated with Claude Code

@nonprofittechy

Copy link
Copy Markdown
Member Author

This one isn't necessary but it does make sense if we're adding another service that depends on syncing it. I could also just postpone the scheduled sync.

@BryceStevenWilley BryceStevenWilley left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the find; committing the initial delete of all tables to update isn't an intended thing. IIRC, I think that committing each court individually in the middle happened after the initial implementation.

I'll make the commented change in the PR before merging.

Comment on lines +456 to +458
// Every court's tables are about to be emptied; drop their versions too, so no reader trusts a
// version whose rows aren't loaded yet. Each court gets its version back when it reloads.
cd.deleteFromTable("installedversion");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not every court's tables are about to be emptied, just the ones passed in. I'll move this to replaceAll, which is the only command that runs in the normal server lifetime (replaceSome being invoked directly is only a manual activity).

In general installedversion is one of those internal implementation details that shouldn't be exposed to things outside of the proxy server though, and was one of the issues I had with the approach in #469, so I'm not gonna make it perfect

@BryceStevenWilley
BryceStevenWilley force-pushed the fix/atomic-court-code-updates branch from 814ac55 to 81cadeb Compare October 7, 2026 21:13
updateAll deleted every changed court's rows up front, and the first
court's commit published all of those deletes. Until each later court
reloaded, it showed its old installedversion with missing rows. A court
whose policy request failed stayed empty until the next run.

Delete each court's tables right before reloading it, so the delete, new
rows, and new installedversion commit together.

replaceAll/replaceSome empty every court's tables but kept their
installed versions, so a court reloaded at the same Tyler version looked
unchanged to anything keyed on versions. Drop installedversion first;
each court gets its version back as it reloads, and courts that
replaceSome doesn't reload are picked up by the next refresh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BryceStevenWilley
BryceStevenWilley force-pushed the fix/atomic-court-code-updates branch from 81cadeb to a0d763a Compare October 7, 2026 21:13
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.

2 participants