[PR #395] [MERGED] Normalize dependencies in today workflow API payloads #698

Closed
opened 2026-03-13 21:04:32 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AJaySi/ALwrity/pull/395
Author: @AJaySi
Created: 3/6/2026
Status: Merged
Merged: 3/8/2026
Merged by: @AJaySi

Base: mainHead: codex/add-helper-to-normalize-task-dependencies


📝 Commits (1)

  • 2403d92 Normalize today workflow task dependencies payload

📊 Changes

1 file changed (+17 additions, -1 deletions)

View changed files

📝 backend/api/today_workflow.py (+17 -1)

📄 Description

Motivation

  • Ensure the dependencies field in API responses is consistently a list regardless of how it's stored on the model.
  • Prevent downstream callers and the indexing pipeline from receiving mixed types (None, string JSON, or list) for dependencies.

Description

  • Added a helper def _normalize_dependencies(dependencies: Any) -> list to backend/api/today_workflow.py that returns [] for None, returns lists unchanged, parses strings with json.loads (and falls back to [] on parse failure or if parsed value is not a list), and returns [] for other types.
  • Replaced direct uses of t.dependencies or [] with _dependencies = _normalize_dependencies(t.dependencies) in the today task payload builder so API responses always include a list under dependencies.
  • Also applied _normalize_dependencies(t.dependencies) to the yesterday task payload construction used for indexing to keep the indexing input consistent.

Testing

  • Ran python -m py_compile backend/api/today_workflow.py, which 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/395 **Author:** [@AJaySi](https://github.com/AJaySi) **Created:** 3/6/2026 **Status:** ✅ Merged **Merged:** 3/8/2026 **Merged by:** [@AJaySi](https://github.com/AJaySi) **Base:** `main` ← **Head:** `codex/add-helper-to-normalize-task-dependencies` --- ### 📝 Commits (1) - [`2403d92`](https://github.com/AJaySi/ALwrity/commit/2403d92f9d0f9c92cec7a66b5912d98668450cc5) Normalize today workflow task dependencies payload ### 📊 Changes **1 file changed** (+17 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `backend/api/today_workflow.py` (+17 -1) </details> ### 📄 Description ### Motivation - Ensure the `dependencies` field in API responses is consistently a list regardless of how it's stored on the model. - Prevent downstream callers and the indexing pipeline from receiving mixed types (None, string JSON, or list) for `dependencies`. ### Description - Added a helper `def _normalize_dependencies(dependencies: Any) -> list` to `backend/api/today_workflow.py` that returns `[]` for `None`, returns lists unchanged, parses strings with `json.loads` (and falls back to `[]` on parse failure or if parsed value is not a list), and returns `[]` for other types. - Replaced direct uses of `t.dependencies or []` with ` _dependencies = _normalize_dependencies(t.dependencies)` in the today task payload builder so API responses always include a list under `dependencies`. - Also applied ` _normalize_dependencies(t.dependencies)` to the yesterday task payload construction used for indexing to keep the indexing input consistent. ### Testing - Ran `python -m py_compile backend/api/today_workflow.py`, which completed successfully. ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69aafa65eacc8328a90bb877262cf77f) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-13 21:04:32 +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#698
No description provided.