Repository navigation
feat(TSTAPP-1): add Red Hat brand filter - #96
Conversation
The sidebar could only filter by size. Add a "Brand:" section with a "Red Hat" checkbox that shows products whose title or description contains "red hat" (case-insensitive). - products context: keep brand selection in its own brandFilters state, separate from the selected sizes. - useProducts: filtering now applies both filters together. A product must match one of the selected sizes AND one of the selected brands; an empty selection matches everything. filterProducts(sizes) keeps its signature and preserves the current brand selection; filterProductsByBrand(brands) is new and preserves the sizes. - utils/matchesBrand: checks title and description separately so a match cannot span the two fields, and tolerates an empty description. - Filter: render the brand checkboxes with a pill-shaped style, since the round 35px size checkbox is too small for "Red Hat". Combining brand and size with AND follows the triage assumption on the ticket. The App and Product snapshot changes are the new Brand section and shifted styled-components class hashes only. Tests: CI=true npm test, npm run lint, npm run typecheck and npm run build all pass. The repo has no pre-commit config. Closes TSTAPP-1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🤖 Finished Review · ✅ Success · Started 12:57 PM UTC · Completed 1:23 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $4.26 |
|
Risk Assessment: moderate (2/5) DetailsScore increases from 1 to 2 because BLAST_RADIUS changed from medium to large (12 files, 500 lines), raising the change-size composite from 3 to 5 and lifting the Tier 1 average to 1.5; this combines with a Tier 2 code-age signal elevated by two source files (Filter.tsx, useProducts.tsx) untouched since 2022, though all other signals remain at the lowest risk level. Previous runRisk Assessment: low (1/5) DetailsBot-authored feature addition with strong test coverage (TEST_FILE_RATIO=0.55), no protected paths, no dependency or CI changes, and low git history churn; the medium blast radius from 11 files and 479 lines is fully offset by all other risk signals scoring at the lowest level. |
ReviewFindingsLow
Earlier findings
Previous run<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJhcHByb3ZlIiwiZmluZGluZ3MiOlt7InNldmVyaXR5IjoibG93IiwiY2F0ZWdvcnkiOiJuYW1pbmctY29udmVudGlvbiIsImZpbGUiOiJzcmMvY29udGV4dHMvcHJvZHVj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9LHsic2V2ZXJpdHkiOiJsb3ciLCJjYXRlZ29yeSI6ImluY29tcGxldGUtZG9jIiwiZmlsZSI6IlJFQURNRS5tZCIsImlkIjoiZl8zNTM4MzZiYmU0MDVkZTljIiwibGluZSI6MjIsImFjdGlvbmFibGUiOnRydWUsImRpbWVuc2lvbiI6ImRvY3MtY3VycmVuY3kifV19 --> ReviewFindingsLow
Labels: The PR adds a new user-facing feature (Red Hat brand filter). Next steps:
|
|
🤖 Finished Fix · ✅ Success · Started 1:24 PM UTC · Completed 1:29 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $0.79 |
- matchesBrand now matches the brand as whole words (escaped, case-insensitive RegExp guarded by non-word characters or string edges), so 'Red Hat' no longer matches 'Bored Hat' or 'Red Hatchback'. Added tests covering both cases plus a punctuation-bounded match. - README Features lists the new brand filter. Verification: CI=true npm test (55 passed), eslint, npm run typecheck and npm run build all pass. Husky pre-commit (lint-staged) and commitlint hooks ran on commit. Addresses #96 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🔧 Fix agent — iteration 1 (bot-triggered)Addressed both low-severity review findings: brand matching is now whole-word only (with tests for Bored Hat and Red Hatchback), and the README lists the brand filter. Proposed an updated PR description because the matching wording and test count were stale. Tests (55/55), lint, typecheck and build pass. Project CI was green, and no merge conflict was reported. Fixed (4):
Tests: passed CI inspections (4):
Conflict update: skipped; strategy Decision points
PR metadata: body updatedNext steps:
Updated by fullsend fix agent |
|
🤖 Finished Review · ✅ Success · Started 1:30 PM UTC · Completed 1:41 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $3.62 |
Superseded by updated review
|
🤖 Finished Retro · ✅ Success · Started 2:52 PM UTC · Completed 3:00 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $3.69 |
The code agent documents user-visible features in README.md alongside its `src/` change, so the path allowlist blocked every such PR at Control 4 — PR #96 (the Red Hat brand filter) failed with: PR changes paths outside src/, public/, and root firebase.json Add `^README\.md$` to the allowlist. Only the root README.md is matched: `docs/README.md`, `README.markdown`, and `README.md.bak` are still refused, and the dot-prefix and agent-instruction denylists are unchanged. Signed-off-by: Shai Revivo <srevivo@redhat.com> Co-authored-by: Claude Code <noreply@anthropic.com>
Retro: PR #96 (TSTAPP-1, Red Hat brand filter)Outcome: The PR merged about 1h55m after it was opened, with one fix iteration. Agent review held up well. Review 1 found two real low-severity gaps: Timeline
Evidence for existing issues (no new proposals)
Other observations (not filed)
Agents repo discovered from the run logs: |
…#100) PR #97 merged at 14:58:11 as commit f026533 before the header fix landed, so `main` still justifies the root README.md allowance with "(PR #96)" — the agent PR this same control refused. The review agent's findings on #97 asked for exactly the opposite, and the merged header now points a later reader at the refusal instead of at the authorization record. Point the header at issue #98, which carries the scope, the accepted risk and the exit condition, and state the convention it was measured against: any further widening links an authorizing issue before merge and cites it here. Comment-only; the Control 4 logic is unchanged. Filed as issue #99 by the retro agent after it read the merged file on main. Signed-off-by: Shai Revivo <srevivo@redhat.com> Co-authored-by: Claude Code <noreply@anthropic.com>
Summary
Adds a Brand filter to the sidebar, under the size filter, with a Red Hat checkbox. A product counts as Red Hat when its title or description contains "red hat" as whole words (case-insensitive), so "Bored Hat" or "Red Hatchback" do not count. Jira: TSTAPP-1.
Changes
src/contexts/products-context/ProductsContextProvider.tsx: newbrandFilters/setBrandFiltersstate, separate from the selected sizes.src/contexts/products-context/useProducts.tsx: filtering applies both filters together.filterProducts(sizes)keeps its signature and keeps the current brand selection.filterProductsByBrand(brands)keeps the current size selection.src/utils/matchesBrand.ts(new): checks the title and description separately, so a match can't span the two fields (title "Wine Red" plus description "Hat" doesn't match). It matches the brand only as whole words, using an escaped, case-insensitive regular expression bounded by non-word characters or the start/end of the text. It also handles an empty description.src/components/Filter/Filter.tsx/style.ts: new "Brand:" section built fromavailableBrands = ['Red Hat']. The size checkboxes are 35px circles, soBrandCheckboxextends their style into a pill that grows with the label text.README.md: the Features list mentions the brand filter.Behavior
Brand and size are combined with AND, as assumed in the triage summary on the ticket. Selecting several sizes still shows products in any of them, as before.
Testing
src/utils/__tests__/matchesBrand.test.ts: match on title, match on description only, case-insensitivity, no match, empty or missing description, no match across the two fields, and whole-word matching ("Bored Hat" and "Red Hatchback" don't match, "(Red Hat)" does).useProducts.test.tsx: brand only, brand + size, brand + a size it doesn't come in, brand cleared, no filters, and size filtering keeps the brand selection.Filter.test.tsx: the Brand section renders, and checking or unchecking "Red Hat" changes the product count (1, then all 17).Results:
CI=true npm test: 55/55 passednpm run lint: cleannpm run typecheck: cleannpm run build: succeedsThe repo has no pre-commit config. The new
.ts/.tsxcode follows the existing formatting, without trailing commas in function arguments.🤖 Generated with Claude Code
Related to https://redhat.atlassian.net/browse/TSTAPP-1
Post-script verification
agent/TSTAPP-1-red-hat-brand-filter)ab28baa8e833abd27aa9394b250cea93b956dec3..HEAD)