[PR #362] [MERGED] Return canonical SemanticHealthMetric for semantic health API #329

Closed
opened 2026-03-02 23:35:09 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AJaySi/ALwrity/pull/362
Author: @AJaySi
Created: 3/2/2026
Status: Merged
Merged: 3/2/2026
Merged by: @AJaySi

Base: mainHead: codex/define-canonical-response-model-for-semantic-health


📝 Commits (1)

  • 6273d1d Unify semantic health response schema

📊 Changes

2 files changed (+44 additions, -18 deletions)

View changed files

📝 backend/api/seo_dashboard.py (+4 -4)
📝 backend/services/intelligence/monitoring/semantic_dashboard.py (+40 -14)

📄 Description

Motivation

  • Ensure the semantic health API returns a single, consistent schema so success and error paths serialize identically.
  • Replace ad-hoc inline dataclasses previously returned by the monitor with the canonical SemanticHealthMetric model used across the codebase.

Description

  • Updated RealTimeSemanticMonitor.check_semantic_health to return SemanticHealthMetric instead of temporary inline dataclasses and changed its signature to -> SemanticHealthMetric in backend/services/intelligence/monitoring/semantic_dashboard.py.
  • Added a canonical no-metrics fallback SemanticHealthMetric with metric_name="semantic_health", a UTC timestamp, and user-facing description/recommendations when no individual metrics are present.
  • Aggregated results into a single SemanticHealthMetric by computing overall status, average value, average threshold, and de-duplicated recommendations before returning the summary.
  • Updated backend/api/seo_dashboard.py:get_semantic_health docs and the local assignment to explicitly use SemanticHealthMetric so the endpoint success path matches the fallback payload shape.

Testing

  • Compiled the modified modules with python -m compileall backend/services/intelligence/monitoring/semantic_dashboard.py backend/api/seo_dashboard.py and the compilation completed successfully.

Codex Task


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/AJaySi/ALwrity/pull/362 **Author:** [@AJaySi](https://github.com/AJaySi) **Created:** 3/2/2026 **Status:** ✅ Merged **Merged:** 3/2/2026 **Merged by:** [@AJaySi](https://github.com/AJaySi) **Base:** `main` ← **Head:** `codex/define-canonical-response-model-for-semantic-health` --- ### 📝 Commits (1) - [`6273d1d`](https://github.com/AJaySi/ALwrity/commit/6273d1de60f13a02f2f2155b54c062fe392bb80f) Unify semantic health response schema ### 📊 Changes **2 files changed** (+44 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `backend/api/seo_dashboard.py` (+4 -4) 📝 `backend/services/intelligence/monitoring/semantic_dashboard.py` (+40 -14) </details> ### 📄 Description ### Motivation - Ensure the semantic health API returns a single, consistent schema so success and error paths serialize identically. - Replace ad-hoc inline dataclasses previously returned by the monitor with the canonical `SemanticHealthMetric` model used across the codebase. ### Description - Updated `RealTimeSemanticMonitor.check_semantic_health` to return `SemanticHealthMetric` instead of temporary inline dataclasses and changed its signature to `-> SemanticHealthMetric` in `backend/services/intelligence/monitoring/semantic_dashboard.py`. - Added a canonical no-metrics fallback `SemanticHealthMetric` with `metric_name="semantic_health"`, a UTC `timestamp`, and user-facing `description`/`recommendations` when no individual metrics are present. - Aggregated results into a single `SemanticHealthMetric` by computing overall `status`, average `value`, average `threshold`, and de-duplicated `recommendations` before returning the summary. - Updated `backend/api/seo_dashboard.py:get_semantic_health` docs and the local assignment to explicitly use `SemanticHealthMetric` so the endpoint success path matches the fallback payload shape. ### Testing - Compiled the modified modules with `python -m compileall backend/services/intelligence/monitoring/semantic_dashboard.py backend/api/seo_dashboard.py` and the compilation completed successfully. ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69a47b1ab1308328989dea3acc0ce4b3) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 23:35:09 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ALwrity#329
No description provided.