Update task status
(
task_id: str,
status: str,
progress_json: Optional[Dict] = None
)
| 1853 | JOIN behavior_logs bl ON p.id = bl.paper_id |
| 1854 | WHERE bl.push_id = ? AND bl.action = 'pushed' |
| 1855 | ORDER BY bl.id ASC |
| 1856 | """, (push_id,)) |
| 1857 | |
| 1858 | papers = [_build_paper_dict(row) for row in cursor.fetchall()] |
| 1859 | papers.sort(key=lambda paper: (paper.get("rank", 10**9), paper.get("behavior_log_id", 10**9))) |
| 1860 | |
| 1861 | cursor.execute( |
| 1862 | """ |
| 1863 | SELECT metadata |
| 1864 | FROM behavior_logs |
| 1865 | WHERE push_id = ? |
| 1866 | AND action = 'push_empty' |
| 1867 | ORDER BY id DESC |
| 1868 | LIMIT 1 |
| 1869 | """, |
| 1870 | (push_id,), |
| 1871 | ) |
| 1872 | metadata_row = cursor.fetchone() |
| 1873 | push_metadata = _load_json_metadata(metadata_row["metadata"]) if metadata_row else {} |
| 1874 | if not push_metadata: |
| 1875 | push_metadata = _derive_push_metadata_from_papers(papers) |
| 1876 | |
| 1877 | conn.close() |
| 1878 | |
| 1879 | return { |
| 1880 | "push_id": push_id, |
| 1881 | "push_time": push_time, |
| 1882 | "papers": papers, |
nothing calls this directly
no test coverage detected