Skip to content

fix: resolve build compilation and linting errors for Issue #125#138

Merged
deekshithgowda85 merged 2 commits into
deekshithgowda85:prodfrom
trivikramkalagi91-commits:fix/issue-125-build-lint
Jun 30, 2026
Merged

fix: resolve build compilation and linting errors for Issue #125#138
deekshithgowda85 merged 2 commits into
deekshithgowda85:prodfrom
trivikramkalagi91-commits:fix/issue-125-build-lint

Conversation

@trivikramkalagi91-commits

@trivikramkalagi91-commits trivikramkalagi91-commits commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Summary

This PR addresses and resolves all build compilation issues, JSX syntax/parsing errors, missing hooks/exports, and ESLint violations across the repository. It stabilizes the development environment and ensures that npm run lint and npm run build pass completely clean without any warnings or errors.

Related Issue

Closes: #125

What Changed

  • Fixed JSX Syntax & Merging Errors (repository-list.tsx): Resolved a nested/corrupted unauthenticated conditional block, separated the staged payload dropzone elements, closed all JSX tags correctly, and cleaned up unused skeletal layout components (SkeletonCard, SkeletonRow).
  • Restored Missing Attack Pipeline Crawler (routeParser.ts): Restored the discoverRoutes directory prober (which was deleted in a previous check-in) to satisfy orchestrator requirements and fix the Turbopack build failure in runScan.ts.
  • Created Missing React Hook (useDebounce.ts): Created the custom debounce utility expected by the repository list filter logic.
  • Fixed Broken Registration Action (register/page.tsx): Replaced an incorrect signIn("credentials") call with the original /api/auth/register POST fetch call, correcting the undefined response build failure.
  • Corrected Sorting telemetry: Updated stars sorting inside repository-list.tsx to query the mapped stars property instead of querying undefined stargazers_count via any typecasts.
  • Resolved ESLint Violations & Warnings:
    • Wrapped handleStop in useCallback and selectedDeployment in useMemo inside testing/page.tsx to stabilize render dependencies.
    • Replaced strict any typecasts with safe unknown types in routeParser.ts, httpClient.ts, and audit-logs/page.tsx.
    • Removed unused imports, states, and variables across attack-pipeline/page.tsx (logs, setLogs), secrets/page.tsx (ShieldCheck), login/page.tsx (keepSignedIn), and crypto.ts (AUTH_TAG_LENGTH).
  • Fixed package.json Syntax: Merged duplicate "scripts" blocks and corrected trailing commas.

Verification

  • I ran pnpm lint (or npm run lint — passed with 0 warnings, 0 errors)
  • I manually verified the affected page, API route, or sandbox flow
  • I checked that no secrets or hardcoded credentials were added

Checklist

  • My branch name follows the repository convention (fix/issue-125-build-lint)
  • My commits use Conventional Commits
  • I kept the change scoped to one issue
  • I updated docs if the behavior or workflow changed
  • I am ready for review

@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown

@trivikramkalagi91-commits is attempting to deploy a commit to the Deekshith Gowda HS's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Route discovery adds endpoint probing and sandbox enrichment, console and auth pages update state and form flow, and shared helpers tighten typing while adding a debounce hook and coverage script.

Changes

Route discovery crawler

Layer / File(s) Summary
Discovery types and probing
lib/attack-pipeline/parsers/routeParser.ts
New route-discovery types and discoverRoutes probe API and page paths, merge sandbox data, and return categorized routes with framework info.
Target route error handling
lib/attack-pipeline/parsers/routeParser.ts
parseTargetRoute normalizes thrown values as unknown, derives error details safely, and keeps AbortError handling.

Console and page updates

Layer / File(s) Summary
Terminal and testing state
app/console/attack-pipeline/page.tsx, app/console/testing/page.tsx
app/console/attack-pipeline/page.tsx keeps only logLines for terminal output, and app/console/testing/page.tsx memoizes the selected deployment and stop handler.
Repository list controls
components/console/repository-list.tsx
RepositoryList updates file-drop extraction, star sorting, control header layout, and loading skeleton selection.
Audit and secrets cleanup
app/console/audit-logs/page.tsx, app/console/secrets/page.tsx
SEVERITY_CONFIG uses a component type for icons, and the secrets page import list drops ShieldCheck.

Authentication pages

Layer / File(s) Summary
Login and registration flow
app/login/page.tsx, app/register/page.tsx
LoginPage drops the unused keep-signed-in state, and RegisterPage sends POST /api/auth/register, validates the JSON response, and redirects to /login on success.

Utility and tooling updates

Layer / File(s) Summary
Network and crypto helpers
lib/crypto.ts, lib/utils/auditLogger.ts, lib/utils/httpClient.ts
AUTH_TAG_LENGTH is removed, auditLogger.log gets an ESLint suppression, and httpClient normalizes unknown errors while widening post to unknown.
Debounce hook and coverage script
lib/hooks/useDebounce.ts, package.json
useDebounce is added as a timed state hook, and package.json adds test:coverage.

Sequence Diagram(s)

sequenceDiagram
  participant discoverRoutes
  participant sandboxModule
  participant HTTP endpoints
  discoverRoutes->>HTTP endpoints: probe API and page paths
  discoverRoutes->>sandboxModule: import extra routes and framework
  sandboxModule-->>discoverRoutes: sandbox-only paths and framework info
  discoverRoutes-->>discoverRoutes: return categorized routes in ParseResult
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • deekshithgowda85/SecDev#12: Both PRs modify lib/attack-pipeline/parsers/routeParser.ts, including discoverRoutes(...) and related route parsing error handling.
  • deekshithgowda85/SecDev#36: Both PRs modify app/register/page.tsx around the registration submit flow and redirect behavior.
  • deekshithgowda85/SecDev#3: Both PRs modify app/console/testing/page.tsx around selected deployment derivation and stop handling.

Poem

I hopped through routes with twitchy nose,
And sniffed the code where sandbox grows.
🐰 I tapped a debounce carrot click,
Then watched the coverage numbers stick.
The moonlit logs went soft and bright,
While every page hopped on just right.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Several edits appear unrelated to build/lint fixes, including UI/layout changes, a registration flow rewrite, and adding a test:coverage script. Remove unrelated UI/flow/script edits or move them to a separate PR so this change stays focused on Issue #125.
Docstring Coverage ⚠️ Warning Docstring coverage is 64.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the PR as a fix for build and lint errors tied to Issue #125.
Linked Issues check ✅ Passed The changes address the issue’s goal of fixing build and lint failures, including syntax, typing, and missing export problems.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
app/console/testing/page.tsx (1)

3-3: 🎯 Functional Correctness | 🔴 Critical

Add useMemo to the React imports

Line 545 accesses useMemo, but line 3 does not import it from React, causing a compilation failure.

Suggested fix
-import React, { useEffect, useState, useCallback, useRef } from "react";
+import React, { useEffect, useState, useCallback, useMemo, useRef } from "react";
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/console/testing/page.tsx` at line 3, The React import in the testing page
is missing useMemo, which is referenced later in the component and will break
compilation. Update the import list in the page component to include useMemo
alongside useEffect, useState, useCallback, and useRef so the hook is available
where it is used.
components/console/repository-list.tsx (1)

387-392: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reset the file input value after handling a selection.

When files are chosen via the <input type="file"> (onChange={handleDrop}), the element retains its value. Selecting the same file again afterwards won't re-fire onChange, so a user cannot re-add a file they previously removed. Clear the input value at the end of handleDrop (e.g. set e.target.value = "" when handling a change event).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/console/repository-list.tsx` around lines 387 - 392, The file
picker in repository-list.tsx keeps its selected value after handleDrop runs,
which prevents choosing the same file again. Update handleDrop to clear the
underlying input element after processing the change event by resetting the
event target value so repeat selections re-trigger onChange. Use the existing
handleDrop handler attached to the file input to locate the fix.
🧹 Nitpick comments (1)
lib/utils/auditLogger.ts (1)

18-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Suppression masks a discarded audit event.

The event object is fully constructed (id, timestamp, etc.) but never consumed — the console output below logs the raw action/severity/details fields instead. The eslint-disable hides this dead construction (and the wasted crypto.randomUUID()/Date.now()), rather than fixing the root cause. Either log the event object or drop it until the backend dispatch (mentioned in the comment) exists.

♻️ Option: log the structured event instead of suppressing
-    // eslint-disable-next-line `@typescript-eslint/no-unused-vars`
     const event: AuditEvent = {
       id: crypto.randomUUID(),
       timestamp: Date.now(),
       action,
       severity,
       details,
     };
     
     // In a production environment, this would dispatch to a secure backend API.
     // For now, we standardize the console output format for the sandbox environment.
     const logPrefix = `[AUDIT - ${severity.toUpperCase()}]`;
-    if (severity === "critical") console.error(logPrefix, action, details || "");
-    else if (severity === "warning") console.warn(logPrefix, action, details || "");
-    else console.info(logPrefix, action, details || "");
+    if (severity === "critical") console.error(logPrefix, event);
+    else if (severity === "warning") console.warn(logPrefix, event);
+    else console.info(logPrefix, event);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/utils/auditLogger.ts` around lines 18 - 25, The AuditLogger is
constructing an unused AuditEvent and suppressing the unused-variable lint,
which hides dead code. In auditLogger.ts, either use the created event in the
logging path (so the structured event with id, timestamp, action, severity, and
details is actually emitted) or remove the event construction entirely until the
backend dispatch is implemented. Update the AuditEvent handling in the
AuditLogger flow so there is no eslint-disable for the discarded event.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/console/repository-list.tsx`:
- Around line 441-472: The Control Navigation Header is duplicated, so the
search/sort/view toggle controls render twice. Remove one of the identical
{!compact && (...)} blocks in repository-list.tsx and keep only a single header
implementation, using the existing search, sortBy, setSearch, setSortBy,
showViewToggle, and setView logic.

In `@lib/attack-pipeline/parsers/routeParser.ts`:
- Line 50: Route discovery in routeParser is mutating live endpoints by probing
unsafe methods and also reporting GET as accepted even when all probes fail.
Update the discovery flow around HTTP_METHODS and the probing logic in
routeParser so it only uses non-destructive methods for discovery, avoids
sending state-changing requests with empty bodies, and only records methods that
actually succeed. Make sure the result-building path does not default to GET
unless it was truly accepted, and verify the accepted-method reporting in the
route discovery function reflects only successful probes.
- Around line 157-164: The sandbox route mapping in parseFromSandbox is
over-assigning POST to every /api/ path, which makes DiscoveredRoute.methods
inaccurate. Update the sandboxExtras construction so it only marks methods that
can be inferred from path-only data in sandboxData.paths, and avoid hardcoding
POST for API routes; keep the logic in parseFromSandbox and the discovered route
object shape consistent with downstream consumers.

---

Outside diff comments:
In `@app/console/testing/page.tsx`:
- Line 3: The React import in the testing page is missing useMemo, which is
referenced later in the component and will break compilation. Update the import
list in the page component to include useMemo alongside useEffect, useState,
useCallback, and useRef so the hook is available where it is used.

In `@components/console/repository-list.tsx`:
- Around line 387-392: The file picker in repository-list.tsx keeps its selected
value after handleDrop runs, which prevents choosing the same file again. Update
handleDrop to clear the underlying input element after processing the change
event by resetting the event target value so repeat selections re-trigger
onChange. Use the existing handleDrop handler attached to the file input to
locate the fix.

---

Nitpick comments:
In `@lib/utils/auditLogger.ts`:
- Around line 18-25: The AuditLogger is constructing an unused AuditEvent and
suppressing the unused-variable lint, which hides dead code. In auditLogger.ts,
either use the created event in the logging path (so the structured event with
id, timestamp, action, severity, and details is actually emitted) or remove the
event construction entirely until the backend dispatch is implemented. Update
the AuditEvent handling in the AuditLogger flow so there is no eslint-disable
for the discarded event.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 31d573f0-ae7e-48c8-b100-417468cda843

📥 Commits

Reviewing files that changed from the base of the PR and between 783e305 and 84a5745.

📒 Files selected for processing (13)
  • app/console/attack-pipeline/page.tsx
  • app/console/audit-logs/page.tsx
  • app/console/secrets/page.tsx
  • app/console/testing/page.tsx
  • app/login/page.tsx
  • app/register/page.tsx
  • components/console/repository-list.tsx
  • lib/attack-pipeline/parsers/routeParser.ts
  • lib/crypto.ts
  • lib/hooks/useDebounce.ts
  • lib/utils/auditLogger.ts
  • lib/utils/httpClient.ts
  • package.json
💤 Files with no reviewable changes (2)
  • lib/crypto.ts
  • app/login/page.tsx

Comment thread components/console/repository-list.tsx Outdated
Comment thread lib/attack-pipeline/parsers/routeParser.ts
Comment thread lib/attack-pipeline/parsers/routeParser.ts
@trivikramkalagi91-commits

Copy link
Copy Markdown
Contributor Author

@deekshithgowda85 i ran both test linit and build locallly and they passed with zeor error and issue is solved and it is ready to merge

@trivikramkalagi91-commits

Copy link
Copy Markdown
Contributor Author

@deekshithgowda85 i ran both test linit and build locallly and they passed with zeor error and issue is solved and it is ready to merge

@deekshithgowda85 deekshithgowda85 merged commit 9584180 into deekshithgowda85:prod Jun 30, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Immediate Run npm run build and npm run lint and correct errors

2 participants