Add --force flag and inconsistency auto-detection#108
Merged
Conversation
…telae update
- Add \`--force\` / \`-f\` flag to the \`update\` subcommand; when set, the
database records for each included stele are deleted and fully rebuilt
from scratch, skipping all consistency checks. Respects --include and
--exclude filters.
- On each normal run, two consistency checks are performed before the
delta insert:
- Publication count: if the RDF repository's \`_publication/\` directory
has fewer entries at HEAD than non-revoked publications in the DB,
the RDF repository was likely force-pushed or rolled back and a
full rebuild is triggered with a warning.
- Auth commit existence: for each historical HTML data repository, the
most-recently-recorded \`auth_commit_hash\` in \`data_repo_commits\` is
verified against the auth repository; a missing commit triggers a
rebuild.
- When a rebuild is triggered, \`DELETE FROM stele\` cascades through all
child tables via \`ON DELETE CASCADE\`. To make cascades reliable, enable
\`PRAGMA foreign_keys = ON\` on every pool connection via \`after_connect\`.
- Add \`stele::TxManager::delete\`, \`publication::TxManager::count_non_revoked\`,
and \`data_repo_commits::TxManager::find_last_auth_commit_for_stele\` to
support the above.
BojanG99
approved these changes
Apr 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description (e.g. "Related to ...", etc.)
Adds a
--forceflag to stelae update and automatic detection of database inconsistencies caused by force-pushes or repository rollbacks. When an inconsistency is detected (mismatched publication count or a missing auth commit), the stele is automatically wiped and rebuilt from scratch.--forceskips the checks and always rebuilds. Also enablesPRAGMA foreign_keys = ONper connection so cascade deletes work correctly.Code review checklist (for code reviewer to complete)
[ ] Tests have been included and/or updated, as appropriate[ ] Standalone docs have been updated accordinglyAutomated tests, benchmarks and linters
You can run the tests, lints and benchmarks that are run on CI locally with: