# Alpha50.6 Change Set

## Scope

Alpha50.6 introduces the first release-managed content administration layer for DigiDala and the first `competitive` campaign mode. The release is based on the verified `v0.4.0-alpha.50.5.9` checkpoint.

### Bot administration

- Administrative commands are available only in Telegram private chats.
- Authorization uses Telegram numeric user IDs stored in `bot_admins`.
- Roles: `content_admin` and `superadmin`.
- Initial superadmins are bootstrapped from the external `TELEGRAM_SUPERADMIN_IDS` environment variable.
- Administrative commands are intentionally absent from the public `/help` and Telegram command menu.
- Administrators can create/remove queued competitive campaigns, inspect the queue, edit the main bot message, edit the `О нас` message, and manage administrator roles (superadmin only).

### Public bot menu

The public message and keyboard are now data-driven. The main menu contains:

- `🪷 Открыть DigiDala`;
- `🎨 Малая мандала творчества`;
- `🎨 Большая мандала творчества`;
- `🏁 Мандалы состязаний`;
- `✨ Особые мандалы`;
- `ℹ️ О нас`;
- `⭐ Поддержать проект`.

`О нас` opens the editable about message in the private chat through `start=about`.

### Competitive Mandala

- mode: `competitive`;
- grid: 20×20 / 400 cells;
- 200 cells per side;
- price: fixed 10 Pix/cell;
- one occupied cell per Telegram user per cycle;
- left/right artwork side is determined by cell column;
- winner is the first side to occupy all 200 cells;
- no persistent team entities are introduced;
- free cells use the existing grayscale SVG marker.

### Artwork

Each competitive campaign uses two separate PNG files:

```text
left.png  1024×2048
right.png 1024×2048
```

They are rendered side-by-side as a single 2048×2048 composition. Files must be RGB/RGBA, 8-bit PNGs. Assets are stored outside release directories under `PIXDALA_CAMPAIGN_ASSETS_DIR` (default `/opt/pixdala/data/campaign-assets`).

### Lifecycle and archive

Queued competitive campaigns are activated server-side in creation order. After a competitive campaign is destroyed, its archive is created with `winner_side` and the next queued campaign is activated automatically. The existing campaign archive trace/participant/message model is reused. In the competitive archive, the winning artwork stays in color and the losing artwork is rendered in grayscale.

## Direct replacement/addition files

- `bot/bot.cjs`
- `bot/README.md`
- `apps/miniapp/app.js`
- `apps/miniapp/index.html`
- `apps/miniapp/styles.css`
- `package.json`
- `packages/backend/application/services.mjs`
- `packages/backend/repositories/bot-repository.mjs`
- `packages/backend/repositories/mandala-repository.mjs`
- `packages/backend/server.mjs`
- `packages/backend/migrations/015_competitive_campaigns_and_bot_admin.sql`
- `tests/integration/api.test.mjs`
- `tests/integration/backend.test.mjs`
- `CHANGELOG.md`
- `docs/PROJECT_STATE.md`
- `docs/PROJECT_CONTEXT.md`
- `docs/ROADMAP.md`
- `ALPHA50.6_CHANGESET.md`

No apply script is used. These are direct replacement/addition files for the repository.

## Verification in the preparation workspace

```text
Structure: OK
JavaScript syntax: OK
Unit: 10/10
Integration: 43/43
API: 17/17
Total: 70/70
```

Deployment and manual Telegram QA remain pending for the candidate.
