# Rollback Procedures

## General

1. Identify target version in `CHANGELOG.md` or git tag (`v0.1.0`, …).
2. `git status` — commit or stash unintended work before rollback.
3. Prefer **git revert** for shared history; use **reset --hard** only when explicitly instructed and no remote depends on the commits.

## VERSION 0.1.0 (baseline)

**Contains:** Documentation, rules, architecture ADR, empty application shell (no app code).

**Rollback to 0.1.0:**

```powershell
Set-Location "C:\Users\akfai\Downloads\Cursor Project\TradingBite-Platform"
git checkout v0.1.0
```

**Nuclear (delete entire new project tree):**

```powershell
# Only if explicitly instructed — removes all platform work
Remove-Item -Recurse -Force "C:\Users\akfai\Downloads\Cursor Project\TradingBite-Platform"
```

Does **not** affect `../TradingBite/` Pine legacy folder.

## Phase F5 rollback (from v0.10.0 to v0.9.0)

```powershell
Set-Location "C:\Users\akfai\Downloads\Cursor Project\TradingBite-Platform"
git checkout v0.9.0
```

Removes live engine, volume pane, and alert domain modules; F4.1 chart/drawings remain.

## Phase F4.1 rollback (from v0.9.0 to v0.8.0)

```powershell
Set-Location "C:\Users\akfai\Downloads\Cursor Project\TradingBite-Platform"
git checkout v0.8.0
```

Reverts F4.1 drawing foundation (21 tools, store fixes); F4 chart window remains at v0.8.0; warehouse DB unchanged.

## Phase F4 rollback (from v0.8.0 to v0.7.0)

```powershell
Set-Location "C:\Users\akfai\Downloads\Cursor Project\TradingBite-Platform"
git checkout v0.7.0
```

Removes chart window + drawing layer; warehouse DB unchanged.

## Phase F3 rollback (from v0.7.0 to v0.6.0)

```powershell
Set-Location "C:\Users\akfai\Downloads\Cursor Project\TradingBite-Platform"
git checkout v0.6.0
```

Removes multi-asset data layer; warehouse DB file on disk is unchanged.

## Phase F2 rollback (from v0.6.0 to v0.5.0)

```powershell
Set-Location "C:\Users\akfai\Downloads\Cursor Project\TradingBite-Platform"
git checkout v0.5.0
```

Removes S/R Finder port; F1 framework + SMA remain.

## Phase F1 rollback (from v0.5.0 to v0.4.0)

```powershell
Set-Location "C:\Users\akfai\Downloads\Cursor Project\TradingBite-Platform"
git checkout v0.4.0
```

Removes indicator framework; warehouse and chart MVP remain.

## Phase E rollback (from v0.4.0 to v0.3.0)

```powershell
Set-Location "C:\Users\akfai\Downloads\Cursor Project\TradingBite-Platform"
git checkout v0.3.0
```

Removes warehouse code; local `data/*.sqlite` files remain on disk unless you delete them manually.

## Phase D rollback (from v0.3.0 to v0.2.0)

```powershell
Set-Location "C:\Users\akfai\Downloads\Cursor Project\TradingBite-Platform"
git checkout v0.2.0
```

Restores Phase C single-symbol chart. Tag `v0.2.0` → commit `70c6e80` is unchanged.

## Phase C rollback (from v0.2.0 to v0.1.0)

If Phase C application work must be abandoned:

```powershell
Set-Location "C:\Users\akfai\Downloads\Cursor Project\TradingBite-Platform"
git checkout v0.1.0
```

This removes Phase C application files while preserving the documentation-only baseline at `bc3795f`. Tag `v0.1.0` is never deleted.

## Before risky changes (Phase C+)

1. Record current version in `PROJECT-STATUS.md`.
2. Commit with clear message or create annotated tag.
3. Document changed files in `CHANGELOG.md`.
4. Run tests/build; only then tag new version.

## Deployment failure

If a future deployment fails: **stop**. Do not stack experimental fixes on production. Roll back deployment artifact to last known good tag; investigate in a local branch.
