|
21 | 21 |
|
22 | 22 | import json |
23 | 23 | import logging |
| 24 | +from datetime import date |
24 | 25 | from pathlib import Path |
25 | 26 | from typing import Any, Dict, List, Optional |
26 | 27 |
|
|
34 | 35 |
|
35 | 36 | from .conftest import scholar_entry_body |
36 | 37 |
|
| 38 | +# Inline seed entries must be dated TODAY, not a fixed calendar date: a |
| 39 | +# hardcoded date ages past DECAY_AGE_DAYS, after which the Scholar review's |
| 40 | +# opportunistic decay sweep archives the seed entry mid-test (a time-bomb that |
| 41 | +# broke these tests on 2026-06-19, 31 days after the old 2026-05-19 literal). |
| 42 | +_TODAY = date.today().isoformat() |
| 43 | + |
37 | 44 |
|
38 | 45 | @pytest.fixture(autouse=True) |
39 | 46 | def _isolated_home(tmp_path: Path, monkeypatch: pytest.MonkeyPatch): |
@@ -354,7 +361,7 @@ def test_review_repairs_phantom_index_row(monkeypatch, tmp_path): |
354 | 361 | (k / "global" / "python" / "use-uv.md").write_text( |
355 | 362 | "---\nid: use-uv\ntype: lesson\nscope: global\nstatus: provisional\n" |
356 | 363 | "confidence: 0.7\napplies-when: |\n x\nkeywords: [a, b, c]\n" |
357 | | - 'title: "use-uv"\ncreated: 2026-05-19\nupdated: 2026-05-19\n' |
| 364 | + f'title: "use-uv"\ncreated: {_TODAY}\nupdated: {_TODAY}\n' |
358 | 365 | "fired: 0\nfired-helpful: 0\nsources:\n - manual\n---\n\n# uv\n\nUse uv always for python.\n", |
359 | 366 | encoding="utf-8", |
360 | 367 | ) |
@@ -729,7 +736,7 @@ def test_end_to_end_proposal_approved_writes_entry_to_knowledge_dir( |
729 | 736 | "applies-when: |\n testing a service with a factory\n" |
730 | 737 | "keywords: [test, stub, factory]\n" |
731 | 738 | 'title: "Stub the factory"\n' |
732 | | - "created: 2026-05-19\nupdated: 2026-05-19\n" |
| 739 | + f"created: {_TODAY}\nupdated: {_TODAY}\n" |
733 | 740 | "fired: 0\nfired-helpful: 0\nsources:\n - manual\n" |
734 | 741 | "---\n\n# Stub the factory\n\nBody sentence long enough to pass.\n" |
735 | 742 | ) |
@@ -795,7 +802,7 @@ def _seed_library_with_broken_link(k: Path, *, broken: str = "global/ghost/never |
795 | 802 | entry.write_text( |
796 | 803 | "---\nid: narr\ntype: lesson\nscope: global\nstatus: provisional\n" |
797 | 804 | "confidence: 0.7\napplies-when: |\n x\nkeywords: [a, b, c]\n" |
798 | | - 'title: "narr"\ncreated: 2026-05-19\nupdated: 2026-05-19\n' |
| 805 | + f'title: "narr"\ncreated: {_TODAY}\nupdated: {_TODAY}\n' |
799 | 806 | "fired: 0\nfired-helpful: 0\nsources:\n - manual\n---\n\n" |
800 | 807 | f"# narr\n\nThis references [[{broken}]] in a sentence we keep.\n", |
801 | 808 | encoding="utf-8", |
@@ -950,7 +957,7 @@ def _entry_frontmatter(id_: str) -> str: |
950 | 957 | return ( |
951 | 958 | f"---\nid: {id_}\ntype: lesson\nscope: global\nstatus: provisional\n" |
952 | 959 | "confidence: 0.7\napplies-when: |\n x\nkeywords: [a, b, c]\n" |
953 | | - f'title: "{id_}"\ncreated: 2026-05-19\nupdated: 2026-05-19\n' |
| 960 | + f'title: "{id_}"\ncreated: {_TODAY}\nupdated: {_TODAY}\n' |
954 | 961 | "fired: 0\nfired-helpful: 0\nsources:\n - manual\n---\n\n" |
955 | 962 | f"# {id_}\n\nA real body sentence that is clearly long enough.\n" |
956 | 963 | ) |
|
0 commit comments