Skip to content

Commit d5f124b

Browse files
committed
Merge branch 'main' into develop
2 parents 8034d99 + 0aeb6b2 commit d5f124b

File tree

65 files changed

+2906
-208
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2906
-208
lines changed

.github/copilot-instructions.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# Copilot Instructions for Nitrite Database
2+
3+
## Project Overview
4+
5+
Nitrite Database is an open source embedded NoSQL database for Java. It's a multi-module Maven project that supports both in-memory and file-based persistent storage.
6+
7+
**Key Features:**
8+
- Embedded, serverless document store
9+
- Document-oriented with schema-less collections
10+
- Extensible storage engines (MVStore, RocksDB)
11+
- Full-text search and indexing
12+
- Transaction support
13+
- Android compatibility (API Level 26+)
14+
15+
## Repository Structure
16+
17+
This is a multi-module Maven project with the following modules:
18+
19+
- `nitrite` - Core database module
20+
- `nitrite-bom` - Bill of materials for dependency management
21+
- `nitrite-jackson-mapper` - Jackson-based JSON mapper
22+
- `nitrite-mvstore-adapter` - MVStore storage adapter
23+
- `nitrite-rocksdb-adapter` - RocksDB storage adapter
24+
- `nitrite-spatial` - Spatial indexing support
25+
- `nitrite-support` - Support utilities
26+
- `nitrite-native-tests` - GraalVM native image tests
27+
- `potassium-nitrite` - Kotlin extension
28+
29+
## Development Environment
30+
31+
### Java Versions
32+
- **Minimum supported:** Java 11 (as configured in pom.xml)
33+
- **Primary testing:** Java 11 and 17
34+
- **Native image testing:** Java 17 and 21 with GraalVM
35+
36+
### Build Tool
37+
Maven is the build tool. Key commands:
38+
39+
```bash
40+
# Build the project
41+
mvn clean install
42+
43+
# Build without tests
44+
mvn clean install -DskipTests
45+
46+
# Run tests only
47+
mvn test
48+
49+
# Build specific module
50+
mvn -pl nitrite clean install
51+
```
52+
53+
## Code Guidelines
54+
55+
### Java Standards
56+
1. **Minimum compatibility:** Code must compile and run on Java 11 (as per maven.compiler.source=11 in pom.xml)
57+
2. **Code style:** Follow existing code formatting in the repository (see `.editorconfig`)
58+
3. **Dependencies:** Check `pom.xml` files before adding new dependencies
59+
4. **API changes:** Be cautious with public API changes - this is a library used by others
60+
61+
### Testing Requirements
62+
1. **Always run tests:** Execute `mvn test` before submitting changes
63+
2. **Write tests:** New features should include unit tests
64+
3. **Test coverage:** Maintain or improve code coverage (tracked via CodeCov)
65+
4. **Cross-platform:** Consider Linux, macOS, and Windows compatibility
66+
67+
### Module-Specific Guidelines
68+
- When modifying storage adapters (`nitrite-mvstore-adapter`, `nitrite-rocksdb-adapter`), ensure compatibility with the core module
69+
- Changes to `nitrite` core module may require updates to adapter modules
70+
- Kotlin extension (`potassium-nitrite`) should mirror Java API capabilities
71+
72+
## Pull Request Best Practices
73+
74+
### Before Creating a PR
75+
1. Run full build: `mvn clean install`
76+
2. Ensure all tests pass across Java 11 and 17
77+
3. Check for compilation warnings
78+
4. Update documentation if changing public APIs
79+
5. Add or update tests for your changes
80+
81+
### PR Scope
82+
- Keep PRs focused on a single issue or feature
83+
- Include issue references in PR description
84+
- Document breaking changes clearly
85+
- Update CHANGELOG.md for significant changes
86+
87+
### Review Process
88+
- All PRs require review before merging
89+
- CI must pass (build on Linux, macOS, Windows)
90+
- CodeQL security analysis must pass
91+
- Code coverage should not decrease significantly
92+
93+
## Security Considerations
94+
95+
1. **No secrets in code:** Never commit API keys, passwords, or credentials
96+
2. **Input validation:** Validate all user inputs, especially in query operations
97+
3. **File operations:** Be careful with file I/O operations in storage adapters
98+
4. **Dependencies:** Check for known vulnerabilities in dependencies
99+
5. **CodeQL:** Address any CodeQL security findings
100+
101+
## Common Tasks
102+
103+
### Good Tasks for Copilot
104+
- Bug fixes in specific modules
105+
- Adding unit tests to improve coverage
106+
- Documentation updates (JavaDoc, README)
107+
- Code style and formatting improvements
108+
- Refactoring isolated methods/classes
109+
- Adding new query operators or filters
110+
- Implementing feature requests with clear specifications
111+
112+
### Tasks Requiring Human Review
113+
- Breaking API changes
114+
- Changes to core database engine logic
115+
- Modifications to transaction handling
116+
- Storage format changes
117+
- Security-sensitive operations
118+
- Multi-module architectural changes
119+
120+
## Documentation
121+
122+
- **JavaDoc:** All public APIs must have JavaDoc comments
123+
- **README updates:** Update README.md if changing features or usage
124+
- **User guide:** Major features may need documentation at https://nitrite.dizitart.com
125+
- **Code comments:** Add comments for complex logic, not obvious code
126+
127+
## Gradle vs Maven
128+
This project uses **Maven**, not Gradle. All build commands should use `mvn`.
129+
130+
## Related Projects
131+
132+
- **Potassium Nitrite:** Kotlin extension within this repository
133+
- **Nitrite Flutter:** Separate repository for Flutter/Dart version
134+
- **Deprecated:** Nitrite DataGate and Nitrite Explorer (no longer maintained)
135+
136+
## Communication
137+
138+
- **Issues:** Use GitHub issues for bugs and feature requests
139+
- **Discussions:** Use GitHub Discussions for questions and community interaction
140+
- **Contributing:** See CONTRIBUTING.md for detailed contribution guidelines
141+
142+
## Additional Resources
143+
144+
- **Website:** https://nitrite.dizitart.com
145+
- **Documentation:** https://nitrite.dizitart.com/java-sdk/getting-started/index.html
146+
- **API Docs:** https://javadoc.io/doc/org.dizitart/nitrite
147+
- **GitHub:** https://github.com/nitrite/nitrite-java

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ updates:
99
# Ignore minor version updates for dependencies with group ID "com.google.errorprone"
1010
- dependency-name: "com.google.errorprone:*"
1111
update-types: [ "version-update:semver-minor" ]
12+
# Pin RocksDB to version 10.2.1
13+
- dependency-name: "org.rocksdb:rocksdbjni"
14+
update-types: [ "version-update:semver-major", "version-update:semver-minor", "version-update:semver-patch" ]
15+
# Pin JUnit BOM to version 6.0.0
16+
- dependency-name: "org.junit:junit-bom"
17+
update-types: [ "version-update:semver-major", "version-update:semver-minor", "version-update:semver-patch" ]
1218
groups:
1319
security:
1420
# Group security updates into a single pull request

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ubuntu-latest
2323
strategy:
2424
matrix:
25-
java: [ '11', '17' ]
25+
java: [ '17' ]
2626
env:
2727
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
2828

@@ -42,7 +42,7 @@ jobs:
4242
run: mvn -B -ff -ntp clean install
4343

4444
- name: Publish Code Coverage
45-
if: github.ref == 'refs/heads/main' && matrix.java == '11'
45+
if: github.ref == 'refs/heads/main' && matrix.java == '17'
4646
uses: codecov/codecov-action@v5
4747
with:
4848
token: ${{ secrets.CODECOV_TOKEN }}
@@ -53,7 +53,7 @@ jobs:
5353
runs-on: macos-latest
5454
strategy:
5555
matrix:
56-
java: [ '11', '17' ]
56+
java: [ '17' ]
5757
env:
5858
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
5959

@@ -76,7 +76,7 @@ jobs:
7676
runs-on: windows-latest
7777
strategy:
7878
matrix:
79-
java: [ '11', '17' ]
79+
java: [ '17' ]
8080
env:
8181
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
8282

@@ -105,7 +105,7 @@ jobs:
105105
steps:
106106
- uses: actions/checkout@v5
107107

108-
- uses: graalvm/setup-graalvm@v1.3.7
108+
- uses: graalvm/setup-graalvm@v1.4.2
109109
with:
110110
java-version: ${{ matrix.java }}
111111
distribution: 'graalvm-community'

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ jobs:
3333

3434
# Initializes the CodeQL tools for scanning.
3535
- name: Initialize CodeQL
36-
uses: github/codeql-action/init@v3
36+
uses: github/codeql-action/init@v4
3737
with:
3838
languages: ${{ matrix.language }}
3939

4040
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
4141
# If this step fails, then you should remove it and run the build manually (see below)
4242
- name: Autobuild
43-
uses: github/codeql-action/autobuild@v3
43+
uses: github/codeql-action/autobuild@v4
4444

4545
# ℹ️ Command-line programs to run using the OS shell.
4646
# 📚 https://git.io/JvXDl
@@ -54,4 +54,4 @@ jobs:
5454
# make release
5555

5656
- name: Perform CodeQL Analysis
57-
uses: github/codeql-action/analyze@v3
57+
uses: github/codeql-action/analyze@v4

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Nitrite is an embedded database ideal for desktop, mobile or small web applicati
2828
- Transaction support
2929
- Schema migration support
3030
- Encryption support
31-
- Android compatibility (API Level 24)
31+
- Android compatibility (API Level 26)
3232

3333
## Kotlin Extension
3434

nitrite-bom/pom.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.dizitart</groupId>
66
<artifactId>nitrite-java</artifactId>
7-
<version>4.3.2-SNAPSHOT</version>
7+
<version>4.3.3-SNAPSHOT</version>
88
</parent>
99

1010
<artifactId>nitrite-bom</artifactId>
@@ -15,6 +15,8 @@
1515

1616
<properties>
1717
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18+
<!-- Skip flattening for BOM module to preserve dependencyManagement section -->
19+
<flatten.skip>true</flatten.skip>
1820
</properties>
1921

2022
<dependencyManagement>

nitrite-jackson-mapper/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.dizitart</groupId>
66
<artifactId>nitrite-java</artifactId>
7-
<version>4.3.2-SNAPSHOT</version>
7+
<version>4.3.3-SNAPSHOT</version>
88
</parent>
99

1010
<artifactId>nitrite-jackson-mapper</artifactId>

nitrite-mvstore-adapter/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.dizitart</groupId>
66
<artifactId>nitrite-java</artifactId>
7-
<version>4.3.2-SNAPSHOT</version>
7+
<version>4.3.3-SNAPSHOT</version>
88
</parent>
99

1010
<artifactId>nitrite-mvstore-adapter</artifactId>

nitrite-mvstore-adapter/src/test/java/org/dizitart/no2/integration/collection/CollectionCompoundIndexTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,10 @@ public void testIssue178() {
242242
assertEquals(cursor.size(), 1);
243243

244244
cursor = collection.find(where("field1").eq(5));
245-
assertEquals(cursor.size(), 1);
245+
assertEquals(cursor.size(), 2);
246246

247247
cursor = collection.find(where("field1").eq(5.0));
248-
assertEquals(cursor.size(), 1);
248+
assertEquals(cursor.size(), 2);
249249

250250
collection.createIndex("field1", "field2");
251251
cursor = collection.find(and(where("field1").eq(0.03),
@@ -257,10 +257,10 @@ public void testIssue178() {
257257
assertEquals(cursor.size(), 1);
258258

259259
cursor = collection.find(where("field1").eq(5));
260-
assertEquals(cursor.size(), 1);
260+
assertEquals(cursor.size(), 2);
261261

262262
cursor = collection.find(where("field1").eq(5.0));
263-
assertEquals(cursor.size(), 1);
263+
assertEquals(cursor.size(), 2);
264264
}
265265

266266
@Test

nitrite-mvstore-adapter/src/test/java/org/dizitart/no2/integration/collection/CollectionFindByCompoundIndexTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public void testFindByOrFilter() throws ParseException {
200200

201201
FindPlan findPlan = cursor.getFindPlan();
202202
assertEquals(3, findPlan.getSubPlans().size());
203-
assertEquals(5, cursor.size());
203+
assertEquals(3, cursor.size());
204204

205205
// distinct
206206
cursor = collection.find(

0 commit comments

Comments
 (0)