personal memory agent
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow adding todos to past days

Remove the past-date guard that prevented adding todos to days before today.
Three code paths enforced this restriction (CLI, tool function, UI template)
and one test asserted it — all updated.

Changes:
- apps/todos/call.py: Remove past-date rejection block, keep format validation
- apps/todos/tools.py: Remove past-date check, update docstring
- apps/todos/app_bar.html: Remove is_future_or_today guard, enable input for all days
- apps/todos/tests/test_call.py: Convert test_add_past_date_rejected to test_add_past_date_allowed
- apps/todos/muse/todos/SKILL.md: Remove "must be today or in the future" from --day docs
- apps/todos/tests/test_tools.py: Update stale comment about date validation

Note: make ci has one pre-existing failure in test_cortex_client.py unrelated to this change.

+11 -26
+1 -5
apps/todos/app_bar.html
··· 69 69 <!-- Use display:contents to make form invisible to flexbox --> 70 70 <form method="post" style="display: contents;"> 71 71 <input type="hidden" name="action" value="add"> 72 - {% set is_future_or_today = day >= today_day %} 73 72 <input 74 73 type="text" 75 74 name="text" 76 75 id="todo-add-input" 77 76 class="todo-add-input" 78 - placeholder="{% if not is_future_or_today %}Can't add todos to past dates{% elif selected_facet %}Add a todo to {{ facets|selectattr('name', 'equalto', selected_facet)|map(attribute='title')|first|default(selected_facet) }}...{% else %}Add a todo... (use #facet){% endif %}" 77 + placeholder="{% if selected_facet %}Add a todo to {{ facets|selectattr('name', 'equalto', selected_facet)|map(attribute='title')|first|default(selected_facet) }}...{% else %}Add a todo... (use #facet){% endif %}" 79 78 autocomplete="off" 80 - {% if not is_future_or_today %}disabled{% endif %} 81 79 > 82 80 </form> 83 81 ··· 90 88 title="Generate weekly todos with AI" 91 89 >✨</button> 92 90 93 - {% if is_future_or_today %} 94 91 <script> 95 92 (function() { 96 93 const input = document.getElementById('todo-add-input'); ··· 150 147 }); 151 148 })(); 152 149 </script> 153 - {% endif %} 154 150 155 151 <script> 156 152 (function() {
+1 -6
apps/todos/call.py
··· 107 107 day = resolve_sol_day(day) 108 108 facet = resolve_sol_facet(facet) 109 109 110 - # Reject past dates 111 110 try: 112 - todo_date = datetime.strptime(day, "%Y%m%d").date() 111 + datetime.strptime(day, "%Y%m%d") 113 112 except ValueError: 114 113 typer.echo(f"Error: invalid day format '{day}'", err=True) 115 - raise typer.Exit(1) 116 - 117 - if todo_date < datetime.now().date(): 118 - typer.echo(f"Error: cannot add todo to past date {day}", err=True) 119 114 raise typer.Exit(1) 120 115 121 116 try:
+1 -1
apps/todos/muse/todos/SKILL.md
··· 49 49 Add a new todo item. 50 50 51 51 - `TEXT`: todo text (positional argument). 52 - - `-d, --day`: day in `YYYYMMDD` (default: `SOL_DAY` env); must be today or in the future. 52 + - `-d, --day`: day in `YYYYMMDD` (default: `SOL_DAY` env). 53 53 - `-f, --facet`: facet name (default: `SOL_FACET` env). 54 54 55 55 Behavior notes:
+4 -3
apps/todos/tests/test_call.py
··· 88 88 assert "First" in result.output 89 89 assert "Second" in result.output 90 90 91 - def test_add_past_date_rejected(self, todo_env): 92 - """Adding to a past date fails.""" 91 + def test_add_past_date_allowed(self, todo_env): 92 + """Adding to a past date succeeds.""" 93 93 todo_env([], day="20200101") 94 94 result = runner.invoke( 95 95 call_app, 96 96 ["todos", "add", "Nope", "--day", "20200101", "--facet", "personal"], 97 97 ) 98 - assert result.exit_code == 1 98 + assert result.exit_code == 0 99 + assert "Nope" in result.output 99 100 100 101 def test_add_empty_text_rejected(self, todo_env): 101 102 """Adding empty text fails."""
+1 -1
apps/todos/tests/test_tools.py
··· 190 190 journal_copy = tmp_path / "journal" 191 191 shutil.copytree(FIXTURES_JOURNAL, journal_copy) 192 192 193 - day = "20991231" # Use future date to avoid date validation 193 + day = "20991231" # Use a future date 194 194 facet = "personal" 195 195 todos_dir = journal_copy / "facets" / facet / "todos" 196 196 todos_dir.mkdir(parents=True, exist_ok=True)
+3 -10
apps/todos/tools.py
··· 108 108 """Append a new unchecked todo entry using the next sequential line number. 109 109 110 110 Args: 111 - day: The day this item is due on in ``YYYYMMDD`` format, must always be today or in the future. 111 + day: The day this item is due on in ``YYYYMMDD`` format. 112 112 facet: Facet name (e.g., "personal", "work"). 113 113 line_number: Expected next line value; must be ``current_count + 1``. 114 114 text: Body of the todo item. Time can be included as ``(HH:MM)`` suffix. ··· 118 118 or an error payload if validation fails. 119 119 """ 120 120 try: 121 - # Validate that the day is not in the past 121 + # Validate day format 122 122 try: 123 - todo_date = datetime.strptime(day, "%Y%m%d").date() 124 - today = datetime.now().date() 125 - if todo_date < today: 126 - today_str = today.strftime("%Y%m%d") 127 - return { 128 - "error": f"Cannot add todo to past date {day}", 129 - "suggestion": f"todos can only be added to today ({today_str}) or future days", 130 - } 123 + datetime.strptime(day, "%Y%m%d") 131 124 except ValueError: 132 125 return { 133 126 "error": f"Invalid day format '{day}'",