Commit Graph

319 Commits

Author SHA1 Message Date
Eduardo Rios
9df151d29d SIENTIAPDE-2012: per-group levels/ignore_models_id filtering
Extends filter_notification_alerts (slot_manager.py) and
filter_notification_reports (formatters.py) to check
receiver_group.get('levels') and receiver_group.get('ignore_models_id'),
mirroring the existing contents/ignore pattern exactly. Closes the gap
SIENTIAPDE-2011 deliberately left open: the query-time union/intersection
filter widens what gets fetched for the union of all active groups, but until
now nothing narrowed each group back down to its own configured slice.

Both checks short-circuit via `not levels_list or ...` / `not
ignore_models_id_list or ...` rather than accessing notification['level']/
['model_id'] directly, so groups that don't configure either field (today's
common case, and every existing unit test fixture) never evaluate the
right-hand side and can't raise KeyError on notifications missing those keys.
ignore_models_id reads via `.get(...) or []`, defensively handling an
explicit `null` in a receiver_groups document from the start (same fix
SIENTIAPDE-2011 needed a follow-up commit for).

Tests:
- 8 new unit tests (4 per file): levels restriction, ignore_models_id
  restriction, neither-configured passthrough, explicit-None safety.
- New e2e test (test_scenario_a_2_1_per_group_levels_and_ignore_models_id)
  against real Mongo/Redis/Temporal: two active groups configured
  differently: SIENTIAPDE-2011's query-time filter widens the fetch to the
  union of both, and this subtask's per-group filter narrows each group back
  to its own levels/ignore_models_id, including the case where a model is
  ignored by only one of the active groups.
- Deduplicated the two e2e suites' identical _extract_html_body helper into
  e2e/helpers.py (extract_html_body), now shared by both.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-15 13:46:03 -03:00
github-actions[bot]
d250383f78 chore: bump version to 0.6.4 2026-09-15 15:26:54 +00:00
a259aeeef7 Merge pull request #41 from Aignosi/fix/SIENTIAPDE-2011
SIENTIAPDE-2011: Compute query-time levels union / ignore_models_id intersection
2026-09-15 12:26:32 -03:00
Eduardo Rios
3d2a5ecc43 test: lock in that levels union replaces default_filter's level, not AND
Manual code-review pass (code-review-python checklist) flagged that no test
exercised default_filter already restricting level (e.g. Alerts' ERROR-only
default) combined with every active group specifying its own levels. The
replace-not-AND behavior is deliberate per SIENTIAPDE-2011's design doc and
ticket text, but was previously only covered by a docstring comment. Adds
test_compute_query_time_filter_union_replaces_default_level_restriction so a
future change reintroducing AND semantics fails a test instead of passing
silently.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-15 11:26:06 -03:00
Eduardo Rios
6479737dfb fix: harden ignore_models_id against explicit null, document levels-union design
Code review findings on the SIENTIAPDE-2011 PR:

- [Major] _compute_query_time_filter used group.get('ignore_models_id', [])
  for the intersection, whose default only applies when the key is missing.
  receiver_groups has no schema validation, so a document with
  ignore_models_id explicitly set to null (key present, value None) made
  .get() return None, and set(None) raised TypeError, crashing the whole
  activity for every mail type. Fixed with `group.get(...) or []`. Added a
  regression test.

- [Minor] CLAUDE.md:48 described Alerts' base data filter as always
  `level: ERROR`, which this ticket's own query-time union can now widen.
  Updated the line to reflect that.

- [Blocker, not applied] A finding argued the levels union should AND with
  default_filter's own level restriction instead of replacing it, to avoid
  widening Alerts (ERROR-only real-time channel) when a receiver_group sets
  broader levels. Both SIENTIAPDE-2011's ticket text and the parent design
  doc explicitly call for the union to replace the hard-coded ERROR-only
  default ("whatever levels the active groups actually care about"), so
  applying that fix would revert the subtask's actual purpose. The
  interim gap the finding correctly identifies (no per-group level filter
  exists yet until SIENTIAPDE-2012 lands) is now documented in
  _compute_query_time_filter's docstring instead of "fixed" by narrowing
  query-time behavior the ticket asked for.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-15 11:13:17 -03:00
Eduardo Rios
58c0bd4f2d SIENTIAPDE-2011: normalize notification timestamp in format_log_report
notification['timestamp'] crosses at least one Temporal activity
boundary (load_latest_data -> filter_notification_reports/alerts)
before reaching format_log_report. Temporal's default data converter
serializes datetime values to plain ISO-8601 strings without
restoring them on decode, and pymongo returns naive datetimes for
BSON Date fields, so the string can carry no UTC offset at all. That
broke export_data_to_postgres's strict to_datetime(..., format=
DATETIME_FORMAT_WITH_TZ) parsing downstream with:
  ValueError: time data "2024-06-01T12:00:00" doesn't match format
  "%Y-%m-%d %H:%M:%S%z"

