fix(followups): F3 - .mam.env BOM, repeated keys and a missing MAM_ENV_FILE

PR #43 review (grok):
(a) A UTF-8 byte-order mark at the start of the file made the first line an
    "invalid key", so its setting was dropped. The one parser (envfile.py,
    used by the wrapper and mqtt_common) now reads with utf-8-sig.
(b) A key given twice keeps its first value (a later line does not replace
    it). The behaviour is unchanged; .mam.env.example's FORMAT section and
    envfile.py's docstring now say so.
(c) MESSAGING.md said a MAM_ENV_FILE naming no file logs an error and makes
    connections fail closed. Both loaders skip it silently and refuse the
    ambient search; a file that exists but cannot be read is the error
    (EnvFileError, one ERROR line and rc 1). The text now says that.

Tests A7: BOM in both loaders, first-value-wins in both loaders plus the
FORMAT text, and a missing explicit file loading neither it nor the ambient
.mam.env without an error plus the MESSAGING text (all three fail at 0051fd6).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCGpJXhSZasJLU38ksDghe
This commit is contained in:
GodopuandClaude Opus 5.5 committed 2026-10-02 08:10:42 +09:00
1 parent 5edf913d22
commit 71ea8095c5
4 files changed
+52 -3

No files matched your search

+2
View File
@@ -21,7 +21,9 @@
# - `export KEY=...`, a key that is not [A-Za-z_][A-Za-z0-9_]*, a line
# without `=`, a line with a NUL byte, and bash's own variables (IFS, PS4,
# RANDOM, BASH_*, ...) are skipped with a warning naming the line number;
# - a UTF-8 byte-order mark at the start of the file is ignored;
# - a variable already set in the environment wins over this file;
# - a key given twice keeps its FIRST value (a later line does not replace it);
# - a file that exists but cannot be read is an error (the wrapper exits 1).
#
# SECURITY: never put real secrets in this template. Secret-bearing vars use a