Skip to content

Handle byte-path Jsonnet imports to prevent apply-time provisioning failures#657

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-otterdog-repository-provisioning
Draft

Handle byte-path Jsonnet imports to prevent apply-time provisioning failures#657
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-otterdog-repository-provisioning

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 12, 2026

Otterdog could report The changes could not be applied successfully due to a Jsonnet evaluator type error (bytes passed where str was expected) during apply/provisioning, while the PR was already merged. This change removes that runtime type mismatch in the Jsonnet import callback path.

  • Root-cause fix: normalize callback inputs before path resolution

    • Updated otterdog.utils._make_jsonnet_import_callback(...) to accept str | bytes for callback args and normalize via os.fsdecode(...).
    • Ensures downstream path operations and callback return values stay string-based for rjsonnet/Python interop.
  • Regression coverage

    • Added test_jsonnet_import_callback_accepts_byte_paths in tests/test_utils.py.
    • Validates the callback works when invoked with byte-based base/rel inputs and still resolves/returns expected content.
def callback(base: str | bytes, rel: str | bytes) -> tuple[str, str | None]:
    base = os.fsdecode(base)
    rel = os.fsdecode(rel)
    candidate = rel if os.path.isabs(rel) else os.path.join(base, rel)
    ...

Copilot AI changed the title [WIP] Fix Otterdog repository provisioning error during PR merge Handle byte-path Jsonnet imports to prevent apply-time provisioning failures May 12, 2026
Copilot AI requested a review from mbarbero May 12, 2026 12:37
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.

Otterdog failed to provision repository with some weird python error and merged the PR

2 participants