From 903caaef1cdd0869656402254efdf8df690be94f Mon Sep 17 00:00:00 2001 From: Seongho Bae Date: Mon, 17 Aug 2026 07:58:29 +0900 Subject: [PATCH 1/2] feat: open the corp grouping with the scored week (v0.98.0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Open period report 2026-W02 from a corporate-entity analysis run also switches Report grouping to Corporate entity. Mean θ stays on the report panel. No TEPP theta is invented. --- ....98.0-analysis-run-open-report-grouping.md | 4 ++ CHANGELOG.md | 9 ++++ .../0024-seed-period-report-analysis-run.md | 7 +-- frontend/package.json | 2 +- frontend/src/App.test.tsx | 3 ++ frontend/src/App.tsx | 43 ++++++++++++++++--- lineageweave/__init__.py | 2 +- pyproject.toml | 2 +- uv.lock | 2 +- 9 files changed, 61 insertions(+), 13 deletions(-) create mode 100644 CHANGELOG.d/0.98.0-analysis-run-open-report-grouping.md diff --git a/CHANGELOG.d/0.98.0-analysis-run-open-report-grouping.md b/CHANGELOG.d/0.98.0-analysis-run-open-report-grouping.md new file mode 100644 index 000000000..1eba3f75e --- /dev/null +++ b/CHANGELOG.d/0.98.0-analysis-run-open-report-grouping.md @@ -0,0 +1,4 @@ +# 0.98.0 Open the corp grouping with the scored week + +Open period report 2026-W02 also switches Report grouping to Corporate +entity. Mean θ stays on the report panel. diff --git a/CHANGELOG.md b/CHANGELOG.md index ba848eea0..8a35c4682 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to this project are documented here. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.98.0] - 2026-08-17 + +### Added + +- Opening **Open period report 2026-W02** from a corporate-entity + analysis run also switches Report grouping to Corporate entity. + After `make seed`, the Demo Corp week is the one that opens. Mean θ + stays on the report panel. No TEPP theta is invented. + ## [0.97.0] - 2026-08-17 ### Added diff --git a/docs/adr/0024-seed-period-report-analysis-run.md b/docs/adr/0024-seed-period-report-analysis-run.md index de8bf3240..58236126e 100644 --- a/docs/adr/0024-seed-period-report-analysis-run.md +++ b/docs/adr/0024-seed-period-report-analysis-run.md @@ -47,9 +47,10 @@ on a path that is not allowed to (ADR 0021 / ADR 0022 / ADR 0023). After `make seed`, Demo Analyst opens Analysis runs and sees **Period report · Succeeded · Demo Corp** next to the lineage and TEPP rows. Opening it shows the cutoff posts and **Open period report -2026-W02** (the week stored on `scope_key`). Mean θ remains on the -period-report panel. Re-seed is idempotent on -`demo-report-seed-2026-w02`. +2026-W02** (the week stored on `scope_key`). That click also switches +Report grouping to Corporate entity so the Demo Corp week is the one +that opens. Mean θ remains on the period-report panel. Re-seed is +idempotent on `demo-report-seed-2026-w02`. ## References — APA 7th diff --git a/frontend/package.json b/frontend/package.json index d62e46766..3e22b4931 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "frontend", "private": true, - "version": "0.97.0", + "version": "0.98.0", "type": "module", "scripts": { "dev": "vite", diff --git a/frontend/src/App.test.tsx b/frontend/src/App.test.tsx index 3d020ad40..af84e69fc 100644 --- a/frontend/src/App.test.tsx +++ b/frontend/src/App.test.tsx @@ -2119,8 +2119,11 @@ describe("App, authenticated", () => { await userEvent.clear(periodInput); await userEvent.type(periodInput, "2026-W03"); expect(periodInput).toHaveValue("2026-W03"); + const groupingSelect = screen.getByLabelText("Report grouping"); + expect(groupingSelect).toHaveValue("process_unit"); await userEvent.click(screen.getByRole("button", { name: "Open period report 2026-W02" })); expect(periodInput).toHaveValue("2026-W02"); + expect(groupingSelect).toHaveValue("corporate_entity"); expect(periodInput).toHaveFocus(); }); diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index c6a3f570d..391cc6954 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1689,6 +1689,24 @@ const REPORT_PERIOD_KEY = /^\d{4}-W\d{2}$/; * That key is a week label, not a theta. Missing or malformed keys * stay closed so we do not invent a period. */ +/** + * Report grouping that matches the run's authorized scope. + * + * A corporate-entity run must not leave the panel on process unit. + */ +function analysisRunReportGrouping(run: AnalysisRun): string | null { + switch (run.scope_kind_code) { + case "analysis_scope_corporate_entity": + return "corporate_entity"; + case "analysis_scope_process_unit": + return "process_unit"; + case "analysis_scope_thread_group": + return "thread_group"; + default: + return null; + } +} + function analysisRunReportPeriod(run: AnalysisRun): string | null { if (run.run_kind_code !== "analysis_run_report") { return null; @@ -1725,7 +1743,7 @@ function AnalysisRunsPanel({ }: { accessToken: string; onSelectPost: (postId: string, options?: SelectPostOptions) => void; - onSelectReportPeriod?: (periodCode: string) => void; + onSelectReportPeriod?: (periodCode: string, groupingKind?: string) => void; }) { const [runs, setRuns] = useState(null); const [selected, setSelected] = useState(null); @@ -1903,7 +1921,7 @@ function AnalysisRunsPanel({ onClick={() => { const periodCode = analysisRunReportPeriod(selected); if (periodCode) { - onSelectReportPeriod(periodCode); + onSelectReportPeriod(periodCode, analysisRunReportGrouping(selected) ?? undefined); document.getElementById("report-period")?.focus(); } }} @@ -2061,14 +2079,17 @@ function ReportsPanel({ onSelectPost, period, onSelectPeriod, + grouping, + onSelectGrouping, }: { accessToken: string; canRebuild: boolean; onSelectPost: (postId: string) => void; period: string; onSelectPeriod: (periodCode: string) => void; + grouping: string; + onSelectGrouping: (groupingKind: string) => void; }) { - const [grouping, setGrouping] = useState("process_unit"); const [payload, setPayload] = useState(null); const [index, setIndex] = useState(null); const [comparison, setComparison] = useState(null); @@ -2129,7 +2150,7 @@ function ReportsPanel({