AGENT SKILL

SynapseML 代码审查

code-review

审查 SynapseML 的 Python 和 Scala 代码变更。在完成 PR 审查或实现变更定稿前使用,用于检查安全性、兼容性、代码风格、生成的代码以及针对性测试。

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

  1. Inspect diff: git --no-pager diff --stat && git --no-pager diff
  2. Run Scala style: sbt scalastyle test:scalastyle
  3. Run Python format check: black --check --extend-exclude 'docs/' .
  4. Run targeted tests for touched code.
  5. Apply the checklists below to every changed file.
  6. 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(): use SafeObjectInputStream with an allowlist
  • [ ] resolveClass allowlist validates array component types. Never allowlist the [ prefix directly; array handling must extract and validate the component class name
  • [ ] resolveProxyClass is 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() or try-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)
  • [ ] Wrappable trait mixed in if the class needs a Python wrapper
  • [ ] SynapseMLLogging trait 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_spec and raise ImportError for blocked dependencies; returning None permits 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

microsoft
microsoft/SynapseML

SynapseML PR 合并就绪处理

synapseml-pr-loop

开发并以证据为依据,让 SynapseML 的功能、缺陷、任务、issue 或拉取请求(PR)达到可合并状态,涵盖测试、快速审查、CI 以及 review-code 六轮严格检验。适用于“5/5 信心”“200% 就绪”、陈旧 PR 修复、rebase 后重新测试的请求、解决所有审查意见,或证明某功能发布时不存在正确性、兼容性、性能或 Spark 回归问题。

软件开发工程师代码仓库协作管理
★ 5.3k
microsoft
microsoft/SynapseML

SynapseML 本地环境搭建与验证

synapseml-local-setup

在 WSL 或 Linux 中本地搭建并验证 SynapseML。当智能体需要让 SynapseML 在本地运行、执行 sbt 编译/测试,或遇到 Java 21、Scala 2.12 compiler-bridge、bad constant pool index、Spark 或本地验证失败时使用。

软件开发工程师开发环境与工具链管理
★ 5.3k
microsoft
microsoft/SynapseML

SynapseML 外部贡献者 PR 审查

synapseml-external-contributor-review

审查外部贡献者的 SynapseML PR,检查其正确性、提示注入和流水线凭证窃取问题,然后通过 synapseml-pr-loop 请求安全且经过授权的 PR CI。适用于未在 Osmos 组/团队或受信任所有者名单中标识的作者,以及维护者请求的可选后续跟进。

安全工程师代码仓库协作管理
★ 5.3k
microsoft
microsoft/SynapseML

SynapseML 分支规则解析

synapseml-branches

解析 SynapseML 特定分支的规则、运行时基线、同步策略和 CI 预期。在对 master、spark4.0、spark4.1、port/sync 分支,或基分支决定行为的 PR 进行编辑、变基、合并、测试或宣布就绪之前使用。

软件开发工程师代码仓库协作管理
★ 5.3k
microsoft
microsoft/SynapseML

Scala 代码编写

scala-code

在 SynapseML 中编写和修改 Scala 代码。当添加或更改 Scala 转换器(transformers)、估计器(estimators)或参数(params)时使用,以遵循仓库模式、保持 scalastyle 检查和编译通过,并通过测试覆盖行为变更。

软件开发工程师代码实现
★ 5.3k