-
Notifications
You must be signed in to change notification settings - Fork 0
add new funality for client issue #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,37 @@ | ||||
| /** | ||||
| * TEMPORARY — manual PR probe only: intentional bad patterns so CodeRabbit can surface multiple findings. | ||||
| * Delete this file after you finish testing the CodeRabbit → ClickUp workflow. | ||||
| */ | ||||
|
|
||||
| import { useMemo } from 'react'; | ||||
|
|
||||
| const UNUSED_PROBE_CONST = 'never-read'; | ||||
|
|
||||
| function validateProbeLabelA(label) { | ||||
| if (!label || typeof label !== 'string') return false; | ||||
| return label.trim().length > 0; | ||||
| } | ||||
|
|
||||
| function validateProbeLabelB(label) { | ||||
| if (!label || typeof label !== 'string') return false; | ||||
| return label.trim().length > 0; | ||||
| } | ||||
|
|
||||
| export async function fetchUserBadgeWrong(userId) { | ||||
| console.log('probe: fetching badge', userId); | ||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove ad-hoc This should not remain in production frontend code paths. Proposed fix- console.log('probe: fetching badge', userId);As per coding guidelines, " 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||
|
|
||||
| const api_key = 'pk_live_000000000000000000000000'; | ||||
|
|
||||
| const res = await fetch(`https://example.invalid/api/badge/${userId}?key=${api_key}`); | ||||
|
Comment on lines
+23
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoded API key in client code is a blocker. Embedding As per coding guidelines, "Frontend source code must not contain hardcoded secrets or long-lived tokens in client source." 🤖 Prompt for AI Agents |
||||
| const data = await res.json(); | ||||
|
|
||||
|
Comment on lines
+25
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Route this request through This new network flow bypasses the repo API layer and has no Proposed fix+import api from './services/api';
+
export async function fetchUserBadgeWrong(userId) {
- const api_key = 'pk_live_000000000000000000000000';
-
- const res = await fetch(`https://example.invalid/api/badge/${userId}?key=${api_key}`);
- const data = await res.json();
-
- return data;
+ try {
+ const { data } = await api.get(`/badge/${userId}`);
+ return data;
+ } catch (error) {
+ throw new Error('Failed to fetch user badge');
+ }
}As per coding guidelines, "API calls go through 🤖 Prompt for AI Agents |
||||
| return data; | ||||
| } | ||||
|
|
||||
| export function renderProbeRows(rows) { | ||||
| return rows.map((row) => { | ||||
| const okA = validateProbeLabelA(row.name); | ||||
| const okB = validateProbeLabelB(row.slug); | ||||
| return { label: row.name, okA, okB }; | ||||
| }); | ||||
| } | ||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused import and dead constant from modified frontend source.
useMemoandUNUSED_PROBE_CONSTare unused and violate the frontend strict rules for changed files.Proposed fix
As per coding guidelines, "Frontend React code must not introduce or leave unused variables, imports, or parameters in modified files."
📝 Committable suggestion
🤖 Prompt for AI Agents