# Release Notes

All notable changes to the Weknow system will be documented in this file.

## [0.3.0] - 2026-06-23

### Module Versions
- **host-agent**: v0.3.0
- **cloud-agent**: v0.3.0
- **apiserver**: v0.3.0

### Changes

#### System Upgrade & Maintenance
- **Feature**: Added SQLite-backed upgrade history tracking to `host-agent`, logging upgrade outcomes (`SUCCESS` / `FAILED`) upon completion.
- **Feature**: Implemented `GET /v1/system/upgrade/history` to query upgrade records.
- **Feature**: Created command line helper tool `tools/upgrade_cli.py` to check system updates, inspect progress, view upgrade history, and trigger upgrades.
- **Feature**: Restricted standalone release notes to the `full` package only, uploading `RELEASE_NOTES.md` under `full/{version}/` and completely removing `version.json` from the release system.
- **Fixed**: Fixed `upgrade.sh` routing logic where specifying `--module full` fell through to incremental comparison instead of downloading the unified full package.
- **Fixed**: Enforced a thread-safe immediate state update lock inside `trigger_upgrade` to block concurrent duplicate upgrade requests.

#### Architecture Decoupling
- **Feature**: Decoupled the legacy monolithic `agent` into two separate microservices: `host-agent` (running as a systemd service) and `cloud-agent` (running containerized under Docker).
- **Feature**: Configured explicit image tag versioning (e.g. `0.3.0`) for both `apiserver` and `cloud-agent` to replace mutable `latest` tags.

#### Host Agent & Edge Gateway
- **Feature**: Built a single-file compiled binary for `host-agent` using PyInstaller to speed up deployment and reduce dependency footprint.
- **Feature**: Updated packaging script (`build_upgrade_package.sh`) to support full system microservice packaging.

#### Testing (E2E)
- **Feature**: Refactored `test_02_device_active.py` to read `wn_num` from the `E2E_WN_NUM` environment variable to prevent MQTT Client ID conflicts during multi-board testing.
- **Feature**: Added onboarding automation workflow and rules integration.

## [0.2.7] - 2026-06-19

### Module Versions
- **Agent**: v0.2.0
- **Apiserver**: v0.2.0

### Changes

#### Agent (v0.2.0)
- **Feature**: Migrated factory configuration fields (`sn`, `productName`, `productModel`, `wifi_ssid`, `wifi_password`) from SQLite database to Rockchip Vendor Storage (ID 16).
- **Feature**: Enforced a strict write-once constraint on Vendor Storage ID 16.
- **Feature**: Required atomic submission of all 5 factory fields via serial UART `WRITE` command.
- **Removed**: Removed serial UART command configuration and storage support for `api_url`.
- **Refactor**: White-listed factory configuration HTTP routes in DB recovery middleware, bypassing 503 errors during factory reset.

#### Apiserver (v0.2.0)
- **Feature**: Added read-only `GET /v1/system/factoryInfo` endpoint, proxying to the agent identity endpoint with 503 error handling (wifi_password is now exposed for local services).
- **Removed**: Removed redundant `wn_sn` field from `WNMetaData` model, DB schema, and API requests/responses.
- **Refactor**: Refactored `updateMetaData` API to support partial updates (skipping null fields instead of applying default empty strings).

#### Documentation
- **Feature**: Added `integration_guide_factory_info.md` to document Vendor Storage behavior, serial commands, and migration strategies.
- **Refactor**: Merged `doc` directory into `docs` directory to unify documentation structure.

#### Testing (E2E)
- **Feature**: Added Vendor Storage backup and restoration in E2E tests to prevent overwriting physical board SNs.
- **Feature**: Added adversarial testing for missing parameters during serial UART writes.
- **Refactor**: Replaced hardcoded `time.sleep()` waiting with robust HTTP polling to eliminate flaky test failures.
- **Fixed**: Fixed a false positive vulnerability in `test_01_factory_reset.py` where tests silently passed if pre-reset state could not be fetched.

## [0.2.6] - 2026-06-08

### Module Versions
- **Agent**: v0.1.3
- **Apiserver**: v0.1.0
- **Media**: v0.1.5
- **Device (edgex)**: v3.1.1
- **Support**: v0.1.2

### Changes

#### Agent (v0.1.3)
- **Fixed**: Wi-Fi AP configuration failure (`failed to configure Wi-Fi AP`) after factory reset. Stale inactive NetworkManager profiles (device listed as `--`) are now queried and cleaned up by their UUIDs prior to creating the new profile to prevent duplicate connection conflicts.
