release 0.3.4: cleanup round 1+2 (audit-driven)#25
Conversation
…rs, Locale.ROOT (P0.2)
…arseAt / PlaygroundEngine / JsonEncoder / ParseTracer (P1.2)
…-up note (P2.1, P2.2)
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughRelease 0.3.4 is a cleanup build that standardizes APIs from null/Optional to Pragmatica Option, fixes cache concurrency by switching PegEngine's failure-message caches to ConcurrentHashMap, hardens the playground server against path traversal and oversized requests, replaces Result.failure(...) patterns with cause.result(), and adds targeted tests plus comprehensive audit documentation. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant PlaygroundServer
participant Parser
participant StaticAssets
Client->>PlaygroundServer: POST /parse (body <= 1MiB?)
alt body > 1MiB
PlaygroundServer-->>Client: 413 Payload Too Large + JSON error (with security headers)
else body <= 1MiB
PlaygroundServer->>Parser: parseCstWithDiagnostics(input, startRule?)
Parser-->>PlaygroundServer: ParseResult (CST or diagnostics)
PlaygroundServer-->>Client: 200/4xx JSON response (with security headers)
end
Client->>PlaygroundServer: GET /{path}
PlaygroundServer->>PlaygroundServer: sanitizeStaticPath(path)
alt path invalid or traversal
PlaygroundServer-->>Client: 400/404 (with security headers)
else valid
PlaygroundServer->>StaticAssets: load resource
StaticAssets-->>PlaygroundServer: resource bytes / 404
PlaygroundServer-->>Client: 200/404 response (with security headers)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
Post-roadmap cleanup release. Two rounds of parallel JBCT review (10 focus-area reviewers + docs-backreference + test-coverage audit, run twice) produced ~150 findings. This release lands the P0 (correctness + security) and P1 (highest-leverage mechanical) fixes. Architectural refactors remain tracked as P3 items in
docs/AUDIT-REPORTS/CONSOLIDATED-BACKLOG.md.Highlights
Fixed (P0)
PegEngine— failure caches nowConcurrentHashMap+computeIfAbsent; honorsIncrementalParser's documented thread-safety contract.X-Content-Type-Options,X-Frame-Options,Referrer-Policy,Cache-Control), Locale.ROOT on case conversions.Changed (P1)
Actions#get(String)andActions#get(Class<? extends RuleId>)now returnOption<Action>/Option<Function<...>>. Minor API break — consumer sites migrated.NodeIndex#smallestContaining(int),smallestContainingFrom(...),parentOf(...)returnOption<CstNode>.SessionImpl#reparseAt(...)propagatesOption<CstNode>; no morefold(cause -> null, ...).Result.failure(cause)→cause.result()across ~50 main-source sites.PlaygroundEngine.parseWithRecoveryrewritten to useOptiondirectly.JsonEncoder+ParseTracer(dead code — sealed hierarchy + by-construction non-null children).Added (P2)
LeftRecursionTest.%recoversmoke test inRuleRecoveryTestwith follow-up note (directive needs deeper wiring audit — P3).docs/AUDIT-REPORTS/directory with 5 artefacts includingCONSOLIDATED-BACKLOG.mdenumerating remaining P3 items.Tests
874 passing + 1 skipped (pre-existing
RoundTripTest), 0 failures.Breaking changes
Minor:
Actions#getreturn types shifted toOption. Consumer updates are one-line. Primary public API (PegParser,ParserConfig,Grammar,CstNode,IncrementalParser.initialize/edit) unchanged.Test plan
mvn testat root — 874/874 + 1 skippedmvn install -DskipTests— all modules install/..rejected with 400; 2 MB POST rejected with 413Summary by CodeRabbit
Security Enhancements
API Improvements
Bug Fixes
Testing & Documentation