Same underlying issue as SIENTIAPDE-2007/2009, fixed here using the
same pattern as SlotManager.put_last_data_timestamp: normalize with
pandas.to_datetime(..., utc=True) and re-format to
DATETIME_FORMAT_WITH_TZ before the value crosses the next boundary.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-15 09:35:25 -03:00
Eduardo Rios
ed666c260d fix: satisfy mypy in put_last_data_timestamp after utc=True normalization
CI mypy caught what my local environment couldn't (Python 3.14 has no
compatible numpy stub for the project's python_version=3.11 mypy target,
so mypy couldn't run locally at all):

  slot_manager.py:353: error: Incompatible types in assignment
    (expression has type "str", variable has type "Timestamp")
  slot_manager.py:368: error: Incompatible return value type
    (got "Timestamp", expected "str | None")

Reassigning `last_data_timestamp` from a Timestamp to its strftime() string
trips mypy's inference (it fixes an unannotated local's type from its first
assignment). Split into a separate `last_data_timestamp_str` for the string
form instead of reusing the name.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-15 08:18:17 -03:00
Eduardo Rios
14b854148a SIENTIAPDE-2011: add e2e coverage for query-time filter, fix stale e2e fixtures
e2e fixtures (default_notification, seed_last_timestamp, default_receiver_group)
still assumed the pre-SIENTIAPDE-2007 string-timestamp representation and the
old ignore_models field name, so the load_notification_package e2e suite was
failing independently of this ticket's changes:

- default_notification now seeds `timestamp` as a native datetime (matches
  production since SIENTIAPDE-2007's Notification.timestamp = now()).
- seed_last_timestamp now uses DATETIME_FORMAT_MS_WITH_TZ (matches what
  put_last_data_timestamp actually writes to Redis today).
- default_receiver_group's ignore_models renamed to ignore_models_id, per
  this ticket's decision.
- test_reports_main_workflow.py's explicit timestamp= call sites updated to
  match.

Also fixes a real production bug in put_last_data_timestamp (slot_manager.py)
surfaced by running the e2e suite against a real Temporal environment: Temporal's
default data converter serializes datetime values to ISO-8601 strings across
the activity boundary, and pymongo returns naive datetimes for BSON Date
fields, so `data['timestamp'].max().strftime(...)` crashed on a plain str.
Unit tests never caught this because they mock the activity boundary and
never cross real (de)serialization. Fixed by normalizing through
`pandas.to_datetime(..., utc=True)`, which handles native datetime/Timestamp
and offset-aware/naive ISO strings uniformly.

Adds test_load_package_query_time_filter_union_and_intersection, a new e2e
test exercising the actual SIENTIAPDE-2011 behavior end-to-end: union of
active groups' levels, intersection of their ignore_models_id, and the
requirement that a model ignored by only one of several active groups must
not be excluded from the fetch.

Note: test_reports_main_workflow.py / test_alerts_main_workflow.py still have
a separate, pre-existing failure in process_notifications.py (same family of
bug: a notification's timestamp field parsed with a fixed strptime format
after crossing the same Temporal serialization boundary) — confirmed present
on the unmodified baseline too, unrelated to this ticket, tracked separately.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-14 12:15:23 -03:00
Eduardo Rios
1711f3b0d1 SIENTIAPDE-2011: Compute query-time levels union / ignore_models_id intersection
Push level and model-exclusion filtering down to the Mongo query instead of
fetching the full notification_queue unfiltered on every run.

- Fix await ordering in load_notification_package so sending_configs (active
  receiver_groups) resolves before load_latest_data is called, letting the
  query filter be built from group data.
- Add _compute_query_time_filter: unions active groups' `levels` (falls back
  to the workflow's default filter if any group has no restriction, since
  that group wants every level) and intersects their `ignore_models_id`
  (a model is only safe to drop from the fetch if every active group
  ignores it).
- Add unit tests covering mixed groups, a model ignored by only one group
  (must not be excluded from the fetch), and the empty active-groups case.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-14 11:46:19 -03:00
