Skip to content

[Refactor] Architecture, contracts and ergonomics audit (Part 1: Storage, Data & IO) (#643) - #645

Merged
remiceres merged 3 commits into
feature/corese-nextfrom
refactor/643-srp-architecture-audit
Oct 23, 2026
Merged

remiceres merged 3 commits into
feature/corese-nextfrom
refactor/643-srp-architecture-audit

Conversation

@remiceres

Copy link
Copy Markdown
Contributor

Summary

This PR addresses Part 1 of the architecture, Single Responsibility Principle (SRP), and contracts audit on core.next (#643), focusing on the foundational storage, data, and io modules.

Key Changes

1. Ergonomic Facade (Values.java)

  • Added static shortcut factories on Values delegating strictly to the shared default ValueFactory:
    • Values.iri(...), Values.bnode(...), Values.literal(...)
    • Values.statement(...) and Values.triple(...)
  • Added comprehensive class Javadoc with concrete usage examples.

2. Formalized Storage SPI & Concurrency Contracts

  • Documented thread-safety invariants on StorageManager: root instance is thread-safe, while openSession() views are strictly confined to a single thread.
  • Formalized try-with-resources lifecycle on QueryOperations.find(): explicitly documented that terminal operations (such as findAny() or limit()) do not auto-close the underlying stream, requiring caller closure to release partition snapshots.
  • Clarified dataset semantics in StatementPattern: absent/empty context array selects all graphs, while explicit new Resource[] { null } selects only the default graph.
  • Added non-breaking StatementPattern.of(Statement) factory avoiding overload ambiguity.
  • Added MetadataOperations.findPredicateStatistics(IRI) returning Optional<PredicateStatistics>.

3. Formalized RDF Statement Contract (Statement.java)

  • Documented immutability and thread-safety requirements for all statement implementations.
  • Specified default graph vs named graph context semantics (getContext() == null).
  • Formalized equality contract based on (subject, predicate, object, context).

4. Architecture & Package Documentation

  • Substantially enhanced package-info.java across storage, storage.api, storage.api.operations, storage.impl.memory, data, data.api, and io.

Verification & Quality

  • All existing and new unit tests pass (ValuesTest, StatementPatternTest, MetadataOperationsTest).
  • All architectural boundary checks in NextModuleBoundaryTest pass (100% compliant).
  • 0 SonarLint issues across all 235 scanned files.
  • 100% backwards-compatible (zero breaking changes).

Closes #643 (Part 1)

…ing model

- Enhance package-info.java files across core.next.storage, api, operations, and impl.memory
- Document session threading confinement, COW snapshot lifecycle, and graph matching semantics
- Formalize stream closing requirements (try-with-resources) on QueryOperations.find()
- Add StatementPattern.of(Statement) factory preserving default and named graph contexts
- Add MetadataOperations.findPredicateStatistics(IRI) returning Optional
- Add unit tests for StatementPattern.of and MetadataOperations default methods
- All NextModuleBoundaryTest pass and 0 SonarLint issues (closes #643 part 1)
…ize data/io contracts

- Add static shortcuts in Values for iri, bnode, literal, statement, and triple
- Formalize immutability, graph context, and equality contract in Statement interface
- Enhance package-info.java documentation across core.next.data and core.next.io
- Add comprehensive unit tests in ValuesTest with zero Sonar alerts (compliant S9133)
- All architectural boundary checks pass (closes #643 part 2)
@github-actions

Copy link
Copy Markdown
Overall Project 57.95% 🍏
Files changed 96.12% 🍏

File Coverage
MetadataOperations.java 100% 🍏
StatementPattern.java 97.96% 🍏
Values.java 95.24% -4.76% 🍏
MutationOperations.java 42.65% 🍏
StorageManager.java 21.74% 🍏
QueryOperations.java 0% 🍏

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Test Results

  418 files    418 suites   37s ⏱️
3 374 tests 3 374 ✅ 0 💤 0 ❌
3 408 runs  3 408 ✅ 0 💤 0 ❌

Results for commit 72a9edd.

♻️ This comment has been updated with latest results.

… part 1

- Add missing literal overloads in Values facade (byte, short, float, duration, xml calendar)
- Add comprehensive unit tests in ValuesTest
- Fix Javadoc HTML tags nesting (doclint compliance) in io and operations
- Refine memory storage package documentation on batch ingestion and stream thread-safety
@github-actions

Copy link
Copy Markdown
Overall Project 57.96% 🍏
Files changed 100% 🍏

File Coverage
MetadataOperations.java 100% 🍏
Values.java 100% 🍏
StatementPattern.java 97.96% 🍏
MutationOperations.java 42.65% 🍏
StorageManager.java 21.74% 🍏
QueryOperations.java 0% 🍏

@remiceres
remiceres merged commit d12b993 into feature/corese-next Oct 23, 2026
2 checks passed
@remiceres
remiceres deleted the refactor/643-srp-architecture-audit branch October 23, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant