chore(pybuilder): aggregate PyBuilder at root and add API spec for non-macro pieces#5024
Conversation
…n-macro pieces PyBuilder was defined as an sbt project but missing from the root TexeraProject aggregate(...), so `sbt test` from the repo root silently skipped it (CI invokes `PyBuilder/jacoco` explicitly so coverage is still reported). Group the aggregate list into "common libraries" and "services" while adding PyBuilder under the common section. Add PythonTemplateBuilderApiSpec covering the non-macro surface that PythonTemplateBuilderSpec only exercises incidentally: factory constructors, RenderMode singletons, EncodableStringRenderer / PyLiteralStringRenderer mode behavior, fromInterpolated parts/args precondition, +(String) UnsupportedOperationException, CR/CRLF normalization, and pinned PythonLexerUtils behavior on Python triple-quoted strings (the lexer is intentionally conservative; pinned so a future triple-quote-aware change breaks the spec deliberately). Refs apache#5023 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5024 +/- ##
============================================
+ Coverage 42.48% 42.70% +0.22%
+ Complexity 2185 2184 -1
============================================
Files 1045 1031 -14
Lines 39878 38094 -1784
Branches 4205 4004 -201
============================================
- Hits 16941 16268 -673
+ Misses 21875 20807 -1068
+ Partials 1062 1019 -43
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
scalafmtCheckAll only iterates over sub-projects in the root aggregate. PyBuilder was excluded from that iteration before this branch added it, so these 4 files had been unformatted on main without CI flagging them. Running PyBuilder/scalafmt makes scalafmtCheckAll pass. No semantic changes — scaladoc star indentation and case class multi-line parameter alignment only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR aligns local sbt test behavior with CI by aggregating the PyBuilder subproject under the root TexeraProject, and expands unit coverage for the non-macro API surface of PythonTemplateBuilder (factories, render modes, render normalization, concatenation behavior, and preconditions).
Changes:
- Add
PyBuilderto the root SBT aggregate list so root-levelsbt testincludes PyBuilder tests. - Add
PythonTemplateBuilderApiSpecto directly test non-macro API behaviors and pin current lexer behavior around Python triple quotes. - Apply formatting-only refactors in existing Scala sources/specs (no intended behavioral changes).
Reviewed changes
Copilot reviewed 3 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| build.sbt | Adds PyBuilder to TexeraProject.aggregate(...) to ensure root builds/tests include it. |
| common/pybuilder/src/test/scala/org/apache/texera/amber/pybuilder/PythonTemplateBuilderApiSpec.scala | New spec covering non-macro PythonTemplateBuilder API and pinning lexer behavior. |
| common/pybuilder/src/test/scala/org/apache/texera/amber/pybuilder/PythonTemplateBuilderSpec.scala | Formatting adjustments only. |
| common/pybuilder/src/main/scala/org/apache/texera/amber/pybuilder/PythonTemplateBuilder.scala | Formatting/minor refactor of chaining; no functional changes intended. |
| common/pybuilder/src/main/scala/org/apache/texera/amber/pybuilder/EncodableInspector.scala | Formatting-only adjustments. |
| common/pybuilder/src/main/scala/org/apache/texera/amber/pybuilder/BoundaryValidator.scala | Formatting-only adjustments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Keep the two-group split readable, but sort each group A-Z so future additions have an obvious slot. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This spec exercises the non-macro API directly via fromInterpolated; the pyb"..." interpolator is not used here. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bobbai00
left a comment
There was a problem hiding this comment.
I see lots of formatting change. Are they needed ? If not can you revert them ?
Other parts LGTM
I explained in the PR description already ;) |
What changes were proposed in this PR?
Three closely related changes scoped to
common/pybuilder:Add
PyBuilderto the rootTexeraProjectaggregate(...), grouped under "common libraries" alongsideAuth,Config,DAO,WorkflowCore, andWorkflowOperator(alphabetized within each group). Before this PR,PyBuilderwas the only sbt project defined but not aggregated, sosbt testandsbt scalafmtCheckAllfrom the repo root silently skipped it. CI still ranPyBuilder/jacocoexplicitly, so coverage reporting was unaffected, but the local/CI matrix mismatch was confusing.Apply scalafmt to four pre-existing PyBuilder files (
BoundaryValidator.scala,EncodableInspector.scala,PythonTemplateBuilder.scala,PythonTemplateBuilderSpec.scala).scalafmtCheckAllonly iterates over aggregated sub-projects, so change 1 brought PyBuilder under the format gate for the first time and surfaced debt that had been accumulating invisibly since the project was introduced. Reformatting these files is the necessary follow-on for change 1 to leave CI green; the diffs are purely scaladoc-star indentation and multi-line case-class parameter alignment, no semantic changes.Add
PythonTemplateBuilderApiSpeccovering non-macro pieces ofPythonTemplateBuilderthatPythonTemplateBuilderSpeconly touches incidentally — factory constructors, render-mode singletons, renderer behavior in both modes,fromInterpolatedprecondition,+(String)UnsupportedOperationException, andrender()CR/CRLF normalization. Also pins currentPythonLexerUtilsbehavior on Python triple-quoted strings (the lexer is intentionally conservative and not triple-quote-aware; pinned so a future triple-quote-aware change trips the spec deliberately).Any related issues, documentation, discussions?
Resolves #5023
How was this PR tested?
sbt PyBuilder/test— 125 tests pass (32 new).sbt PyBuilder/jacocoline coverage went from 30.12% to 31.73% and method coverage from 13.17% to 15.30% (6 newly covered methods); the rest ofPythonTemplateBuilder.scalais thepybImplmacro body which jacoco cannot instrument at runtime.sbt scalafmtCheckAllnow passes cleanly with PyBuilder included.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.7 (1M context)