## 2026-07-27 - Detail enhancement defaults and Windows deployment
- Phase: D1 implementation and VM deployment tooling.
- Type: feature behavior / deployment / testing.
- Symptom: schema, runtime fallback, and VM persisted config could independently retain `enable_detail_enhancement=False`; the Bash deploy script depended on an SSH alias and `pytest`.
- Root cause: new-install defaults, the flat persisted value, and the nested `schedule_detail_config` persisted value are separate paths; startup migration can copy the nested value back over the flat one; the script also assumed a Unix developer environment.
- Fix or workaround: set all three defaults to `true`; after stopping AstrBot, deploy writes the VM JSON config before startup; Bash accepts `VM`, `SSH_KEY`, `SSH_PORT`, `PYTHON_BIN`, `SKIP_LOCAL_TESTS`, and `DETAIL_ENHANCEMENT_ENABLED`; add `ops/deploy-plugin.ps1`.
- Prevention rule: configuration switches must be checked at schema, runtime fallback, and production persistence layers; cross-machine deploy commands must make SSH and test-runtime dependencies explicit.
- Validation evidence: `python -m unittest discover -s tests -q` passed 250 tests; commits `d8a5c18`, `c3d7151`, and `6f1a80c` were pushed; final VM verification found `FLAT=True`, `NESTED=True`, matching `main.py` and schema hashes, `active`, and `NRestarts=0`.
## 2026-07-27 - Unified person contract cannot infer a cross-platform identity from legacy aliases
- Phase: OPS unified person P0 contract and migration foundation.
- Type: API contract / privacy / data migration.
- Symptom: the previous private-user alias compatibility setting can look like an identity-link source, but its old format has no immutable Bot, adapter, or subject namespace evidence.
- Root cause: legacy `private_user_aliases` was designed to merge local private delivery records, before the five-part identity key and explicit owner-controlled merge policy existed.
- Fix or workaround: contract identity keys now use `ops-origin-v1:<sha256(canonical normalized identity)>`, require all five identity dimensions, and migration stores legacy aliases only as `legacy_alias_candidates`. It does not create an `identity_link` from them.
- Prevention rule: only an explicit administrator merge with audit evidence may link identities. Nicknames, weak aliases, bare platform IDs, device IDs, and old delivery aliases are never cross-platform binding proof.
## 2026-07-27 - Person lifecycle needs explicit owner and primary-identity safeguards
- Phase: P1 companion person registry and identity lifecycle.
- Type: authorization / data integrity / rollback.
- Symptom: a generic authorized lifecycle request could otherwise attach or detach identities from an owner profile; detaching a profile's primary or final active identity could leave an invalid projection.
- Root cause: P0 established the read-only contract but did not yet have a lifecycle service enforcing owner-specific authorization or active-link cardinality.
- Fix or workaround: registry mutations require operation IDs and emit fixed result fields/audit evidence. Owner link, unlink, merge, and split require `owner_authorized`; unlinking the final active link is rejected; primary-link unlink deterministically promotes another active key.
- Prevention rule: never infer person binding from names or aliases; never expose a profile whose resolved identity is inactive; lifecycle changes must be copy-on-write, retry-safe, and reversible only from their recorded operation evidence.
- Type: data integrity / reversible lifecycle / concurrency safety.
- Symptom: `split_merged_people` required the target profile to remain untouched after merge and restored the entire target snapshot. A harmless later target update therefore either blocked a valid split or would be lost if the guard were relaxed.
- Root cause: the merge snapshot mixed source provenance with target rollback state, while target updates have no reason to belong to the identity mapping being reversed.
- Fix or workaround: record merge revision and merge-added aliases as provenance; split validates merge-owned moved links and overlay person/origin/merge provenance before mutation, restores only the source and moved resources, and removes only merge-owned target additions. For overlays it rolls back only `person_id`, `origin_person_id`, and `merge_operation_id`, preserving independent post-merge policy state. The current target profile otherwise remains authoritative. Changed, re-bound, or deleted moved links return `split_conflict` without partial writes.
- Prevention rule: reversible operations may restore only resources they can prove they own. Never replace an aggregate target record from an old snapshot when independent updates can occur after the original operation.
- Symptom: direct `MemoryCompanion.compose_context` calls carried ordinary session IDs but no frozen unified-person projection, while the runtime had no canonical companion-instance or subject-namespace source.
- Root cause: P0 exposed read-only resolve APIs but deliberately did not invent deployment identity dimensions; the feature-context adapter never supplied an explicit five-part identity.
- Fix or workaround: add empty-by-default `unified_person_companion_instance_id` and exact `adapter_instance_id=subject_namespace` configuration. Resolve the event platform kind/name through `_preferred_platform_instance_id` and reject ambiguous instances; then resolve only the current event Bot, exact adapter, and sender. Inject projection/source only for an active exact link with `verified` or `explicit_linked` assurance.
- Prevention rule: plugin names, UMO prefixes, platform labels, nicknames, and bare IDs are not substitutes for configured identity dimensions. Missing, pending, mismatched, or low-assurance inputs must omit person authority.
- Validation evidence: `tests.test_p2_unified_person_bridge` covers the real compose call, configuration defaults, resolved and fail-closed counterexamples without changing the P0 fingerprint.