Skip to content

Commit 34ae78b

Browse files
feat: display impl_tags in Implementation tab (#2434)
- Fix API to include impl_tags in /specs/{spec_id} response (was missing) - Add implTags prop to SpecTabs component - Display impl_tags as chips in Impl tab (only non-empty categories) - Update test mock to include impl_tags
1 parent 85278f5 commit 34ae78b

4 files changed

Lines changed: 44 additions & 0 deletions

File tree

api/routers/specs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ async def get_spec(spec_id: str, db: AsyncSession = Depends(require_db)):
8787
review_image_description=impl.review_image_description,
8888
review_criteria_checklist=impl.review_criteria_checklist,
8989
review_verdict=impl.review_verdict,
90+
impl_tags=impl.impl_tags,
9091
)
9192
for impl in spec.impls
9293
]

app/src/components/SpecTabs.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ interface SpecTabsProps {
3434
imageDescription?: string;
3535
strengths?: string[];
3636
weaknesses?: string[];
37+
implTags?: Record<string, string[]>;
3738
// Quality tab
3839
qualityScore: number | null;
3940
criteriaChecklist?: Record<string, unknown>;
@@ -144,6 +145,7 @@ export function SpecTabs({
144145
imageDescription,
145146
strengths,
146147
weaknesses,
148+
implTags,
147149
qualityScore,
148150
criteriaChecklist,
149151
libraryId,
@@ -495,6 +497,42 @@ export function SpecTabs({
495497
</>
496498
)}
497499

500+
{/* Implementation Tags - only show non-empty categories */}
501+
{implTags && Object.entries(implTags).some(([, values]) => values && values.length > 0) && (
502+
<Box sx={{ mt: 3, pt: 2, borderTop: '1px solid #e5e7eb', display: 'flex', flexWrap: 'wrap', gap: 2 }}>
503+
{Object.entries(implTags)
504+
.filter(([, values]) => values && values.length > 0)
505+
.map(([category, values]) => (
506+
<Box key={category} sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>
507+
<Typography
508+
component="span"
509+
sx={{
510+
fontFamily: '"MonoLisa", monospace',
511+
fontSize: '0.65rem',
512+
color: '#9ca3af',
513+
}}
514+
>
515+
{category}:
516+
</Typography>
517+
{values.map((value, i) => (
518+
<Chip
519+
key={i}
520+
label={value}
521+
size="small"
522+
sx={{
523+
fontFamily: '"MonoLisa", monospace',
524+
fontSize: '0.65rem',
525+
height: 20,
526+
bgcolor: '#f3f4f6',
527+
color: '#4b5563',
528+
}}
529+
/>
530+
))}
531+
</Box>
532+
))}
533+
</Box>
534+
)}
535+
498536
{/* No data message */}
499537
{!imageDescription && (!strengths || strengths.length === 0) && (!weaknesses || weaknesses.length === 0) && (
500538
<Typography sx={{ fontFamily: '"MonoLisa", monospace', fontSize: '0.85rem', color: '#9ca3af' }}>

app/src/pages/SpecPage.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ interface Implementation {
3939
review_image_description?: string;
4040
review_criteria_checklist?: Record<string, unknown>;
4141
review_verdict?: string;
42+
// Implementation-level tags
43+
impl_tags?: Record<string, string[]>;
4244
}
4345

4446
interface SpecDetail {
@@ -735,6 +737,7 @@ export function SpecPage() {
735737
imageDescription={currentImpl?.review_image_description}
736738
strengths={currentImpl?.review_strengths}
737739
weaknesses={currentImpl?.review_weaknesses}
740+
implTags={currentImpl?.impl_tags}
738741
qualityScore={currentImpl?.quality_score || null}
739742
criteriaChecklist={currentImpl?.review_criteria_checklist}
740743
libraryId={selectedLibrary || ''}

tests/unit/api/test_routers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ def mock_spec():
7474
mock_impl.review_verdict = "APPROVED"
7575
mock_impl.review_strengths = ["Clean code", "Good visualization"]
7676
mock_impl.review_weaknesses = ["Could use better labels"]
77+
# Implementation-level tags
78+
mock_impl.impl_tags = {"patterns": ["data-generation"], "styling": ["alpha-blending"]}
7779

7880
mock_spec = MagicMock()
7981
mock_spec.id = "scatter-basic"

0 commit comments

Comments
 (0)