Progress: write as a writer, confine and merge the import, keep FTS on downgrade

- The progress endpoints begin as writers (request.ctx.db.write()), so a
  heartbeat during a refresh waits instead of failing a lock upgrade.  The
  config switch fires after the commit.
- `..` is collapsed before the ignored-directory check.  Clear only resets
  an existing FileGroup; it never indexes a file.
- Import confines config paths to the media directory.  A newer plain view
  keeps its `viewed` but takes the config's position; only progress written
  after the config wins.  Files are globbed before the write transaction.
- The dump skips a row outside the media directory instead of failing.
- The downgrade drops the columns with ALTER TABLE, which keeps file_group's
  FTS triggers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-10-08 16:04:18 -06:00
parent c8201700a8
commit e21c6d9f0a
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
6 changed files with 232 additions and 47 deletions

View file

@ -19,6 +19,6 @@ def upgrade():
def downgrade():
with op.batch_alter_table('file_group') as batch_op:
batch_op.drop_column('position')
batch_op.drop_column('progress')
# Not batch_alter_table: rebuilding file_group drops its FTS triggers (see 2026_09_20_1200).
op.execute('ALTER TABLE file_group DROP COLUMN position')
op.execute('ALTER TABLE file_group DROP COLUMN progress')