Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ jobs:
run: ./mill --no-daemon mill.scalalib.scalafmt/checkFormatAll '__.sources'
- name: Validate shared skill
run: ./scripts/check-skill-frontmatter.sh
- name: Check native Java parsing
run: |
./mill --no-daemon nativeCopy --dest ./scalex-check
bash scripts/check-native.sh ./scalex-check
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:

- name: Test binary
run: |
bash scripts/check-native.sh ./${{ matrix.artifact }}
./${{ matrix.artifact }} help
./${{ matrix.artifact }} index .
./${{ matrix.artifact }} search . Scalex
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Codex CLI and desktop plugin packaging and repository marketplace, sharing the existing skill and binary bootstrap with Claude Code.

### Fixed
- Native Java parsing retains the five AST fields inspected by JavaParser's validator. Classes with fields, local variables, arrays, intersection casts, and multi-catch types now parse like the JVM build. Existing indexes rebuild once to discard previously cached parse failures.
- Test repositories configure their own Git identity and disable commit signing, so the suite runs on clean CI machines without developer Git settings.
- Output budgets preserve complete JSON documents, apply to symbol summaries, and count Unicode characters correctly. Oversized JSON returns truncation metadata instead of a broken prefix.
- CLI usage errors exit 2 and Git failures exit 1, with structured JSON errors when requested. Invalid Git refs no longer look like successful empty diffs.
Expand Down
1 change: 1 addition & 0 deletions docs/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ When adding or changing commands/flags:

- **Guava group ID**: `com.google.guava:guava`, NOT `com.google.common:guava`
- **GraalVM native image**: Guava needs `--initialize-at-run-time=com.google.common.hash.Striped64,com.google.common.hash.LongAdder,com.google.common.hash.BloomFilter,com.google.common.hash.BloomFilterStrategies` (see `build-native.sh`)
- **JavaParser native validation**: `resources/META-INF/native-image/scalex/reflect-config.json` retains the five AST fields read reflectively by the non-empty-list validator. The metadata test checks coverage against the installed JavaParser version; `bash scripts/check-native.sh <binary>` exercises those constructs in the compiled executable. PR CI and every release platform run this check.
- **No `.par` in Scala 3**: Use `list.asJava.parallelStream()` instead of `list.par`
- **No non-local `return` in Scala 3**: `return` inside lambdas/closures is deprecated. Use `scala.util.boundary` + `boundary.break` instead. This includes `return` inside `.foreach`, `.map`, `try`/`catch` blocks inside lambdas, etc.
- **Scalameta `Pkg.children` wraps stats in `PkgBody`**: Use `pkg.stats` to access direct children (Import, Defn.Class, etc.), not `pkg.children` which nests them inside a `PkgBody` wrapper node.
Expand Down
11 changes: 10 additions & 1 deletion docs/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## Pending

### Native parsing parity and measured query performance

- [x] Reproduce and fix native-only Java parse failures, with a native regression check (492 JVM tests; full-workspace native/JVM parity)
- [ ] Reuse deserialized file paths and avoid full name-map construction for isolated lookups
- [ ] Reuse reference confidence, sort keys, and classification patterns without changing results
- [ ] Measure complete requests and command/render phases without double-counting nested timings
- [ ] Document opt-in native heap tuning; keep portable defaults unchanged
- [ ] Validate native/JVM parity, tests, and separate before/after performance measurements

### Architecture and reliability cleanup

- [x] Upgrade Scala, Mill, libraries, and formatting tools to the latest stable releases and validate compatibility
Expand All @@ -15,7 +24,7 @@
- [x] Run tests, fatal-warning compilation, and shared skill validation in PR CI
- [x] Consolidate contributor/build documentation and normalize Scala brace/import conventions
- [x] Validate all 491 tests, fatal-warning compilation, formatting, and native CLI smoke checks
- [ ] Benchmark the latest build separately: cold index, warm index, query latency, and cache size
- [x] Benchmark the latest build separately: cold index, warm index, query latency, cache size, CPU/allocation profiles, and native GC

- [x] Codex CLI and desktop plugin packaging, marketplace installation, and shared skill validation (local install verified with Codex CLI 0.153.4)
- [ ] Publish Codex marketplace changes and verify installation from GitHub; optionally submit to OpenAI's public plugin directory
Expand Down
22 changes: 22 additions & 0 deletions resources/META-INF/native-image/scalex/reflect-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
{
"name": "com.github.javaparser.ast.body.FieldDeclaration",
"fields": [{ "name": "variables" }]
},
{
"name": "com.github.javaparser.ast.expr.ArrayCreationExpr",
"fields": [{ "name": "levels" }]
},
{
"name": "com.github.javaparser.ast.expr.VariableDeclarationExpr",
"fields": [{ "name": "variables" }]
},
{
"name": "com.github.javaparser.ast.type.IntersectionType",
"fields": [{ "name": "elements" }]
},
{
"name": "com.github.javaparser.ast.type.UnionType",
"fields": [{ "name": "elements" }]
}
]
44 changes: 44 additions & 0 deletions scripts/check-native.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
set -euo pipefail

case "${1:-./scalex}" in
/*) binary="${1:-./scalex}" ;;
*) binary="$PWD/${1:-./scalex}" ;;
esac
workspace=$(mktemp -d)
trap 'rm -rf "$workspace"' EXIT

cat > "$workspace/Counter.java" <<'JAVA'
package example;

/** A counter with both primitive and generic fields. */
public class Counter<T> {
private int value;
private java.util.List<T> items;
public static final int DEFAULT = 0;
public Counter(int initial) { value = initial; }
public int current() { return value; }
public void exercise() {
int[] numbers = new int[2];
Object action = (Runnable & java.io.Serializable) () -> {};
try { throw new java.io.IOException(); }
catch (java.io.IOException | IllegalArgumentException error) {}
}
}
JAVA
git -C "$workspace" init -q
git -C "$workspace" add Counter.java

stats=$("$binary" index "$workspace" --json)
if ! grep -q '"parseFailures":0' <<< "$stats"; then
echo "Native Java parsing regression: $stats" >&2
exit 1
fi
members=$("$binary" members "$workspace" Counter --json)
for name in value items DEFAULT current; do
if ! grep -q "\"name\":\"$name\"" <<< "$members"; then
echo "Native Java member missing: $name" >&2
exit 1
fi
done
echo 'Native Java parsing and member extraction passed.'
3 changes: 2 additions & 1 deletion src/index/persistence.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import com.google.common.hash.{BloomFilter, Funnels}

object IndexPersistence {
private val MAGIC = 0x53584458
private val VERSION: Byte = 8
// Invalidate cached Java parse failures from native images missing validator metadata.
private val VERSION: Byte = 9

def indexPath(workspace: Path): Path = workspace.resolve(".scalex").resolve("index.bin")

Expand Down
24 changes: 24 additions & 0 deletions tests/native-metadata.test.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package scalex

import com.github.javaparser.metamodel.JavaParserMetaModel
import munit.FunSuite
import scala.jdk.CollectionConverters.*
import scala.util.Using

class NativeMetadataSuite extends FunSuite {
test("native metadata covers every field read by JavaParser's non-empty-list validator") {
val required = JavaParserMetaModel.getNodeMetaModels.asScala.flatMap { node =>
node.getAllPropertyMetaModels.asScala.collect {
case property if property.isNonEmpty && property.isNodeList =>
(owner = property.getContainingNodeMetaModel.getType.getName, field = property.getName)
}
}.toSet
val resource = getClass.getResourceAsStream("/META-INF/native-image/scalex/reflect-config.json")
assert(resource != null, "Native metadata must be included in the application resources")
val metadata = Using.resource(resource)(stream => ujson.read(stream.readAllBytes()))
val registered = metadata.arr.flatMap { entry =>
entry("fields").arr.map(field => (owner = entry("name").str, field = field("name").str))
}.toSet
assertEquals(registered, required)
}
}