# Release v0.2.0

## Highlights

This release introduces instance lifecycle improvements, a new database reset command, CLI hostname support, and proper Docker image versioning.

## New Features

### FLUSH_ALL Operation
- New `FLUSH_ALL` command to clear all instances and machine definitions from the database
- Gated by `storage.allow_flush_all` config option (default: `false` for safety)
- Configurable via YAML (`storage.allow_flush_all: true`) or env var (`RSTMDB_ALLOW_FLUSH_ALL=true`)
- CLI: `rstmdb-cli flush-all`
- Returns count of removed instances and machines

### Instance Re-creation After Deletion
- Deleted instances can now be re-created with the same ID (creates a fresh instance)
- Controlled by `storage.allow_instance_recreate` config option (default: `true`)
- Configurable via YAML or env var (`RSTMDB_ALLOW_INSTANCE_RECREATE`)

### CLI Hostname Resolution
- `--server` flag now accepts hostnames like `localhost:7401`, not just IP addresses
- Prefers IPv4 when both IPv4 and IPv6 addresses are available

## Bug Fixes

### Instance Deletion Now Works Correctly
- `GET_INSTANCE` now returns `INSTANCE_NOT_FOUND` for soft-deleted instances (previously returned the deleted instance)
- `APPLY_EVENT` now rejects events on deleted instances with `INSTANCE_NOT_FOUND`
- `LIST_INSTANCES` already correctly excluded deleted instances (unchanged)

### Null Params Handling
- `LIST_INSTANCES` and `WATCH_ALL` no longer fail when called without parameters
- Server now falls back to defaults when `params` is `null` on the wire

### Docker Build
- Updated Rust base image from pinned `1.83` to rolling `rust:1-slim-bookworm` to avoid `cargo-chef` dependency breakage
- Release workflow now properly tags Docker images with semver (`0.2.0`, `0.2`, `0`, `latest`)

### Release Packaging
- `rstmdb-cli` binary is now included in all release artifacts (tarballs, zips, DEB, RPM)
- Previously only the `rstmdb` server binary was packaged

## Configuration Changes

### New Options

| Config Path | Env Variable | Default | Description |
|-------------|-------------|---------|-------------|
| `storage.allow_instance_recreate` | `RSTMDB_ALLOW_INSTANCE_RECREATE` | `true` | Allow re-creating instances after deletion |
| `storage.allow_flush_all` | `RSTMDB_ALLOW_FLUSH_ALL` | `false` | Allow the FLUSH_ALL operation |

### Protocol Changes

- New operation: `FLUSH_ALL` (requires server config to enable)
- No breaking changes to existing operations

## Documentation

- Added doc tests across all crates (19 doc tests covering core APIs)
- Updated configuration reference with new options
- Updated API docs for `DELETE_INSTANCE` behavior and `FLUSH_ALL`
- Updated CLI reference with hostname support and `flush-all` command
- Added instance re-creation examples to concepts guide

## Testing

- 204+ unit/integration tests passing across all workspace crates
- 19 doc tests covering public API examples
- New test coverage for:
  - Instance deletion lifecycle (delete, get, apply, list)
  - Instance re-creation (allowed and disallowed)
  - FLUSH_ALL (enabled, disabled, empty database, recreate after flush)
  - Null params handling for LIST_INSTANCES and WATCH_ALL

## Upgrade Notes

- **No breaking changes** — all existing APIs remain compatible
- Soft-deleted instances that were previously visible via `GET_INSTANCE` will now return `INSTANCE_NOT_FOUND` (this is the correct behavior)
- Default config enables instance re-creation (`allow_instance_recreate: true`) and disables flush (`allow_flush_all: false`)
- Update your config files to include the new options if desired (see `config.example.yaml`)

## Installation

### Binary Downloads

Download from the [GitHub Releases](https://github.com/rstmdb/rstmdb/releases/tag/v0.2.0) page. Each archive includes both `rstmdb` (server) and `rstmdb-cli`.

### Docker

```bash
docker pull rstmdb/rstmdb:0.2.0
```

### DEB (Debian/Ubuntu)

```bash
sudo dpkg -i rstmdb_0.2.0_amd64.deb
```

### RPM (RHEL/Fedora)

```bash
sudo rpm -i rstmdb-0.2.0-1.x86_64.rpm
```
