Skip every write for a reference the reset cannot classify

A reference whose path is under no configured root is meant to be left alone
entirely, but needs_verify was decided before the classification guard, so it
was the one write of four that did not skip. Classification now comes first,
which also stops an out-of-view row being counted as changed or unchanged when
the reset did nothing with it either way.

Stamping the version was also the only database access in the runner that could
throw into its caller, so a transient lock while stamping aborted the seeder's
whole scan -- prune, fast phase and enrichment -- over a step whose own writes
were already committed. A failed stamp is now logged and leaves the step
pending, like every other failure there.
This commit is contained in:
Simon Pinfold
2026-08-18 12:11:09 -07:00
parent 0e6145904a
commit 4f0622a276
3 changed files with 59 additions and 11 deletions

View File

@@ -101,9 +101,18 @@ def run_pending_semantics_steps(interrupt_check: InterruptCheck | None = None) -
)
return applied
with create_session() as session:
set_semantics_version(session, step.version)
session.commit()
try:
with create_session() as session:
set_semantics_version(session, step.version)
session.commit()
except Exception:
logging.exception(
"Asset semantics step %d (%s) finished but could not be stamped, "
"so it runs again; its own writes are already committed",
step.version,
step.description,
)
return applied
applied += 1
logging.info(

View File

@@ -129,14 +129,6 @@ def _reproject_batch(
summary.absent_files += 1
continue
if unchanged:
summary.unchanged_files += 1
else:
# Hand it to the verify path rather than re-read the file for hash and size.
summary.changed_files += 1
if not row.needs_verify:
set_needs_verify.append(row.reference_id)
try:
derived_tags = set(
normalize_tags(get_path_derived_tags_from_path(row.file_path))
@@ -145,6 +137,14 @@ def _reproject_batch(
summary.unclassified_paths += 1
continue
if unchanged:
summary.unchanged_files += 1
else:
# Hand it to the verify path rather than re-read the file for hash and size.
summary.changed_files += 1
if not row.needs_verify:
set_needs_verify.append(row.reference_id)
loader_path = compute_loader_path(row.file_path)
if loader_path != row.loader_path:
loader_paths[row.reference_id] = loader_path