Skip to content

Conversation

@He-Pin
Copy link
Contributor

@He-Pin He-Pin commented Jan 31, 2026

@He-Pin He-Pin marked this pull request as draft January 31, 2026 14:58
@He-Pin He-Pin marked this pull request as ready for review January 31, 2026 15:32
Copy link
Collaborator

@stephenamar-db stephenamar-db left a comment

Choose a reason for hiding this comment

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

This PR needs another look. It's not ready.
Make sure to use Scala collections and operators when needed

for (s <- objs.reverse) {
current = new Val.Obj(s.pos, s.getValue0, false, s.triggerAsserts, current)
// Preserve excludedKeys if they exist in the chain's keys OR in the collected excludedKeys
val filteredExcludedKeys = if (s.excludedKeys != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

use scala sets?
Also just use intersect?
https://docs.scala-lang.org/overviews/collections/sets.html

Copy link
Contributor Author

@He-Pin He-Pin Feb 3, 2026

Choose a reason for hiding this comment

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

The default Scala Set is immutable, not easy to use here, the current value cache is a java linkedHashMap, and IIRC, Java's HashMap is faster than Scala's

@He-Pin He-Pin marked this pull request as draft February 3, 2026 06:30
@He-Pin He-Pin force-pushed the objectRemoveKey branch 2 times, most recently from 101839e to ee0b34c Compare February 3, 2026 13:03
@He-Pin He-Pin marked this pull request as ready for review February 3, 2026 13:04
@He-Pin He-Pin requested a review from stephenamar-db February 3, 2026 13:21
@He-Pin He-Pin closed this Feb 4, 2026
@He-Pin He-Pin reopened this Feb 4, 2026
@He-Pin He-Pin force-pushed the objectRemoveKey branch 5 times, most recently from ef9709d to 2702fb2 Compare February 7, 2026 08:56
@He-Pin He-Pin closed this Feb 7, 2026
@He-Pin He-Pin reopened this Feb 7, 2026
Copilot AI review requested due to automatic review settings February 10, 2026 03:19
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

Ports upstream Jsonnet behavior for std.objectRemoveKey so it preserves hidden fields and interacts correctly with super/inheritance (including assertion behavior), alongside new regression tests.

Changes:

  • Re-implement std.objectRemoveKey by delegating to Val.Obj.removeKeys (excluded-keys wrapper approach) rather than rebuilding a concrete object.
  • Extend object key gathering / lookup logic in Val.Obj to account for excluded keys across inheritance chains.
  • Add/expand stdlib + go test-suite coverage for hidden fields, inheritance, and super/assert interactions.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
sjsonnet/test/src-jvm-native/sjsonnet/BaseFileTests.scala Improves debugging output when an error was expected but evaluation succeeded.
sjsonnet/test/resources/test_suite/stdlib.jsonnet Adds stdlib-level assertions covering hidden fields + inheritance semantics for objectRemoveKey.
sjsonnet/test/resources/go_test_suite/builtinObjectRemoveKey_hidden.jsonnet New regression test for hidden-field retention through objectRemoveKey.
sjsonnet/test/resources/go_test_suite/builtinObjectRemoveKey_hidden.jsonnet.golden Golden output for hidden-field regression test.
sjsonnet/test/resources/go_test_suite/builtinObjectRemoveKey_super.jsonnet New regression test for super behavior through objectRemoveKey.
sjsonnet/test/resources/go_test_suite/builtinObjectRemoveKey_super.jsonnet.golden Golden output for super regression test.
sjsonnet/test/resources/go_test_suite/builtinObjectRemoveKey_super_assert.jsonnet New regression test ensuring self/super asserts behave correctly with removed keys.
sjsonnet/test/resources/go_test_suite/builtinObjectRemoveKey_super_assert.jsonnet.golden Golden output for assert regression test.
sjsonnet/src/sjsonnet/stdlib/ObjectModule.scala Switches objectRemoveKey builtin implementation to Val.Obj.removeKeys.
sjsonnet/src/sjsonnet/Val.scala Adds excludedKeys plumbing, removeKeys, and adjusts key gathering / field lookup accordingly.
sjsonnet/src/sjsonnet/Util.scala Adds shared empty LinkedHashMap helper + small set utilities used by the new logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@He-Pin He-Pin closed this Feb 10, 2026
@He-Pin He-Pin reopened this Feb 10, 2026
@He-Pin
Copy link
Contributor Author

He-Pin commented Feb 10, 2026

refs: com-lihaoyi/mill#6814

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

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants