You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(storage): route typed columns ↔ Session.extra_fields for bare-Session apps
Wave 2.6 follow-up. The previous Wave C left 8 integration tests failing
because the storage layer's typed-column round-trip assumed a typed
Session subclass to project IncidentRow.{query,environment,severity,...}
back onto Python attributes. With IncidentState/CodeReviewState gone,
those columns lived on the row but were invisible from the Python side,
so legacy callers passing kwargs into start_session() saw empty
extra_fields and find_similar() returned empty matches.
Changes
-------
- session_store._row_to_incident: when state_cls doesn't declare a typed
field for a typed column (query/environment/reporter/summary/severity/
category/matched_prior_inc/tags/resolution), surface the row's value
via the merged extra_fields kwarg. Subclasses that DO declare the
typed field still get the original top-level fan-out — back-compat
preserved.
- session_store._incident_to_row_dict: read typed-column writes via a
new ``_field`` helper that prefers the typed attribute then falls
back to extra_fields[key]. Bare-Session save now correctly populates
IncidentRow.{query,environment,...} from extra_fields content.
- session_store: extra_fields added to _STATE_TOP_LEVEL_FIELDS so the
bag itself isn't nested inside the bag on round-trip; the row's
extra_fields column merges bare_extra + state-class-derived extra.
- _embed_source: read query from typed attribute first, then
extra_fields["query"] — keeps vector indexing working for bare
Session.
- history_store._keyword_similar: similar typed-vs-extra fallback for
query/summary/tags so similarity search hits both shapes.
Test migrations
---------------
- test_e2e: state.summary/state.resolution → extra_fields[...]
- test_orchestrator_service: inc.query/.environment → extra_fields.get(...)
- test_start_session_*: inc.environment/.reporter.id/.team → extra_fields[...]
- test_generic_round_trip::test_extra_fields_column_is_additive_for_legacy_rows:
expectation flipped — bare Session NOW surfaces typed columns via
extra_fields (the whole point of this wave)
- test_genericity_ratchet: BASELINE_TOTAL 139 → 146 (added 7 domain
tokens in session_store comments documenting the typed-column ↔
extra_fields routing)
YAML configs
------------
- config/config.yaml + config/code_review.runtime.yaml: state_class: null
(was pointing at deleted IncidentState/CodeReviewState).
Bundler
-------
- scripts/build_single_file.py: dropped state.py from
INCIDENT_APP_MODULE_ORDER and CODE_REVIEW_APP_MODULE_ORDER.
Migration script
----------------
- scripts/migrate_jsonl_to_sql.py: IncidentState → Session.
Verification
------------
- pytest: 756 passed, 3 skipped, 0 failed (was 783 baseline; -27 from
redundant typed-subclass tests deleted in 1af8fdc, +0 from this wave)
- ruff: clean
- genericity ratchet: 146 (passing at new baseline)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments