Three faults with one root: the stored body of a code-defined node is an import shim, and nothing that mattered was ever read from the code itself. - The run stamp could not identify what ran. The shim imports whatever is on disk when the worker starts, and an uncommitted tree stamps <commit>-dirty for every run it ever produces. Run.code_digest hashes the repository's .py files, memoized on their stat state, and it is read again when the run is actually claimed -- so a sweep queued for hours records the code each of its runs executed, not the code that was there when it was submitted. - The stage cache adopted code that was too new. The fingerprint hashed the shim, which is invariant under any edit to the imported function or anything it calls into, so a re-run was served from cache and answered without the outputs the edit added. It now carries the repo digest and the node's declared ports. Every fingerprint changes once, which invalidates the existing cache; a canvas flow has no repository and keys as before. - An interrupted sync looked like a hand-edited canvas. The engine answers a new-node template for a node with no stored body, and the template carries no marker, so the drift check read "somebody edited this" and demanded --force -- for the one state that re-running the sync is the fix for. NodeSource.missing states the fact, and sync skips those and reuses the bodies it read instead of asking for each one twice. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
39 lines
900 B
Python
39 lines
900 B
Python
"""run.code_digest
|
|
|
|
`origin_commit` names a commit, and a dirty tree has the same one all day. The
|
|
node bodies are import shims, so what actually ran is whatever was on disk when
|
|
the worker started. This column hashes those files at run time, which is the
|
|
only thing that tells two runs of an uncommitted tree apart.
|
|
|
|
Revision ID: a4d9e2b71c68
|
|
Revises: f2c6a8d15e93
|
|
Create Date: 2026-08-26
|
|
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
import sqlmodel.sql.sqltypes
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "a4d9e2b71c68"
|
|
down_revision = "f2c6a8d15e93"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
op.add_column(
|
|
"run",
|
|
sa.Column(
|
|
"code_digest",
|
|
sqlmodel.sql.sqltypes.AutoString(length=64),
|
|
nullable=False,
|
|
server_default="",
|
|
),
|
|
)
|
|
|
|
|
|
def downgrade():
|
|
op.drop_column("run", "code_digest")
|