Skip to content

v0.4.0 — API consolidation + JBCT polish (breaking)

Choose a tag to compare

@siy siy released this 03 May 07:47
· 324 commits to main since this release
e57c05f

Highlights

Breaking release. API consolidation pass: factory naming, parse-don't-validate Grammar, Result/Option boundary cleanups, Formatter immutable config, SessionImpl record. Six logical phases over 16 commits. All 897 tests green throughout.

No incremental v2.5 cache remap. The original 0.4.0 plan item was superseded by the v2.5 spike's NO-GO recommendation (docs/incremental/V2.5-SPIKE.md) — the actual perf lever is pivot-selection in findBoundaryCandidate, not cache invalidation. A naive lever-1 swap was tried in 0.3.6 development but hit boundary-semantic regressions; deferred until that's resolved cleanly.

What changed (BREAKING)

  • Grammar parse-don't-validate. Grammar.of(...) removed; use Grammar.grammar(rules, ...) returning Result<Grammar>. Validation runs inside the factory; standalone validate() removed.
  • Factory rename across the codebase. of()/create()/at() → typeName() for all public factories. Affected: SourceLocation.sourceLocation, SourceSpan.sourceSpan, ParserConfig.parserConfig, ParseResult.Success.success, ParseResult.Failure.failure, ParseResult.CutFailure.cutFailure, ActionCompiler.actionCompiler, SemanticValues.semanticValues, ParserGenerator.parserGenerator, CstHash.cstHash, SessionFactory.sessionFactory, TraceRecord.traceRecord.
  • Test assertion idiom. Tests rewritten from assertTrue(result.isSuccess()) + unwrap() to result.onFailureDo(c -> fail(c.message())).onSuccessDo(...). Failure causes are no longer silently swallowed.
  • SessionImpl → IncrementalSession record. Drops the Impl anti-pattern. Session interface unchanged; record components are internal-only.
  • Formatter builder is now immutable. New FormatterConfig record; Formatter instances are thread-safe to share post-construction.
  • PegEngine.createWithoutActions(...) returns Result<PegEngine> (symmetric with create).
  • PegEngine action dispatch is now a Result.lift boundary instead of try/catch.
  • Playground parseRequestBody returns Result<ParseRequest> with explicit BadRequest cause.
  • Incremental nullables → Option: tryIncrementalReparse, findBoundaryCandidate. Zero (CstNode) null casts remain in peglib-incremental.

Documentation

  • Maven Mojo execute() methods rewritten as Result pipelines with JBCT-boundary Javadoc explaining the lift contract.
  • CLI main methods (AnalyzerMain, PlaygroundRepl, PlaygroundServer, PackratStatsProbe) carry JBCT-boundary Javadoc.

Migration

See CHANGELOG.md § [0.4.0] § "Migration guide" for per-change recipes.

Known limitations

  • Incremental singleCharEdit perf is still ~325 ms/op pending the lever 1 boundary work. Targeted for 0.4.1 or later.
  • Generator-side %recover was already shipped in 0.3.6 — orthogonal to this release.

Tests

897 passing (no change from 0.3.6 baseline — refactor preserved semantics throughout), 0 failures, 0 skipped.