Skip to content

agent: @U0AJM7X8FBR Admin + Docs + API - we want to update the /coding page in #21

Merged
sweetmantech merged 3 commits intomainfrom
feature/coding-agent-pr-tracking
Mar 23, 2026
Merged

agent: @U0AJM7X8FBR Admin + Docs + API - we want to update the /coding page in #21
sweetmantech merged 3 commits intomainfrom
feature/coding-agent-pr-tracking

Conversation

@sweetmantech
Copy link
Copy Markdown
Contributor

@sweetmantech sweetmantech commented Mar 23, 2026

Automated PR from coding agent.

Prompt: @U0AJM7X8FBR Admin + Docs + API - we want to update the /coding page in the admin codebase to view analytics around pull requests opened by the coding-agent.
• What is the link to the pull request opened?
• Which codebase was the pull request opened in?
• What was the original prompt which triggered the Agent to open this pull request?
Implementation details
• Docs - update the existing endpoint GET /api/admins/coding/slack - documentation-driven development.
• API - implement the endpoint to follow the updated docs.
• Admin - update the existing /coding page to display the new info

  • graph - add a line for the pull requests opened
  • table - add a new column for 'pull requests'

Summary by CodeRabbit

  • New Features
    • Charts can show an optional second data series with its own label and color.
    • Dashboard summary now shows three inline metrics: tags, tags with PRs, and total PRs.
    • Table gains a "Pull Requests" column that lists linked PR references.
    • New "Tags & Pull Requests Over Time" chart visualizes both tags and associated PR counts.

- Add pull_requests: string[] to SlackTag type
- Update getTagsByDate to track pull_request_count per date
- Update AdminLineChart to support an optional second line (PRs)
- Add Pull Requests column to SlackTagsTable
- Wire chart and table to show tags vs PRs over time

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
admin Ready Ready Preview Mar 23, 2026 10:07pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2026

📝 Walkthrough

Walkthrough

The diff adds pull-request tracking to the Slack tags admin UI: types and aggregation now include PR counts, the tags page shows PR metrics and a new "Pull Requests" column, and AdminLineChart gains an optional secondLine prop to render a secondary series merged by date.

Changes

Cohort / File(s) Summary
Chart Component Enhancement
components/Admin/AdminLineChart.tsx
Added optional secondLine prop (label, color) and conditional count2 chart config; merged primary and secondary series by date into mergedData; renders secondary Line and ChartLegend when present.
Tags Page & Columns
components/CodingAgentSlackTags/CodingAgentSlackTagsPage.tsx, components/CodingAgentSlackTags/SlackTagsColumns.tsx
Page header now shows three inline metrics (tags, tags with PRs, total PRs); chart uses secondLine for "Tags with PRs"; table columns add a "Pull Requests" column that renders PR URLs as external links or a muted em dash when empty.
Type & Aggregation
lib/coding-agent/getTagsByDate.ts, types/coding-agent.ts
Exported TagsByDateEntry now includes pull_request_count; getTagsByDate aggregates per-date count and pull_request_count; SlackTag gains pull_requests: string[]; SlackTagsResponse adds total_pull_requests and tags_with_pull_requests.

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant Page as CodingAgentSlackTagsPage
  participant Lib as getTagsByDate
  participant Chart as AdminLineChart

  Browser->>Page: Request tags data (API)
  Page->>Lib: getTagsByDate(tags[])
  Lib-->>Page: [{date, count, pull_request_count}...]
  Page->>Chart: Render with primary series + secondLine (if pull_request_count > 0)
  Chart-->>Browser: Draw mergedData with count and count2 series
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 ✨
I hopped through dates and stitched two lines in play,
Tags and PRs now skip along the way,
Legends whisper, links leap into view,
Charts bloom double — a rabbit's happy chew!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is vague and incomplete, using non-descriptive phrases like 'Admin + Docs + API' without clearly conveying the main objective of adding pull request tracking analytics to the /coding page. Revise the title to be more concise and specific, such as: 'Add PR tracking analytics to /coding admin page' or 'Update /coding page with coding-agent PR analytics'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/coding-agent-pr-tracking

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

… type and UI

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
components/CodingAgentSlackTags/CodingAgentSlackTagsPage.tsx (1)

75-86: Avoid computing getTagsByDate twice.

getTagsByDate(data.tags) is called twice with identical input—once for the primary series and once for secondLine. Consider computing it once.

♻️ Proposed refactor to compute once
      {!isLoading && !error && data && data.tags.length > 0 && (
-        <>
+        (() => {
+          const tagsByDate = getTagsByDate(data.tags);
+          return (
+            <>
-          <AdminLineChart
-            title="Tags & Pull Requests Over Time"
-            data={getTagsByDate(data.tags).map((d) => ({ date: d.date, count: d.count }))}
-            label="Tags"
-            secondLine={{
-              data: getTagsByDate(data.tags).map((d) => ({
-                date: d.date,
-                count: d.pull_request_count,
-              })),
-              label: "Pull Requests",
-            }}
-          />
+              <AdminLineChart
+                title="Tags & Pull Requests Over Time"
+                data={tagsByDate.map((d) => ({ date: d.date, count: d.count }))}
+                label="Tags"
+                secondLine={{
+                  data: tagsByDate.map((d) => ({
+                    date: d.date,
+                    count: d.pull_request_count,
+                  })),
+                  label: "Pull Requests",
+                }}
+              />
-          <SlackTagsTable tags={data.tags} />
-        </>
+              <SlackTagsTable tags={data.tags} />
+            </>
+          );
+        })()
       )}

Alternatively, extract the chart data preparation into a useMemo at the top of the component.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/CodingAgentSlackTags/CodingAgentSlackTagsPage.tsx` around lines 75
- 86, Compute getTagsByDate(data.tags) once and reuse it for both series: call
getTagsByDate(data.tags) into a single variable (or a useMemo) at the top of the
component, then pass that cached result to AdminLineChart for the primary series
and to secondLine.data (mapping to pull_request_count) instead of calling
getTagsByDate twice; update references to getTagsByDate in the AdminLineChart
props to use the new variable.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/CodingAgentSlackTags/SlackTagsColumns.tsx`:
- Around line 53-62: In SlackTagsColumns where prs is rendered, the regex
url.match(/\/pull\/(\d+)/) can return undefined and produce "#undefined"; fix by
extracting the match into a variable (e.g., const prMatch =
url.match(/\/pull\/(\d+)/)) and render a safe fallback: if prMatch exists render
`#${prMatch[1]}` otherwise render a sensible fallback such as the original url
or a label like "View PR" (keep the same anchor href and key to preserve
uniqueness). Ensure this change is applied inside the map callback that renders
the <a> for prs so non-matching URLs no longer show "#undefined".

---

Nitpick comments:
In `@components/CodingAgentSlackTags/CodingAgentSlackTagsPage.tsx`:
- Around line 75-86: Compute getTagsByDate(data.tags) once and reuse it for both
series: call getTagsByDate(data.tags) into a single variable (or a useMemo) at
the top of the component, then pass that cached result to AdminLineChart for the
primary series and to secondLine.data (mapping to pull_request_count) instead of
calling getTagsByDate twice; update references to getTagsByDate in the
AdminLineChart props to use the new variable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 273a2a2c-87eb-4995-b053-1dd8dec543c9

📥 Commits

Reviewing files that changed from the base of the PR and between 03ee6dd and e9f0203.

📒 Files selected for processing (5)
  • components/Admin/AdminLineChart.tsx
  • components/CodingAgentSlackTags/CodingAgentSlackTagsPage.tsx
  • components/CodingAgentSlackTags/SlackTagsColumns.tsx
  • lib/coding-agent/getTagsByDate.ts
  • types/coding-agent.ts

…n PR column

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
components/CodingAgentSlackTags/CodingAgentSlackTagsPage.tsx (1)

75-85: Avoid duplicate getTagsByDate aggregation in render.

Line 77 and Line 80 recompute the same grouped series. Compute once and reuse for both lines to reduce repeated work and keep chart wiring easier to maintain.

♻️ Proposed refactor
 export default function CodingAgentSlackTagsPage() {
   const [period, setPeriod] = useState<AdminPeriod>("all");
   const { data, isLoading, error } = useSlackTags(period);
+  const tagsByDate = data ? getTagsByDate(data.tags) : [];

   return (
@@
           <AdminLineChart
             title="Tags & Pull Requests Over Time"
-            data={getTagsByDate(data.tags).map((d) => ({ date: d.date, count: d.count }))}
+            data={tagsByDate.map((d) => ({ date: d.date, count: d.count }))}
             label="Tags"
             secondLine={{
-              data: getTagsByDate(data.tags).map((d) => ({
+              data: tagsByDate.map((d) => ({
                 date: d.date,
                 count: d.pull_request_count,
               })),
               label: "Tags with PRs",
             }}
           />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/CodingAgentSlackTags/CodingAgentSlackTagsPage.tsx` around lines 75
- 85, The render currently calls getTagsByDate(data.tags) twice when building
the AdminLineChart props; compute const tagsByDate = getTagsByDate(data.tags)
once above the JSX and reuse tagsByDate.map(...) for both the primary line and
the secondLine data to avoid duplicate aggregation and make the AdminLineChart
wiring (props: title, data, label, secondLine) clearer and cheaper to render.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lib/coding-agent/getTagsByDate.ts`:
- Around line 20-23: The pull_request_count currently increments by 1 per tag
regardless of how many PRs are referenced; change the increment in the block
that updates counts (where counts[date] is initialized and modified) to add the
actual number of PRs referenced by the tag (use tag.pull_requests?.length or 0)
instead of always adding 1 so pull_request_count reflects total PR links for
that date.

---

Nitpick comments:
In `@components/CodingAgentSlackTags/CodingAgentSlackTagsPage.tsx`:
- Around line 75-85: The render currently calls getTagsByDate(data.tags) twice
when building the AdminLineChart props; compute const tagsByDate =
getTagsByDate(data.tags) once above the JSX and reuse tagsByDate.map(...) for
both the primary line and the secondLine data to avoid duplicate aggregation and
make the AdminLineChart wiring (props: title, data, label, secondLine) clearer
and cheaper to render.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 81d31782-a4f8-41c1-abd5-0b66e2fa6454

📥 Commits

Reviewing files that changed from the base of the PR and between e9f0203 and 01d5420.

📒 Files selected for processing (3)
  • components/CodingAgentSlackTags/CodingAgentSlackTagsPage.tsx
  • components/CodingAgentSlackTags/SlackTagsColumns.tsx
  • lib/coding-agent/getTagsByDate.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/CodingAgentSlackTags/SlackTagsColumns.tsx

Comment on lines +20 to 23
if (!counts[date]) counts[date] = { count: 0, pull_request_count: 0 };
counts[date].count += 1;
counts[date].pull_request_count += (tag.pull_requests?.length ?? 0) > 0 ? 1 : 0;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

pull_request_count is currently counting tags, not pull requests.

At Line 22, this adds 1 per tagged message with any PR. That undercounts days where a message includes multiple PR links and conflicts with “pull requests over time” semantics.

🔧 Proposed fix
-    counts[date].pull_request_count += (tag.pull_requests?.length ?? 0) > 0 ? 1 : 0;
+    counts[date].pull_request_count += tag.pull_requests?.length ?? 0;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!counts[date]) counts[date] = { count: 0, pull_request_count: 0 };
counts[date].count += 1;
counts[date].pull_request_count += (tag.pull_requests?.length ?? 0) > 0 ? 1 : 0;
}
if (!counts[date]) counts[date] = { count: 0, pull_request_count: 0 };
counts[date].count += 1;
counts[date].pull_request_count += tag.pull_requests?.length ?? 0;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/coding-agent/getTagsByDate.ts` around lines 20 - 23, The
pull_request_count currently increments by 1 per tag regardless of how many PRs
are referenced; change the increment in the block that updates counts (where
counts[date] is initialized and modified) to add the actual number of PRs
referenced by the tag (use tag.pull_requests?.length or 0) instead of always
adding 1 so pull_request_count reflects total PR links for that date.

@sweetmantech sweetmantech merged commit 0e1af72 into main Mar 23, 2026
3 checks passed
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