Skip to content

feat: name leftover-map reconstruction on leftover pairs (v2.12.30) - #564

Closed
seonghobae wants to merge 8 commits into
mainfrom
feat/leftover-map-reconstruction-v21230
Closed

feat: name leftover-map reconstruction on leftover pairs (v2.12.30)#564
seonghobae wants to merge 8 commits into
mainfrom
feat/leftover-map-reconstruction-v21230

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Buyer next action

After make seed, leftover post–criterion pairs sit above the member list with leftover-map reconstruction next to leftover-map distance d. Click the pair to open that post. The reconstruction badge is omitted when the pair has no complete-case leftover map (fallback rows do not invent a reconstruction). A signed reconstruction is shown, never clamped. Never invent leftover score or theta.

A leftover residual R is not the leftover the two leftover-map axes reconstruct. Gabriel (1971) reconstructs a centered matrix as the inner product of person and item coordinates. Two leftover-map axes pad unused axes with zero and drop hidden SVD axes after the second, so reconstruction R̂_c = ξ_{1:2} · ζ_{1:2} recovers centered leftover R̃ = R − center, not raw residual R and not leftover-map distance d. Rank-0 origin maps store R̂ = 0. A rank-1 cell stores exact centered leftover. A rank-3+ cell stores truncated reconstruction, which is not R and not d.

Scope (this PR only)

  • ADR 0186 leftover-map reconstruction
  • migration 0186 nullable leftover_map_reconstruction on leftover pair rows (no nonnegative CHECK)
  • persist/fetch/seed leftover_map_reconstruction when complete-case ξ, ζ exist (R̂_c = ξ_{1:2} · ζ_{1:2}; unused axes pad with 0; hidden SVD axes after the second are dropped)
  • frontend badge + named reconstruction next action; i18n en/ko/zh/ja/vi
  • rank-1 cell reconstruction equals centered leftover; rank-4 synthetic residual proves R̂ ≠ R, ≠ leftover_distance, and full-rank inner product; leftover_distance stays two-axis Euclidean
  • rank-0 maps store R̂ = 0; fallback omits reconstruction; negative finite reconstruction is stored
  • do not persist leftover_map_explained_share, leftover_map_unexplained_share, leftover_map_unexplained, leftover_map_cross_share, or leftover-map coordinates
  • release 2.12.30

Independent of leftover stacks already in review

Do not mix into:

Independent exact-head APPROVE required. Do not self-approve. Squash-merge only with independent APPROVE + exact-head required success.

Verification

  • uv run --with pytest --with numpy pytest tests/test_leftover_pairs.py — 13 passed
  • frontend leftover formatters, LeftoverPairList, i18n, and App.test leftover report surface — 133 passed

Open in Devin Review

Persist two-axis Gabriel reconstruction R̂ of centered leftover on
closest and farthest leftover pairs so buyers can read reconstructed
leftover next to distance d, then open that post.
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 14 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ea271136-e350-4962-b13f-54e5e5ca3c04

📥 Commits

Reviewing files that changed from the base of the PR and between 1e72636 and 78afd5b.

📒 Files selected for processing (27)
  • AGENTS.md
  • ARCHITECTURE.md
  • CHANGELOG.d/2.12.30-leftover-map-reconstruction.md
  • CHANGELOG.md
  • CLAUDE.md
  • backend/app/report_ingestion.py
  • backend/tests/test_api.py
  • docs/adr/0003-fast-mlsirm-report-integration.md
  • docs/adr/0048-persist-lsirm-leftover-pairs.md
  • docs/adr/0049-leftover-pair-report-ui.md
  • docs/adr/0186-leftover-map-reconstruction.md
  • frontend/src/App.test.tsx
  • frontend/src/api.ts
  • frontend/src/components/LeftoverPairList.stories.tsx
  • frontend/src/components/LeftoverPairList.test.tsx
  • frontend/src/components/LeftoverPairList.tsx
  • frontend/src/i18n.test.ts
  • frontend/src/i18n.ts
  • frontend/src/leftoverMapReconstruction.test.ts
  • frontend/src/leftoverMapReconstruction.ts
  • lineageweave/leftover_pairs.py
  • migrations/0186_report_leftover_map_reconstruction.sql
  • migrations/rollback/0186_report_leftover_map_reconstruction.sql
  • scripts/seed_demo_data.py
  • tests/test_leftover_pairs.py
  • tests/test_period_report.py
  • tests/test_schema.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae enabled auto-merge (squash) August 24, 2026 05:21

Copy link
Copy Markdown
Contributor Author

