Publishing 0.1.13: AI translation no longer crashes on an empty answer
Publishing 0.1.13 fixes the AI translation of posts when the AI provider answers with no text at all. The response parser expected text and crashed when it got nothing, which a provider returning an empty content can cause.
Now an answer that is not text gives an empty result instead of a crash, and a warning is written to the log, so an operator can see that a blank translation was stored. The warning describes only the type of the answer, never its contents, so it cannot leak personal data or API keys into the logs.
No change otherwise. Update the dependency; there is nothing to configure.
Full release notes: Publishing 0.1.13
0.1.13 · 22 May 2026
PR #20 — restore a defensive non-binary fallback in TranslatePostWorker.parse_translated_response/1, plus a follow-up that tightens the log-safe type descriptor.
Fixed
TranslatePostWorker.parse_translated_response/1no longer raisesFunctionClauseErroron non-binary input. After PR #19 delegated parsing to core’sTranslation.parse_response/2(guarded byis_binary/1), thedef-public function could crash when handednil/ atom / number / map by a test or external caller — andAI.extract_content/1can itself surface{:ok, nil}when a provider returns a nullcontent. A guardedwhen is_binary(response)clause now owns the parse path; a catch-all clause fails closed with the empty-tuple shape{"", nil, ""}and emits aLogger.warningso a production occurrence (which would persist a blank translation row) is operator-visible.- The
describe_type/1log helper reports only a value’s type/shape — never its contents — to avoid leaking PII / API keys from pathological inputs, and uses aproper_list?/1guard so it doesn’t itself crash on improper lists (length/1raisesArgumentErroron[:a | :b]).
Changed
describe_type/1now uses a literalnilhead instead of anis_nil/1guard, and gained anis_bitstring/1clause so a non-byte-aligned bitstring (e.g.<<1::3>>, which is not anis_binary/1match) logs asbitstringrather thanunknown.- Locked transitive dependencies:
etcher 0.4.8,fresco 0.5.5,ex_doc 0.40.3.
Publishing 0.1.13. Install or update: {:phoenix_kit_publishing, "~> 0.1"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.