Skip to content

tech-debt: normalize inline datetime.now(utc).isoformat() onto utc_timestamp() (#12726) - #12834

Merged
mrveiss merged 3 commits into
Dev_new_guifrom
issue-12726
Jul 27, 2026
Merged

mrveiss merged 3 commits into
Dev_new_guifrom
issue-12726

Conversation

@mrveiss

@mrveiss mrveiss commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Thinking Path

Picked as an unblocked, purely mechanical issue. utc_timestamp() (autobot_shared/time_utils.py:49) is literally datetime.now(timezone.utc).isoformat(), so this is a consistency change with no behaviour delta — confirmed by comparing output formats including the +00:00 suffix.

The canonical definition itself is deliberately untouched: rewriting time_utils.utc_timestamp() to call itself would be infinite recursion.

What Changed

100 inline call sites across 44 files replaced with the canonical helper, imports added where missing.

Three things a blind find/replace would have shipped

Worth listing, because each was caught by verification rather than by the edit step:

1. A SyntaxError. My import-insertion regex matched the opening line of a multi-line from autobot_shared.tracing import ( block and inserted inside the parentheses, breaking initialization/lifespan.py (E999). flake8 caught it; the replace step had no idea. Every changed file is now AST-parsed.

2. Newly-unused imports. Removing the last inline use orphaned from datetime import datetime, timezone in 24 files — including two function-local (indented) imports that a top-level-only regex missed. Cleaned iteratively, driven by flake8 F401 output rather than guesswork, and only where genuinely unused: files still using datetime elsewhere keep it.

3. A comment-only rewrite. In drift_checker_test.py the sole occurrence was inside a comment, so the sweep edited prose and added an import nothing used. That file is reverted — a sweep should change code, not commentary.

Verification

flake8  (all 44 changed files):  0 findings
isort   --check-only:            clean
black   --check:                 44 files unchanged
AST parse:                       all 44 files OK

knowledge/backends/ + api/desktop_control_lock_test.py
  this branch: 38 failed, 63 passed
  baseline:    38 failed, 63 passed     ← byte-identical

Those 38 are pre-existing chromadb-unavailable failures, present unmodified on Dev_new_gui.

Model Used

Claude Opus 5 (1M context)

Closes #12726

…mestamp() (#12726)

100 inline call sites across 44 files replaced with the canonical helper
(autobot_shared/time_utils.py:49), which is literally the same expression — so
this is a pure style/consistency change with no behaviour delta. Verified the
formats match, including the '+00:00' suffix.

The canonical definition itself is deliberately untouched: rewriting
time_utils.utc_timestamp() to call itself would be infinite recursion.

Three things this sweep turned up that a blind find/replace would have shipped:

1. SyntaxError. My import-insertion regex matched the OPENING line of a
   multi-line `from autobot_shared.tracing import (` block and inserted inside
   the parentheses, breaking initialization/lifespan.py (E999). Caught by
   flake8, not by the replace step. Every changed file is now AST-parsed.

2. Newly-unused imports. Removing the last inline use left `from datetime
   import datetime, timezone` orphaned in 24 files — including two
   FUNCTION-LOCAL (indented) imports that a top-level-only regex missed.
   Cleaned iteratively, driven by flake8 F401 output rather than guesswork, and
   only where genuinely unused (files still using datetime elsewhere keep it).

3. A comment-only rewrite. In drift_checker_test.py the sole occurrence was
   inside a comment, so the sweep edited prose and added an import nothing used.
   That file is reverted — the sweep should change code, not commentary.

Verification: flake8 clean (0 findings) across all 44 changed files; isort and
black clean; every file AST-parses. knowledge/backends + desktop_control_lock:
38 failed / 63 passed — byte-identical to an unmodified tree (pre-existing
chromadb-unavailable failures).

Closes #12726
@github-actions

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant