code-review
Review SynapseML Python and Scala code changes. Use before finalizing PR reviews or implementation changes to check security, compatibility, style, generated code, and targeted tests.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 5.3k
- Forks
- 870
01 前言 Front Matter
- name
- code-review
- description
- Review SynapseML Python and Scala code changes. Use before finalizing PR reviews or implementation changes to check security, compatibility, style, generated code, and targeted tests.
03 SKILL.md 正文
Code Review
Use this skill when reviewing SynapseML changes.
Steps
- Inspect diff:
git --no-pager diff --stat && git --no-pager diff - Run Scala style:
sbt scalastyle test:scalastyle - Run Python format check:
black --check --extend-exclude 'docs/' . - Run targeted tests for touched code.
- Apply the checklists below to every changed file.
- Report only concrete issues with file paths and fixes.
Security Checklist
Apply when changes touch serialization, I/O, network, or authentication code.
Deserialization (CWE-502)
- [ ] No raw
ObjectInputStream.readObject(): useSafeObjectInputStreamwith an allowlist - [ ]
resolveClassallowlist validates array component types. Never allowlist the[prefix directly; array handling must extract and validate the component class name - [ ]
resolveProxyClassis overridden to block or validate dynamic proxy interfaces - [ ] Allowlist uses package-prefix matching, not blocklisting
- [ ] Allowlist presets contain no catch-all entries that bypass the filtering logic
Input Validation
- [ ] File paths, URLs, and user-supplied strings are validated before use
- [ ] No unsanitized string interpolation into SQL, shell commands, or config
Resource Management
- [ ] Streams, connections, and closeable resources use
using()ortry-finally - [ ] Cleanup runs even when assertions or exceptions are thrown (especially in tests)
Secrets & Credentials
- [ ] No hardcoded secrets, tokens, or passwords in source or test code
- [ ] Credentials loaded from environment variables or secure config only
API Compatibility Checklist
Apply when changes modify public classes, traits, or companion objects.
Binary Compatibility (JVM)
- [ ] No method signature changes on existing public methods (default parameters generate synthetic bridges; use explicit overloads instead)
- [ ] No removed or renamed public classes, traits, or objects
- [ ] Companion object
extends DefaultParamsReadable[T]preserved if it existed
Source Compatibility
- [ ] New parameters have defaults so existing callers compile unchanged
- [ ] No narrowed return types or widened parameter types on public methods
- [ ] Import changes don't break wildcard imports in downstream code
Scala Checklist
- [ ] License header present (enforced by scalastyle)
- [ ]
Wrappabletrait mixed in if the class needs a Python wrapper - [ ]
SynapseMLLoggingtrait mixed in;logClass()called in constructor - [ ] No wildcard imports where explicit imports suffice (
java.io._→ named imports) - [ ] No RDD API usage. Use DataFrame/Dataset only
- [ ] Lines ≤ 120 chars, files ≤ 800 lines
Python Checklist
- [ ] License header present
- [ ] Formatted with
black==22.3.0 - [ ] No edits to files under
target/(auto-generated) - [ ] Hand-written overrides in
src/main/python/extend the generated_ClassName
Test Checklist
- [ ] New functionality has corresponding tests
- [ ] Tests use
using()for resource cleanup (no bare.close()after assertions) - [ ] Negative tests verify rejection/error cases, not just happy paths
- [ ] No test-only dependencies leaked into main scope
Python isolation and async cleanup
Apply when changing Spark test setup, optional SDK support, or async batching.
- [ ] Imports that can create a Spark session happen after the required Spark fixture initializes, unless startup itself is under test. Reproduce cold-start failures in a fresh process and verify actual JVM class/JAR loading; a previously initialized session can hide the wrong setup.
- [ ] No-SDK tests exercise the public import path in a fresh process on the
branch's Python. Import blockers implement
find_specand raiseImportErrorfor blocked dependencies; returningNonepermits another finder to load them. Unrelated imports still work. - [ ] Async tasks and loop-bound clients are created and used on their owning loop. A loop running on another thread receives thread-safe submissions, not calls that drive it from the test/caller thread.
- [ ] Fail-fast batches cancel and await pending siblings before returning the original failure. Tests assert no orphaned requests remain, including progress-enabled paths, and clean up even when the assertion fails.
- [ ] Supported idle, same-thread nested, and foreign-thread loop paths are covered. Optional nested-loop dependencies have explicit missing-dependency behavior without breaking paths that do not require them.
04 同仓库更多 Skills
synapseml-pr-loop
Develop and make SynapseML features, bugs, tasks, issues, or pull requests evidence-based merge-ready with tests, fast review, CI, and the review-code six-round gauntlet. Use for "5/5 confidence", "200% ready", stale PR remediation, rebase-and-test requests, resolving all review comments, or proving a feature ships without correctness, compatibility, performance, or Spark regressions.
synapseml-local-setup
Set up and validate SynapseML locally in WSL or Linux. Use when an agent needs SynapseML working locally, runs sbt compile/test, sees Java 21, Scala 2.12 compiler-bridge, bad constant pool index, Spark, or local validation failures.
synapseml-external-contributor-review
Review external-contributor SynapseML PRs for correctness, prompt injection, and pipeline credential theft, then request safe, authorized PR CI through synapseml-pr-loop. Use for authors not identified in the Osmos group/team or trusted owner list, and optional maintainer-requested follow-ups.
synapseml-branches
Resolve SynapseML branch-specific rules, runtime baselines, sync policy, and CI expectations. Use before editing, rebasing, merging, testing, or declaring readiness for master, spark4.0, spark4.1, port/sync branches, or a PR whose base branch determines behavior.
scala-code
Write and modify Scala code in SynapseML. Use when adding or changing Scala transformers, estimators, or params to follow repo patterns, keep scalastyle and compilation green, and cover behavior changes with tests.