# ALPHA50.9.16_CHANGESET

## DigiDala — Living Chat Mandala renderer/status follow-up

**Release:** `v0.4.0-alpha.50.9.16`
**Status:** local patch; staging QA required
**Production:** untouched

### Problem found in staging QA

`50.9.15` correctly updated Living Chat Mandala statistics, but the generated SVG status asset was malformed. The renderer appended `fill` attributes after the SVG self-closing slash, producing invalid XML such as `... fill-opacity="1"/ fill="...">`. Telegram therefore could not render the intended artwork.

### Fix

1. **SVG renderer**
   - Rewrites the existing template `<path .../>` tag safely.
   - Removes previous fill presentation attributes before adding the current unit color and progress opacity.
   - Preserves valid self-closing SVG markup.

2. **Telegram status**
   - Keeps SVG as the internal canonical render format.
   - Rasterizes the rendered SVG to PNG on the bot host.
   - Sends `/status` as `sendPhoto` with `chat-mandala.png`, so the Mandala is visible inline in the Telegram chat.

3. **Rasterization**
   - Uses ImageMagick via `magick`, with `convert` as fallback.
   - Intermediate files are created under the OS temp directory and removed after rendering.
   - No message text is written to these temporary files.

### Verification target

Before staging deployment, local technical checks must pass. Staging must also have ImageMagick available as either `magick` or `convert`.

Production remains untouched until staging Telegram QA passes.

### Completion lifecycle

4. **Living Chat Mandala lifecycle**
   - Adds explicit profiling → active → completed → archived state handling.
   - Adds automatic completion when Structure reaches 95% and Energy reaches 70%.
   - Adds administrator-only `⏹ Finish ritual` and `/finish` with confirmation.
   - Sends the final PNG, archives the finished game, and offers `🌱 Start a new mandala` in the same group.
   - `/status` can show the latest archived result when there is no active game.

5. **Localization**
   - Adds RU/EN localization for every new lifecycle label, button, confirmation, completion message and state label.
   - The existing per-user language preference remains unchanged.

Production remains untouched until the complete staging Telegram QA passes.
