Backend execution for Issue Query DSL (service, JPA, REST) (SZ-69)
rk@tigase.net opened 2 weeks ago

Description

This issue implements the backend execution layer for the Issue Query DSL, building on top of the standalone DSL core library.

The goal of this phase is to make parsed and validated DSL queries executable against the existing Issue persistence model, without introducing any end-user UI exposure yet. The backend will translate DSL constructs into JPA Specifications, orchestrate query execution, and expose controlled REST endpoints gated by availability policy.

This phase focuses on correctness, composability, and controlled exposure. Performance optimizations and query planning are explicitly deferred.

Scope

Included:

  • IssueQueryService to orchestrate DSL execution
  • Translation of DSL WHERE clauses into JPA Specifications
  • Extension of IssueSpecification to support DSL-driven predicates
  • Support for:
    • field comparisons
    • IN / NOT IN
    • range and temporal operators
    • basic sorting and limiting
  • REST controller for DSL execution and validation
  • Capability-gated REST exposure using workflow availability policy
  • Consistent execution behavior for future UI and CLI consumers

Explicitly Excluded:

  • UI components or pages
  • CLI integration
  • Query optimization or execution planning
  • Caching or performance tuning
  • Cross-entity joins or non-Issue queries
  • Saved queries or persistence of DSL statements

Architecture Notes

  • The backend depends on the DSL library, but the DSL library remains unaware of backend concerns.
  • Execution is layered: DSL => ParsedQuery => Specification => Repository execution
  • Sorting and limiting may initially be applied in-memory to favor simplicity.
  • REST endpoints are gated via existing workflow availability mechanisms and disabled by default until explicitly enabled.
  • This phase establishes a stable execution contract for later UI and CLI work.

Time Estimate

Estimated: 8–12 hours

Work Log (Planned)

Design:

  • Define execution contract between ParsedQuery and backend
  • Identify mapping rules between DSL fields and Issue entity attributes

Service Layer:

  • Implement IssueQueryService
  • Validate and execute parsed DSL queries
  • Handle projection of selected fields into a generic result structure

JPA Integration:

  • Extend IssueSpecification with DSL-aware builders
  • Implement predicate generation for supported operators
  • Ensure compatibility with existing specification usage

REST Layer:

  • Add REST endpoints for:
    • parse + validate only
    • parse + validate + execute
  • Integrate workflow availability checks to control exposure

Testing:

  • Add unit tests for specification generation
  • Add service-level tests for DSL execution paths
  • Validate error propagation from parser and validator

Status

Planned

This issue establishes backend execution for the Issue Query DSL and prepares the system for controlled exposure to UI and CLI consumers in subsequent phases.

  • rk@tigase.net commented 2 weeks ago

    Work Log

    Design & Analysis (1.5–2.0 hours):

    • Reviewed DSL core library contracts (ParsedQuery, SelectClause, WhereClause, Condition, OrderByClause) to define a stable execution boundary
    • Identified mapping between DSL field names and Issue entity attributes
    • Defined supported operator-to-predicate mappings for initial execution phase
    • Explicitly scoped out query planning, optimization, and cross-entity joins

    Execution Contract (0.5–1.0 hour):

    • Defined execution flow: DSL string => ParsedQuery (parser) => ValidationResult (validator) => Specification => Repository execution => Projected query result
    • Established error propagation rules from parser/validator to REST responses
    • Defined generic QueryResult structure to decouple execution from UI concerns

    Service Layer (2.0–3.0 hours):

    • Implemented IssueQueryService as the central orchestration point
    • Integrated DSL parser and validator into service pipeline
    • Translated ParsedQuery WHERE clauses into JPA Specifications
    • Implemented initial in-memory handling for ORDER BY and LIMIT (Phase 1)
    • Implemented projection logic to extract selected fields from Issue entities
    • Ensured service layer remains independent of REST and UI concerns

    JPA Specification Integration (2.0–3.0 hours):

    • Extended IssueSpecification with DSL-aware predicate builders
    • Implemented predicate support for:
      • Equality and inequality operators
      • IN / NOT IN operators
      • Range operators (BETWEEN)
      • Temporal operators (OLDER_THAN, NEWER_THAN)
      • Text operators (CONTAINS, STARTS_WITH, ENDS_WITH)
    • Ensured compatibility with existing specification usage patterns
    • Verified that DSL-driven specifications compose correctly with existing filters

    REST Layer (1.5–2.5 hours):

    • Implemented IssueQueryController for DSL execution
    • Added endpoints for:
      • parse + validate only (no execution)
      • parse + validate + execute
    • Integrated workflow availability checks using existing policy mechanism
    • Disabled DSL execution endpoints by default via configuration
    • Ensured consistent REST response structure for success and failure cases

    Error Handling (0.5–1.0 hour):

    • Mapped ParseException and validation errors to appropriate HTTP responses
    • Ensured validation warnings are returned without blocking execution
    • Verified that execution failures do not leak internal exceptions to clients

    Testing (1.5–2.0 hours):

    • Added unit tests for DSL-to-Specification translation
    • Added service-level tests covering:
      • valid query execution
      • invalid DSL input
      • unsupported operators or fields
    • Verified correct interaction with IssueRepository
    • Ensured tests avoid unnecessary Spring context bootstrapping

    Documentation & Integration (0.5–1.0 hour):

    • Documented execution flow and extension points for future optimization
    • Verified backend execution is consumable by future UI and CLI layers
    • Ensured no end-user UI exposure is introduced in this phase

    Total Estimated Effort

    Estimated: 8–12 hours

    Outcome:

    • Backend can execute validated DSL queries against Issue data
    • Execution is correct, composable, and controlled
    • System is prepared for subsequent UI and CLI integration without refactoring
  • rk@tigase.net commented 2 weeks ago
    rksuma@Ramakrishnans-MacBook-Pro sztab-query-dsl % git checkout wolnosc
    git pull
    Already on 'wolnosc'
    Your branch is up to date with 'origin/wolnosc'.
    Already up to date.
    rksuma@Ramakrishnans-MacBook-Pro sztab-query-dsl % git checkout -b feature/Issue-DSL-backend-execution
    Switched to a new branch 'feature/Issue-DSL-backend-execution'
    rksuma@Ramakrishnans-MacBook-Pro sztab-query-dsl % git push -u origin feature/Issue-DSL-backend-execution
    Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
    remote:  
    remote: Create a pull request for 'feature/Issue-DSL-backend-execution' by visiting:
    remote:     https://tigase.dev/sztab/~pulls/new?target=1325:wolnosc&source=1325:feature/Issue-DSL-backend-execution
    remote:  
    To https://tigase.dev/sztab.git
     * [new branch]      feature/Issue-DSL-backend-execution -> feature/Issue-DSL-backend-execution
    branch 'feature/Issue-DSL-backend-execution' set up to track 'origin/feature/Issue-DSL-backend-execution'.
    rksuma@Ramakrishnans-MacBook-Pro sztab-query-dsl % 
    
    
  • rk@tigase.net changed state to 'In Progress' 2 weeks ago
    Previous Value Current Value
    Open
    In Progress
  • rk@tigase.net changed state to 'Closed' 1 week 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-69
Please wait...
Page is in error, reload to recover