Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docs/resource-budgets.md
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,13 @@ references and registry state. Daemon threads do not guarantee completion when
the process exits; durable abandoned-attempt recovery remains necessary.

Explicit `consolidate()` forces one pass with the same eight result keys plus
the existing nonpersisted preference extraction result. A busy owner produces
`extract_preferences`, which reports `UNAVAILABLE (ScheduledPreferencesUnsupported)`.
Scheduled preference maps have no persistence or refresh implementation; this
stage does no extraction, source read or write. Otherwise complete maintenance
reports `completed_with_limits`. Cancellation, layer failures or deferrals, and
pending caller writes retain precedence. Bulk `ingest()` reports the same
preference limitation. Entity-scoped extraction remains a return-only helper,
and query-time preference retrieval remains available. A busy owner produces
nine explicit `BUSY` entries and does not queue a hidden forced pass. A file
call without an existing transaction uses a dedicated connection. An existing
caller transaction uses the original connection's protected savepoints and
Expand Down
13 changes: 10 additions & 3 deletions tests/test-l0-style-routing-747.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,13 +1039,20 @@ def test_manual_pending_result_and_health_do_not_clear_prior_completed_failure(s
token = coordinator._begin_observation()
coordinator._finish_observation(token, MAINTENANCE.MaintenanceReport((), "SKIPPED"), "failed", "PriorFailure")
conn.execute("INSERT INTO sentinel VALUES ('caller')")
personality = types.SimpleNamespace(extract_preferences=lambda _conn: None)
importer = types.SimpleNamespace(import_module=lambda name: STYLE if name == "truememory.personality_style_vec"
else types.SimpleNamespace(extract_preferences=lambda _conn: None))
else personality)
with patch.object(MAINTENANCE, "engine_layer_specs", public_specs), patch.object(MAINTENANCE, "importlib", importer), \
patch.object(MAINTENANCE, "_installed_dependency", return_value=None):
patch.object(MAINTENANCE, "_installed_dependency", return_value=None), \
patch.object(personality, "extract_preferences",
side_effect=AssertionError("unsupported preference work")) as preferences:
result = engine.consolidate()
preferences.assert_not_called()
self.assertEqual(len(result), 9)
self.assertTrue(all("pending caller commit" in value for value in result.values()))
self.assertEqual(set(result), set(MAINTENANCE._MAINTENANCE_RESULT_KEYS))
self.assertTrue(all("pending caller commit" in result[key]
for key in MAINTENANCE._MAINTENANCE_RESULT_KEYS if key != "extract_preferences"), result)
self.assertEqual(result["extract_preferences"], "UNAVAILABLE (ScheduledPreferencesUnsupported)")
self.assertEqual(coordinator.status, ("failed", "PriorFailure"))
self.assertEqual(engine.get_style_health()["last_error"], "PriorFailure")
conn.rollback()
Expand Down
14 changes: 11 additions & 3 deletions tests/test-maintenance-engine-routing-753.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,9 @@ def run(conn, coordinator, **kwargs):
result = self.engine.consolidate()
automatic.assert_not_called()
self.assertEqual(set(result), set(MAINTENANCE._MAINTENANCE_RESULT_KEYS))
self.assertTrue(all("ERROR" not in value and "UNAVAILABLE" not in value for value in result.values()), result)
self.assertTrue(all("ERROR" not in value and "UNAVAILABLE" not in value
for key, value in result.items() if key != "extract_preferences"), result)
self.assertEqual(result["extract_preferences"], "UNAVAILABLE (ScheduledPreferencesUnsupported)")
self.assertIn("vector_generation_unverified", result["cluster_messages"])
with self.assertRaises(sqlite3.ProgrammingError):
seen[0].execute("SELECT 1")
Expand All @@ -732,9 +734,15 @@ def test_24_then_25_committed_adds_across_engines_use_durable_counts(self) -> No

def test_borrowed_manual_preserves_caller_writes_and_rollback(self) -> None:
self.add(1, commit=False)
with patch.object(self.engine_module, "create_db", side_effect=AssertionError("new handle")):
with patch.object(self.engine_module, "create_db", side_effect=AssertionError("new handle")), \
patch.object(self.modules["truememory.personality"], "extract_preferences",
side_effect=AssertionError("unsupported preference work")) as preferences:
result = self.engine.consolidate()
self.assertTrue(all("pending caller commit" in value for value in result.values()), result)
preferences.assert_not_called()
self.assertEqual(set(result), set(MAINTENANCE._MAINTENANCE_RESULT_KEYS))
self.assertTrue(all("pending caller commit" in result[key]
for key in MAINTENANCE._MAINTENANCE_RESULT_KEYS if key != "extract_preferences"), result)
self.assertEqual(result["extract_preferences"], "UNAVAILABLE (ScheduledPreferencesUnsupported)")
self.assertTrue(self.conn.in_transaction)
self.conn.rollback()
self.assertEqual(self.conn.execute("SELECT count(*) FROM messages").fetchone()[0], 0)
Expand Down
Loading
Loading