Skip to content

Conversation

@sushilk123
Copy link

@sushilk123 sushilk123 commented Oct 21, 2025

Summary

Removes temporary ESLint exclusions for re-export violations by refactoring the problematic files to follow the established re-export guidelines.

Changes

  • DropdownMenu: Moved Radix UI re-exports from DropdownMenu.tsx to index.ts
  • Parser: Moved PostgreSQL parser re-export from parser.ts to parser/index.ts
  • ESLint Config: Removed temporary exclusions from base.js

Testing

  • All re-export violations resolved
  • Public API maintained unchanged
  • ESLint rules now apply consistently across codebase

Resolves

Fixes #2349

Summary by CodeRabbit

  • Refactor

    • Consolidated parser exports into a single public API and surfaced PostgreSQL parsing utilities and related types from the central parser entry.
    • Adjusted DropdownMenu export surface so primitives (item indicator and radio item) are exposed from the public component entry.
    • Added internal parsing guards to improve parse result handling and error branching.
  • Chores

    • Removed a local lint override so affected files now follow global linting rules.

- Move re-exports from DropdownMenu.tsx to index.ts file
- Move PostgreSQL parser re-export from parser.ts to parser/index.ts
- Remove temporary ESLint exclusions from base.js configuration
- Maintain same public API while following re-export guidelines

Resolves liam-hq#2349
@sushilk123 sushilk123 requested a review from a team as a code owner October 21, 2025 19:51
@sushilk123 sushilk123 requested review from MH4GF, NoritakaIkeda, junkisai and sasamuku and removed request for a team October 21, 2025 19:51
@giselles-ai
Copy link

giselles-ai bot commented Oct 21, 2025

Finished running flow.

Step Status Updated(UTC)
1 Oct 21, 2025 7:51pm
2 Oct 21, 2025 7:53pm
3 Oct 21, 2025 7:53pm

@vercel
Copy link

vercel bot commented Oct 21, 2025

Someone is attempting to deploy a commit to the Liam Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 21, 2025

Walkthrough

Removed per-file ESLint overrides for DropdownMenu and parser files; moved DropdownMenu re-exports into its index.ts; consolidated parser public exports through parser/index.ts (pgParse and PgParseResult re-exported). No runtime logic changes.

Changes

Cohort / File(s) Summary
ESLint config
frontend/internal-packages/configs/eslint/base.js
Removed the per-file override/exclusion for the DropdownMenu and parser files so they now follow the global no-restricted-syntax rule.
Parser public API
frontend/packages/schema/src/parser.ts, frontend/packages/schema/src/parser/index.ts
Centralized parser exports to ./parser/index.ts: re-exported pgParse (alias of PostgreSQL parse) and PgParseResult type; other parser exports (detectFormat, ProcessError, parse, setPrismWasmUrl, supportedFormatSchema) now re-export from the centralized index.
DropdownMenu exports
frontend/packages/ui/src/components/DropdownMenu/DropdownMenu.tsx, frontend/packages/ui/src/components/DropdownMenu/index.ts
Removed re-exports from DropdownMenu.tsx; added named re-exports in index.ts (ItemIndicatorDropdownMenuItemIndicator, RadioItemDropdownMenuPrimitiveRadioItem). Implementation unchanged.
PGlite parse handling
frontend/internal-packages/pglite-server/src/PGliteInstanceManager.ts
Added private type-guard helpers isParseError and isParseSuccess; refactored executeSql to use these guards and added a fallback parse-error return when neither guard matches.

Sequence Diagram(s)

(omitted — changes are export/refactor-only and do not alter runtime control flow)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Potential attention points:

  • frontend/internal-packages/pglite-server/src/PGliteInstanceManager.ts — verify the type-guard logic matches all PgParseResult shapes.
  • Parser re-exports (frontend/packages/schema/src/parser.ts and .../index.ts) — confirm no accidental API surface changes and correct type-only vs runtime exports.
  • ESLint config change — ensure lint now passes for the moved re-exports.

Possibly related PRs

Suggested labels

Review effort 3/5

Suggested reviewers

  • junkisai
  • NoritakaIkeda
  • sasamuku
  • hoshinotsuyoshi

Poem

🐇 I hopped through modules, neat and spry,
moved exports where the indexes lie.
ESLint nods, no special case,
tidy trees in the codebase space,
a rabbit smiles — tidy bytes go by.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The changes to PGliteInstanceManager.ts introduce private type-guard helper methods (isParseError and isParseSuccess) and refactor the executeSql method to use these guards. While these changes are related to the PgParseResult type being refactored, they go beyond the stated scope of issue #2349, which explicitly targets only moving re-exports to index.ts files and removing ESLint exclusions. The addition of defensive type guards represents an implementation change not required by the issue objectives. Clarify whether the PGliteInstanceManager.ts changes are necessary adaptations for the refactored types or if they should be extracted into a separate follow-up PR. If these changes are necessary, update the PR description to document why they were required. If not, consider reverting them to keep this PR focused on the explicit goal of moving re-exports and removing ESLint exclusions.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "fix: remove temporary ESLint exclusions for re-export violations" is clear, concise, and directly related to the primary objective of the changeset. It accurately summarizes the main intent of the changes: removing temporary ESLint exclusions by refactoring files to comply with re-export guidelines. The title uses a conventional prefix and conveys the essential change without unnecessary details.
Linked Issues Check ✅ Passed The code changes directly address all primary requirements from linked issue #2349. The DropdownMenu re-exports (ItemIndicator and RadioItem) have been successfully moved from DropdownMenu.tsx to index.ts, the PostgreSQL parser re-export (pgParse) has been moved from parser.ts to parser/index.ts with appropriate type exports, and the temporary ESLint exclusions for both files have been removed from the base configuration. These changes follow the established re-export guidelines by centralizing re-exports in index.ts files as required.
Description Check ✅ Passed The PR description provides substantive content covering the summary, specific changes made to each file, testing approach, and issue resolution link. While it doesn't strictly follow the template structure (which specifies "Issue: resolve:" and "Why is this change needed?" sections), the author has effectively communicated what was changed (DropdownMenu, Parser, ESLint Config), why (to remove temporary exclusions), and how it was validated. The description includes sufficient information for reviewers to understand the scope and rationale.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@giselles-ai
Copy link

giselles-ai bot commented Oct 21, 2025

Check changeset necessity

Status: NOT REQUIRED

Reason:

  • Affects target packages @liam-hq/schema and @liam-hq/ui, but only reorganizes re-exports (moved PostgreSQL parser exports and Radix UI re-exports to index files) with the public API explicitly maintained unchanged.
  • No user-facing changes: no new features, bug fixes, API or behavioral changes; added displayName is devtools-only.
  • ESLint config changes are development tooling in an internal configs package and do not impact published packages.
  • Purpose is to remove temporary lint exclusions and align with re-export guidelines; this is internal refactoring.

Changeset (copy & paste):

# No changeset required — internal refactor with no user-facing changes in @liam-hq/schema or @liam-hq/ui.

@vercel
Copy link

vercel bot commented Oct 22, 2025

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

Project Deployment Preview Comments Updated (UTC)
liam-app Ready Ready Preview Comment Oct 22, 2025 2:25am
liam-erd-sample Canceled Canceled Oct 22, 2025 2:25am
liam-storybook Ready Ready Preview Comment Oct 22, 2025 2:25am

Copy link
Member

@MH4GF MH4GF left a comment

Choose a reason for hiding this comment

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

Thanks! The diff is LGTM, but the formatter failed, so please check it.
https://github.com/liam-hq/liam/actions/runs/18695870345/job/53336274540?pr=3839

- Reorder exports to satisfy Biome linter requirements
- Move named exports before wildcard export for proper organization
@sushilk123 sushilk123 force-pushed the fix/remove-eslint-re-export-exclusions branch from eb53d8c to 71b4236 Compare October 22, 2025 21:09
- Replace 'export {} from' syntax with separate import and export statements
- Maintains same public API while satisfying ESLint no-restricted-syntax rule
- Keeps parser.ts file to maintain package.json export compatibility
@MH4GF
Copy link
Member

MH4GF commented Oct 24, 2025

@sushilk123 It seems lint is still failing. Try running pnpm fmt.
Also, if you click Re-request review, I'll review it right away!

Sushil Khairnar and others added 3 commits October 24, 2025 15:49
- Split type imports into separate import statement
- Split type exports into separate export statement
- Follows Biome's preferred import/export organization
…nstanceManager

- Add proper type guards for PgParseResult to handle error and success cases
- Replace unsafe member access with type-safe checks using isParseError/isParseSuccess
- Isolate type assertions to dedicated helper functions
- Add fallback handling for edge cases where neither error nor parse_tree exist

Fixes unsafe member access violations on parseResult.error and parseResult.parse_tree
Copy link
Contributor

@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: 3

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c1578a and 10d7efb.

📒 Files selected for processing (1)
  • frontend/internal-packages/pglite-server/src/PGliteInstanceManager.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Name utility files in camelCase (e.g., mergeSchema.ts)

Files:

  • frontend/internal-packages/pglite-server/src/PGliteInstanceManager.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript/TSX across the codebase

Files:

  • frontend/internal-packages/pglite-server/src/PGliteInstanceManager.ts
frontend/internal-packages/**

📄 CodeRabbit inference engine (AGENTS.md)

Infra and tooling (e2e, configs, storybook, agent) live under frontend/internal-packages

Files:

  • frontend/internal-packages/pglite-server/src/PGliteInstanceManager.ts
frontend/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

frontend/**/*.{ts,tsx}: Use named exports only (no default exports)
Import UI components from @liam-hq/ui when available
Import icons from @liam-hq/ui
Follow existing import patterns and tsconfig path aliases
Use consts instead of function declarations for simple utilities (e.g., const toggle = () => {})
Use runtime type validation with valibot for external data validation
Use early returns for readability

Files:

  • frontend/internal-packages/pglite-server/src/PGliteInstanceManager.ts
🧬 Code graph analysis (1)
frontend/internal-packages/pglite-server/src/PGliteInstanceManager.ts (1)
frontend/internal-packages/pglite-server/src/types.ts (1)
  • SqlResult (1-11)
🔇 Additional comments (1)
frontend/internal-packages/pglite-server/src/PGliteInstanceManager.ts (1)

81-93: Good refactor for readability, but depends on fixing the type guards.

The explicit branching with early returns improves code clarity and follows the coding guidelines. The fallback case on line 93 is good defensive programming.

However, the effectiveness of this refactor depends on fixing the type guard implementations (lines 65-75) to ensure type-safe narrowing.

Comment on lines +65 to +75
private isParseError(
result: PgParseResult,
): result is { error: { message: string } } {
return (result as any).error !== null
}

private isParseSuccess(
result: PgParseResult,
): result is { parse_tree: { stmts: any[] } } {
return (result as any).parse_tree?.stmts != null
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify PgParseResult type structure to ensure correct type guards.

The type guards assume a specific discriminated union structure for PgParseResult. Please verify the actual type definition to ensure the guards correctly match the type's structure.

Run the following script to examine the PgParseResult type definition:


🏁 Script executed:

#!/bin/bash
# Description: Find and display the PgParseResult type definition from the parser module

# Search for PgParseResult type definition
ast-grep --pattern 'type PgParseResult = $$$'

# Also search for interface definitions
ast-grep --pattern 'interface PgParseResult {
  $$$
}'

# Search for export statements
rg -nP --type=ts 'export.*PgParseResult' -A 5

Length of output: 2518


Fix type guard return types to properly narrow PgParseResult.

The logic in both guards is correct, but the return type annotations are incomplete. They only reflect the discriminating field (error or parse_tree) while omitting other required fields, breaking type safety for callers. The return types should preserve the full structure with narrowed error:

  • isParseError: return type should be result is PgParseResult & { error: NonNullable<PgParseResult['error']> }
  • isParseSuccess: return type should be result is PgParseResult & { error: null }

This ensures callers can still access stderr_buffer and other fields after the guard.

🤖 Prompt for AI Agents
In frontend/internal-packages/pglite-server/src/PGliteInstanceManager.ts around
lines 65 to 75, the two type guard return annotations are too narrow and drop
other PgParseResult fields; update them so isParseError returns result is
PgParseResult & { error: NonNullable<PgParseResult['error']> } and
isParseSuccess returns result is PgParseResult & { error: null }, keeping the
existing runtime checks but changing only the return type signatures so callers
retain access to fields like stderr_buffer and other PgParseResult properties
after narrowing.

Comment on lines +65 to +69
private isParseError(
result: PgParseResult,
): result is { error: { message: string } } {
return (result as any).error !== null
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix type guard implementation to avoid unsafe type assertions.

The type guard uses as any, which defeats TypeScript's type safety and can lead to runtime errors. Additionally, checking error !== null without first verifying the property exists could throw if error is undefined.

Apply this diff to use proper type narrowing:

 private isParseError(
   result: PgParseResult,
 ): result is { error: { message: string } } {
-  return (result as any).error !== null
+  return 'error' in result && result.error != null
 }

Alternatively, if the property is always present but may be null/undefined:

 private isParseError(
   result: PgParseResult,
 ): result is { error: { message: string } } {
-  return (result as any).error !== null
+  return (result as { error?: { message: string } | null }).error != null
 }
🤖 Prompt for AI Agents
In frontend/internal-packages/pglite-server/src/PGliteInstanceManager.ts around
lines 65 to 69, the type guard uses an unsafe cast to any and only checks error
!== null which can throw if the property is missing; change the implementation
to first check that the 'error' property exists (using the 'in' operator or
typeof) and then test for non-null/undefined (error != null), e.g. return
'error' in result && result.error != null, so you avoid any type assertions and
properly narrow the type.

Comment on lines +71 to +75
private isParseSuccess(
result: PgParseResult,
): result is { parse_tree: { stmts: any[] } } {
return (result as any).parse_tree?.stmts != null
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Remove unsafe type assertion from type guard.

The type guard uses as any, which bypasses TypeScript's type checking. While the optional chaining provides some safety, proper type narrowing is more robust.

Apply this diff to use the in operator for type-safe narrowing:

 private isParseSuccess(
   result: PgParseResult,
 ): result is { parse_tree: { stmts: any[] } } {
-  return (result as any).parse_tree?.stmts != null
+  return 'parse_tree' in result && Array.isArray(result.parse_tree?.stmts)
 }
🤖 Prompt for AI Agents
In frontend/internal-packages/pglite-server/src/PGliteInstanceManager.ts around
lines 71 to 75, remove the unsafe "as any" assertion in the type guard and
replace it with proper property-in checks: first test whether "parse_tree" is in
result and that result.parse_tree is an object, then test whether "stmts" is in
result.parse_tree (and is an array if desired) using the "in" operator and
runtime checks; update the return type accordingly so the guard returns true
only when those properties exist and are correctly shaped, avoiding any use of
"as any".

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.

Remove temporary ESLint exclusions for re-export violations

2 participants