AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

`IQueryModifier.ToSql` Signature Is Narrower Than The Class Implementation In Pg-Meta

The `IQueryModifier` interface in pg-meta declares `toSql()` with no parameters, but the `QueryModifier` class and internal callers require an optional `options` argument. This type mismatch can cause TypeScript compile errors for consumers using the interface.

mediumConfidence 97%SupabaseRealtimeStorage

Origin Analysis

The interface was not updated when `QueryModifier.toSql` gained an optional `options` parameter, leaving the public contract out of sync with the implementation.
1. In a TypeScript consumer, declare `const m: IQueryModifier = new QueryModifier(...)`. 2. Call `m.toSql({ isCTE: false, isFinal: true })`. 3. TypeScript errors: Expected 0 arguments, but got 1. Alternatively, inspect `QueryModifier.ts` lines 12-15 (interface) vs 44-46 (class).

Fixing Code Block

export interface IQueryModifier { range: (from: number, to: number) => QueryModifier toSql: (options?: { isCTE: boolean; isFinal: boolean }) => SafeSqlFragment }
Widens the interface's `toSql` property to accept the same optional `options` object as the `QueryModifier` class and actual call sites. This matches the class definition and allows consumers holding `IQueryModifier` references to pass options without breaking existing no-argument calls.

Edge Case Audit

Type-only change; no runtime impact. Backward compatible: existing callers with no argument still type-check. Rollback is simply reverting the interface change. Ensure there are no alternative implementations of `IQueryModifier` that have a stricter method signature; optional parameter keeps them assignable. In rare advanced type scenarios, widening an optional parameter could affect overload resolution in consumer code, but this is unlikely and not a runtime issue. Keep interface in sync with class when adding parameters in the future.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state