Repository navigation
Multi-module reactor, ArchUnit guards, and a filter-sql-adapter module - #1
Merged
Merged
Conversation
bbartolome
marked this pull request as draft
July 30, 2026 22:49
bbartolome
force-pushed
the
feature/multimodule-archunit-sql-adapter
branch
11 times, most recently
from
September 4, 2026 02:54
99e48fc to
c2a105c
Compare
|
… mode (T1) FieldRegistry.of now takes a Lombok-built FieldRegistrySpec instead of a raw List<FieldDefinition>, so the registry can gain configuration later without another signature change. FieldRegistry.permissive()/isPermissive() are removed and PermissiveFieldRegistry becomes a test-only fixture; the two isPermissive() call sites collapse to an unconditional fields.find(path).isEmpty() check, which is behaviour-preserving because the fixture's find() always resolves.
…(T2) OperatorDefinition gains a derived, three-state ValueShape (NONE for unary, LIST for FUNCTION-syntax or explicitly list-valued operators like "is in", SCALAR otherwise) rather than a plain boolean, since a scalar-defaulting boolean would wrongly reject every FUNCTION-syntax filter. FilterValidator now checks a FieldFilter/AnyFilter's value shape against its resolved operator's declared shape, alongside the existing applicableTypes/ permittedOperators checks, benefiting every FilterValidator consumer.
Wire filter-sql-adapter into the reactor and define its public API/SPI contracts (sql.api.SqlFragment/ColumnMapping/FilterQueryTranslator/ SqlRenderException, sql.spi.QueryBuilder) per plan.md's Phase 3 design. Contracts and Javadoc only — no translation logic yet (T6).
Adds sql.spi.AnsiQueryBuilder, a public Template Method QueryBuilder implementation whose final binary()/unary() dispatchers delegate to 8 protected hooks covering all 13 built-in operators plus a renderUnknown/unaryUnknown fallback pair for custom operators (D16), with a security-relevant mandated quoteIdentifier escaping contract (D23). Adds sql.api.DefaultFilterQueryTranslator, the concrete FilterQueryTranslator implementation: validates via FilterValidator on entry (D27), converts JsonNode values per D7/D19's mapping (including the catch-all for unrecognized subtypes), expands AnyFilter per-node in visitAny while dropping unmapped operands (D18/D29), rejects zero-operand And/OrFilter at any depth and empty list-shaped values (D11/D22/D30), and dispatches binary()/unary() by operator.isUnary() rather than by null value (D33). Adds unit tests covering all 13 built-in operators' SQL/bind-parameter output, a custom-operator renderUnknown fallback (with and without an override), the status-is-null vs. exists dispatch distinction, and the empty and/or / empty-list / any-expansion drop-unmapped edge cases.
Pins H2 2.3.232 (test scope) in the parent dependencyManagement and filter-sql-adapter's own dependencies. Adds a test-scope H2QueryBuilder extending AnsiQueryBuilder, overriding quoteIdentifier solely to exercise the Template Method extension path with real coverage. Adds H2FilterQueryTranslatorTest, executing DefaultFilterQueryTranslator output as real PreparedStatements against an in-memory H2 schema/seed dataset, covering each operator family end to end plus D18's any-expansion drop-unmapped-operands path and D21's null-tolerant is-in parameter list.
Adds BoundaryRulesTest to filter-sql-adapter with a module-local public-types rule (sql.api/sql.spi types must be public, mirroring filter-core's existing rule), a cross-module rule that filter-sql-adapter's main scope may not depend on filter-core's internal/spi packages, and a rule that filter-core may not depend on filter-sql-adapter (kept per D26 as documentation of intent even though Maven's reactor build order already makes it unfalsifiable). No testfixtures-leak rule is added, per D15. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Documents the SQL adapter's pipeline (validate -> translate -> ColumnMapping -> QueryBuilder -> PreparedStatement), the JsonNode-to-Java value-conversion table with its date-time and BigInteger caveats, the vendor-defined LIKE escaping vs. mandated identifier quoting distinction, how to write a vendor QueryBuilder by extending AnsiQueryBuilder's 8 protected hooks, and the adapter's known limitations (flat/single-table mappings, no custom AnyExpansionStrategy). Linked from README.md and docs/filter-dsl.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Restructure dense paragraphs into scannable bullets and tables: - ADR: tighter Context/Decision/Consequences with bullet-point breakdown - SQL adapter: top-of-page nav, inline pipeline diagram, tables for LIKE/quoting and known limitations, consolidated caveats to avoid duplication No content changes — all substantive information preserved, just reorganized for better skimmability. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
bbartolome
force-pushed
the
feature/multimodule-archunit-sql-adapter
branch
from
September 7, 2026 20:14
c2a105c to
61b6445
Compare
|
bbartolome
marked this pull request as ready for review
September 16, 2026 02:48
bbartolome
added this pull request to the merge queue
Sep 16, 2026
bbartolome
removed this pull request from the merge queue due to the queue being cleared
Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.







