Repository navigation
[WP6] Starter auto-configuration robustness (fluent null-spec, BPP early-init, ordering, API parity) #195
Copy link
Copy link
Open
Labels
status: ready-for-agentFully specified and ready for an autonomous AFK agent to implementFully specified and ready for an autonomous AFK agent to implementtype: bugSomething isn't workingSomething isn't working
Description
此內容由 AI 產生(specification-mapper 全庫審查 2026-07-16.執行圖)。
Work package WP6 · findings: COR-13, COR-12, MAINT-02, MAINT-05 · worst severity: medium · effort: S
From the 2026-07-16 whole-codebase review of branch jakarta (snapshot 7de4a33; modules mapper/ + starter/). Every finding below is CONFIRMED by independent adversarial verification. File:line coordinates are from the snapshot and may have drifted.
Findings
COR-13 — Fluent findBySpec throws IllegalArgumentException for null or empty criteria, unlike every sibling method (correctness, medium)
- File:
starter/src/main/java/tw/com/softleader/data/jpa/spec/starter/repository/support/QueryBySpecExecutorAdapter.java:116 - Evidence: the fluent overload passes
mapper.toSpec(spec, domainClass)straight tofindBy; empty criteria map to anullSpecification andSimpleJpaRepository.findByasserts non-null, whilefindBySpec(...)/findBySpec(..., pageable)tolerate null and return all rows. - Failure scenario: an empty search form submitted through the fluent projection/paging API → opaque 500.
COR-12 — BeanPostProcessor declared as non-static @Bean forces early instantiation of all RepositoryFactoryCustomizer beans (correctness, medium)
- File:
starter/src/main/java/tw/com/softleader/data/jpa/spec/starter/autoconfigure/SpecMapperAutoConfiguration.java:116 - Evidence:
jpaRepositoryFactoryBeanPostProcessor(List<RepositoryFactoryCustomizer>)is an instance@Beanmethod with an eagerListinjection — every customizer bean and its dependencies are instantiated at BPP-registration time, dropping proxying/@Transactionalon those dependencies.
MAINT-02 — Auto-configuration lacks @AutoConfiguration/@AutoConfigureAfter; ordering rests on alphabetical FQCN sort (maintainability, medium)
- File:
starter/src/main/java/tw/com/softleader/data/jpa/spec/starter/autoconfigure/SpecMapperAutoConfiguration.java:111 - Evidence: the class is a plain
@Configuration;@ConditionalOnBean(JpaRepositoryFactoryBean.class)only evaluates correctly because the class name happens to sort after Spring Data's auto-configuration.
MAINT-05 — QueryBySpecExecutor lacks counterparts for JpaSpecificationExecutor's delete(spec) and findAll(spec, countSpec, pageable) (maintainability, low)
- File:
starter/src/main/java/tw/com/softleader/data/jpa/spec/starter/repository/QueryBySpecExecutor.java:44 - Note: the
countSpecoverload was deliberately removed in PR Fix api cross 3.x #127 for cross-Boot-3.x compilation compatibility — do not blindly reintroduce it.
Plan
- COR-13: in the fluent
findBySpec, substitute an unrestricted Specification (e.g.(root, query, cb) -> null) whentoSpecyields null, matching sibling semantics (empty criteria = no filtering). - COR-12: make the BPP
@Beanmethodstaticand inject customizers lazily (ObjectProvider<RepositoryFactoryCustomizer>, resolved at post-process time). - MAINT-02: convert the class to
@AutoConfiguration(after = JpaRepositoriesAutoConfiguration.class), keeping theAutoConfiguration.importsregistration consistent. - MAINT-05: add
deleteBySpec(Object spec)delegating todelete(Specification); document in Javadoc why thecountSpecoverload is intentionally absent (PR Fix api cross 3.x #127 cross-version constraint). (The join/fetch-POJO delete edge case is WP3's COR-08, not this package.) - Tests: empty-criteria fluent query returns all rows;
deleteBySpecdeletes matching rows; a context test asserting the auto-configuration ordering annotation is in place.
Acceptance criteria
- An empty form through the fluent API returns results instead of a 500.
- Customizer beans and their dependencies are no longer force-initialized at BPP registration.
- New tests from step 5 pass; regression:
make testgreen.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
status: ready-for-agentFully specified and ready for an autonomous AFK agent to implementFully specified and ready for an autonomous AFK agent to implementtype: bugSomething isn't workingSomething isn't working
Activity