## 2026-07-24 - Q4.2 calendar history Bridge and stable deduplication
- Phase: Q4.2 memory temporal fields and calendar linkage
- Type: API contract / behavior / test
- Symptom: calendar status updates could be mixed with chat or operations facts, and repeated sync could overwrite the first ingestion timestamp.
- Root cause: CalendarStore belongs to the companion plugin; the memory side lacked a dedicated historical layer, stable event key, and an insert-time preservation rule.
- Fix/workaround: added `record_calendar_event`; stored `memory_type=calendar_event`, `memory_layer=calendar_history`, source and time metadata; derived a stable memory id from `event_id`; SQLite conflict updates now exclude `created_at` and update status plus `updated_at` only.
- Prevention rule: calendar linkage uses only the standard Bridge; dynamic age is computed at retrieval time; one event id reuses one memory id; current operations facts still come from Controller/NAS Ops.
- Validation evidence: `tests.test_calendar_bridge`, temporal, Bridge and panel regression tests passed; the focused test verifies `created_at` preservation, `updated_at` change, layer isolation and no persisted `age_seconds`.
## 2026-07-24 - PowerShell stdin can corrupt Chinese source literals
- Phase: Q4.2 implementation and encoding repair
- Type: build / environment
- Symptom: Chinese literals added through a PowerShell Python here-string became question marks.
- Root cause: the command channel code page is not a reliable UTF-8 transport for Chinese script stdin.
- Fix/workaround: all source reads and writes use explicit Python UTF-8; edit scripts use Unicode escapes or `chr()` for Chinese; post-write scans check for question marks and `py_compile`.
- Prevention rule: never use PowerShell default encoding to write Chinese source; always verify UTF-8 readability, compilation and `git diff --check`.
- Validation evidence: modified Python files read as UTF-8 and pass compilation and focused tests.
## 2026-07-24 - Full discovery includes an unrelated companion dependency
- Phase: full regression validation
- Type: test / environment
- Symptom: full `unittest discover` ran 137 test entries, with 136 passing and `test_security_cache` failing during collection because it imports the ordinary companion branch and the environment has no `astrbot` package.
- Root cause: the existing test module resolves `page_api` from `astrbot_plugin_private_companion-main`; this ops-only task must not modify that branch, and the local unit-test environment does not provide AstrBot runtime dependencies.
- Fix/workaround: kept the ordinary branch unchanged; validated all relevant ops, temporal, Bridge, storage, injection and panel tests separately, and will run discovery excluding only this unrelated module.
- Prevention rule: separate pure unit tests from host-runtime integration tests; do not treat a host dependency collection error as a product regression.
- Validation evidence: focused suite passed 16/16; `compileall -q core tests` and `git diff --check` passed.