Cycle 2026-08-24: pushed exact head ac5de72 as independent leftover-map reconstruction (ADR 0186, v2.12.30) onto main. Copilot review requested. Auto-merge armed squash; still blocked on independent exact-head APPROVE. Do not self-approve. Do not mix into #481/#485/#535/#537/#539/#563 leftover stacks.

Local verification: leftover pair unit tests 13 passed; frontend leftover formatters + LeftoverPairList + i18n + App leftover surface 133 passed. Synthetic fixtures only.

devin-ai-integration[bot]

This comment was marked as resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 24, 2026 05:42
@seonghobae
seonghobae enabled auto-merge (squash) August 24, 2026 08:03
@opencode-agent
opencode-agent Bot disabled auto-merge August 24, 2026 08:42
@seonghobae
seonghobae enabled auto-merge August 24, 2026 09:12

Copy link
Copy Markdown
Contributor Author

Leftover-map persist+2D UI restack is now #579 (v2.12.19, ADR 0121/0126) on main@b4911f8. Reconstruction naming on leftover pairs stays a later increment after that persist lands. Do not mix into #74/#92. Independent review only — never self-approve.

@github-actions
github-actions Bot disabled auto-merge August 24, 2026 10:55
@seonghobae
seonghobae enabled auto-merge August 24, 2026 11:50
# Conflicts:
#	AGENTS.md
#	ARCHITECTURE.md
#	CHANGELOG.md
#	CLAUDE.md
#	backend/tests/test_api.py
#	docs/adr/0003-fast-mlsirm-report-integration.md
#	frontend/package.json
#	lineageweave/leftover_pairs.py
#	pyproject.toml
#	tests/test_leftover_pairs.py
#	tests/test_period_report.py
#	tests/test_schema.py
#	uv.lock
@github-actions
github-actions Bot disabled auto-merge August 24, 2026 15:53
@seonghobae
seonghobae enabled auto-merge August 24, 2026 15:55
@opencode-agent
opencode-agent Bot disabled auto-merge August 24, 2026 16:51
@seonghobae
seonghobae enabled auto-merge August 24, 2026 17:04
@opencode-agent
opencode-agent Bot disabled auto-merge August 24, 2026 17:58
…onstruction-v21230

# Conflicts:
#	AGENTS.md
#	ARCHITECTURE.md
#	CHANGELOG.md
#	CLAUDE.md
#	backend/app/report_ingestion.py
#	backend/tests/test_api.py
#	docs/adr/0003-fast-mlsirm-report-integration.md
#	docs/adr/0048-persist-lsirm-leftover-pairs.md
#	docs/adr/0049-leftover-pair-report-ui.md
#	frontend/package.json
#	frontend/src/App.test.tsx
#	frontend/src/api.ts
#	frontend/src/components/LeftoverPairList.tsx
#	lineageweave/leftover_pairs.py
#	pyproject.toml
#	scripts/seed_demo_data.py
#	tests/test_leftover_pairs.py
#	tests/test_period_report.py
#	tests/test_schema.py
#	uv.lock
devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae
seonghobae enabled auto-merge August 24, 2026 18:45
@opencode-agent
opencode-agent Bot disabled auto-merge August 24, 2026 19:26

Copy link
Copy Markdown
Contributor Author

Cycle comment: leftover increment still waits for independent APPROVE + exact-head required success. Author must not self-approve. Do not squash-merge without that APPROVE. Recut leftover-map length onto protected main as independent v2.12.31 / ADR 0187 (0183–0186 claimed by open leftover share/reconstruction PRs). Do not mix leftover stacks. Issues #79 and #87 stay open.

Copy link
Copy Markdown
Contributor Author

Cycle 2026-08-25T07:05 KST: #564 stays independent. It must not mix with leftover stacks #485 / #518 / #521 / #537 / #539 / #563 / #579.

Landed ADR 0182 already defines unexplained leftover as U = R − R̂ with the same two-axis inner product used for leftover-map distance. That identity only holds when persisted reconstruction is that internal , not a separately centered .

This cycle therefore opens a fresh main-based persist of leftover-map reconstruction so U + R̂ = R remains auditable. Do not squash-merge #564 onto that work. Independent exact-head APPROVE required. Author will not self-approve.

# Conflicts:
#	AGENTS.md
#	ARCHITECTURE.md
#	frontend/package.json
#	lineageweave/leftover_pairs.py
#	pyproject.toml
#	tests/test_leftover_pairs.py
#	uv.lock

Copy link
Copy Markdown
Contributor Author

Independent leftover stack — do not mix. This cycle implements uncentered leftover-map reconstruction R̂ = ξ_{1:2} · ζ_{1:2} on current main (ADR 0183 / v2.12.31) so landed U + R̂ = R stays auditable. #564 remains the centered-R̃ reconstruction (ADR 0186 / v2.12.30) and is not rebased, amended, or squash-merged into this increment. Do not substitute centered R̃ for the reconstruction used to form unexplained leftover U (ADR 0182).

