mikebridge opened a new pull request, #42709:
URL: https://github.com/apache/superset/pull/42709

   ### SUMMARY
   
   The versioning capture path swallows `OperationalError`/`ProgrammingError` 
to survive the pre-migration window where the versioning tables don't exist 
yet. But those exception classes also cover deadlocks, lock timeouts, and 
dropped connections — and the class-based swallow filed all of them under 
"table missing": no log line, no capture-error metric, while the user's save 
reported success and its version history quietly didn't exist. That defeats the 
module's own documented posture that capture regressions should be "alertable 
rather than log-grep-only."
   
   Three sites, three consequences:
   
   - `changes/listener.py` — the whole save's change records dropped silently
   - `baseline/collection.py` — `shadow_row_count` returns `None`, so the 
caller skips baseline capture for the flush
   - `queries.py` (read path) — every affected save renders an empty change list
   
   This PR adds `is_missing_table_error()`, which verifies the specific 
condition — `pgcode`/`sqlstate` `42P01` on PostgreSQL, errno `1146` on MySQL, 
`"no such table"` on SQLite — instead of inferring it from the exception class. 
The genuine migration race stays exactly as quiet as before; everything else 
now logs and, on the persist path, increments the existing 
`superset.versioning.capture.*` counter. The predicate is deliberately narrow: 
an ambiguous error gets logged, not swallowed — over-reporting is recoverable, 
a silent capture drop is not.
   
   Disclosure: this change was developed with AI assistance (Claude), on behalf 
of and reviewed by @mikebridge.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — observability-only change; no user-facing behaviour.
   
   ### TESTING INSTRUCTIONS
   
   - `pytest tests/unit_tests/versioning/test_db_errors.py` — 9 tests pinning 
the driver shapes per supported metadata DB (psycopg2 `pgcode`, psycopg3 
`sqlstate`, MySQL errno, SQLite message), including the negative cases 
(deadlock, lock-wait timeout, locked database, connection drop).
   - `pytest tests/unit_tests/versioning/test_listener.py` — the new 
`test_transient_persist_failure_is_logged_and_counted` fails against the 
previous listener (no log, no metric); 
`test_missing_table_stays_silent_during_persist` passes before and after, 
pinning that the benign case's behaviour is unchanged.
   - Manual: point a dev instance at a metadata DB where the versioning 
migration hasn't run — saves still succeed with no error noise (the migration 
race stays silent).
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to