7 Commits

Author SHA1 Message Date
Summy Wu b3f7c2cb30 debug: allow configuring variable value length limit (#8907)
### Why are the changes in this PR needed?

The DAP debugger currently truncates variable values to a hardcoded
limit of 100 characters, with no way for callers to configure it.
Long values cannot be inspected or copied whole from a debugger UI.

### What are the changes in this PR?

- Add a new `SetMaxVariableLength` Debugger option (in both
  `v1/debug` and the top-level `debug` package)
- A value of 0 disables truncation; the default stays 100 characters
  for backward compatibility
- Plumb the limit through `variableManager` and `namedVar`, so it
  applies to top-level and nested (object/array/set) variables alike
- Relax `truncatedString` to return the original string unchanged
  when the limit is <= 0
- Add `TestTruncatedString` and `TestVariableValueLengthLimit`
  covering the default limit, unlimited (0), negative, custom limits,
  and boundary cases

### Notes

- `go build ./...` and `go test ./v1/debug/...` both pass
- Default behavior is unchanged; the new option is opt-in
- This PR was developed with AI assistance (Claude Code)

### Further comments

Refs #8890

---------

Signed-off-by: summy wu <summy.wu81@gmail.com>
2026-07-31 09:36:34 -05:00
Johan Fylling a179a24c48 v1 API
All packages, except for `cmd` and `internal`, have been moved into a new `v1` root package.

Old packages are kept for backwards-compatibility reasons. All contained code is replaced with simple type aliases and proxy functions to `v1` implementations.

Old packages default to the Rego v0 syntax, new `v1` packages default to the Rego v1 syntax.

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2024-12-12 15:27:34 +01:00
Johan Fylling 7bb6dbe36b Preparing for v1 API
Moving (most) source to v1 root package to prepare for v0/v1 API separation.

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2024-12-12 15:09:03 +01:00
Anders Eknert 270f31f6af Avoid copying loop vars (Go 1.22+) (#7191)
This isn't needed anymore, so now we don't.
Also enabled the copyloopvar linter in case we
accidentally do this in the future.

Signed-off-by: Anders Eknert <anders@styra.com>
2024-11-24 20:51:38 +01:00
Anders Eknert f6103df603 Debugger: allow YAML to be used as input (#7178)
* Debugger: allow YAML to be used as input

By using the unmarshal function from util instead of the stdlib

Signed-off-by: Anders Eknert <anders@styra.com>

* Adding test

Signed-off-by: Johan Fylling <johan.dev@fylling.se>

---------

Signed-off-by: Anders Eknert <anders@styra.com>
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
Co-authored-by: Johan Fylling <johan.dev@fylling.se>
2024-11-19 15:50:17 +01:00
Johan Fylling 09c1bdfc7c debug: Configurable rego-options on debugger (#7053)
* debug: Configurable rego-options on debugger

Adding `RegoOption` launch option to debugger for setting custom rego options.

Fixes: #7045
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2024-09-23 16:45:05 +02:00
Johan Fylling 3ac5104087 debug: Adding debugger SDK (#6877)
This is an experimental feature, subject to change.

Fixes: #6876

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2024-08-28 20:26:52 +02:00