All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
income streams, Sankey cashflow, progress overlay, settings sub-pages
Wave 1 (9 features across 4 streams):
Stream A — dashboard skeleton
1.A.1 ScenarioShell with top tabs (Plan/Cash Flow/Tax Analytics/Compare/
Reports/Estate/Settings) + left Sidebar with Plans switcher.
1.A.2 GET /scenarios/{id}/year-stats?year=N returning per-year metrics
(NW, Δ NW, taxable income, taxes, eff. rate, spending, contribs,
investment growth). YearScrubber + YearStatsPanel render the
right-hand sidebar; URL ?year= preserves selection.
1.A.3 FanChart gains optional `milestones` prop (lib/milestone.ts maps
life_event.kind → emoji) + selectedYear marker line.
Stream B — goals + progress
1.B.1 New goals_eval module: target_nw_by_year / never_run_out /
target_real_income probability evaluation. Wired into POST
/simulate (exact, per-path) and GET /scenarios/{id}/projection
(approximated from persisted fan via percentile interpolation).
GoalsSection renders pass/fail badges.
1.B.2 GET /scenarios/{id}/progress overlays AccountSnapshot totals on
the projection fan; ProgressPage shows variance side-panel.
Stream C — income + cashflow
1.C.1 New IncomeStream model + alembic 0003 + CRUD endpoints. Engine
aggregates streams into per-year inflows + taxable arrays;
income tax routes through the jurisdiction tax engine.
IncomeStreamsSection on Plan tab.
1.C.2 GET /scenarios/{id}/cashflow?year=N returns sources/sinks for
an ECharts Sankey (sums conserve). CashflowTab body.
Stream D — settings
1.D.1 SettingsTab + sub-nav (Milestones/Rates/Dividends/Bonds/Tax/
Metrics/Other/Notes); placeholder cards for unbuilt sub-pages.
1.D.2 LifeEventsSection relocated to /scenarios/:id/settings.
1.D.3 RatesSettings (Fixed/Historical/Advanced segmented + per-asset
cards). SimulateRequest gains rates_mode, inflation_pct,
stocks/bonds growth + dividend, stocks_allocation. New
build_fixed_paths() in simulator. Real-return arithmetic
verified against (1+g+d)/(1+i)−1 ≈ 5.4%.
1.D.4 NotesSettings — markdown textarea, save-on-blur, stored in
scenario.config_json.notes.
Backend: 238 pytest pass (+19 new), mypy + ruff clean.
Frontend: typecheck + 7 unit tests + production build clean.
Roadmap for Wave 2-N is documented in the implementation plan.
69 lines
2.3 KiB
Python
69 lines
2.3 KiB
Python
"""add income_stream table
|
|
|
|
Revision ID: 0003
|
|
Revises: 0002
|
|
Create Date: 2026-05-10 00:00:00.000000
|
|
|
|
ProjectionLab parity Wave 1: first-class typed income streams. Replaces
|
|
the scalar `savings_per_year_gbp` + generic `life_event.delta` model for
|
|
recurring income.
|
|
"""
|
|
from collections.abc import Sequence
|
|
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
from alembic import op
|
|
|
|
revision: str = "0003"
|
|
down_revision: str | None = "0002"
|
|
branch_labels: str | Sequence[str] | None = None
|
|
depends_on: str | Sequence[str] | None = None
|
|
|
|
SCHEMA = "fire_planner"
|
|
|
|
|
|
def _jsonb() -> sa.types.TypeEngine[object]:
|
|
return postgresql.JSONB().with_variant(sa.JSON(), "sqlite")
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"income_stream",
|
|
sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True),
|
|
sa.Column("scenario_id", sa.Integer(), nullable=False),
|
|
sa.Column("kind", sa.Text(), nullable=False),
|
|
sa.Column("name", sa.Text(), nullable=False),
|
|
sa.Column("start_year", sa.Integer(), nullable=False, server_default=sa.text("0")),
|
|
sa.Column("end_year", sa.Integer(), nullable=True),
|
|
sa.Column("amount_gbp_per_year",
|
|
sa.Numeric(12, 2),
|
|
nullable=False,
|
|
server_default=sa.text("0")),
|
|
sa.Column("growth_pct",
|
|
sa.Numeric(6, 4),
|
|
nullable=False,
|
|
server_default=sa.text("0")),
|
|
sa.Column("tax_treatment",
|
|
sa.Text(),
|
|
nullable=False,
|
|
server_default=sa.text("'income'")),
|
|
sa.Column("enabled",
|
|
sa.Boolean(),
|
|
nullable=False,
|
|
server_default=sa.text("true")),
|
|
sa.Column("payload", _jsonb(), nullable=True),
|
|
sa.Column("created_at",
|
|
sa.TIMESTAMP(timezone=True),
|
|
nullable=False,
|
|
server_default=sa.text("now()")),
|
|
schema=SCHEMA,
|
|
)
|
|
op.create_index("idx_income_stream_scenario",
|
|
"income_stream", ["scenario_id"],
|
|
schema=SCHEMA)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("idx_income_stream_scenario", table_name="income_stream", schema=SCHEMA)
|
|
op.drop_table("income_stream", schema=SCHEMA)
|