ff7b441140 ci(deploy): Configure env_list_path as array in deploy workflow 2026-09-11 00:25:25 -03:00
github-actions[bot]
d12c89e1c5 chore: bump version to 0.6.3 2026-09-10 13:31:42 +00:00
Bruno Domingues
b933783e59 Merge pull request #40 from Aignosi/fix/SIENTIAPDE-2068
Configure Deploy Workflow for pyproject.toml Version Updates
2026-09-10 10:31:15 -03:00
d8ece5ea3c Merge branch 'main' into fix/SIENTIAPDE-2068 2026-09-10 10:26:37 -03:00
30fe5ff69c SIENTIAPDE-2068: Configure deploy workflow to update version in pyproject.toml 2026-09-10 10:20:41 -03:00
Bruno Domingues
0c63b68cdd Merge pull request #39 from Aignosi/fix/SIENTIAPDE-2068
feat(CI/CD): Migrate Orchestrator-Worker Deployment to Flow B
2026-09-09 23:30:52 -03:00
bfbc71bbfb SIENTIAPDE-2068: feat(cicd): migrate orchestrator-worker deploy to Flow B
- Delete release.yml (tarball-only, no deploy job).
- Add deploy.yml calling reusable-deploy-dataops.yml — mirror to Gitea,
  dual-bump GITHUB_BRANCH (development + chart-ref label branch), helmfile
  deploy. workflow_dispatch has no inputs: uses the picked branch as-is.