Copy link
Copy Markdown
Contributor Author

Independent leftover stack — do not mix.

Uncentered leftover-map reconstruction persist is now #588 (ADR 0183 / v2.12.31) on current main so landed U + R̂ = R stays auditable. #564 remains the centered- reconstruction (ADR 0186 / v2.12.30) and is not rebased, amended, or squash-merged into that increment.

@seonghobae
seonghobae enabled auto-merge August 24, 2026 22:46
@github-actions
github-actions Bot disabled auto-merge August 24, 2026 22:56
@seonghobae
seonghobae enabled auto-merge August 24, 2026 22:57
@opencode-agent
opencode-agent Bot disabled auto-merge August 24, 2026 23:38
@seonghobae
seonghobae enabled auto-merge August 25, 2026 00:22
@github-actions
github-actions Bot disabled auto-merge August 25, 2026 00:24
@seonghobae
seonghobae enabled auto-merge (squash) August 25, 2026 00:35
@opencode-agent
opencode-agent Bot disabled auto-merge August 25, 2026 01:07
@seonghobae
seonghobae enabled auto-merge August 25, 2026 01:22
…onstruction-v21230

# Conflicts:
#	AGENTS.md
#	ARCHITECTURE.md
#	CLAUDE.md
#	docs/adr/0049-leftover-pair-report-ui.md
devin-ai-integration[bot]

This comment was marked as resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 25, 2026 02:28
@seonghobae
seonghobae enabled auto-merge August 25, 2026 03:26
@opencode-agent
opencode-agent Bot disabled auto-merge August 25, 2026 03:40
@seonghobae

Copy link
Copy Markdown
Contributor Author

Closed as superseded by the accepted raw-residual contract and PR #588. ADR 0182 defines U = R − R̂ against raw residual R; this branch reconstructs centered residual R̃ and would break the landed audit identity. PR #588 is the compatible reconstruction persistence path.

@seonghobae seonghobae closed this Aug 25, 2026
seonghobae added a commit that referenced this pull request Aug 25, 2026
…588)

* feat: name leftover-map reconstruction on leftover pairs (v2.12.31)

Persist two-axis Gabriel reconstruction R̂ = ξ_{1:2} · ζ_{1:2} on
period leftover pairs so landed unexplained leftover U = R − R̂ stays
auditable as U + R̂ = R (ADR 0183). Reconstruction is the same internal
two-axis inner product already used for U; do not substitute the
centered R̃ reconstruction claimed by leftover stack #564.

After make seed, closest and farthest leftover pairs sit above the
member list with signed R̂ next to leftover-map distance d; click opens
that post. Missing or non-finite reconstruction omits the badge rather
than inventing a leftover score. Signed reconstruction is stored, never
clamped. Complete-case coverage (ADR 0168) stays independent.

Independent of leftover stacks #485, #518 (landed), #521, #537, #539,
#563, #564, and #579.

* fix(adr): allocate reconstruction decision 0201

* fix: restore R̂-persistence docs and finish ADR 0183→0201 renumbering

The prior merge of origin/main into this branch (91d8e4f) resolved the
AGENTS.md/ARCHITECTURE.md/CLAUDE.md conflicts by dropping this PR's own
leftover-map reconstruction documentation:

- AGENTS.md reverted to "Two-axis reconstruction R̂ is not persisted",
  contradicting the shipped migration/ADR 0201 that persists it, and
  dropped ADR 0201 from the governing-ADR list.
- ARCHITECTURE.md kept a redundant "0183 / 0201" pair (0183 is this
  repo's real, unrelated ADR 0183 "GNB four Korean chrome"; the stale
  0183 leftover-map reference should have been renumbered to 0201, not
  kept alongside it).
- CLAUDE.md's "Where the rest lives" pointer never got the ADR 0201
  cross-reference added.

Also finishes the ADR-number renumbering the PR's own history had
started (docs/adr/0201-leftover-map-reconstruction.md is the actual
ADR; ADR 0183 already belongs to a different, already-landed decision
on main): fixes remaining stale "ADR 0183" citations in
docs/adr/0003, the 2.12.31 CHANGELOG.d fragment, and the migration
0183 SQL header comment, all of which should cite ADR 0201.

docs/adr/0049's own conflict resolution (0158 + 0201 amendments) was
already correct and is unchanged.

* docs: reconcile ADR 0182 reconstruction context

* test(leftover): cover reconstruction candidate contract

* fix(leftover): prove rank-zero reconstruction identity

---------

Co-authored-by: seonghobae <seonghobae@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant