Self-healing history CRUD backed by SQLite.
Members
(inner, constant) HEALING_TESTID_CHUNK
Chunk a key LIKE test-ID query so the OR fanout per statement is bounded.
Each (deduped) base test ID expands to two LIKE clauses (raw +
@v%-versioned), so a chunk size of 100 caps the OR list at 200 clauses
per query — well within the Postgres planner's comfort zone for OR-of-LIKE
expressions on large workspaces. SQLite handles arbitrary OR depth, but
chunking keeps both adapters on the same execution path.
Input testIds are first collapsed to their base form (the @vN
suffix is stripped) and de-duplicated. Without this, a list containing
both "TC-1" and "TC-1@v2" would emit overlapping patterns —
TC-1@v%::% from the first and TC-1@v2::% from the second — and any
row like TC-1@v2::click::submit would match both. Per-chunk COUNT(*)
results would then be summed across chunks and double-count rows that
straddle the chunk boundary; SELECT * callers would see duplicate rows.
Collapsing to base IDs makes the per-row match set disjoint across the
entire input, regardless of chunk size.
(inner) _migrated
Upsert a healing entry.
Methods
(static) countByTestIds(testIds) → {number}
Count healing entries for specific test IDs.
Parameters:
| Name | Type | Description |
|---|---|---|
testIds |
Array.<string> |
Returns:
- Type
- number
(static) countSuccessesByTestIds(testIds) → {number}
Count successful healing entries for specific test IDs.
Parameters:
| Name | Type | Description |
|---|---|---|
testIds |
Array.<string> |
Returns:
- Type
- number
(static) deleteByTestIds(testIds)
Delete healing entries for a list of test IDs.
Parameters:
| Name | Type | Description |
|---|---|---|
testIds |
Array.<string> |
(static) get(key) → {Object|undefined}
Get a healing entry by key.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string | — " |
Returns:
- Type
- Object | undefined
(static) getAllAsDict() → {Object.<string, Object>}
Get all healing entries as a dictionary keyed by composite key.
Returns:
- Type
- Object.<string, Object>
(static) getByTestId(testId) → {Object.<string, Object>}
Get all healing entries for a specific test (keys starting with "
Accepts both raw test IDs ("TC-1") and versioned scope IDs
("TC-1@v2"). When a versioned scope is passed we also query the
legacy (unversioned) prefix so that pre-existing healing entries
remain readable after upgrading to versioned scopes.
Parameters:
| Name | Type | Description |
|---|---|---|
testId |
string | — raw test ID or versioned scope ID |
Returns:
Map of "action::label" → entry.
- Type
- Object.<string, Object>
(static) getByTestIds(testIds) → {Array.<Object>}
Get all healing entries scoped to a list of test IDs.
Filters at the SQL layer using key LIKE patterns so we never load other
workspaces' rows into Node memory — the workspace-scoped replacement for
getAllAsDict() when the caller already knows which test IDs belong to
the current workspace. Matches both <testId>::% (raw) and <testId>@v%::%
(versioned scope) prefixes, mirroring countByTestIds / deleteByTestIds.
Returns raw rows — when the same (testId, action, label) tuple has both
a legacy unversioned row and one or more versioned rows, callers will see
one entry per row. ORDER BY strategyVersion ASC NULLS FIRST mirrors the
sort getByTestId uses so callers can deduplicate via the
"later-row-wins" pattern (Map.set keyed on baseTestId::action::label)
and end up with the versioned entry as the survivor — matching the
single-test reader's semantics.
Parameters:
| Name | Type | Description |
|---|---|---|
testIds |
Array.<string> |
Returns:
Raw healing_history rows (key, strategyIndex, succeededAt, failCount, strategyVersion, …), oldest-first by strategyVersion.
- Type
- Array.<Object>