1# Semantic diff in spec browser23## Source4- Origin: human5- Created: 2026-06-23T01:37:45Z6- Tags: dashboard, spec-browser, semantic-diff, consistency78## Prompt9The change detail's Specs tab already renders SpecDeltaView — the requirement/scenario-level delta from spec_parser.semantic_spec_diff. But the spec browser (current/dirty/refs mode) only shows side-by-side SpecContentView + raw unified diff. The backend (_spec_browser in plugin_api.py) already computes semantic_summary (the +/~/− counts) for changed files but discards the full semantic_diff. Wire semantic_diff into the spec-browser file payload and render SpecDeltaView there too, making diffing consistent across both views.1011<!-- OPENSPEC_IDEA_ENRICHMENT_START -->12## Enrichment Report1314Generated: 2026-06-23T01:38:40Z1516### Problem17The change detail's Specs tab renders SpecDeltaView (requirement/scenario-level structured diff from spec_parser.semantic_spec_diff), but the spec browser (current/dirty/refs modes) only shows side-by-side SpecContentView + raw unified diff. The backend already computes semantic_summary (the +/~/− counts) for changed files in _spec_browser but discards the full semantic_diff. This means the two spec-diffing surfaces in the dashboard are inconsistent — one is structured and navigable, the other is raw text comparison.1819### Proposed Direction201. In plugin_api.py _spec_browser(), compute and include the full semantic_diff for each changed file (currently only semantic_summary is computed). The _compute_semantic_diff helper already exists and is used by _change_detail. 2. In dashboard/dist/index.js SpecsView, replace the side-by-side SpecContentView rendering for changed files with SpecDeltaView (the component already exists and is used by ChangeSpecsView). 3. Add a view-mode toggle (semantic / side-by-side / raw) so users can switch between the structured delta and the raw comparison. 4. Keep the "current" mode as-is (no diff, just SpecContentView).2122### Key Questions23- Should the spec browser default to semantic diff view or keep side-by-side as default with a toggle?24- Should unchanged requirements be collapsed (like in change detail) or shown expanded since the user is browsing, not reviewing a specific change?25- Should we add a view-mode toggle (semantic / side-by-side / raw) to the spec browser toolbar, or just replace the current side-by-side with semantic?2627### Feasibility28Feasibility: High2930### T-Shirt Size31T-Shirt Size: S3233### Size Justification34The backend helper (_compute_semantic_diff) and the frontend component (SpecDeltaView) both already exist and are used by the change detail. The work is wiring them together in the spec browser path — adding semantic_diff to the _spec_browser payload and switching the render call. No new parsing logic, no new components.3536### Risks37- Larger API payload — semantic_diff adds structured JSON per changed file. For repos with many changed specs, this could bloat the response. Mitigated by only including it for changed files (status not in unchanged/missing), same as the current semantic_summary gating.38- SpecDeltaView was built for change-scoped diffs (before=baseline, after=proposed). In the spec browser dirty/refs mode, before/after semantics are different (HEAD vs worktree, or ref vs ref). The component should work as-is since it just compares two strings, but the labels might be confusing.3940### Suggested Next Step41Draft a change proposal that specifies the exact payload field addition in _spec_browser and the frontend render swap, with a view-mode toggle for semantic/side-by-side/raw.42<!-- OPENSPEC_IDEA_ENRICHMENT_END -->