Summary
Restructures the single-module
org.sequeless:sequeless-filterjar into a two-module Maven reactor:filter-core— the existing DSL (AST, ANTLR grammar/parser, serializer, registries, completion), largely unchanged, plus two small independently-motivated fixes surfaced while designing the SQL adapter.filter-sql-adapter(new) — translates aFilterNodeAST into SQL via a hexagonalQueryBuildervendor port, with a Template MethodAnsiQueryBuilderdefault implementation and an H2-backed end-to-end test suite.ArchUnit guards the module/package boundaries that are actually enforceable (see
docs/specs/multimodule-archunit-sql-adapter/plan.mdfor the full design record — 33 decisions, D1–D33, resolved via user interview and three rounds of automated review before any code was written).FieldRegistry.of(...)is reinstated infilter-coremain scope, retyped to take a builder-constructedFieldRegistrySpecinstead of a rawList;PermissiveFieldRegistrymoves to test-only.OperatorDefinitiongains a derived value-shape signal (NONE/SCALAR/LIST), andFilterValidatorgains a value-shape check — benefits every consumer of the parser, not just the SQL adapter.filter-sql-adaptershipsSqlFragment,ColumnMapping,FilterQueryTranslator/DefaultFilterQueryTranslator,SqlRenderException, and theQueryBuilderport +AnsiQueryBuilderdefault (8 protected extension hooks).filter-sql-adapter's main scope off filter-core'sinternal/spipackages, and document (though Maven already enforces) that filter-core may not depend back onsql...docs/sql-adapter.mddocuments the pipeline, theJsonNode→Java value-conversion table, vendorQueryBuilderauthoring, and known limitations (flat/single-table column mappings only, vendor-definedLIKEescaping, no temporal coercion).No commit in this branch is marked as a breaking change (per plan decisions D1/D10), even though a couple of the
filter-coreAPI changes are technically breaking — nothing in this repo is actually published today (no<distributionManagement>/deploy step exists), so there's no real external consumer to break.Commits
fix:— retypeFieldRegistry.oftoFieldRegistrySpec, drop permissive modefeat:— derived value-shape signal +FilterValidatorshape checkbuild:— convert to a Maven reactor with afilter-coremodulebuild:— reactor-proof release tooling and docsfeat:— addfilter-sql-adaptermodule contractsfeat:— implementAnsiQueryBuilderandFilterQueryTranslatorfeat:— add H2 test fixture and end-to-end SQL adapter testsfeat:— addfilter-sql-adapterArchUnit boundary rulesdocs:— add filter-sql-adapter referenceTest plan
./mvnw -B verifygreen across all 3 reactor modules (82filter-coretests + 41filter-sql-adaptertests)filter-core's existingBoundaryRulesTestrules pass unmodifiedfilter-sql-adapter's new ArchUnit rule (sql..may not reachinternal../spi..) verified to actually fail on a deliberate violation, then reverted before commitany-expansion with a partialColumnMapping(dropped-unmapped-operand behavior), and anull-valuedis inelementdocs/specs/multimodule-archunit-sql-adapter/plan.md, particularly the accepted breaking-but-unmarkedFieldRegistry/FilterValidatorchanges🤖 Generated with Claude Code