code-review

Daftar periksa tinjauan cepat untuk perubahan kode Python dan Scala sebelum menyelesaikannya.

npx skills add https://github.com/microsoft/synapseml --skill code-review

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.

Lebih banyak skill dari microsoft

oss-growth
microsoft
Persona peretas pertumbuhan OSS
agent-framework-azure-ai-py
microsoft
Bangun agen Azure AI Foundry menggunakan Microsoft Agent Framework Python SDK (agent-framework-azure-ai). Gunakan saat membuat agen persisten dengan AzureAIAgentsProvider, menggunakan alat yang dihosting (code interpreter, file search, web search), mengintegrasikan server MCP, mengelola utas percakapan, atau mengimplementasikan respons streaming. Mencakup alat fungsi, keluaran terstruktur, dan agen multi-alat.
development
airunway-aks-setup
microsoft
Siapkan AI Runway di AKS — dari klaster kosong hingga model berjalan. Mencakup verifikasi klaster, instalasi controller, penilaian GPU, penyiapan penyedia, dan deployment pertama. KAPAN: "setup AI Runway", "onboard AKS cluster", "install AI Runway", "airunway setup", "deploy model to AKS", "GPU inference on AKS", "KAITO setup on AKS", "run LLM on AKS", "vLLM on AKS", "set up model serving on AKS", "AI Runway controller".
devops
appinsights-instrumentation
microsoft
Panduan untuk instrumentasi aplikasi web dengan Azure Application Insights. Menyediakan pola telemetri, pengaturan SDK, dan referensi konfigurasi. KAPAN: cara menginstrumentasi aplikasi, SDK App Insights, pola telemetri, apa itu App Insights, panduan Application Insights, contoh instrumentasi, praktik terbaik APM.
devops
applicationinsights-web-ts
microsoft
Instrumentasi aplikasi browser/web dengan Application Insights JavaScript SDK (@microsoft/applicationinsights-web). Digunakan untuk Real User Monitoring (RUM) — tampilan halaman, klik, dependensi AJAX/fetch, pengecualian, peristiwa kustom, dan jejak agen GenAI sisi browser yang dikorelasikan dengan jejak OpenTelemetry backend. Mencakup pengaturan SDK Loader Script dan npm, ekstensi kerangka kerja (React, React Native, Angular), Click Analytics, inisialisasi telemetri, dan konvensi semantik OTel GenAI untuk span agen/alat/model yang dipancarkan dari browser.
devops
azure-ai-anomalydetector-java
microsoft
Bangun aplikasi deteksi anomali dengan Azure AI Anomaly Detector SDK untuk Java. Gunakan saat mengimplementasikan deteksi anomali univariat/multivariat, analisis deret waktu, atau pemantauan bertenaga AI.
development
azure-ai-language-conversations-py
microsoft
Implementasikan Pemahaman Bahasa Percakapan (CLU) menggunakan SDK Python azure-ai-language-conversations. Gunakan saat bekerja dengan ConversationAnalysisClient untuk menganalisis maksud dan entitas percakapan, membangun fitur NLP, atau mengintegrasikan pemahaman bahasa ke dalam aplikasi.
development
azure-ai-ml-py
microsoft
Azure Machine Learning SDK v2 untuk Python. Gunakan untuk ruang kerja ML, pekerjaan, model, kumpulan data, komputasi, dan pipeline. Pemicu: "azure-ai-ml", "MLClient", "ruang kerja", "registri model", "pekerjaan pelatihan", "kumpulan data".
development