Remove asset and price-tracking subsystem #48

Closed
opened 2026-08-15 13:34:48 +02:00 by myrmidex · 2 comments
Owner

Removes the stock-ticker machinery inherited from the VWCE-share origins. Already hidden from the UI in bace06d — this deletes the code, routes and tables behind it.

Scope

PHP:

  • app/Models/Asset.php, app/Models/Pricing/AssetPrice.php
  • app/Http/Controllers/AssetController.php, app/Http/Controllers/Pricing/PricingController.php
  • Tracker::asset() relationship; asset_id and price_tracking_enabled columns

Routes: the entire assets.* (4) and pricing.* (4) groups in routes/web.php

Frontend:

  • components/Assets/AssetSetupForm.tsx, components/Pricing/UpdatePriceForm.tsx
  • TrackerAsset interface and asset / price_tracking_enabled fields in types/domain.ts
  • Asset/price branches in Onboarding/CreateTrackerStep.tsx

Migrations: new migration dropping asset_prices and assets, and dropping asset_id + price_tracking_enabled from trackers. Do not edit historical migrations.

Closes the need for #38 (price tracking end-to-end) and #35 (settings toggle for price tracking) — both should be closed as won't-fix when this lands. They build the subsystem this removes.

Acceptance criteria

  • grep -ri "asset\|price" app/ routes/ resources/js/ returns no product-code hits
  • Migration runs clean forward on a fresh DB
  • Onboarding still completes end-to-end
  • Lint + PHPStan clean
Removes the stock-ticker machinery inherited from the VWCE-share origins. Already hidden from the UI in bace06d — this deletes the code, routes and tables behind it. ## Scope **PHP:** - `app/Models/Asset.php`, `app/Models/Pricing/AssetPrice.php` - `app/Http/Controllers/AssetController.php`, `app/Http/Controllers/Pricing/PricingController.php` - `Tracker::asset()` relationship; `asset_id` and `price_tracking_enabled` columns **Routes:** the entire `assets.*` (4) and `pricing.*` (4) groups in `routes/web.php` **Frontend:** - `components/Assets/AssetSetupForm.tsx`, `components/Pricing/UpdatePriceForm.tsx` - `TrackerAsset` interface and `asset` / `price_tracking_enabled` fields in `types/domain.ts` - Asset/price branches in `Onboarding/CreateTrackerStep.tsx` **Migrations:** new migration dropping `asset_prices` and `assets`, and dropping `asset_id` + `price_tracking_enabled` from `trackers`. Do not edit historical migrations. ## Related tickets Closes the need for #38 (price tracking end-to-end) and #35 (settings toggle for price tracking) — both should be closed as won't-fix when this lands. They build the subsystem this removes. ## Acceptance criteria - [ ] `grep -ri "asset\|price" app/ routes/ resources/js/` returns no product-code hits - [ ] Migration runs clean forward on a fresh DB - [ ] Onboarding still completes end-to-end - [ ] Lint + PHPStan clean
myrmidex added this to the (deleted) milestone 2026-08-15 13:34:48 +02:00
myrmidex added the
enhancement
label 2026-08-15 13:34:48 +02:00
myrmidex self-assigned this 2026-08-15 13:34:48 +02:00
myrmidex modified the milestone from (deleted) to v0.4.0 2026-08-15 13:42:20 +02:00
Author
Owner

Scope reduced by #47

Two files listed here were already deleted in d379f00:

  • resources/js/components/Assets/AssetSetupForm.tsx
  • resources/js/components/Pricing/UpdatePriceForm.tsx

Both were orphaned by bace06d (v0.3.0 price-UI hiding) — nothing imported them — and they carried the only two remaining ESLint errors, so leaving them would have shipped #47 on a red branch. Since they were unreachable, they fell under #47's "delete unreachable" remit.

Everything else in this ticket is unchanged: the PHP models/controllers, the assets.* and pricing.* route groups, the schema migration, and the types/domain.ts fields all still need doing.

## Scope reduced by #47 Two files listed here were already deleted in `d379f00`: - `resources/js/components/Assets/AssetSetupForm.tsx` - `resources/js/components/Pricing/UpdatePriceForm.tsx` Both were orphaned by `bace06d` (v0.3.0 price-UI hiding) — nothing imported them — and they carried the only two remaining ESLint errors, so leaving them would have shipped #47 on a red branch. Since they were unreachable, they fell under #47's "delete unreachable" remit. Everything else in this ticket is unchanged: the PHP models/controllers, the `assets.*` and `pricing.*` route groups, the schema migration, and the `types/domain.ts` fields all still need doing.
Author
Owner

Done — 671cdb6

11 files, −392 lines. The stock-ticker machinery is gone.

Deleted: Asset, Pricing/AssetPrice, AssetController, Pricing/PricingController, CreateTrackerStep.tsx (orphaned since #51).

Migration: 2026_08_15_000003_drop_assets_and_pricing.php — drops the asset_id FK and column plus price_tracking_enabled from trackers, then asset_prices, then assets.

Routes: assets.* and pricing.* groups removed (8 routes).

Types: domain.ts reduced to {id, label, unit, count}.

Tracker is now user_id, label, unit, count.

Beyond the ticket

TrackerController::update() returned back() redirects — the last redirect-based endpoint, the same pattern behind the silent-failure bug fixed in #50. Converted to JSON with a 404 for a missing tracker, matching CounterController. Deliberate contract change; two tests added since the endpoint was previously uncovered.

Caught before commit

down() initially had asset_prices.price as decimal(12,4) — the original is (10,4) — and omitted three indexes (assets.symbol, asset_prices.asset_id, asset_prices.date). Corrected against the source migrations.

That is the second time writing down() from memory produced a schema mismatch (#49 had the same class of error). Lesson taken: write the round-trip test first rather than hand-checking the transcription.

New tests

DropAssetsMigrationTest (4 tests) executes the migration rather than inspecting it:

  • Migrated schema has no asset/price tables or columns
  • down() restores all three
  • up() after down() drops them again, proving the FK ordering (dropForeign before dropColumn; asset_prices before assets)
  • A tracker's count survives the round trip — the one that actually matters

From review

Clean pass, no blockers, no changes recommended.

It verified the FK ordering against real migration history and found the premise slightly narrower than I stated: a third FK (users.asset_id → assets) existed historically but was already dropped in 2026_05_02_000003, so trackers.asset_id was the only remaining reference. Conclusion unchanged.

Also confirmed price_tracking_enabled is genuinely unreferenced — the remaining grep hits are Laravel's laravel-assets publish tag and Inertia's asset-versioning helper, both unrelated — and that no caller expected the old redirect contract.

Gates

Pint PASS (48 files) · PHPUnit OK (31 tests, 81 assertions) · ESLint exit 0 · build PASS

The #54 suite passed unchanged throughout this deletion — no regressions.

"PHPStan clean" not checked; not installed yet (#55).

## Done — `671cdb6` 11 files, −392 lines. The stock-ticker machinery is gone. **Deleted:** `Asset`, `Pricing/AssetPrice`, `AssetController`, `Pricing/PricingController`, `CreateTrackerStep.tsx` (orphaned since #51). **Migration:** `2026_08_15_000003_drop_assets_and_pricing.php` — drops the `asset_id` FK and column plus `price_tracking_enabled` from `trackers`, then `asset_prices`, then `assets`. **Routes:** `assets.*` and `pricing.*` groups removed (8 routes). **Types:** `domain.ts` reduced to `{id, label, unit, count}`. `Tracker` is now `user_id`, `label`, `unit`, `count`. ### Beyond the ticket **`TrackerController::update()` returned `back()` redirects** — the last redirect-based endpoint, the same pattern behind the silent-failure bug fixed in #50. Converted to JSON with a 404 for a missing tracker, matching `CounterController`. Deliberate contract change; two tests added since the endpoint was previously uncovered. ### Caught before commit `down()` initially had `asset_prices.price` as `decimal(12,4)` — the original is `(10,4)` — and omitted three indexes (`assets.symbol`, `asset_prices.asset_id`, `asset_prices.date`). Corrected against the source migrations. That is the **second** time writing `down()` from memory produced a schema mismatch (#49 had the same class of error). Lesson taken: write the round-trip test first rather than hand-checking the transcription. ### New tests `DropAssetsMigrationTest` (4 tests) executes the migration rather than inspecting it: - Migrated schema has no asset/price tables or columns - `down()` restores all three - `up()` after `down()` drops them again, proving the FK ordering (`dropForeign` before `dropColumn`; `asset_prices` before `assets`) - **A tracker's `count` survives the round trip** — the one that actually matters ### From review Clean pass, no blockers, no changes recommended. It verified the FK ordering against real migration history and found the premise slightly narrower than I stated: a third FK (`users.asset_id → assets`) existed historically but was already dropped in `2026_05_02_000003`, so `trackers.asset_id` was the only remaining reference. Conclusion unchanged. Also confirmed `price_tracking_enabled` is genuinely unreferenced — the remaining grep hits are Laravel's `laravel-assets` publish tag and Inertia's asset-versioning helper, both unrelated — and that no caller expected the old redirect contract. ### Gates Pint PASS (48 files) · PHPUnit OK (**31 tests, 81 assertions**) · ESLint exit 0 · build PASS The #54 suite passed unchanged throughout this deletion — no regressions. "PHPStan clean" not checked; not installed yet (#55).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lvl0/incr#48
No description provided.