mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-12 20:15:56 +00:00
Fix: health-check reported success after reference search failed (#1998)
`project health-check` runs three tools but only two of them can fail the check: an exception from `FindReferencingSymbolsTool` was caught and logged as a warning, while the verdict tested `find_symbol_data` alone. The command therefore printed "Health check passed - All tools working correctly" and exited 0 on a project whose reference search had just blown up - the one signal a health check exists to give. Co-authored-by: Arkadiusz Gładki <biosmoothly@gmail.com>
This commit is contained in:
1 parent
c1ca4324d1
commit
701e7c843f
2 files changed
+14
-5
No files matched your search
@@ -13,6 +13,12 @@ Status of the `main` branch. Changes prior to the next official version change w
|
||||
which could leave grandchildren as zombies; cleanup now waits for the discovered descendants (#1464)
|
||||
- Fix: `read_only` restriction in project definition was not applied to base tool set when in single-project context (#1938)
|
||||
|
||||
* CLI:
|
||||
- Fix: `project health-check` reported `Health check passed - All tools working correctly` and
|
||||
exited 0 even when `FindReferencingSymbolsTool` had raised, because that failure was logged as
|
||||
a warning while the verdict checked `FindSymbolTool` only. A reference-search failure now fails
|
||||
the check; a symbol with no references is still a pass
|
||||
|
||||
* Memories:
|
||||
- Fix: `save_memory`/`edit_memory` wrote directly to the memory file with `open(path, "w")`, which
|
||||
truncates it before the new content is written; a crash, OOM kill, or full disk partway through
|
||||
|
||||
+8
-5
@@ -1011,6 +1011,8 @@ class ProjectCommands(AutoRegisteringGroup):
|
||||
)
|
||||
find_symbol_data = json.loads(find_symbol_result)
|
||||
log.info("FindSymbolTool found %d matches for symbol %s", len(find_symbol_data), symbol_name)
|
||||
if not find_symbol_data:
|
||||
raise ProjectCommands._HealthCheckFailure("FindSymbolTool returned no results")
|
||||
|
||||
# Test 3: FindReferencingSymbolsTool
|
||||
log.info("Testing FindReferencingSymbolsTool for symbol: %s", symbol_name)
|
||||
@@ -1020,11 +1022,12 @@ class ProjectCommands(AutoRegisteringGroup):
|
||||
find_refs_data = json.loads(find_refs_result)
|
||||
log.info("FindReferencingSymbolsTool found %d references for symbol %s", len(find_refs_data), symbol_name)
|
||||
except Exception as e:
|
||||
log.warning("FindReferencingSymbolsTool failed for symbol %s: %s", symbol_name, str(e))
|
||||
|
||||
# Verify tools worked as expected
|
||||
if not find_symbol_data:
|
||||
raise ProjectCommands._HealthCheckFailure("FindSymbolTool returned no results")
|
||||
# A symbol with no references at all is a legitimate result, so the number of
|
||||
# references is not asserted - but a *failure* of the reference search means the
|
||||
# language server is not functional, which is the single thing this command is
|
||||
# asked to determine. Logging it as a warning let the command print
|
||||
# "All tools working correctly" and exit 0 after the search had already failed.
|
||||
raise ProjectCommands._HealthCheckFailure(f"FindReferencingSymbolsTool failed for symbol {symbol_name}: {e}") from e
|
||||
|
||||
log.info("Health check completed successfully")
|
||||
|
||||
|
||||
Reference in new issue
Block a user