Introduce standalone Issue Query DSL core library (SZ-68)
rk@tigase.net opened 2 weeks ago

Description

This issue delivers the core Issue Query DSL library as a standalone, reusable module, independent of Sztab backend, REST, UI, or persistence layers.

The DSL provides an SQL-like query language for querying Issue data, designed to be consumed uniformly by future execution layers (backend services, REST APIs, CLI tools, and UI components). The library focuses strictly on language concerns: parsing, AST modeling, semantic validation, and reusable query templates.

The implementation is intentionally framework-free (no Spring, JPA, or UI dependencies), producing a clean JAR that can later be embedded, licensed, or extracted as an independent product if desired.

No end-user exposure is introduced in this change.

Scope

Included:

  • DSL grammar and lexer
  • Recursive-descent parser producing a structured AST
  • AST model covering SELECT, WHERE, GROUP BY, ORDER BY, and LIMIT
  • Aggregate function support (COUNT, SUM, AVG, MIN, MAX)
  • Semantic validation layer (field validity, operator compatibility, duration formats, grouping rules)
  • Predefined query templates demonstrating real-world usage
  • Unit tests for parser and validator
  • Maven module packaging (sztab-query-dsl)

Explicitly Excluded:

  • JPA or database execution
  • REST endpoints
  • UI components
  • CLI integration
  • Query optimization or planning
  • Persistence concerns

Architecture Notes

  • The DSL library is dependency-inverted: higher layers depend on it, but it depends only on the JDK.
  • Parser tests validate AST intent rather than grammar trivia to allow grammar evolution without test churn.
  • Validation enforces semantic correctness while remaining execution-agnostic.
  • The module is suitable for later licensing or external distribution without refactoring.

Work Log

Design & Scoping:

  • Defined DSL goals and explicit non-goals
  • Established strict separation between language and execution
  • Designed AST model aligned with Issue domain semantics

Core DSL Implementation:

  • Implemented lexer and recursive-descent parser
  • Built AST model for all query clauses
  • Added aggregate function support
  • Implemented set-based, range-based, and temporal operators

Validation Layer:

  • Implemented semantic validation rules
  • Enforced field/operator compatibility
  • Added GROUP BY and aggregate consistency checks
  • Designed error and warning reporting

Templates:

  • Added reusable query templates covering:
    • Daily operations
    • Incident response
    • Metrics and trend analysis
    • Search and aging scenarios

Testing:

  • Added focused unit tests for parser behavior
  • Added semantic validation tests
  • Ensured tests assert structure and intent rather than grammar details

Integration:

  • Packaged as standalone Maven module
  • Merged into wolnosc as a non-exposed internal capability

Status

Completed

The Issue Query DSL core library is now available for backend execution, REST exposure, CLI tooling, and UI integration in subsequent phases.

  • rk@tigase.net changed state to 'In Progress' 2 weeks ago
    Previous Value Current Value
    Open
    In Progress
  • rk@tigase.net commented 2 weeks ago

    rksuma@Ramakrishnans-MacBook-Pro sztab-query-dsl % git merge feature/Issue-DSL-library Updating c68c90d..b2c5bbf Fast-forward sztab-query-dsl/pom.xml | 47 +++++++++++ sztab-query-dsl/src/main/java/com/sztab/query/exception/ParseException.java | 21 +++++ sztab-query-dsl/src/main/java/com/sztab/query/model/AggregateFunction.java | 48 +++++++++++ sztab-query-dsl/src/main/java/com/sztab/query/model/Condition.java | 79 ++++++++++++++++++ sztab-query-dsl/src/main/java/com/sztab/query/model/OrderByClause.java | 36 ++++++++ sztab-query-dsl/src/main/java/com/sztab/query/model/ParsedQuery.java | 87 ++++++++++++++++++++ sztab-query-dsl/src/main/java/com/sztab/query/model/SelectClause.java | 69 ++++++++++++++++ sztab-query-dsl/src/main/java/com/sztab/query/model/WhereClause.java | 36 ++++++++ sztab-query-dsl/src/main/java/com/sztab/query/parser/QueryLexer.java | 76 +++++++++++++++++ sztab-query-dsl/src/main/java/com/sztab/query/parser/QueryParser.java | 251 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ sztab-query-dsl/src/main/java/com/sztab/query/parser/QueryValidator.java | 180 ++++++++++++++++++++++++++++++++++++++++ sztab-query-dsl/src/main/java/com/sztab/query/templates/QueryTemplates.java | 347 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ sztab-query-dsl/src/test/java/com/sztab/query/parser/QueryParserTest.java | 83 +++++++++++++++++++ sztab-query-dsl/src/test/java/com/sztab/query/parser/QueryValidatorTest.java | 90 ++++++++++++++++++++ 14 files changed, 1450 insertions(+) create mode 100644 sztab-query-dsl/pom.xml create mode 100644 sztab-query-dsl/src/main/java/com/sztab/query/exception/ParseException.java create mode 100644 sztab-query-dsl/src/main/java/com/sztab/query/model/AggregateFunction.java create mode 100644 sztab-query-dsl/src/main/java/com/sztab/query/model/Condition.java create mode 100644 sztab-query-dsl/src/main/java/com/sztab/query/model/OrderByClause.java create mode 100644 sztab-query-dsl/src/main/java/com/sztab/query/model/ParsedQuery.java create mode 100644 sztab-query-dsl/src/main/java/com/sztab/query/model/SelectClause.java create mode 100644 sztab-query-dsl/src/main/java/com/sztab/query/model/WhereClause.java create mode 100644 sztab-query-dsl/src/main/java/com/sztab/query/parser/QueryLexer.java create mode 100644 sztab-query-dsl/src/main/java/com/sztab/query/parser/QueryParser.java create mode 100644 sztab-query-dsl/src/main/java/com/sztab/query/parser/QueryValidator.java create mode 100644 sztab-query-dsl/src/main/java/com/sztab/query/templates/QueryTemplates.java create mode 100644 sztab-query-dsl/src/test/java/com/sztab/query/parser/QueryParserTest.java create mode 100644 sztab-query-dsl/src/test/java/com/sztab/query/parser/QueryValidatorTest.java rksuma@Ramakrishnans-MacBook-Pro sztab-query-dsl % git push origin wolnosc Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 To https://tigase.dev/sztab.git c68c90d..b2c5bbf wolnosc -> wolnosc rksuma@Ramakrishnans-MacBook-Pro sztab-query-dsl % git branch -d feature/Issue-DSL-library Deleted branch feature/Issue-DSL-library (was b2c5bbf). rksuma@Ramakrishnans-MacBook-Pro sztab-query-dsl % git push origin --delete feature/Issue-DSL-library remote:
    remote: Create a pull request for 'feature/Issue-DSL-library' by visiting: remote: https://tigase.dev/sztab/~pulls/new?target=1325:wolnosc&source=1325:feature/Issue-DSL-library remote:
    To https://tigase.dev/sztab.git

    • [deleted] feature/Issue-DSL-library rksuma@Ramakrishnans-MacBook-Pro sztab-query-dsl % git log --oneline --decorate --graph -5
    • b2c5bbf (HEAD -> wolnosc, origin/wolnosc, origin/HEAD) Introduce Issue DSL core library (parser, AST, validation, tests)
    • c68c90d Docs: add Issue DSL engine overview
    • 7e37147 (tag: v1.7.1) Fix global vs project issues routing and filters (release 1.7.1)
    • 989ffed Add clickable links
    • 17b1aae Add link to starting Sztab rksuma@Ramakrishnans-MacBook-Pro sztab-query-dsl %
  • rk@tigase.net changed state to 'Closed' 2 weeks ago
    Previous Value Current Value
    In Progress
    Closed
issue 1 of 1
Type
New Feature
Priority
Normal
Assignee
Version
none
Sprints
n/a
Customer
n/a
Issue Votes (0)
Watchers (3)
Reference
SZ-68
Please wait...
Page is in error, reload to recover