Backend engineer comparing a database row marked “closed” with a SQLAlchemy Session object that still shows “open” after a bulk update.

SQLAlchemy Updated the Rows. Which Objects in the Session Are Still Stale?

Fri, Nov 20, 2026

A successful ORM bulk UPDATE is not, by itself, evidence that every already-loaded Python object in the Session now represents the updated row. SQLAlchemy explicitly separates database DML from synchronization of the Session identity map. With ORM-enabled update() executed through Session.execute(), synchronize_session="auto", "fetch", "evaluate", and False define different reconciliation behavior. Synchronization can update attributes immediately, expire them so a later access reloads them, fail because the predicate cannot be evaluated in Python, or deliberately leave local objects unchanged.

The acceptance question goes beyond “Did the UPDATE affect two rows?” For each object identity already present in this Session, which mapped attributes are current, which are expired, which are demonstrably stale, and what does the next read return under the selected strategy? SQLAlchemy’s state-management documentation explains the distinction. Expiration removes an attribute’s persisted value so later access reloads it. An unexpired attribute can continue to expose its existing local value.

The playbook uses a disposable SQLite fixture, synthetic identities, an independently authored expected-case manifest, a pytest harness, a negative control, per-case evidence, and a recovery protocol. The reference run used CPython 3.13.5, SQLAlchemy 2.0.50, and SQLite 3.46.1 on Linux x86-64 with glibc 2.41. SQLAlchemy 2.0.55, released October 16, 2026, includes a fix for stale values on multiple matched objects. The execution environment could not install 2.0.55, so every result specific to that version is marked EXPECTED / NOT EXECUTED.

Define the exact acceptance contract

Treat database mutation and object reconciliation as separate proof obligations. SQLAlchemy documents ORM-enabled UPDATE synchronization specifically in terms of objects currently present in the Session identity map: updated attributes may be refreshed with the new value or at least expired so that their next access repopulates them. Setting synchronize_session=False disables that reconciliation and can leave corresponding local objects unchanged.

For this playbook, a case is acceptable only when its evidence establishes all five propositions: the input identities were known before DML; the expected database rows were matched; the post-DML identity-map state is classified as current, expired, or stale without accidentally triggering a read; the prescribed readback produces the expected row values; and rollback or repair behaves according to a pre-authored oracle. A green rowcount is supporting evidence, not the acceptance oracle.

The identity requirement matters because a Session maintains one Python instance per database identity while that identity is represented in its identity map. Normal ORM loading reconciles database identities with those existing instances; it does not imply that any arbitrary operation has repopulated every already-loaded attribute.

The evidence vocabulary is fixed:

Evidence class

Meaning

DOCUMENTED

Stated by SQLAlchemy documentation or changelog

OBSERVED

Produced by the executed frozen reference run

EXPECTED / NOT EXECUTED

Oracle derived from documentation or independently authored manifest, but not run on the stated target

INFERENCE

Engineering conclusion from documented or observed evidence

ACCEPT means the case met its declared contract. REPAIR means the database action may be correct but the Session state or subsequent read needs correction. RERUN means the evidence comes from a runtime that differs materially from the target. HOLD means required evidence or ownership is missing.

Testing queue fairness with PostgreSQL SKIP LOCKED illustrates the same distinction. A successful lock acquisition alone cannot establish queue fairness, just as an affected-row count alone cannot establish that the objects in a Session are current.

Pin the tested version and environment

SQLAlchemy 2.0.55 fixed a multi-object expiration regression introduced by change #11917 in 2.0.36. When an ORM-enabled UPDATE matched more than one object in a Session, some server-side onupdate columns and columns assigned SQL expressions could be expired on only one matched object, leaving the others stale. The fix expires those columns on all matched objects.

That fix directly affects the question this playbook asks. A state-reconciliation qualification run performed on 2.0.50 cannot be relabeled as a 2.0.55 qualification run merely because the general API contract is similar.

The reference run used the following environment.

Python:      CPython 3.13.5
SQLAlchemy:  2.0.50
SQLite:      3.46.1
pytest:      9.0.2 available in environment
OS:          Linux 6.18.57 x86_64
libc:        glibc 2.41
Session:     autoflush=False
              expire_on_commit=False during candidate observation
Database:    one temporary file per case

To qualify the 2.0 maintenance release considered here, pin SQLAlchemy==2.0.55. As of November 20, 2026, the SQLAlchemy 2.0.55 release on PyPI lists October 16, 2026 as the release date. PyPI also lists a newer 2.1 branch. The behavior examined here is specific to the 2.0 documentation and the versions identified in the ledger.

Record the runtime fingerprint

The bounded fingerprint gate is simple: the harness must record sys.version, sqlalchemy.__version__, sqlite3.sqlite_version, platform information, Session configuration, and the source digest before a ledger can receive an ACCEPT decision.

Pass condition: every recorded runtime field exactly matches the declared qualification target.

Fail condition: version, database library, Session expiration policy, or harness source differs materially. The decision is RERUN, not “probably equivalent.”

For this report, the CPython 3.13.5 / SQLAlchemy 2.0.50 run is OBSERVED. A SQLAlchemy 2.0.55 rerun is EXPECTED / NOT EXECUTED because the available execution environment had 2.0.50 installed and could not retrieve 2.0.55 from the package index.

Create the disposable fixture

The fixture must make stale state visible without introducing concurrency, application data, or transaction-visibility ambiguity. Three rows are enough: identities 1 and 2 begin state="open" with scores 10 and 20; identity 3 begins state="closed" with score 30. Every case gets a new temporary SQLite file, seeds the same rows, loads all three objects into one Session, and only then executes the candidate bulk UPDATE.

The fixture isolates identity-map reconciliation from changes made by another writer. A Fresh SELECT Can Leave Your SQLAlchemy Object Stale examines what happens when another transaction modifies a row while an older reference remains in the identity map. Here, one Session issues the bulk UPDATE and already holds the objects being inspected.

SQLAlchemy documents that expiration removes persisted values from mapped attributes and causes later access to load them in the Session’s current transactional context. It also documents that commit and rollback normally expire Session state; therefore expire_on_commit=False is intentional during candidate inspection so commit-time expiration does not erase the synchronization signal we are trying to measure.

# test_bulk_sync.py
import hashlib
import json
import platform
import sqlite3
from pathlib import Path

import pytest
import sqlalchemy as sa
from sqlalchemy import Integer, String, func, select, update
from sqlalchemy.orm import DeclarativeBase, Mapped, Session, mapped_column


class Base(DeclarativeBase):
    pass


class Item(Base):
    tablename = "item"

    id: Mapped[int] = mapped_column(primary_key=True)
    state: Mapped[str] = mapped_column(String(20), nullable=False)
    score: Mapped[int] = mapped_column(Integer, nullable=False)


BASELINE = [
    (1, "open", 10),
    (2, "open", 20),
    (3, "closed", 30),
]


def object_values(objects):
    return [(o.id, o.state, o.score) for o in objects]


def database_values(engine):
    with engine.connect() as conn:
        rows = conn.execute(
            sa.text("select id, state, score from item order by id")
        )
        return [tuple(row) for row in rows]


@pytest.fixture
def lab(tmp_path):
    db = tmp_path / "bulk-sync.db"
    engine = sa.create_engine(f"sqlite+pysqlite:///{db}")

    Base.metadata.create_all(engine)

    with Session(engine) as seed:
        seed.add_all(
            Item(id=id_, state=state, score=score)
            for id_, state, score in BASELINE
        )
        seed.commit()

    statements = []

    @sa.event.listens_for(engine, "before_cursor_execute")
    def record_sql(conn, cursor, statement, parameters, context, executemany):
        statements.append(statement)

    yield engine, statements

    engine.dispose()


def fingerprint():
    source = Path(__file__).read_bytes()
    return {
        "python": platform.python_version(),
        "sqlalchemy": sa.__version__,
        "sqlite": sqlite3.sqlite_version,
        "platform": platform.platform(),
        "source_sha256": hashlib.sha256(source).hexdigest(),
    }

The same fixture design is useful when checking duplicate members in a Python ZIP archive. Authored inputs and an independent manifest establish what each member should contain. Here, those controls establish what each database row and retained object should contain after the UPDATE.

Author an independent expected-case manifest

The expected manifest must be written before comparing observations. Do not derive expected values from rowcount, emitted SQL, or the object states returned by the candidate run. Otherwise the implementation becomes its own oracle.

For the simple literal assignment state="closed" over WHERE state="open", SQLAlchemy documents that "fetch" identifies affected rows using a prior SELECT or RETURNING, depending on backend capability, and reconciles matching in-memory objects. "evaluate" evaluates the WHERE criterion in Python against objects present in the Session. "auto" is the default and chooses "fetch" on backends supporting RETURNING, otherwise "evaluate". False leaves Session state unsynchronized.

Case

Strategy/action

Expected DB

Expected held objects before repair

Expected decision

C01

auto, literal SET

ids 1–2 closed

ids 1–2 closed

ACCEPT

C02

fetch, literal SET

ids 1–2 closed

ids 1–2 closed

ACCEPT

C03

evaluate, literal SET

ids 1–2 closed

ids 1–2 closed

ACCEPT

C04

False, literal SET

ids 1–2 closed

ids 1–2 still open

REPAIR

C05

False then expire_all() + access

ids 1–2 closed

reload to closed

ACCEPT after repair

C06

evaluate, unevaluable predicate

baseline

baseline

ACCEPT expected failure

C07

False, UPDATE then rollback

baseline after rollback

reload baseline

ACCEPT negative transaction control

C08

fetch, SQL-expression SET

scores 15/25

current or expired-then-readback 15/25

ACCEPT only after inspection/readback

C09

2.0.55 multirow expression regression target

updated

all matched expression attrs expired/reconciled

EXPECTED / NOT EXECUTED

The C09 oracle comes from the 2.0.55 changelog, not the local 2.0.50 run. The changelog explicitly says the stale-values regression was corrected so columns requiring expiration are expired for all matched objects.

Keep a negative control

C04 is the synchronization negative control. It deliberately selects synchronize_session=False, performs an UPDATE that matches identities 1 and 2, and requires two simultaneously true observations: the database rows changed, and the already-loaded objects retained "open".

Pass condition: the harness detects that discrepancy and labels it REPAIR.

Fail condition: the validation reports ACCEPT merely because rowcount == 2.

This negative control follows SQLAlchemy’s documented False semantics: Session state is not synchronized and may not correspond to affected rows that are represented by local objects.

Reproduce the misleading success signal

The easiest misleading green signal is:

result = session.execute(
    update(Item)
    .where(Item.state == "open")
    .values(state="closed"),
    execution_options={"synchronize_session": False},
)

assert result.rowcount == 2

That assertion can be true while item1.state and item2.state remain "open" in the same Session. The executed 2.0.50 reference run produced exactly that outcome: database readback showed identities 1 and 2 as "closed", while the loaded Python objects still exposed their baseline "open" values before repair. This is OBSERVED, not inferred.

The observation aligns with SQLAlchemy’s contract for False: the ORM does not reconcile Session objects automatically.

The important distinction is not “database correct versus ORM broken.” The database action and Session policy are both behaving according to the selected configuration. The defect would be an application acceptance test that equates successful DML with current object state.

A readback using session.get(Item, 1) is not automatically an independent freshness oracle either. SQLAlchemy documents that Session.get() first checks the identity map and can return an already-present, unexpired instance without issuing SQL. If the acceptance question concerns the exact held object, inspect its state and explicitly expire or refresh it when the contract calls for that action.

For this lab, the correct diagnostic sequence is: record DML rowcount; inspect sa.inspect(obj).expired_attributes without triggering value access; record current object dictionary state where needed; obtain database values independently; then perform only the repair prescribed by the manifest.

Run the controlled comparison

The controlled comparison changes one relevant variable at a time: synchronize_session. Identical synthetic rows, identity-map population, Session options, and UPDATE predicate remain fixed.

The executed SQLAlchemy 2.0.50 reference run produced:

Case

Reference observation

Database

Held-object result

Status

C01 auto

rowcount 2

ids 1–2 closed

ids 1–2 closed

OBSERVED / ACCEPT

C02 fetch

rowcount 2; SQLite statement used RETURNING id

ids 1–2 closed

ids 1–2 closed

OBSERVED / ACCEPT

C03 evaluate

rowcount 2

ids 1–2 closed

ids 1–2 closed

OBSERVED / ACCEPT

C04 False

rowcount 2

ids 1–2 closed

ids 1–2 still open

OBSERVED / REPAIR

C05 False + expire

rowcount 2

ids 1–2 closed

next access reloaded closed

OBSERVED / ACCEPT after repair

C06 unevaluable evaluate

InvalidRequestError

baseline

baseline

OBSERVED / ACCEPT expected failure

C07 rollback

UPDATE attempted then rollback

baseline

baseline after expiration/readback

OBSERVED / ACCEPT

C08 fetch + SQL expression

rowcount 2

scores 15/25

score readback 15/25

OBSERVED / ACCEPT

C09 2.0.55 regression target

no 2.0.55 run

Not observed

Not observed

EXPECTED / NOT EXECUTED / RERUN

For C02, seeing RETURNING id in the captured SQLite statement is a reference-run observation, not a universal promise that every dialect uses that form. The documentation permits "fetch" to use either a preliminary SELECT or RETURNING, depending on database support.

The same problem arises when checking which sibling tasks still run after asyncio.gather raises. The top-level result cannot establish the state of every task. In this comparison, inspect each retained object even when the UPDATE reports the expected row count.

Preserve failures before cleanup

A failed case should write its evidence before tmp_path cleanup destroys the disposable database. At minimum preserve the fingerprint, case identifier, SQL text, rowcount or exception type, identity keys, expired-attribute sets, object values where safe to read, database readback, expected manifest row, and decision.

Pass condition: a failed assertion leaves enough evidence to reproduce the exact divergence.

Fail condition: pytest reports only assert False after the temporary database and SQL trace have disappeared.

A practical harness can serialize each case record to evidence/<case>.json before making its final assertion. Do not store customer data or external credentials; this fixture has none.

Test error and boundary cases

The first required boundary is "evaluate" with a criterion the Python evaluator cannot interpret. SQLAlchemy documents that sufficiently complex criteria may not be evaluable and that the strategy will raise an error; the recommended alternative for that situation is "fetch".

The executed reference case used:

stmt = (
    update(Item)
    .where(func.lower(Item.state) == "open")
    .values(state="closed")
)

session.execute(
    stmt,
    execution_options={"synchronize_session": "evaluate"},
)

On SQLAlchemy 2.0.50 this produced InvalidRequestError before the intended UPDATE took effect. The independent database read returned the baseline. That exception and database result are OBSERVED for 2.0.50. More generally, "evaluate" can raise when it cannot interpret a complex criterion. The documented fallback in that case is "fetch".

The second boundary is assigning a SQL expression to a column. For example, the following assignment calculates a new score in the database.

.values(score=func.abs(Item.score) + 5)

An assignment like this may require expiration and readback. In the 2.0.50 reference run, "fetch" updated both matched rows. Subsequent reads on the objects returned scores of 15 and 25. The SQL trace showed per-object SELECT statements for the affected score attributes during readback. That query pattern is OBSERVED on the reference runtime. The query count can vary.

SQLAlchemy 2.0.55 fixed a regression affecting expiration of server-side or SQL-expression values when an UPDATE matches multiple objects. To qualify that version, inspect the affected attributes on every matched identity, including the second object.

Capture the per-case evidence ledger

An evidence ledger should be append-only for a run and use stable case identities. The executed reference evidence can be summarized as follows:

Case

Runtime

DML/exception

Session evidence

Independent DB evidence

Decision

C01

SA 2.0.50

UPDATE, rowcount 2

matched objects closed

matched rows closed

ACCEPT

C02

SA 2.0.50

UPDATE…RETURNING id, rowcount 2

matched objects closed

matched rows closed

ACCEPT

C03

SA 2.0.50

UPDATE, rowcount 2

matched objects closed

matched rows closed

ACCEPT

C04

SA 2.0.50

UPDATE, rowcount 2

matched objects still open

matched rows closed

REPAIR

C05

SA 2.0.50

UPDATE, rowcount 2

expire_all; access reloads closed

matched rows closed

ACCEPT

C06

SA 2.0.50

InvalidRequestError

baseline retained

baseline retained

ACCEPT expected failure

C07

SA 2.0.50

UPDATE then rollback

rollback/readback baseline

baseline

ACCEPT

C08

SA 2.0.50

expression UPDATE, rowcount 2

affected scores read as 15/25

15/25

ACCEPT

C09

SA 2.0.55 target

not run

not observed

not observed

RERUN (EXPECTED / NOT EXECUTED)

The ledger separates observation from interpretation. For example, C04’s database success is not itself a failure. The REPAIR decision follows because this playbook’s contract requires the retained objects to become safe for subsequent use, while the chosen strategy intentionally left them stale.

Audit missing evidence

For each row, require four artifacts: runtime fingerprint, candidate DML outcome, pre-readback identity-map state, and post-action authoritative readback.

If any one is missing, the decision cannot be ACCEPT.

A case with database readback but no knowledge of which instances were resident is HOLD because the identity-map question was not observed. A case with object values but no independent row read is HOLD because local reconciliation has not been compared with the database. A case run on 2.0.50 when the release claim names 2.0.55 is RERUN.

The completeness gate prevents an especially dangerous report shape: “all tests passed” with no retained evidence that the negative control actually produced stale state.

Reconcile observed state with expected state

Reconciliation is a three-way comparison:

independent expected manifest
          |
          v
candidate ORM operation ---> Session identity-map evidence
          |
          +-----------------> database readback

For auto, fetch, and evaluate literal-update cases, the 2.0.50 observations agreed with the manifest. For False, the database and Session intentionally diverged, which also agreed with the manifest. C04 is therefore a successful test of a behavior that requires operational repair.

The difference between expired and stale matters. An expired attribute is explicitly marked for reload; SQLAlchemy documents that its value is removed and a later access issues a query in the Session’s current transaction. A stale, unexpired value under synchronize_session=False remains locally readable without that forced reload.

Accordingly, the playbook must not report “stale” merely because expired_attributes contains a column. Expiration is a reconciliation mechanism. The stronger stale classification is appropriate when the database row differs from an unexpired value still available on the retained instance.

Testing Kubernetes topology spread constraints uses a similar check. A nominally healthy workload still needs to satisfy the declared placement condition. For the ORM, the condition is that each held object has the expected value or reloads it on access.

A useful executable assertion pattern is:

assert database_values(engine) == expected["db"]

for obj in objects:
    state = sa.inspect(obj)
    observed_expired[obj.id] = sorted(state.expired_attributes)

assert object_values(objects) == expected["memory"]

Only call object_values() at the manifest-prescribed readback point, because attribute access itself can satisfy an expiration and alter the evidence.

Separate documented behavior from observations

The evidence supports four statements with different scopes.

Documented: "auto" chooses "fetch" when RETURNING is available and otherwise "evaluate"; "fetch" obtains affected identities through a prior query or RETURNING; "evaluate" evaluates the WHERE predicate in Python and can fail on unsupported expressions; False does not synchronize Session state.

Documented: the Session identity map maintains one object per database identity, and expiration causes mapped attributes to reload from the Session’s current transaction when accessed. Commit and rollback normally expire state.

Observed on the reference runtime: SQLAlchemy 2.0.50 with SQLite 3.46.1 produced the C01–C08 outcomes recorded above, including a stale negative control under False, literal-value synchronization for the other three strategies, an "evaluate" error for the chosen lower() criterion, and successful post-expiration readback.

Version-specific documented change: SQLAlchemy 2.0.55 fixes the multi-object expiration regression described in #13675.

Do not collapse those categories into “SQLAlchemy always does X.” The actual SQL emitted by "fetch" is dialect-dependent, transaction visibility affects what an expired attribute can reload, and patch releases can change reconciliation bugs while preserving the high-level strategy contract. SQLAlchemy’s Session API explicitly warns that a refresh in a highly isolated transaction may still see the same transaction-visible value rather than an external change.

Bound the repair

Limit the repair to affected objects in the Session you own so that unrelated transaction behavior stays intact.

For a deliberate synchronize_session=False case, the smallest repair is generally expiration or explicit refresh of the affected state before downstream code relies on it. SQLAlchemy provides Session.expire(), expire_all(), and refresh() for that purpose.

Pass condition: after repair, the exact retained object reference returns the expected database-backed values and no unrelated persistence outcome changed.

Fail condition: the “repair” closes the Session, commits unrelated work, rolls back someone else’s transaction, or replaces the object reference without proving downstream callers now use the replacement.

Repair the smallest failing boundary

For C04, the evidence already proves the UPDATE is correct. Re-running the UPDATE would be the wrong repair because the failing boundary is local state reconciliation.

A minimal repair is:

session.expire(item1, ["state"])
session.expire(item2, ["state"])

assert item1.state == "closed"
assert item2.state == "closed"

expire() itself invalidates the selected attributes; their later access performs the load. If immediate I/O is desired and ownership is clear, session.refresh(item, ["state"]) combines invalidation with immediate refresh. SQLAlchemy documents both mechanisms and notes that refresh/expiration operate against the current transactional context.

For a query-wide update where Session synchronization is semantically required, an even smaller preventive repair may be changing the candidate strategy from False to "fetch" or "auto" rather than adding manual expiration afterward. That choice should follow backend and predicate requirements rather than a blanket rule. "evaluate" is attractive when the predicate is evaluable and avoiding synchronization round trips is useful, but SQLAlchemy warns against it when many Session objects are expired because evaluating criteria can require refresh activity.

For the C06 unsupported-evaluator boundary, the repair is not to catch and ignore the exception. Use "fetch" if its database/backend semantics satisfy the case, as the SQLAlchemy documentation recommends when "evaluate" cannot interpret the criterion.

If the runtime falls within the affected range starting at 2.0.36 and multi-object expression expiration matters, upgrade to a patch containing the #13675 fix and rerun the complete evidence set. The SQLAlchemy changelog identifies the release containing the correction.

Validate rollback and safe rerun

Rollback is a control, not a generic freshness command. SQLAlchemy documents rollback as ending the current transaction and expiring remaining objects so their state can be loaded again.

C07 deliberately executes the False UPDATE and then rolls it back. The 2.0.50 reference run observed baseline database values afterward. Accessing the retained objects after rollback also returned baseline values because rollback expiration forced readback. That case is ACCEPT because the manifest expected the transaction not to persist.

The recovery protocol is:

  1. Freeze the failing ledger and database/SQL evidence before cleanup.

  2. Determine whether the divergence is DML correctness, Session reconciliation, unsupported evaluation, version mismatch, or transaction ownership.

  3. Repair only that boundary.

  4. Recreate the fixture from baseline; never continue the acceptance run from a mutated prior case.

  5. Execute the negative control again.

  6. Execute the repaired case.

  7. Execute all sibling synchronization strategies so the repair has not invalidated the comparison.

  8. Perform post-repair database and exact-object readback.

  9. Issue ACCEPT only when the complete manifest matches.

Checking Playwright request-routing coverage also requires independent evidence that a request reached the origin. Apply the same reporting discipline here. If the target environment has not run the case, record EXPECTED / NOT EXECUTED.

Assign an operational owner

A rerun needs an owner for three decisions: who owns the Session transaction, who may discard or invalidate local object state, and who approves changing the pinned SQLAlchemy version.

Pass condition: those responsibilities are explicit before repair.

Fail condition: a helper chooses commit(), rollback(), expiration, or version upgrade merely to make the fixture green without knowing whether pending state belongs to another unit of work.

This is particularly important because expiration and refresh are not purely observational if unflushed object changes exist; SQLAlchemy’s state-management documentation notes that expiring or refreshing an object can discard unflushed changes on that object.

Apply the ACCEPT / REPAIR / RERUN / HOLD gate

Use the evidence from each case to select the decision and the corresponding action.

Evidence state

Decision

Required action

DB rows match manifest; required local objects are current or correctly expired/read back; fingerprint matches

ACCEPT

Preserve ledger

DB rows are correct but retained unexpired objects are stale

REPAIR

Expire/refresh or change synchronization strategy, then verify

"evaluate" cannot evaluate the predicate

REPAIR

Use a qualified "fetch" path; rerun case

Intended rollback restores baseline and readback confirms it

ACCEPT

Preserve as negative transaction control

SQLAlchemy/database/runtime differs from qualification target

RERUN

Recreate all cases under pinned target

2.0.55-specific multirow regression case has not run

RERUN

Status remains EXPECTED / NOT EXECUTED

Required identity-map evidence, DB evidence, or source fingerprint is missing

HOLD

Recover evidence; do not infer

Transaction/state ownership is ambiguous

HOLD

Owner resolves pending work

Negative control unexpectedly appears synchronized

HOLD

Treat harness/oracle as suspect

Bulk UPDATE decision flow. A runtime mismatch or an unexecuted required version-specific case leads to RERUN. Unexpected database rows, unexplained stale objects, or a failed negative control lead to HOLD. Repair expected stale objects under False, read them back, then check the negative control. ACCEPT when all required checks pass.

This gate deliberately rejects “the UPDATE worked” as an insufficient release condition. The operational correctness claim is the relationship among SQL row state, Session identity state, expiration state, and the subsequent read.

Backend development at Refonte Learning

The three-month program requires 10–12 hours per week, a basic understanding of programming, and progress toward a bachelor’s or higher degree. The curriculum covers Node.js and Express, MongoDB and SQL database management, REST APIs and microservices, authentication and authorization, testing and debugging, Docker and cloud deployment, and a capstone project. The program describes practical projects, mentoring, and a potential internship. Successful completion offers a Training Certificate and a Certificate of Internship.

For broader practice with databases, APIs, testing, and debugging, see the Refonte Learning Backend Development Program. The published curriculum does not specify coverage of SQLAlchemy Session synchronization.

Two related SQLAlchemy diagnostics address different symptoms. When a nested JSON change fails to persist, check whether the ORM detected the mutation and emitted an UPDATE. When work survives a savepoint rollback, check when the Session flushed pending changes relative to the savepoint.

The decision for SQLAlchemy 2.0.55 is RERUN. Cases C01–C08 have OBSERVED reference evidence on 2.0.50. The 2.0.55 documentation and changelog establish the expected behavior and identify the stale-state fix. The 2.0.55 outcome remains EXPECTED / NOT EXECUTED until that pinned runtime executes the manifest, negative control, expression-update regression case, rollback control, and post-repair verification.