Skip to content

Conversation

@sgammon
Copy link
Member

@sgammon sgammon commented Jul 27, 2025

Ready for review Powered by Pull Request Badge

Summary

Adds annotations (elide.annotations.Secret and elide.annotations.Cleartext) and integrates them with the Kotlin Redacted Plugin by @ZacSweers; ships Elide's annotations as built-ins, and activates both Redacted and Kotlin Serialization as default built-in plugins.

  • Runtime Built-ins
    • Add core
    • Add base
    • Add test
    • Redacted plugin JAR
  • Kotlin Plugins: Redacted
    • Add Redacted plugin support (coordinates/runtime)
    • Add Redacted plugin to JVM builder
    • Add kotlin { redaction = true/false } to elide.pkl
  • Samples
    • Add serialization to ktjvm project
    • Add redaction to ktjvm project

Usage

Given:

import elide.annotations.Secret

data class MyCoolData(
  @Secret val name: String,
)

fun main() {
  println(MyCoolData(name = "secret").toString())
}

elide build && elide run produces:

MyCoolData(name=██)

@sgammon sgammon added this to the Release R18: Beta milestone Jul 27, 2025
@sgammon sgammon requested review from a team and Copilot July 27, 2025 21:16
@sgammon sgammon self-assigned this Jul 27, 2025
@sgammon sgammon added feature Large PRs or issues with full-blown features lang:kotlin Related to Kotlin lang support labels Jul 27, 2025
@sgammon sgammon added this to Elide Jul 27, 2025
@sgammon sgammon moved this to In Progress in Elide Jul 27, 2025
@sgammon sgammon changed the title feat: support redacted kotlin plugin feat: support kotlin redacted plugin Jul 27, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR integrates the Kotlin Redacted Plugin into Elide, adding support for redacting sensitive data in Kotlin classes through annotations. The implementation adds new annotations (elide.annotations.Secret and elide.annotations.Cleartext) and enables automatic redaction of fields marked with these annotations in toString() output.

  • Adds redaction feature configuration to Kotlin build settings with default enabled state
  • Integrates Redacted plugin into the embedded Kotlin compiler with built-in support
  • Creates new annotations for marking secret and cleartext fields in data classes

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/tooling/src/main/pkl/Kotlin.pkl Adds redaction configuration option to Kotlin feature settings
packages/tooling/src/main/kotlin/elide/tooling/project/manifest/ElidePackageManifest.kt Adds redaction field to KotlinFeatureOptions data class
packages/tooling/src/main/kotlin/elide/tooling/jvm/JvmLibraries.kt Adds Elide module coordinates and redacted plugin version constants
packages/graalvm-kt/src/main/kotlin/elide/runtime/gvm/kotlin/KotlinCompilerConfig.kt Implements redacted plugin configuration for embedded Kotlin compiler
packages/builder/src/main/kotlin/elide/tooling/kotlin/KotlinCompiler.kt Registers redacted plugin components in Kotlin compiler services
packages/builder/src/main/kotlin/elide/tooling/jvm/JvmBuildConfigurator.kt Adds Elide core modules to classpath and enables serialization by default
packages/base/src/commonMain/kotlin/elide/annotations/Secret.kt Defines Secret annotation for marking sensitive data
packages/base/src/commonMain/kotlin/elide/annotations/Cleartext.kt Defines Cleartext annotation for overriding redaction
packages/cli/src/projects/ktjvm/src/main/kotlin/sample/main.kt Sample code demonstrating redaction functionality
packages/cli/src/projects/ktjvm/src/test/kotlin/sample/testGreeting.kt Tests for redaction and serialization features
Comments suppressed due to low confidence (1)

packages/tooling/src/main/kotlin/elide/tooling/jvm/JvmLibraries.kt:57

  • The constant name ELIDE_CORE maps to dev.elide:elide-base-jvm while ELIDE_BASE maps to dev.elide:elide-core-jvm. This naming is inconsistent and confusing - the constant names should match their actual Maven coordinates.
  public const val ELIDE_CORE: String = "dev.elide:elide-base-jvm"

@codecov
Copy link

codecov bot commented Jul 27, 2025

Codecov Report

❌ Patch coverage is 9.52381% with 57 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@2fff818). Learn more about missing BASE report.
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
...n/kotlin/elide/tooling/jvm/JvmBuildConfigurator.kt 0.00% 22 Missing ⚠️
...n/elide/runtime/gvm/kotlin/KotlinCompilerConfig.kt 28.57% 15 Missing ⚠️
.../src/main/kotlin/elide/tooling/jvm/JvmLibraries.kt 0.00% 13 Missing ⚠️
...main/kotlin/elide/tooling/kotlin/KotlinCompiler.kt 0.00% 6 Missing ⚠️
...e/tooling/project/manifest/ElidePackageManifest.kt 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1594   +/-   ##
=======================================
  Coverage        ?   39.73%           
=======================================
  Files           ?      780           
  Lines           ?    37118           
  Branches        ?     5244           
=======================================
  Hits            ?    14748           
  Misses          ?    20602           
  Partials        ?     1768           
Flag Coverage Δ
jvm 39.73% <9.52%> (?)
lib 39.73% <9.52%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...e/tooling/project/manifest/ElidePackageManifest.kt 11.93% <0.00%> (ø)
...main/kotlin/elide/tooling/kotlin/KotlinCompiler.kt 0.00% <0.00%> (ø)
.../src/main/kotlin/elide/tooling/jvm/JvmLibraries.kt 0.00% <0.00%> (ø)
...n/elide/runtime/gvm/kotlin/KotlinCompilerConfig.kt 38.55% <28.57%> (ø)
...n/kotlin/elide/tooling/jvm/JvmBuildConfigurator.kt 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2fff818...a33080e. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sgammon sgammon merged commit 5de7cd5 into main Jul 27, 2025
19 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Elide Jul 27, 2025
@sgammon sgammon mentioned this pull request Sep 21, 2025
31 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Large PRs or issues with full-blown features lang:kotlin Related to Kotlin lang support

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants