Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

All notable changes to this project will be documented in this file.

## [v0.0.5] - 2026-04-21

Comment on lines +5 to +6
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR metadata describes v0.0.5 as dated 2026-04-21, but the changelog entry is dated 2026-04-17. Please align the changelog release date with the intended release date (or adjust the PR description) so version history is consistent.

Copilot uses AI. Check for mistakes.
### Changed

- Deferred resolver route router construction until the module-level `router` attribute is accessed, reducing import-time dependency coupling.
- Added resolver mutation-testing configuration for `mutmut`, including resolver API routes, services, store modules, and selective test invocation.
- Lazily load baseline and granger engine classes via module `__getattr__` hooks to avoid import-time engine dependencies in store modules.
- Hardened shared Redis patching in resolver tests by importing store modules dynamically and only patching available attributes.
- Improved exception wrapper tests to preserve original HTTP exception identity and validate sync/async handler shape preservation.
- Tightened resolver pylint design thresholds and refactored analyzer/connector/rca interfaces to keep strict linting without compatibility regressions.
- Added structured RCA signal-input wiring and expanded edge-case tests so resolver `mypy`, `pylint`, and `pytest` all pass cleanly at 100% coverage.
- Applied cleanup-only compatibility wording updates in resolver config/comments and datasource fallback test literals with no behavior changes.
- Added a temporary SQLite test bootstrap for resolver tests, cleaned up resolver request/analyzer docstrings, and excluded generated mutation fixtures from resolver mypy.

## [v0.0.4] - 2026-04-14

### Changed
Expand Down
8 changes: 6 additions & 2 deletions api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# package marker for api submodules
"""
Package exports for the `api` module namespace.
Api module for the resolver package.

Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""
5 changes: 2 additions & 3 deletions api/requests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
Requests and data models for API endpoints.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from .analyze import AnalyzeJobCreateRequest, AnalyzeRequest
Expand Down
7 changes: 6 additions & 1 deletion api/requests/_time_range.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
"""
Shared time-range request models.
Time range request model for log and metric queries.

Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions api/requests/analyze.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
Analyze request models.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions api/requests/correlation.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
Correlation request models.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions api/requests/events.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
Deployment event request models.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions api/requests/logs.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
Log request models.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions api/requests/metrics.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
Metrics request models.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions api/requests/slo.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
SLO request models.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions api/requests/topology.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
Topology request models.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions api/requests/traces.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
Trace request models.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions api/responses/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
Response models for API endpoints and internal data structures.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions api/responses/analysis.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
Analysis report response models.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions api/responses/anomalies.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
Anomaly response models.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
26 changes: 13 additions & 13 deletions api/responses/base.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
Base response models and serialization helpers.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand All @@ -19,17 +18,18 @@


def _coerce(obj: SerializableValue) -> SerializableValue:
result: SerializableValue = obj
if isinstance(obj, dict):
return {k: _coerce(v) for k, v in obj.items()}
if isinstance(obj, list):
return [_coerce(v) for v in obj]
if isinstance(obj, np.integer):
return int(obj)
if isinstance(obj, np.floating):
return float(obj)
if isinstance(obj, np.ndarray):
return obj.tolist()
return obj
result = {k: _coerce(v) for k, v in obj.items()}
elif isinstance(obj, list):
result = [_coerce(v) for v in obj]
elif isinstance(obj, np.integer):
result = int(obj)
elif isinstance(obj, np.floating):
result = float(obj)
elif isinstance(obj, np.ndarray):
result = obj.tolist()
return result


class NpModel(BaseModel):
Expand Down
5 changes: 2 additions & 3 deletions api/responses/jobs.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
Asynchronous analysis job response models.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions api/responses/logs.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
Log response models.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions api/responses/rca.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
RCA and causal response models.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions api/responses/slo.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
SLO response models.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions api/responses/traces.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""
Trace response models.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
33 changes: 2 additions & 31 deletions api/routes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,16 @@
"""
Routes initialization and shared data models for API endpoints.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations

from fastapi import APIRouter

from api.routes.analyze import router as analyze_router
from api.routes.causal import router as causal_router
from api.routes.correlation import router as correlation_router
from api.routes.events import router as events_router
from api.routes.forecast import router as forecast_router
from api.routes.health import router as health_router
from api.routes.jobs import router as jobs_router
from api.routes.logs import router as logs_router
from api.routes.metrics import router as metrics_router
from api.routes.ml import router as ml_router
from api.routes.slo import router as slo_router
from api.routes.topology import router as topology_router
from api.routes.traces import router as traces_router

router = APIRouter()

router.include_router(health_router)
router.include_router(analyze_router)
router.include_router(metrics_router)
router.include_router(logs_router)
router.include_router(traces_router)
router.include_router(correlation_router)
router.include_router(slo_router)
router.include_router(topology_router)
router.include_router(events_router)
router.include_router(forecast_router)
router.include_router(causal_router)
router.include_router(ml_router)
router.include_router(jobs_router)

__all__ = ["router"]
Comment on lines 14 to 45
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description says the aggregated API router is now constructed lazily when api.routes.router is accessed, but api/routes/__init__.py currently exports an empty APIRouter with no lazy inclusion logic. If external code still imports and uses api.routes.router, it will silently miss all routes. Either reintroduce lazy route inclusion (e.g., via __getattr__ that populates router) or update/remove the exported router to avoid a misleading compatibility surface.

Copilot uses AI. Check for mistakes.
5 changes: 2 additions & 3 deletions api/routes/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
including metric anomalies, log bursts, service latency issues, error propagation, and more. You may filter or specify
time ranges and other parameters in the AnalyzeRequest to focus the analysis.

Copyright (c) 2026 Stefan Kumarasinghe
Copyright (c) 2026 Stefan Kumarasinghe.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""

from __future__ import annotations
Expand Down
Loading
Loading