Skip to content

fix: sort feed by newest, remove relevance scoring#8

Merged
jeremylongshore merged 1 commit intomainfrom
fix/feed-newest-no-relevance
Feb 16, 2026
Merged

fix: sort feed by newest, remove relevance scoring#8
jeremylongshore merged 1 commit intomainfrom
fix/feed-newest-no-relevance

Conversation

@jeremylongshore
Copy link
Collaborator

@jeremylongshore jeremylongshore commented Feb 16, 2026

Summary

  • Feed now sorts by published_at DESC instead of relevance_score DESC, published_at DESC — most articles have null relevance scores (Agent 3 not run during ingestion), causing unpredictable ordering
  • Removed Trending section, score legend, and relevance badge from article cards — replaced with time-ago badge
  • Removed stale Firestore composite index (articles: relevance_score DESC, published_at DESC)
  • Added ingestion-complete event listener so feed auto-refreshes after ingestion finishes
  • relevance_score kept in Firestore and agent tools (no backend changes)

Test plan

  • npx tsc --noEmit passes clean
  • firestore.indexes.json valid JSON, stale index removed
  • test_dashboard_queries.py updated and syntax-valid
  • Manual: confirm articles sorted newest-first on dashboard
  • Manual: confirm no Trending section or relevance badges
  • Deploy indexes: firebase deploy --only firestore:indexes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Removed trending score feature from article display.
    • Articles now show time-ago indicators for publication date instead of trending metrics.
    • Changed article ordering to prioritize newest content first.
    • Simplified dashboard interface for a cleaner, more focused user experience.

Articles were sorting by relevance_score DESC which is null for most
articles (Agent 3 assigns scores but ingestion path skips it), causing
unpredictable ordering. Feed now sorts purely by published_at DESC.

Removed: TrendingSection component, calculateTrendingScore(), score
legend, relevance composite Firestore index. Added ingestion-complete
event listener to auto-refresh feed after ingestion completes.

Relevance_score field kept in Firestore and agents — only dashboard
display and query ordering changed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@qodo-code-review
Copy link

Review Summary by Qodo

Sort feed by newest, remove relevance scoring from dashboard

🐞 Bug fix ✨ Enhancement

Grey Divider

Walkthroughs

Description
• Feed now sorts by published_at DESC instead of relevance score
• Removed Trending section, score legend, and relevance badges
• Added ingestion-complete event listener for auto-refresh
• Removed stale Firestore composite index on relevance_score
Diagram
flowchart LR
  A["Feed Query"] -->|"Changed from relevance_score DESC"| B["published_at DESC only"]
  C["Article Card"] -->|"Removed relevance badge"| D["Time-ago badge"]
  E["Trending Section"] -->|"Removed"| F["Simplified UI"]
  G["Firestore Index"] -->|"Deleted composite"| H["Single-field index"]
  I["Ingestion Complete"] -->|"Event listener"| J["Auto-refresh feed"]
Loading

Grey Divider

File Changes

1. dashboard/src/pages/Articles.tsx ✨ Enhancement +9/-189

Remove trending section and relevance scoring from feed

• Removed calculateTrendingScore() function and trending score calculations
• Removed TrendingSection component displaying trending articles by category
• Replaced relevance score badge with time-ago badge in ArticleCard
• Changed feed query to sort by published_at DESC only, removing relevance_score DESC
• Added ingestion-complete event listener with refreshKey state for auto-refresh
• Removed score legend UI explaining relevance, HN upvotes, and trending scores
• Simplified state management by removing allArticles state variable

dashboard/src/pages/Articles.tsx


2. tests/firebase/test_dashboard_queries.py 🧪 Tests +4/-6

Update test to verify newest-first article ordering

• Renamed test from test_articles_by_relevance_query to test_articles_by_newest_query
• Removed orderBy('relevance_score', 'desc') from query
• Updated test docstring to reflect newest-first ordering instead of relevance-based
• Updated error message to indicate single-field orderBy doesn't need composite index

tests/firebase/test_dashboard_queries.py


3. firestore.indexes.json ⚙️ Configuration changes +1/-16

Remove stale relevance score composite index

• Removed composite index on articles collection with relevance_score DESC, published_at DESC
• Fixed trailing comma formatting in JSON structure

firestore.indexes.json


Grey Divider

Qodo Logo

@gemini-code-assist
Copy link

Summary of Changes

Hello @jeremylongshore, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the user experience on the dashboard by prioritizing recency in the article feed and streamlining the interface. It addresses issues with inconsistent article ordering by simplifying the sorting mechanism and removes less utilized or problematic UI elements related to relevance scoring. Additionally, it improves data freshness by enabling automatic feed updates post-ingestion and cleans up the database by removing an obsolete index.

Highlights

  • Feed Sorting Logic Updated: The main article feed now sorts exclusively by published_at DESC (newest first), removing the relevance_score DESC component which often led to unpredictable ordering due to many articles having null relevance scores.
  • UI Simplification: The 'Trending section', relevance score legend, and relevance badges on article cards have been removed from the dashboard. A 'time-ago' badge has been introduced to display article age.
  • Firestore Index Optimization: A stale Firestore composite index (articles: relevance_score DESC, published_at DESC) that is no longer needed has been removed.
  • Automatic Feed Refresh: An ingestion-complete event listener has been added to automatically refresh the article feed on the dashboard once new data ingestion finishes.
Changelog
  • dashboard/src/pages/Articles.tsx
    • Removed getRelevanceColor import and trending_score from the Article interface.
    • Deleted the calculateTrendingScore function and the TrendingSection component.
    • Updated ArticleCard to display a 'time-ago' badge instead of a relevance score.
    • Refactored article fetching logic to remove allArticles state and related trending calculations.
    • Modified the Firestore query to order articles solely by published_at in descending order.
    • Implemented an ingestion-complete event listener to trigger feed refreshes.
    • Removed the 'Score Legend' and the rendering of the 'Trending Section' from the UI.
  • firestore.indexes.json
    • Removed the composite Firestore index for articles collection group on relevance_score DESC, published_at DESC.
  • tests/firebase/test_dashboard_queries.py
    • Renamed test_articles_by_relevance_query to test_articles_by_newest_query to reflect the updated sorting.
    • Adjusted the Firestore query in the test to remove orderBy('relevance_score', 'desc').
    • Updated the pytest.fail message to indicate that single-field ordering should not require a composite index.
Activity
  • The pull request was generated using Claude Code.
  • TypeScript compilation (npx tsc --noEmit) passed clean.
  • The firestore.indexes.json file was validated, and the stale index was confirmed removed.
  • The test_dashboard_queries.py file was updated and confirmed to be syntactically valid.
  • Manual testing is planned to confirm articles are sorted newest-first on the dashboard.
  • Manual testing is planned to confirm the absence of the Trending section and relevance badges.
  • Deployment of indexes (firebase deploy --only firestore:indexes) is planned.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Feb 16, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Remove trending score feature and replace with time-based ordering. Frontend updates remove trending_score field, TrendingSection component, and calculateTrendingScore function, replacing them with time-ago indicators and event-listener-based refresh. Firestore indexes are updated to remove the relevance_score index, and tests are updated to verify newest-first ordering instead of relevance-based queries.

Changes

Cohort / File(s) Summary
Frontend trending removal
dashboard/src/pages/Articles.tsx
Removed trending_score field from Article interface, deleted calculateTrendingScore function and TrendingSection component. Replaced all-articles pre-load with ingestion-complete event listener to trigger refresh. Updated ArticleCard to display time-ago indicator for published_at instead of trending/relevance score badge. Fetch logic now filters by category with published_at DESC ordering.
Firestore index cleanup
firestore.indexes.json
Removed composite index for collectionGroup "articles" with relevance_score (DESC) and published_at (DESC) fields. Retained existing articles index with category and published_at fields. Adjusted JSON structure with proper comma and brace formatting.
Test updates
tests/firebase/test_dashboard_queries.py
Renamed test method from test_articles_by_relevance_query to test_articles_by_newest_query. Updated query to remove orderBy on relevance_score and retain orderBy on published_at (DESC). Updated docstring and error messages to reflect "newest first" ordering semantics.

Sequence Diagram

sequenceDiagram
    participant Client as Client (Dashboard)
    participant Firestore as Firestore
    participant EventSystem as Event System

    rect rgba(100, 150, 200, 0.5)
    Note over Client,EventSystem: Old Flow - Pre-load all articles
    Client->>Firestore: Fetch all articles
    Firestore-->>Client: Return articles with relevance_score
    Client->>Client: Calculate trending scores
    Client->>Client: Render with trending badges
    end

    rect rgba(150, 200, 100, 0.5)
    Note over Client,EventSystem: New Flow - Event-driven refresh
    EventSystem->>Client: Emit ingestion-complete event
    Client->>Firestore: Fetch articles by category<br/>(orderBy: published_at DESC)
    Firestore-->>Client: Return articles
    Client->>Client: Render with time-ago indicator
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Trending scores fade to the past,
Event listeners, fast and steadfast,
Time-ago badges now shine so bright,
Published dates guide the reader's light,
Simplicity blooms—the code is light!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/feed-newest-no-relevance

Comment @coderabbitai help to get the list of available commands and usage tips.

@jeremylongshore jeremylongshore merged commit c9d082a into main Feb 16, 2026
8 of 9 checks passed
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively refactors the article feed to sort by publication date instead of the deprecated relevance score. The changes are well-executed across the frontend component, Firestore index configuration, and integration tests. The removal of the trending score logic and related UI elements simplifies the codebase significantly. I've added one suggestion to improve the maintainability of the new auto-refresh mechanism.

Comment on lines 224 to 228
useEffect(() => {
const fetchAllArticles = async () => {
try {
const articlesRef = collection(db, 'articles')
const q = query(
articlesRef,
orderBy('relevance_score', 'desc'),
orderBy('published_at', 'desc'),
limit(200)
)
const snapshot = await getDocs(q)
const fetched: Article[] = []
snapshot.forEach((doc) => {
fetched.push({ id: doc.id, ...doc.data() } as Article)
})
setAllArticles(fetched)
} catch (err) {
console.error('Error fetching all articles:', err)
}
}
fetchAllArticles()
const handler = () => setRefreshKey(k => k + 1)
window.addEventListener('ingestion-complete', handler)
return () => window.removeEventListener('ingestion-complete', handler)
}, [])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using a string literal for the event name 'ingestion-complete' is brittle because it's duplicated in IngestionButton.tsx. This could lead to silent failures if the string is changed in one file but not the other.

To improve maintainability and prevent potential bugs, I recommend defining this event name as a shared constant. For example, you could create a file like src/lib/events.ts:

// src/lib/events.ts
export const INGESTION_COMPLETE_EVENT = 'ingestion-complete';

Then, import and use this constant in both Articles.tsx and IngestionButton.tsx.

While window events are simple for this use case, for future enhancements, consider using a more structured approach for cross-component communication, such as React Context, to make dependencies more explicit.

@greptile-apps
Copy link

greptile-apps bot commented Feb 16, 2026

Greptile Summary

Simplifies the Articles feed by removing relevance-based sorting (which produced unpredictable ordering due to null scores) in favor of published_at DESC. Removes the Trending section, score legend, and relevance badge UI, replacing them with a time-ago indicator. Adds an ingestion-complete event listener so the feed auto-refreshes after ingestion finishes.

  • Firestore query changed from orderBy(relevance_score DESC, published_at DESC) to orderBy(published_at DESC), and the stale composite index was removed from firestore.indexes.json
  • Trending section, calculateTrendingScore, allArticles dual-fetch, and score legend all removed — significant code reduction (~200 lines)
  • ingestion-complete custom event listener added (consistent with existing pattern in SystemActivityCard)
  • test_dashboard_queries.py updated to match the new query
  • Issue: tests/firebase/test_firestore_indexes.py:test_articles_relevance_published_index still asserts the removed index exists — this test was not updated and will fail

Confidence Score: 3/5

  • Straightforward simplification but will break an existing test that wasn't updated
  • The core changes are clean and well-motivated — removing dead relevance scoring UI and simplifying to chronological ordering. However, the test_articles_relevance_published_index test in test_firestore_indexes.py still asserts the removed composite index must exist, which will cause test failures. This is a concrete issue that needs to be fixed before merge.
  • firestore.indexes.json — the index removal is not reflected in tests/firebase/test_firestore_indexes.py, which will fail

Important Files Changed

Filename Overview
dashboard/src/pages/Articles.tsx Removed Trending section, relevance scoring UI, and dual-fetch pattern. Simplified to single published_at DESC query. Added ingestion-complete event listener for auto-refresh. Minor issue: time-ago is displayed twice per card.
firestore.indexes.json Removed (relevance_score DESC, published_at DESC) composite index and fixed trailing comma. However, test_firestore_indexes.py:test_articles_relevance_published_index still asserts this index exists — test will fail.
tests/firebase/test_dashboard_queries.py Renamed test and updated query to match new published_at DESC ordering. Error message correctly notes single-field orderBy shouldn't need composite index.

Sequence Diagram

sequenceDiagram
    participant User
    participant Articles as Articles.tsx
    participant Firestore
    participant IngBtn as IngestionButton
    participant MCP as MCP Service

    User->>Articles: Load feed
    Articles->>Firestore: query(articles, orderBy published_at DESC, limit 100)
    Firestore-->>Articles: Article documents

    User->>IngBtn: Click "Run Ingestion"
    IngBtn->>MCP: POST /trigger/ingestion
    MCP-->>IngBtn: 202 Accepted (run_id)
    loop Poll status
        IngBtn->>MCP: GET /trigger/ingestion/{run_id}
        MCP-->>IngBtn: {phase, stats, status}
    end
    IngBtn->>IngBtn: dispatchEvent('ingestion-complete')
    IngBtn-->>Articles: CustomEvent('ingestion-complete')
    Articles->>Firestore: Re-fetch articles (refreshKey incremented)
    Firestore-->>Articles: Updated article documents
Loading

Last reviewed commit: 1d02f30

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment on lines 1 to 2
{
"indexes": [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing index test will break

Removing the (relevance_score DESC, published_at DESC) composite index here is correct for the new query, but tests/firebase/test_firestore_indexes.py:112test_articles_relevance_published_index — still asserts this index must exist in the file. That test will fail after this change.

Either remove or update the test in test_firestore_indexes.py to match the new index set.

Comment on lines +94 to 97
{/* Time indicator */}
<div className="w-auto px-2 h-8 rounded-lg flex items-center justify-center text-xs font-medium shrink-0 bg-muted text-muted-foreground tabular-nums">
{formatTimeAgo(article.published_at)}
</div>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate time-ago display

formatTimeAgo(article.published_at) is now rendered twice per card: once here in the new time indicator badge, and again on line 116 in the source metadata row. Previously the badge showed the relevance score, so they were distinct. Now both positions display the same value, which is visually redundant.

Consider removing one of the two instances — either this badge or the inline text on line 116.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@qodo-code-review
Copy link

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (2) 📎 Requirement gaps (0)

Grey Divider


Action required

1. formatTimeAgo() lacks date validation 📘 Rule violation ⛯ Reliability
Description
The new time-ago badge calls formatTimeAgo(article.published_at) without handling missing/invalid
dates, which can render Invalid Date or misleading values. This violates the requirement to
explicitly handle null/empty/boundary cases for user-visible behavior.
Code

dashboard/src/pages/Articles.tsx[R94-97]

+        {/* Time indicator */}
+        <div className="w-auto px-2 h-8 rounded-lg flex items-center justify-center text-xs font-medium shrink-0 bg-muted text-muted-foreground tabular-nums">
+          {formatTimeAgo(article.published_at)}
        </div>
Evidence
PR Compliance ID 3 requires explicit handling of null/empty/boundary values; the newly added UI
calls formatTimeAgo() for every article, but the helper does not guard against invalid/missing
timestamps and can produce user-visible incorrect output.

Rule 3: Generic: Robust Error Handling and Edge Case Management
dashboard/src/pages/Articles.tsx[94-97]
dashboard/src/pages/Articles.tsx[69-81]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The newly added time-ago badge calls `formatTimeAgo(article.published_at)` for every article, but `formatTimeAgo()` does not handle invalid/missing timestamps (e.g., `undefined`, empty string, unparsable strings) and can display `Invalid Date`, `NaN`, or negative time values.

## Issue Context
Articles are hydrated from Firestore via `doc.data()` and cast to `Article` without runtime validation, so `published_at` may be absent or malformed in some documents.

## Fix Focus Areas
- dashboard/src/pages/Articles.tsx[69-81]
- dashboard/src/pages/Articles.tsx[94-97]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Firestore index docs outdated 📘 Rule violation ✧ Quality
Description
This PR removes the articles(relevance_score DESC, published_at DESC) composite index but does not
update STATUS.md and the Firestore schema/operator docs to reflect the new index expectations.
This breaks the requirement to document noteworthy configuration/operational changes.
Code

firestore.indexes.json[L3-16]

-    {
-      "collectionGroup": "articles",
-      "queryScope": "COLLECTION",
-      "fields": [
-        {
-          "fieldPath": "relevance_score",
-          "order": "DESCENDING"
-        },
-        {
-          "fieldPath": "published_at",
-          "order": "DESCENDING"
-        }
-      ]
-    },
Evidence
PR Compliance ID 11 requires configuration changes to be documented in STATUS.md and relevant
manuals under 000-docs/; the PR changes Firestore index configuration while the documentation
still describes a relevance-based composite index and STATUS.md contains no note about this
index/deploy change.

AGENTS.md
firestore.indexes.json[1-16]
000-docs/001-AT-ARCH-firestore-schema.md[397-418]
STATUS.md[1-15]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Firestore index configuration changed (relevance-based composite index removed), but repository operational documentation was not updated. This makes operator guidance and schema/index expectations inaccurate.

## Issue Context
`firestore.indexes.json` is the source of truth for deployed composite indexes. `000-docs/001-AT-ARCH-firestore-schema.md` currently documents a relevance-based composite index and field names that no longer match the actual index configuration. `STATUS.md` also lacks a note about index deployment expectations.

## Fix Focus Areas
- firestore.indexes.json[1-47]
- 000-docs/001-AT-ARCH-firestore-schema.md[397-435]
- STATUS.md[1-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. CI fails: missing relevance index 🐞 Bug ⛯ Reliability
Description
The PR removes the articles(relevance_score DESC, published_at DESC) composite index, but the repo
still has a test that asserts this index must exist. This will fail CI even though the dashboard
query no longer uses relevance_score.
Code

firestore.indexes.json[R1-5]

{
  "indexes": [
-    {
-      "collectionGroup": "articles",
-      "queryScope": "COLLECTION",
-      "fields": [
-        {
-          "fieldPath": "relevance_score",
-          "order": "DESCENDING"
-        },
-        {
-          "fieldPath": "published_at",
-          "order": "DESCENDING"
-        }
-      ]
-    },
    {
      "collectionGroup": "articles",
      "queryScope": "COLLECTION",
Evidence
firestore.indexes.json no longer defines the relevance composite index, while
tests/firebase/test_firestore_indexes.py still requires it via
test_articles_relevance_published_index.

firestore.indexes.json[1-16]
tests/firebase/test_firestore_indexes.py[112-137]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR removed the Firestore composite index `articles(relevance_score DESC, published_at DESC)`, but the repo still has an index-validation test that asserts this index must exist. This mismatch will fail CI.

## Issue Context
Dashboard queries now sort by `published_at` only, so the composite index likely isn’t required anymore (unless another feature still uses it).

## Fix Focus Areas
- tests/firebase/test_firestore_indexes.py[112-137]
- firestore.indexes.json[1-16]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

4. Newest sort may be incorrect 🐞 Bug ✓ Correctness
Description
Feed now sorts only by published_at DESC, but published_at is stored as a string and ingestion
normalization can emit ISO strings with non-UTC offsets. Lexicographic ordering of mixed-offset ISO
strings can misorder true chronological newest-first results.
Code

dashboard/src/pages/Articles.tsx[R239-244]

        if (selectedCategory === 'all') {
          q = query(
            articlesRef,
-            orderBy('relevance_score', 'desc'),
            orderBy('published_at', 'desc'),
            limit(100)
          )
Evidence
The dashboard query orders by published_at alone. Backend writes published_at as a string. RSS
normalization uses date_parser.parse(...) and returns dt.isoformat() without converting to UTC,
so offsets other than +00:00 can be stored.

dashboard/src/pages/Articles.tsx[235-252]
perception_app/mcp_service/routers/storage.py[133-151]
perception_app/mcp_service/routers/rss.py[93-99]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The dashboard now relies on `orderBy(&#x27;published_at&#x27;, &#x27;desc&#x27;)` for newest-first ordering, but `published_at` is stored as a string and may include mixed timezone offsets. Mixed-offset ISO strings can break true chronological ordering when sorted lexicographically.

## Issue Context
RSS normalization currently returns `dt.isoformat()` without converting to UTC when the feed provides a timezone.

## Fix Focus Areas
- dashboard/src/pages/Articles.tsx[235-252]
- perception_app/mcp_service/routers/rss.py[93-99]
- perception_app/mcp_service/routers/storage.py[133-151]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment on lines +94 to 97
{/* Time indicator */}
<div className="w-auto px-2 h-8 rounded-lg flex items-center justify-center text-xs font-medium shrink-0 bg-muted text-muted-foreground tabular-nums">
{formatTimeAgo(article.published_at)}
</div>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. formattimeago() lacks date validation 📘 Rule violation ⛯ Reliability

The new time-ago badge calls formatTimeAgo(article.published_at) without handling missing/invalid
dates, which can render Invalid Date or misleading values. This violates the requirement to
explicitly handle null/empty/boundary cases for user-visible behavior.
Agent Prompt
## Issue description
The newly added time-ago badge calls `formatTimeAgo(article.published_at)` for every article, but `formatTimeAgo()` does not handle invalid/missing timestamps (e.g., `undefined`, empty string, unparsable strings) and can display `Invalid Date`, `NaN`, or negative time values.

## Issue Context
Articles are hydrated from Firestore via `doc.data()` and cast to `Article` without runtime validation, so `published_at` may be absent or malformed in some documents.

## Fix Focus Areas
- dashboard/src/pages/Articles.tsx[69-81]
- dashboard/src/pages/Articles.tsx[94-97]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines 1 to 5
{
"indexes": [
{
"collectionGroup": "articles",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "relevance_score",
"order": "DESCENDING"
},
{
"fieldPath": "published_at",
"order": "DESCENDING"
}
]
},
{
"collectionGroup": "articles",
"queryScope": "COLLECTION",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. Ci fails: missing relevance index 🐞 Bug ⛯ Reliability

The PR removes the articles(relevance_score DESC, published_at DESC) composite index, but the repo
still has a test that asserts this index must exist. This will fail CI even though the dashboard
query no longer uses relevance_score.
Agent Prompt
## Issue description
The PR removed the Firestore composite index `articles(relevance_score DESC, published_at DESC)`, but the repo still has an index-validation test that asserts this index must exist. This mismatch will fail CI.

## Issue Context
Dashboard queries now sort by `published_at` only, so the composite index likely isn’t required anymore (unless another feature still uses it).

## Fix Focus Areas
- tests/firebase/test_firestore_indexes.py[112-137]
- firestore.indexes.json[1-16]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@@ -1,19 +1,5 @@
{
"indexes": [
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Firestore index docs outdated 📘 Rule violation ✧ Quality

This PR removes the articles(relevance_score DESC, published_at DESC) composite index but does not
update STATUS.md and the Firestore schema/operator docs to reflect the new index expectations.
This breaks the requirement to document noteworthy configuration/operational changes.
Agent Prompt
## Issue description
The Firestore index configuration changed (relevance-based composite index removed), but repository operational documentation was not updated. This makes operator guidance and schema/index expectations inaccurate.

## Issue Context
`firestore.indexes.json` is the source of truth for deployed composite indexes. `000-docs/001-AT-ARCH-firestore-schema.md` currently documents a relevance-based composite index and field names that no longer match the actual index configuration. `STATUS.md` also lacks a note about index deployment expectations.

## Fix Focus Areas
- firestore.indexes.json[1-47]
- 000-docs/001-AT-ARCH-firestore-schema.md[397-435]
- STATUS.md[1-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@jeremylongshore jeremylongshore deleted the fix/feed-newest-no-relevance branch February 27, 2026 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant