5301b47f16
Stored credential secrets are encrypted with a key derived from ORCHESTRAD_SECRET_KEY. When that value changes, the secrets are intact but unreadable, and the only symptom was an opaque "decryption failed" surfacing deep inside an unrelated operation: "preview failed: building LDAP client: failed to decrypt credential: decryption failed" Nothing pointed at the real cause, so the error is now self-diagnosing: - ErrDecryptionFailed states that the data was encrypted under a different ORCHESTRAD_SECRET_KEY (or is corrupted). GCM auth failure on a well-formed ciphertext is overwhelmingly a wrong-key case. - The three credential decrypt sites name the credential, so the operator knows which password to restore or re-enter. - New services.CheckSecretKey verifies every stored secret against the current key. It runs at startup (LogSecretKeyCheck) and in `doctor`, so a mismatched key is reported once, loudly, at the moment it is first used rather than during the next rule run. A correctly-sized but *different* key passed doctor's existing length check and still broke every bind. Not fatal: the server still starts, since an operator may be mid-migration or may intend to re-enter the secrets. Verified on the demo instance: starting with a wrong key logs "1 of 1 stored credential secret(s) CANNOT be decrypted ... [OrchestrAD]", and the rule preview error now names both the credential and the key. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>