mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-09-16 21:02:35 +00:00
Follow-up to the PR #254 integration fixes, from an xhigh review of the merged branch. Five of fourteen findings; the other nine are written up in .scratch/pr254-deferred-review-findings.md (untracked). - Re-raise CancelledError from resolve_template_async. gather's `return_exceptions=True` captures it like any other exception, so the BaseException branch was swallowing it: a render cancelled during shutdown logged "shortening failed" and carried on to transmit. - Warn once per template, not once per render. The unresolved-template warning runs on the inbound message path, so a shorten_url filter in Test_Command.response_format wrote a WARNING per matching message, unthrottled, to a rotating 5 MB log. - Add a `urlencode` filter. A quoted literal substitutes nested fields verbatim, which is right for prose and wrong for URLs: `sender` is whatever a remote node advertises, and an unencoded `&`, `#` or space rewrote the query, truncated at a fragment, or malformed the link that was then POSTed to the shortener. `/` is encoded too, since an interpolated field is one path segment. - Distinguish the two ways shortening can be unavailable. A template needing resolution with no config now warns at the resolver instead of returning {} indistinguishably from "nothing to do"; a pre-pass that ran but could not shorten logs at debug, since that is transient network trouble rather than a misconfiguration and must not escalate on the message path. - Cover the path_command wiring. _format_path_reply_prefix is the only place the pre-pass is called and had no test, so a dropped `await` or a missing `shortened=` would have disabled shortening silently. The warn-once cache is module state, so its test fixture is autouse: without it a test that renders an unresolved template suppresses the warning in whichever test runs next, which is an order-dependent failure. Every template shipped in config.ini.example still renders identically to the regex parser this replaced.