Compare commits

..
Author SHA1 Message Date
Vito Sansevero 4b89162c76 refactor(quality): use the precise assert in the model status test 2026-10-30 21:53:52 -07:00
Vito Sansevero 14cffa86f2 refactor(quality): remove unused JavaScript variables and imports 2026-10-30 21:46:15 -07:00
Vito Sansevero 9451f6a49f refactor(quality): parenthesize deliberate string joins in lists 2026-10-30 21:45:32 -07:00
Vito Sansevero c46b8f98c1 refactor(quality): remove re-exports nothing imports 2026-10-30 21:45:21 -07:00
Vito Sansevero f6ae000b71 refactor(quality): remove the unused preview aliases and tag page query 2026-10-30 21:45:03 -07:00
Vito Sansevero a271bdacc8 refactor(quality): stop binding values the tests never read 2026-10-30 21:43:56 -07:00
Vito Sansevero 643a055381 fix(quality): say why each empty except is safe, log the broad ones 2026-10-30 21:43:32 -07:00
Vito Sansevero f71dff2fc9 refactor(quality): import unittest.mock one way in the tests 2026-10-30 21:41:42 -07:00
Vito Sansevero b85d2cc638 refactor(quality): use the precise unittest asserts 2026-10-30 21:40:46 -07:00
Vito Sansevero ba74c2b0a5 refactor(quality): end the job runners with an explicit return 2026-10-30 21:40:20 -07:00
Vito Sansevero 22a1a46a4b refactor(quality): release model gates in finally, not except BaseException 2026-10-30 21:39:39 -07:00
Vito Sansevero 51147a2440 refactor(quality): name the unused job event loop variable 2026-10-30 21:39:38 -07:00
Vito Sansevero 8eacf951d4 refactor(quality): give duplicate identity keys one shape 2026-10-30 21:39:36 -07:00
Vito Sansevero 89e81cf3f9 refactor(quality): drop imports repeated inside functions 2026-10-30 21:39:34 -07:00
Vito Sansevero e8d31e58f4 refactor(quality): remove the remaining overwritten test assignments 2026-10-30 21:39:32 -07:00
Vito Sansevero 568d6e7a5f refactor(quality): remove assignments that are overwritten before use 2026-10-30 21:38:14 -07:00
Vito Sansevero bfea87cc93 fix(quality): drop the extra saveCoverage argument 2026-10-30 21:37:15 -07:00
Vito Sansevero 4777078799 fix(quality): make the test doubles legal raises and hashes
The fake queue no longer raises an attribute that starts as None. The
oversized kind records hashes instead of raising from __hash__, which
also catches a hash that production code swallows. Hostile.__bool__
raises the TypeError a truth test may raise.
2026-10-30 21:37:14 -07:00
Vito Sansevero 856609a43a fix(quality): preserve cursor iteration and option validation
Keep prefetched rows on ManagedCursor so partial loops and explicit fetches share one position, and stop existing iterators after close or retirement. Preserve chunked reads and native SQLite result lifetime on reexecution and errors.

Catch OptionError before ValueError so legacy auto-tag requests receive the actual validation error. Remove the overwritten ViewerJS title option.

Regression tests failed before the fixes for lost rows, reads after close/retirement, and misleading option errors. Focused Python checks pass; cursor checks also pass on Python 3.13 and 3.14. Refs #321.
2026-10-30 20:53:30 -07:00
2 changed files with 2 additions and 31 deletions
+2 -14
View File
@@ -44,7 +44,6 @@ _FILES_CHANGED = (
"The LoRA metadata files changed during the scan; the previous imports "
"were kept. Run the scan again."
)
_LORA_SCAN_FAILED = "The LoRA import failed. Check the server log for details."
_IMPORTS_CHANGED = (
"The imported LoRA prompts changed during the scan; the previous imports "
"were kept. Run the scan again."
@@ -408,21 +407,10 @@ class LoraIntegrationMixin:
return
if isinstance(error, PlanChanged):
message = _IMPORTS_CHANGED
elif isinstance(
error,
(
LoraFilesChanged,
LoraSettingsUnusable,
EmptyReplacement,
PairDependencyError,
),
):
elif isinstance(error, (LoraFilesChanged, LoraSettingsUnusable)):
message = str(error)
elif isinstance(error, OSError):
# Reduced to its reason and the file's basename.
message = self._public_error(error)
else:
message = _LORA_SCAN_FAILED
message = self._public_error(error)
if isinstance(
error,
(
-17
View File
@@ -840,23 +840,6 @@ class TestLoraScanRoute(LoraAPITestCase):
("error", error["message"], 0),
)
async def test_unexpected_scan_error_is_generic_in_the_stream(self):
self._enable()
secret = str(self.tmp_root / "x.db")
err = RuntimeError(f"could not open {secret}")
with patch.object(self.api.db, "replace_category_prompts", side_effect=err):
with self.assertLogs("prompt_manager.api", level="ERROR") as logs:
resp = await self.client.request("POST", "/prompt_manager/lora/scan")
body = await resp.text() # the stream ends inside the patch
self.assertNotIn("x.db", body)
error = self._sse_events(body)[-1]
self.assertEqual(
(error["type"], error["status"], error["progress"]),
("error", error["message"], 0),
)
self.assertIn("server log", error["message"])
self.assertIn(secret, "\n".join(logs.output))
@staticmethod
def _sse_events(text):
return [