Skip to content

fix(render): E_PATH_ESCAPE suggests vendor-or-declare remediation#33

Merged
robinbraemer merged 2 commits into
mainfrom
feat/error-hint-render-debug
Apr 28, 2026
Merged

fix(render): E_PATH_ESCAPE suggests vendor-or-declare remediation#33
robinbraemer merged 2 commits into
mainfrom
feat/error-hint-render-debug

Conversation

@robinbraemer

Copy link
Copy Markdown
Member

Closes spike-1 #7. (#8 deferred — see #480.)

PathError::Escape now carries an actionable suggestion field naming both correct remediations: vendor under the Package directory, or declare in akua.toml [dependencies] and reference the resolved alias. Added a stringly-typed marker so the sandboxed render path (which collapses everything to KclEval(string)) hits the same suggestion as the in-process path.

New docs/errors/E_PATH_ESCAPE.md covers both remediations with examples.

Test plan

  • Integration test drives a Package with an escaping pkg.render path; asserts E_PATH_ESCAPE + suggestion mentioning vendor + akua.toml + the doc URL
  • Existing CLI integration tests still green

Closes spike-1 issue #7.

The path-escape error produced by the sandbox guard
(`PathError::Escape`) now carries an actionable `suggestion` field
naming both correct remediations:

  1. Vendor the dependency under the Package directory.
  2. Declare it in `akua.toml` `[dependencies]` and reference the
     resolved alias (`charts.<name>.path` for Helm; `import <alias>`
     for KCL/Akua packages).

Three pieces:

- `crates/akua-cli/src/verbs/render.rs` — refactor the path-escape
  to_structured arms to use a shared `PATH_ESCAPE_SUGGESTION` const,
  and add an `ESCAPE_MARKER` substring sniffer mirroring the existing
  `STRICT_MARKER`. The sandboxed render path collapses every plugin
  failure to `KclEval(string)`, so the typed `PathError::Escape`
  match arm only fires on the in-process path; without the marker
  the user got the generic `E_RENDER_KCL` with no remediation.

- `docs/errors/E_PATH_ESCAPE.md` — new dedicated error page covering
  the two remediations with concrete examples + cross-links to
  lockfile-format and security-model docs.

- `crates/akua-cli/tests/cli_integration.rs` — regression test
  drives a Package whose `pkg.render` argument escapes the Package
  dir, asserts E_PATH_ESCAPE on stderr with `suggestion` mentioning
  both `vendor`, `akua.toml`, and the error doc URL.

Issue #8 (`akua render --debug`) deferred to follow-up #480 — its
JSON shape depends on the eventual sentinel-mechanism resolution
(#475/#479) and shouldn't be locked in until that's settled.
…sjoint

Pin both error-message sniffers as non-overlapping so a future edit
to either can't silently misroute KCL plugin-panic messages between
E_STRICT_UNTYPED_CHART and E_PATH_ESCAPE.
@robinbraemer robinbraemer merged commit 822f87a into main Apr 28, 2026
2 checks passed
@robinbraemer robinbraemer deleted the feat/error-hint-render-debug branch April 28, 2026 11:07
robinbraemer added a commit that referenced this pull request Apr 28, 2026
…ker (#39)

`find_package_root` now accepts either `kcl.mod` (kpm-published)
or `package.k` (Akua-published) as a `KclModule` marker. Annotation
detection (`detect_package`) and filesystem detection (`detect_kind`)
already recognize `dev.akua.*` annotations + `akua.toml + package.k`
directories from PR #34; the missing piece was the cache-root
descent step that finalizes a fetched OCI artifact.

End result: `[dependencies] upstream = { oci = "...", version = "..." }`
where the artifact is an Akua-published OCI package now resolves
through to the cached directory and lands as a `KclModule` dep.

Also fixes a pre-existing test-only build break in `verbs/render.rs`
where the `args(...)` test helper was missing the `debug` field
added in PR #33.

Test plan:
- `cargo test -p akua-core --features oci-fetch --lib oci_fetcher::tests`
  — 12/12 (new: `extract_blob_unpacks_akua_published_plain_tar`)
- `cargo test --workspace --all-features` — green
- `cargo clippy --workspace --all-features` — clean
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