Skip to content

feat(TSTAPP-1): add Red Hat brand filter - #96

Merged
shairevivo merged 2 commits into
mainfrom
agent/TSTAPP-1-red-hat-brand-filter
Nov 15, 2026
Merged

shairevivo merged 2 commits into
mainfrom
agent/TSTAPP-1-red-hat-brand-filter

Conversation

@fullsend-ai-coder

@fullsend-ai-coder fullsend-ai-coder Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

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: new brandFilters / setBrandFilters state, separate from the selected sizes.
  • src/contexts/products-context/useProducts.tsx: filtering 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 keeps the current brand selection.
    • New 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 from availableBrands = ['Red Hat']. The size checkboxes are 35px circles, so BrandCheckbox extends their style into a pill that grows with the label text.
  • README.md: the Features list mentions the brand filter.

Behavior

Selection Result
Red Hat only Only Red Hat products (in the current catalog: Red Hat AI Black T-Shirt)
Red Hat + S Red Hat products that come in S
Red Hat + a size it doesn't come in Empty list
Brand cleared Size-only filtering, as before
Nothing selected All products

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

  • New 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).
  • Updated snapshots: the Filter and App snapshots include the new Brand section. The Product snapshot only has shifted styled-components class names (adding a styled component changes the generated IDs).

Results:

  • CI=true npm test: 55/55 passed
  • npm run lint: clean
  • npm run typecheck: clean
  • npm run build: succeeds

The repo has no pre-commit config. The new .ts/.tsx code 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

  • Branch is not main/master (agent/TSTAPP-1-red-hat-brand-filter)
  • Secret scan passed (gitleaks — ab28baa8e833abd27aa9394b250cea93b956dec3..HEAD)
  • PR body secret scan passed (gitleaks — no-git)
  • Final PR description secret scan passed (gitleaks — no-git)

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>
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Triggers review agent dispatch label Nov 15, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 12:57 PM UTC · Completed 1:23 PM UTC

Commit: 6639b86 · View workflow run →

Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $4.26

@fullsend-ai-review fullsend-ai-review Bot added the risk/low PR risk: low label Nov 15, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Score 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 run

Risk Assessment: low (1/5)

Details

Bot-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.

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Review

Findings

Low

  • [naming-convention] src/contexts/products-context/useProducts.tsx:11 — In the new matchesSizes helper, the outer callback parameter is still named filter and the inner one size. Both names were carried over from the old filterProducts body, where the array was called filters. The sibling matchesBrands (line 18) names its parameter brand to match brands, so the two helpers read inconsistently. Cosmetic only, no runtime effect; non-blocking.
    Remediation: sizes.some((size: string) => product.availableSizes.some((s: string) => s === size))

Earlier findings

  • src/utils/matchesBrand.ts:4 — edge-case — resolved by change: plain substring matching was replaced by an escaped, case-insensitive whole-word regex ((^|\W)...(\W|$)). New tests check that "Bored Hat" and "Red Hatchback" don't match and that "Cap (Red Hat)" does.
  • README.md:22 — incomplete-doc — resolved by change: the Features list now includes "Filter products by brand (e.g. Red Hat) using Context Api" (line 23).
Previous run

<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJhcHByb3ZlIiwiZmluZGluZ3MiOlt7InNldmVyaXR5IjoibG93IiwiY2F0ZWdvcnkiOiJuYW1pbmctY29udmVudGlvbiIsImZpbGUiOiJzcmMvY29udGV4dHMvcHJvZHVjdHMtY29udGV4dC91c2VQcm9kdWN0cy50c3giLCJpZCI6ImZfNzNmMzEwOGRkNWQ3MjE2MyIsImxpbmUiOjExLCJhY3Rpb25hYmxlIjpmYWxzZSwiZGltZW5zaW9uIjoic3R5bGUtY29udmVudGlvbnMifSx7InNldmVyaXR5IjoibG93IiwiY2F0ZWdvcnkiOiJlZGdlLWNhc2UiLCJmaWxlIjoic3JjL3V0aWxzL21hdGNoZXNCcmFuZC50cyIsImlkIjoiZl81MzZhNmY3NjBiYmU0YThjIiwibGluZSI6NCwiYWN0aW9uYWJsZSI6dHJ1ZSwiZGltZW5zaW9uIjoiY29ycmVjdG5lc3MifSx7InNldmVyaXR5IjoibG93IiwiY2F0ZWdvcnkiOiJpbmNvbXBsZXRlLWRvYyIsImZpbGUiOiJSRUFETUUubWQiLCJpZCI6ImZfMzUzODM2YmJlNDA1ZGU5YyIsImxpbmUiOjIyLCJhY3Rpb25hYmxlIjp0cnVlLCJkaW1lbnNpb24iOiJkb2NzLWN1cnJlbmN5In1dLCJkaXNwb3NpdGlvbnMiOlt7ImlkIjoiZl81MzZhNmY3NjBiYmU0YThjIiwic3RhdHVzIjoicmVzb2x2ZWRfYnlfY2hhbmdlIn0seyJpZCI6ImZfMzUzODM2YmJlNDA1ZGU5YyIsInN0YXR1cyI6InJlc29sdmVkX2J5X2NoYW5nZSJ9XX0= -->

Review

Findings

Low

  • [naming-convention] src/contexts/products-context/useProducts.tsx:11 — In the new matchesSizes helper, the outer callback parameter is still named filter and the inner one size. Both names were carried over from the old filterProducts body, where the array was called filters. The sibling matchesBrands (line 18) names its parameter brand to match brands, so the two helpers read inconsistently. Cosmetic only, no runtime effect; non-blocking.
    Remediation: sizes.some((size: string) => product.availableSizes.some((s: string) => s === size))

Earlier findings

  • src/utils/matchesBrand.ts:4 — edge-case — resolved by change: plain substring matching was replaced by an escaped, case-insensitive whole-word regex ((^|\W)...(\W|$)). New tests check that "Bored Hat" and "Red Hatchback" don't match and that "Cap (Red Hat)" does.
  • README.md:22 — incomplete-doc — resolved by change: the Features list now includes "Filter products by brand (e.g. Red Hat) using Context Api" (line 23).
Previous run (2)

<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W3sic2V2ZXJpdHkiOiJsb3ciLCJjYXRlZ29yeSI6ImVkZ2UtY2FzZSIsImZpbGUiOiJzcmMvdXRpbHMvbWF0Y2hlc0JyYW5kLnRzIiwiaWQiOiJmXzUzNmE2Zjc2MGJiZTRhOGMiLCJsaW5lIjo0LCJhY3Rpb25hYmxlIjp0cnVlLCJkaW1lbnNpb24iOiJjb3JyZWN0bmVzcyJ9LHsic2V2ZXJpdHkiOiJsb3ciLCJjYXRlZ29yeSI6ImluY29tcGxldGUtZG9jIiwiZmlsZSI6IlJFQURNRS5tZCIsImlkIjoiZl8zNTM4MzZiYmU0MDVkZTljIiwibGluZSI6MjIsImFjdGlvbmFibGUiOnRydWUsImRpbWVuc2lvbiI6ImRvY3MtY3VycmVuY3kifV19 -->

Review

Findings

Low

  • [edge-case] src/utils/matchesBrand.ts:4 — matchesBrand uses a plain case-insensitive substring check ((text || '').toLowerCase().includes(search.toLowerCase())) and does not check word boundaries. Any title or description where 'red hat' appears inside other words matches the Red Hat brand filter. Examples are 'Bored Hat Tee', 'Tired Hat' and 'Red Hatchback'. The PR guards against a match spanning the title and description, but it does not guard against a match that starts or ends partway through a word inside one field. In the current catalog only 'Red Hat AI Black T-Shirt' matches, so this has no effect today. It will produce false positives as products are added.
    Remediation: Match on word boundaries, e.g. build a case-insensitive RegExp of the form \b<escaped search>\b and test it against text || ''. Add tests showing that 'Bored Hat' and 'Red Hatchback' do not match.

  • [incomplete-doc] README.md:22 — The README Features section lists 'Filter products by available sizes using Context Api' but does not mention the brand filter this PR adds (the Brand section with the Red Hat checkbox in the sidebar). A reader of the README would not know brand filtering exists.
    Remediation: Add a bullet under Features such as: '- Filter products by brand (e.g. Red Hat) using Context Api'.


Labels: The PR adds a new user-facing feature (Red Hat brand filter).


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added the enhancement New feature or request label Nov 15, 2026
@fullsend-ai-coder

fullsend-ai-coder Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Finished Fix · ✅ Success · Started 1:24 PM UTC · Completed 1:29 PM UTC

Commit: 6639b86 · View workflow run →

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>
@fullsend-ai-coder

Copy link
Copy Markdown
Contributor Author

🔧 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):

  1. [edge-case] matchesBrand used a plain substring check, so Red Hat matched inside other words such as Bored Hat or Red Hatchback (src/utils/matchesBrand.ts): matchesBrand now tests an escaped, case-insensitive RegExp bounded by non-word characters or the start/end of the text, so only whole-word matches count. Title and description are still checked separately. Added a test showing Bored Hat Tee and Red Hatchback do not match while (Red Hat) does.
  2. [incomplete-doc] README Features section does not mention the brand filter (README.md): Added the bullet: Filter products by brand (e.g. Red Hat) using Context Api.
  3. PR description became stale after these fixes (substring matching wording, test list, 54/54 test count, README not listed): Proposed an updated PR body that describes whole-word matching, the new test case, the README change, and the current 55/55 test result.
  4. Merge conflict check: GitHub reports mergeable=MERGEABLE, so no conflict reconciliation was needed (skipped).

Tests: passed

CI inspections (4):

  1. security / Secret scan (gitleaks) (passing, success): Secret scan passed on the PR head.
  2. security / Production dependency audit (passing, success): Dependency audit passed on the PR head.
  3. DCO (passing, success): DCO check passed.
  4. merge agent PRs on clean review / merge-on-clean-review (passing, skipped): Skipped because the review requested changes. This is expected, not a failure.

Conflict update: skipped; strategy none; forge MERGEABLE; target main

Decision points
  • How to express word boundaries in matchesBrand (alternatives: Use \b around the escaped brand as the reviewer suggested, Use (^|\W) and (\W|$) guards around the escaped brand; rationale: Both behave the same for Red Hat. The explicit guards also stay correct for brand names that start or end with punctuation, and they avoid lookbehind syntax that older browsers in the browserslist may lack.)
  • Prettier reports trailing-comma differences in the matchesBrand files (alternatives: Reformat both files with prettier --write, Keep the existing no-trailing-comma style; rationale: The same warnings exist at the PR head and lint-staged only formats js/json/css/md, so reformatting would add unrelated churn.)

PR metadata: body updated

Next steps:

  • /fs-review — request a re-review of the changes
  • /fs-fix <your instruction> — run another fix pass with specific guidance
  • Push commits directly — review re-runs automatically on push

Updated by fullsend fix agent

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 1:30 PM UTC · Completed 1:41 PM UTC

Commit: 578d288 · View workflow run →

Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $3.62

@fullsend-ai-review fullsend-ai-review Bot added risk/moderate PR risk: moderate and removed risk/low PR risk: low labels Nov 15, 2026
@fullsend-ai-review
fullsend-ai-review Bot dismissed their stale review November 15, 2026 13:41

Superseded by updated review

@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label Nov 15, 2026
@shairevivo
shairevivo enabled auto-merge (squash) November 15, 2026 14:44
@shairevivo
shairevivo disabled auto-merge November 15, 2026 14:47
@shairevivo
shairevivo enabled auto-merge (squash) November 15, 2026 14:49
@shairevivo
shairevivo merged commit 78b28c0 into main Nov 15, 2026
64 of 66 checks passed
@shairevivo
shairevivo deleted the agent/TSTAPP-1-red-hat-brand-filter branch November 15, 2026 14:51
@fullsend-ai-retro

fullsend-ai-retro Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

🤖 Finished Retro · ✅ Success · Started 2:52 PM UTC · Completed 3:00 PM UTC

Commit: 578d288 · View workflow run →

Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $3.69

shairevivo added a commit that referenced this pull request Nov 15, 2026
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>
@fullsend-ai-retro

Copy link
Copy Markdown

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: matchesBrand matched substrings, so "Bored Hat" and "Red Hatchback" counted as Red Hat, and the README didn't mention the new filter. The fix run fixed both in about 6 min for $0.79. Review 2 approved. The human reviewer added no further code findings. Their involvement was operational: getting the PR merged. I am filing no new proposals, because every problem below is already tracked.

Timeline

  • 12:48–12:56 The code agent (43715689447, $1.33) opened the PR. Tests, lint, typecheck and build all passed.
  • 12:57–13:23 Review 1 ($4.26) returned request-changes with 2 actionable low findings. The review itself took about 5 min (13:00–13:04 with 7 dimension sub-agents and a challenger). The session then sat idle for about 18 min (13:04:38–13:23:00) because a 1200s ScheduleWakeup "fallback heartbeat" was still pending.
  • 13:23–13:29 The fix agent made commit 578d288: whole-word regex, new tests, and a README bullet.
  • 13:29–13:41 Review 2 ($3.62) approved. It posted one new cosmetic finding marked actionable:false: naming in matchesSizes. That code was unchanged since the first commit, so Review 1's style sub-agent had missed it.
  • 13:41 The repo-local .github/workflows/auto-merge.yml (run 43720294150) refused to merge: PR changes paths outside src/, public/, and root firebase.json. The only such file was the README.md line the review had asked for. The run's apparent 65-min duration is really two ~8s attempts; the second was a manual re-run at 14:46.
  • 14:44–14:51 The human opened ci(auto-merge): allow the root README.md in the path allowlist #97 to add the root README.md to the allowlist. They then replied to and resolved both bot review threads, which the org default-branch ruleset requires (required_review_thread_resolution: true), and the PR merged through native auto-merge.

Evidence for existing issues (no new proposals)

Other observations (not filed)

  • Review 1 returned request-changes for two low findings because of the rule "any actionable finding, regardless of severity, gets request-changes" in skills/pr-review/SKILL.md / agents/review.md. Here that worked out: both fixes were real improvements and the fix loop was cheap.
  • Review 1 missed the naming nit that Review 2 caught on identical code. It was cosmetic, and one occurrence isn't enough to call it a pattern.
  • The code agent never considered the README, and this repo's AGENTS.md has no docs guidance. Adding guidance would have saved only the README part of a fix round that was needed anyway.
  • Autonomy: the human made no code-level corrections, so the agent review matched the human outcome for this change. What still needs a human is merge plumbing: the path allowlist and thread resolution. That will shrink once ci(auto-merge): allow the root README.md in the path allowlist #97, #956/#9446 and #1881 land.

Agents repo discovered from the run logs: fullsend-ai/agents@v0.56.1 (62f25ace461b).

shairevivo added a commit that referenced this pull request Nov 15, 2026
…#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ready-for-merge All reviewers approved — ready to merge ready-for-review Triggers review agent dispatch risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant