Skip to content

change PrepareContext to AddDataToContext, and change the data signature #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 15, 2025

Conversation

robbyt
Copy link
Owner

@robbyt robbyt commented Apr 15, 2025

Previously, when passing data through to the ContextProvider, the paths were hard-coded in the final ctx object passed to the VM. This change allows customization of the final object by requiring all data is sent to the data.Provider as a map[string]any (instead of the previous non-namespaced any).

…or sending data through to the data.Provider
@robbyt robbyt requested a review from Copilot April 15, 2025 00:09
Copy link

github-actions bot commented Apr 15, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link
Contributor

@Copilot 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.

Copilot reviewed 36 out of 36 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (4)

platform/constants/ctx.go:12

  • Removal of sub-key constants (e.g., Request, Response, InputData) detected. Confirm that this change is intentional and that all references now correctly use the intended string literals.
Ctx = "ctx" // top-scope variable name for accessing input data from scripts

engines/starlark/evaluator/evaluator_test.go:144

  • [nitpick] Direct usage of the string literal "request" is now used instead of the previous constant. Consider extracting this key as a shared constant if consistent naming is required across the codebase.
"request": rMap,

engines/starlark/evaluator/evaluator_test.go:243

  • Consider adding test cases that pass multiple input maps to verify the merging behavior of AddDataToContext.
inputs: []map[string]any{{"test": "data"}},

engines/benchmarks/benchmark_test.go:171

  • [nitpick] Benchmark test now accesses the 'name' key directly instead of a nested key. Verify that this change aligns with the new convention and update any inline comments if necessary.
name := ctx["name"]

@robbyt robbyt force-pushed the rterhaar/ctx-prefix-config branch from 2427ac1 to f012343 Compare April 15, 2025 02:30
Copy link

@robbyt robbyt merged commit c4a2e98 into main Apr 15, 2025
5 checks passed
@robbyt robbyt deleted the rterhaar/ctx-prefix-config branch April 15, 2025 02:32
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.

1 participant