- Add require-chart-ref-label.yml (branch-protection check, wired separately).
2026-09-09 23:18:46 -03:00
cae514ebae Merge pull request #38 from Aignosi/fix/SIENTIAPDE-2009
SIENTIAPDE-2007  SIENTIAPDE-2007: Compare native datetime in load_latest_data $gt filter and bump sientia_do pin to 1.12.2
2026-09-09 11:07:38 -03:00
Eduardo Rios
3c69b35b3f fix: use DATETIME_FORMAT_MS_WITH_TZ instead of isoformat for last_data_timestamp
Addresses review feedback: prefer sientia_do's explicit datetime format
constant over Python's isoformat()/fromisoformat() when round-tripping
last_data_timestamp through Redis, matching the convention already used
elsewhere in mongo_db.py and slot_manager.py.
2026-09-09 10:54:22 -03:00
Eduardo Rios
2467d24188 style: fix ruff formatting in test_mongo_db.py
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-13 11:37:13 -03:00
Eduardo Rios
70f6a5d820 chore: ignore .obsidian/ directory
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-13 11:31:10 -03:00
Eduardo Rios
c3cd58028c SIENTIAPDE-2007 SIENTIAPDE-2007: Compare native datetime in load_latest_data $gt filter and bump sientia_do pin to 1.12.2
Notification.timestamp is now stored as a native BSON Date instead of a
string, so load_latest_data must parse the ISO string coming from Redis
back to datetime before building the $gt filter, or the comparison
silently breaks (BSON String vs Date always evaluates False). Also fixes
put_last_data_timestamp, which would otherwise raise TypeError trying to
json.dumps a pandas Timestamp when persisting the new watermark to Redis.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-12 13:53:01 -03:00
7352b1c1df chore(devops): Update CI quality gate workflow and add Claude AI guidance 2026-08-05 15:52:11 -03:00
817fcb90be Merge pull request #37 from Aignosi/feature/SIENTIAPDE-1646
Enhance Orchestration with Runtime Workflow Support and System Updates
2026-07-21 14:55:49 -03:00
cf3a367794 SIENTIAPDE-1646
SIENTIAPDE-1646: Refactor TemporalManager by extracting schedule update and task queue name building logic into dedicated helper methods.
2026-07-21 11:12:11 -03:00
a4b6f6aa88 SIENTIAPDE-1646
SIENTIAPDE-1646: Remove validate.sh script, refactor TemporalManager for improved readability, and update temporal schedule tests to explicitly define workflow types and align task queue naming conventions.
2026-07-21 10:17:30 -03:00
7b845a7de4 SIENTIAPDE-1646
SIENTIAPDE-1646: Update quality gate workflow to use dataops-module template.
2026-07-21 09:58:02 -03:00
292e84236c SIENTIAPDE-1646
SIENTIAPDE-1646: Configure quality gate workflow to use requirements-local.txt for dependency scanning.
2026-07-21 09:53:35 -03:00
9921fd1bcf SIENTIAPDE-1646
Merge branch 'main' into feature/SIENTIAPDE-1646
2026-07-21 08:06:45 -03:00
Bruno Domingues
23052e4f8c Merge pull request #36 from Aignosi/feature/SIENTIAPDE-1945
Remove Helm values.yaml configuration file
2026-07-10 11:51:24 -03:00
0e9608bcd1 SIENTIAPDE-1945: Remove values.yaml Helm configuration file 2026-07-08 22:13:09 -03:00
56e065d59c chore(sonar): Update project key 2026-07-01 21:15:32 -03:00
233a771e36 SIENTIAPDE-1646
SIENTIAPDE-1646 Update RUNTIME_WORKFLOWS in TemporalManager to include 'drift' and 'simple_metrics', expanding workflow capabilities and enhancing orchestration functionality.
2026-06-11 09:44:20 -03:00
c1e399894a SIENTIAPDE-1646
SIENTIAPDE-1646 Update RUNTIME_WORKFLOWS in TemporalManager to include 'minimal_retrain', enhancing workflow capabilities.
2026-06-10 14:12:34 -03:00
b0f9a1abe4 SIENTIAPDE-1646
Update helm upgrade command version in values.yaml from 0.6.5 to 0.6.6 for sientia-orchestrator-worker.
2026-05-25 16:37:35 -03:00
7b925069ac SIENTIAPDE-1646
SIENTIAPDE-1646 Update TemporalManager to consistently assign task queues for runtime workflows, enhancing schedule creation logic and ensuring proper handling of runtime names.
2026-05-25 14:46:50 -03:00
7413b70957 Merge branch 'feature/SIENTIAPDE-1646' of github.com:Aignosi/sientia-dataops-orchestrator_temporal into feature/SIENTIAPDE-1646 2026-05-25 10:13:03 -03:00
feca52a357 SIENTIAPDE-1646
SIENTIAPDE-1646 Add support for runtime workflows in TemporalManager by introducing RUNTIME_WORKFLOWS constant and updating schedule creation logic to handle runtime names appropriately.
2026-05-25 10:12:50 -03:00
30d558c299 Merge branch 'main' into feature/SIENTIAPDE-1646 2026-05-25 10:04:30 -03:00
08e28441dc SIENTIAPDE-1646
Update helm upgrade command version in values.yaml from 0.6.0 to 0.6.5 for sientia-orchestrator-worker.
2026-05-25 10:00:12 -03:00
5e918b458c SIENTIAPDE-1646
Update GITHUB_BRANCH in values.yaml to feature/SIENTIAPDE-1646, refactor mongo_db.py for cleaner code, and enhance worker.py by adding missing commas for improved syntax consistency.
2026-05-22 16:26:52 -03:00
474c2ef42c SIENTIAPDE-1646
Enhance orchestration configuration and documentation. Added `RUNTIME` variable to `.env.example`, updated `.gitignore` to exclude `openspec/` and `.cursor/`, and modified `README.md` to clarify queue naming conventions and runtime handling. Refactored activities to use synchronous database and email handling, improving performance and consistency. Updated test cases to reflect these changes and ensure compatibility with new activity definitions.
2026-05-22 15:02:16 -03:00
fa24a2fb85 Merge pull request #34 from Aignosi/fix/SIENTIAPDE-1712
SIENTIAPDE-1712: Enhance Error Handling and Configuration Alignment
2026-04-02 16:20:48 -03:00
4d5231ca16 SIENTIAPDE-1712
Add 'on_conflict' parameter to multiple test cases in test_orchestrator_functions.py for improved error handling consistency.
2026-04-01 13:53:53 -03:00
c4f221438b SIENTIAPDE-1712
Update GITHUB_BRANCH in values.yaml to fix/SIENTIAPDE-1712 for alignment with the latest bug fix efforts.
2026-03-27 14:53:55 -03:00
d0c37542f7 Merge branch 'main' into fix/SIENTIAPDE-1712 2026-03-27 14:11:17 -03:00
e7705964d5 SIENTIAPDE-1712
Fix error model retrieval in notification_generator.ipynb and add on_conflict parameter to common_config in orchestrator_functions.py for improved error handling.
2026-03-27 14:09:48 -03:00
e5a685eb90 Merge pull request #33 from Aignosi/feature/SIENTIAPDE-1478
SIENTIAPDE-1478: Orchestration Platform Enhancements, Worker Refactoring, and Documentation Updates
2026-01-23 13:48:12 -03:00
4f5832cfb3 SIENTIAPDE-1478
Update sientia-dataops-library dependency to version 1.8.2 in requirements.txt
2026-01-23 13:10:16 -03:00
7f8105dd1e SIENTIAPDE-1478
Fix spelling errors in poller behavior parameters in prepare_worker.py for consistency and clarity.
2026-01-21 15:42:36 -03:00
c9e3a15515 SIENTIAPDE-1478
Update sonar-project.properties to broaden coverage exclusions for worker files, enhancing code quality analysis.
2026-01-19 10:14:36 -03:00