---
title: Fix latent edge-weight double-penalty in v_roster_asset_lineage_walk
type: task
status: completed
description: >-
  Recursive walk view multiplies source_share and target_share at each hop, double-penalizing
  non-unit shares. Latent today (all shares = 1.0) but will surface when multi-leg trade weighting
  ships.
base_uri: user:task/league/fix-roster-asset-lineage-walk-edge-weight-double-penalty.md
created_at: '2026-05-21T18:15:02.994Z'
entity_id: d4080e2e-7533-401d-ad62-4fa4d922f697
finished_at: '2026-08-03T16:03:50.038Z'
observations:
  - ████████████████████████████████████████████████
  - ████████████████████████████████████████████████
  - ████████████████████████████████████████████████
owner_identity_uri: █████████████████████████
priority: Low
public_read: true
relations:
  - follows [[████████████████████-██████-█████-███████-██████████████]]
tags:
  - user:tag/league-xo-football.md
updated_at: '2026-08-03T16:03:52.829Z'
visibility_analyzed_at: '2026-11-05T23:49:28.818Z'
---

## Background

`db/adhoc/2026-05-20-add-roster-asset-lineage.sql:177` defines `v_roster_asset_lineage_walk` recursive view with edge weight:

```sql
w.cumulative_weight * (t.source_share * t.target_share)
```

This double-penalizes when shares become non-unit (multi-leg trades, fractional attribution). The correct form is:

```sql
w.cumulative_weight * t.target_share
```

Reasoning: `source_share` represents the source holding's fraction of its outbound basket -- already accounted for via its inbound `target_share` from the previous step. Multiplying both at each hop compounds the same fraction twice along a chain.

The bug is latent today because all current `source_share = target_share = 1.0` per the v1 START_TEAM_BEARS rule. It will surface as soon as composite-market-value-driven multi-leg trade weighting ships (currently scope-deferred on the lineage task).

## Plan

- [ ] Author `db/adhoc/YYYY-MM-DD-fix-roster-asset-lineage-walk-edge-weight.sql` that DROPs and re-CREATEs `v_roster_asset_lineage_walk` with `w.cumulative_weight * t.target_share`.
- [ ] Add a test fixture with non-unit shares to lock in the corrected behavior (e.g., synthetic 2-leg chain where leg 1 has target_share=0.5 and leg 2 has target_share=0.4; verify cumulative_weight at depth 2 is 0.2, not 0.1).
- [ ] `yarn db:exec`, `yarn export:schema`, commit.

## References

- ███████████████████████████████████████████████████ observation: [formula-audit] db/adhoc/2026-05-20-add-roster-asset-lineage.sql:177 confirmed as 'cumulative*weight * (source*share * target_share)'.
- Originally a latent observation on the Completed lineage attribution task; promoted to a tracked task here because the multi-leg trade share weighting feature will trip over this.
