Skip to content

Fix jq selectors for hyphenated dependency names#3758

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-jq-selectors-hyphens
Draft

Fix jq selectors for hyphenated dependency names#3758
Copilot wants to merge 2 commits intomainfrom
copilot/fix-jq-selectors-hyphens

Conversation

Copy link
Contributor

Copilot AI commented Feb 23, 2026

jq treats - as the subtraction operator, so .envoy-docs.repo is parsed as .envoy minus docs.repo rather than a key lookup — breaking bazel-update.sh for any dependency with a hyphenated name (e.g. envoy-docs).

Changes

  • bazel/dependency/bazel-update.sh: Quote the __DEP__ placeholder in all four default jq selectors so the expanded selector uses ."envoy-docs".repo syntax instead of .envoy-docs.repo
# Before
REPO_SELECTOR="${REPO_SELECTOR:-".__DEP__.repo"}"
# After
REPO_SELECTOR="${REPO_SELECTOR:-".\"__DEP__\".repo"}"

Quoted key syntax is fully compatible with non-hyphenated names — ."envoy".repo is equivalent to .envoy.repo.

Original prompt

Problem

The default jq selectors in bazel/dependency/bazel-update.sh fail when dependency names contain hyphens (e.g., envoy-docs).

When DEP=envoy-docs, the __DEP__ placeholder gets replaced producing jq selectors like:

.envoy-docs.repo

In jq, .envoy-docs.repo is interpreted as .envoy minus docs.repo (the - is the subtraction operator), not as a key lookup for the key "envoy-docs". This causes the following error:

jq: error: docs/0 is not defined at <top-level>, line 1:
.envoy-docs.repo       
jq: 1 compile error
Error: Process completed with exit code 3.

This is breaking the sync from envoy workflow in envoyproxy/envoy-website which calls bazel run //bazel:update envoy-docs <sha>.

Fix

In bazel/dependency/bazel-update.sh, the four default jq selectors on lines 30-41 need to quote the dependency name so jq treats it as a key lookup rather than an expression with subtraction.

Change lines 30-41 from:

REPO_SELECTOR="${REPO_SELECTOR:-".__DEP__.repo"}"
REPO_SELECTOR="${REPO_SELECTOR/__DEP__/${DEP}}"
REPO="$("${JQ}" -r "${REPO_SELECTOR}" "${DEP_DATA}")"
SHA_SELECTOR="${SHA_SELECTOR:-".__DEP__.sha256"}"
SHA_SELECTOR="${SHA_SELECTOR/__DEP__/${DEP}}"
EXISTING_SHA="$("${JQ}" -r "${SHA_SELECTOR}" "${DEP_DATA}")"
VERSION_SELECTOR="${VERSION_SELECTOR:-".__DEP__.version"}"
VERSION_SELECTOR="${VERSION_SELECTOR/__DEP__/${DEP}}"
EXISTING_VERSION="$("${JQ}" -r "${VERSION_SELECTOR}" "${DEP_DATA}")"
URL_SELECTOR="${URL_SELECTOR:-".__DEP__.urls[0]"}"
URL_SELECTOR="${URL_SELECTOR/__DEP__/${DEP}}"
URL="$(${JQ} -r "${URL_SELECTOR}" "${DEP_DATA}")"

To:

REPO_SELECTOR="${REPO_SELECTOR:-".\"__DEP__\".repo"}"
REPO_SELECTOR="${REPO_SELECTOR/__DEP__/${DEP}}"
REPO="$("${JQ}" -r "${REPO_SELECTOR}" "${DEP_DATA}")"
SHA_SELECTOR="${SHA_SELECTOR:-".\"__DEP__\".sha256"}"
SHA_SELECTOR="${SHA_SELECTOR/__DEP__/${DEP}}"
EXISTING_SHA="$("${JQ}" -r "${SHA_SELECTOR}" "${DEP_DATA}")"
VERSION_SELECTOR="${VERSION_SELECTOR:-".\"__DEP__\".version"}"
VERSION_SELECTOR="${VERSION_SELECTOR/__DEP__/${DEP}}"
EXISTING_VERSION="$("${JQ}" -r "${VERSION_SELECTOR}" "${DEP_DATA}")"
URL_SELECTOR="${URL_SELECTOR:-".\"__DEP__\".urls[0]"}"
URL_SELECTOR="${URL_SELECTOR/__DEP__/${DEP}}"
URL="$(${JQ} -r "${URL_SELECTOR}" "${DEP_DATA}")"

This way, when DEP=envoy-docs, the selectors become ."envoy-docs".repo, ."envoy-docs".sha256, etc., which jq correctly interprets as quoted key lookups. This is also safe for non-hyphenated names — ."envoy".repo works identically to .envoy.repo.

The file to edit is: bazel/dependency/bazel-update.sh

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@netlify
Copy link

netlify bot commented Feb 23, 2026

Deploy Preview for nifty-bassi-e26446 ready!

Name Link
🔨 Latest commit 488adac
🔍 Latest deploy log https://app.netlify.com/projects/nifty-bassi-e26446/deploys/699c3009f8b04f000869199b
😎 Deploy Preview https://deploy-preview-3758--nifty-bassi-e26446.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix jq selectors for dependencies with hyphens Fix jq selectors for hyphenated dependency names Feb 23, 2026
Copilot AI requested a review from phlax February 23, 2026 10:47
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