Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions .agents/flow/issues/bugfix-cluster-source-report-grain.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
This is by an automated agent, not a human.

# Show attribution reports as the source grain: production lacks the prototype clamp and still anchors rows on bad cases

English | [中文](bugfix-cluster-source-report-grain.md)

```yaml flow
kind: issue
id: bugfix-116
milestone: bugfix
depends: []
priority: P2
status: in-progress
scope:
- plans/**
- apps/web/src/pages/evolution/**
- tests/e2e/**
- .agents/**
adr: []
github:
number: 826
url: https://github.com/Shadow-Azure/harness-evolution/issues/826
```

## Background

### Symptom

On production evolution run `01M9297ZSHMEHCKZR4WB0AEXG7`, the requester captured a step-4 "object attribution" table whose single row was nearly a full viewport tall: the bad-case, member, and report cells occupied only the top line while the rest of the row was blank. The first column was labelled "source bad case" and the attribution report ID sat in the third column. The requester asked: clustering comes from attribution reports, so why does this view show the source as a bad case instead of the attribution report?

The captured table is not step 5 "clusters and severity"; it is the step-4 attribution input/report table. Both steps use the word "source" for different grains:

- Step 4 anchors rows on the **reported bad case** (`caseGroups` groups by `badCaseId`, first column `rowspan`), while the report ID is the third column; the same row also carries a "this clustering" column, so the table reads like a cluster-source table.
- Step 5 already anchors rows on **attribution reports** (#817). Production run `01M8PKYNKYVHQD8B1K05N8EBP5` shows "source attribution reports (7 reports · clustered from attribution conclusions)" and the report-first table.
- A scan of all 32 runs in this workspace that have clusters found an `attributionId` on every case row, with zero missing. Step 5 has not fallen back to bad cases; the screenshot is step 4, not the cluster table.

### Production vs prototype

At the same 1500×837 viewport:

| Scenario | Row height | Description cell | Clamp |
| --- | --- | --- | --- |
| Production step 4 (run `01M9297...`, row `swe-ba7af...`) | 723px | 259×723 | `-webkit-line-clamp: none`, `overflow: visible` |
| V2 prototype step 4 (run `EV-20261118-07`) | 54px | 409×54 | `td.attr-desc span` clamped to two lines |

Production `StepAttribution.vue` sets only `max-width: 320px` and `vertical-align: top` on `td.desc`, without the two-line clamp that `StepCaseTable.vue` (steps 5/6) and the V2 prototype already use. A 1000-character attribution description is therefore rendered in full and stretches the row to 723px, leaving the row-spanning first column with only its top line populated. The prototype's step 4 keeps a normal row height, but it also puts the bad case first and the report third, so the source semantics are the same on both sides and need the same report-first change; the row-height difference comes only from the missing clamp in production.

### Root cause

1. **Row height**: the step-4 description cell lacks the prototype/`StepCaseTable.vue` two-line clamp and an expand entry point; long report text wraps at `max-width` and stretches the row, while the row-spanning first column only occupies the top.
2. **Source semantics**: step 4 anchors rows on the bad case and labels the first column "source bad case", with the attribution report only in the third column; the same table also has a "this clustering" column. Users naturally read the first column as the clustering source. Step 5 is report-first, but both steps share the word "source" without a copy boundary saying step 4 is attribution input and step 5 is the cluster source.

## Goals

- Make the attribution report the step-4 row anchor: report ID first, report description second, and the reported bad case fifth with its deep link and `case object` note.
- Clamp the step-4 description to two lines with an explicit expand/collapse entry, matching steps 5/6; at 1500×837 a row should return to about 54px.
- Rename "source bad case" to "reported bad case" in steps 4/5/6 and state that the clustering source is the attribution report.
- Do not change the API, database, clustering algorithm, or severity; historical run read replay stays unchanged.

## Design authority

- [08 §10.2 step 4 object attribution](../../../plans/fullstack-design/08-frontend-implementation.md): current columns and the section to update.
- [08 §10.3 step 5 clusters and severity](../../../plans/fullstack-design/08-frontend-implementation.md): report-first source table and the bad-case column.
- [06 §5.4/§5.10 cluster ↔ attribution detail](../../../plans/fullstack-design/06-database-design.md): a cluster member is an attribution report.
- [Agent Note: project cluster source rows from attribution reports](https://github.com/Shadow-Azure/harness-evolution/blob/main/.agents/notes/implemented/bug-fix/2026-12-05-cluster-source-attribution-reports.md): the existing step-5/6 report-row implementation and fallback boundary.
- [08 §10.1 attribution deep links](../../../plans/fullstack-design/08-frontend-implementation.md): deep-link targets for the reported bad case and report ID.
- V2 prototype `plans/ui-prototype-v2/harness-evolution.html`, functions `evStepAttr()` and `evClusterReportTable()`.

## Implementation

### Prototype (delivered first in this issue)

- Reorder the step-4 nine columns to report / description / member / category / reported bad case / result source / confidence / this clustering / feedback; drop the bad-case `rowspan` so every report has its own row, keeping the "N member reports" badge for multi-report cases.
- Rename the step-4 header "source bad case" to "reported bad case" and add the note "clustering uses the attribution reports in this table as its source; a reported bad case is only the report's input".
- Rename the same column in the step-5/6 report table and the feedback drawer.
- Keep the prototype's existing two-line clamp, deep links, demo data, and clustering algorithm.

Before / after (same run `EV-20261118-07`, same 1500×837 viewport, same scroll position):

| Before · bad case anchors the row | After · attribution report anchors the row |
| --- | --- |
| ![before](https://raw.githubusercontent.com/Shadow-Azure/harness-evolution/agent/cluster-source-ui-8bce33856925/plans/evidence/cluster-source-ui/step4-before.png) | ![after](https://raw.githubusercontent.com/Shadow-Azure/harness-evolution/agent/cluster-source-ui-8bce33856925/plans/evidence/cluster-source-ui/step4-after.png) |

### Production (after requester confirmation)

- Apply the same `attr-desc span` two-line clamp and an explicit expand/collapse to `StepAttribution.vue`; reorder its columns as above.
- Rename the step-5/6 report-table column in `StepCaseTable.vue`.
- Update `plans/fullstack-design/08-frontend-implementation.md` and `plans/ui-prototype-v2/design-v2.md`; no contract fields are added because `StepAttributionRow` already carries the report and description fields.
- Keep the expand state local to the frontend; do not call the API or rerun historical runs.

## Implementation steps

1. Reorder the prototype step-4 table to report-first, unify the "reported bad case" copy, and add the before/after screenshots (the prototype PR for this issue).
2. After confirmation, update the `StepAttribution.vue` column order, clamp, and expand interaction.
3. Update `StepCaseTable.vue` and the feedback drawer labels; add component/E2E assertions for the report-first column, row height, and expanded full text.
4. Update 08 §10.2/§10.3 and `design-v2.md`, run the gates, and attach production before/after evidence.

## Dependencies and boundary

- Dependencies: none. #817 already landed the step-5/6 report rows; this issue only changes step-4 presentation and copy.
- This issue first delivers the prototype, evidence, and the issue itself; the production implementation will follow in a separate PR after confirmation.
- Non-goals: do not change the clustering algorithm, `probe_clusters` / `probe_cluster_probes`, severity, or API; do not rerun historical runs; do not substitute screenshots for real browser verification.

## Verification

```sh
# Prototype after (evidence in this issue)
# open plans/ui-prototype-v2/harness-evolution.html?u=admin&page=evo&ws=ws-harness&step=3#/run/EV-20261118-07 at 1500x837
# first row tr height should be about 54px; first column should be an attribution report ID

# After the production fix
# open run 01M9297ZSHMEHCKZR4WB0AEXG7 step 4 at the same viewport
# that row should be at most two lines plus an expand button; first column should be the report ID
```

- Prototype now: six report rows, 54px `tr` height; first column `AR-0901-002` etc.; fifth column "reported bad case".
- Production now: the same row is 723px; `td.desc` is 259×723 with `line-clamp: none`.
- Step-5 regression: run `01M8PKYNKYVHQD8B1K05N8EBP5` still shows "source attribution reports"; six clusters / 19 report rows all carry `attributionId`.

## Acceptance

- Prototype before/after use the same run, viewport, and scroll position; after-fix first column is the report ID, the bad case is fifth, and rows stay about 54px.
- After the production fix the same row is at most two lines plus expand; the first column is the report ID; "source bad case" no longer appears in step-4/5/6 headers.
- Step 5 still sources from attribution reports; the legacy V1 and missing-report fallbacks stay unchanged.
- No API/database/clustering diff; historical run read semantics stay unchanged.

## Gates and CI

- `pnpm verify:flow`, `pnpm verify:flow-online` (after number backfill), `pnpm verify:docs`.
- For the frontend implementation: `pnpm lint:web`, `pnpm typecheck:web`, `pnpm test:web`, `pnpm test:e2e -- --pattern "run-detail|cluster"`.
- Evidence lives in `plans/evidence/cluster-source-ui/`; do not commit production screenshots, Session content, or credentials.

## Non-goals

- Do not change the step-4 potential-bad-case data source or the model that one bad case may produce multiple member reports.
- Do not change the clustering algorithm, severity formula, or report fallback policy.
- Do not treat a label rename as the row-height fix, or a clamp alone as the source-grain fix.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 双语配对一致性记录(docs/i18n/README.md):两侧在最后一次确认一致状态下的
# git blob hash。两种语言同等权威;编辑任一侧后带上另一侧,然后重录:
# pnpm run record:i18n -- .agents/flow/issues/bugfix-cluster-source-report-grain.md
bugfix-cluster-source-report-grain.md: a293d59eadf4ea8103c82139da2d905d9941a1c9
bugfix-cluster-source-report-grain.en.md: 0a699dda7294d6d10d026051725e785ac857c854
Loading
Loading