Skip to content

[FEATURE] test: no black-box regression coverage for window functions or CTEs (documented language-spec features) #698

Closed

Description

@jeffreyaven

Summary

Two documented language-spec feature areas have no execution-level regression coverage:

Current coverage

  • Parser-level unit tests only:
    • internal/stackql/astanalysis/earlyanalysis/cte_test.go - parses simple/multiple/recursive CTEs, ROW_NUMBER() OVER, PARTITION BY, frame clauses; AST assertions only, nothing is executed.
    • internal/stackql/parserutil/parser_util_test.go - asserts window function expressions are marked as aggregate expressions.
  • One robot scenario touches CTEs indirectly: CTE Within View Returns Results in test/robot/functional/stackql_mocked_from_cmd_line.robot - a single basic CTE inside a CREATE VIEW over the internal stackql_repositories table.
  • Zero robot coverage for any window function (OVER ( does not appear in any .robot file, stackql_context.py, or any .sql/.iql test asset), top-level WITH over a provider-backed table, multiple CTEs, or recursive CTEs.

Per AGENTS.md, black-box robot scenarios are the canonical evidence for user-visible query behaviour; a runtime regression in any of these paths would currently ship green.

Proposed scenarios (mocked providers)

Window functions:

  • ROW_NUMBER() / RANK() / DENSE_RANK() over a provider table
  • aggregate with OVER (PARTITION BY ... ORDER BY ...)
  • frame clause (ROWS BETWEEN N PRECEDING AND CURRENT ROW)
  • LAG() / LEAD()

CTEs:

  • top-level WITH ... AS (...) selecting from a provider table
  • multiple CTEs in one statement
  • recursive CTE

Side effect: adjudicates a docs discrepancy

The language-spec docs claim recursive CTE support with examples, while the MCP server dialect instructions (pkg/mcp_server/content/instructions/02-dialect.md) currently list recursive CTEs as not supported. The recursive-CTE scenario settles it: whichever way the test lands, one of the two documents gets corrected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions