Skip to content

feat(lsp): pin gopls and pyright versions in build toolchain (ACM-34129)#8

Open
jnpacker wants to merge 2 commits into
mainfrom
ACM-34129
Open

feat(lsp): pin gopls and pyright versions in build toolchain (ACM-34129)#8
jnpacker wants to merge 2 commits into
mainfrom
ACM-34129

Conversation

@jnpacker
Copy link
Copy Markdown
Member

@jnpacker jnpacker commented May 16, 2026

Summary

  • Pin gopls to v0.21.1 and pyright to 1.1.409 via GOPLS_VERSION/PYRIGHT_VERSION Containerfile ARGs, making LSP versions reproducible and consistent with all other dependency pins in the build toolchain
  • Propagate both versions through Makefile variables and scripts/build.sh --build-arg flags so they can be overridden at build time
  • Extend make update-deps to auto-fetch latest gopls (from GitHub golang/tools releases) and pyright (from PyPI) alongside all other dependencies
  • Fix plans/INDEX.md session entry separators from # ── headings to --- thematic breaks

Jira: https://redhat.atlassian.net/browse/ACM-34129

Follow-up to #7 (ACM-34104) which added LSP support with unpinned versions.

Summary by CodeRabbit

  • Chores

    • Language Server Protocol versions (gopls and pyright) are now explicitly pinned in the build system instead of using latest versions, ensuring reproducible builds across environments.
  • Tests

    • Added comprehensive tests to validate that LSP version pinning is correctly configured throughout the build toolchain.

Add GOPLS_VERSION and PYRIGHT_VERSION ARGs to Containerfile.agents with
pinned defaults (gopls 0.21.1, pyright 1.1.409). Propagate through Makefile
variables and build.sh --build-arg flags. Extend update-deps target to
auto-fetch latest gopls release from GitHub and pyright from PyPI.
Fix plans/INDEX.md session separators from heading to thematic break.
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 16, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jnpacker

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

📝 Walkthrough

Walkthrough

This PR introduces LSP version pinning for gopls and pyright across the build system. Version variables are declared in the Makefile, propagated as container build arguments through the Containerfile, and installed with specific pinned versions. The Makefile's update-deps target automates fetching latest versions, and a new test script validates the entire integration.

Changes

LSP Version Pinning and Build Integration

Layer / File(s) Summary
Version Contract and Containerfile Setup
Makefile, containerfiles/Containerfile.agents
Makefile defines GOPLS_VERSION (0.21.1) and PYRIGHT_VERSION (1.1.409) variables. Containerfile declares matching build arguments at the global and stage level. Installation commands replace unpinned latest references with pinned versions using variable substitution.
Build Pipeline Integration
Makefile, scripts/build.sh
Makefile build recipe passes version variables as environment variables into the build script, which forwards them as --build-arg parameters to the container build invocation.
Automated Version Update Tooling
Makefile
The update-deps target fetches the latest gopls and pyright versions from upstream, reports them alongside other dependency versions, and uses sed to update the pinned version assignments in the Makefile.
Comprehensive System Validation
tests/test_lsp_version_pinning.sh
New test script validates that build arguments are declared and properly wired in the Containerfile, confirms version variables exist in the Makefile and are passed through build.sh, verifies update-deps fetches and updates versions correctly, ensures build args use environment-variable substitution, and validates index.md formatting compliance.
Documentation and Planning Updates
plans/INDEX.md
Removes decorative separator lines from the sessions list and adds a new 2026-05-16 entry documenting the LSP version pinning feature with associated Jira and PR references.

🎯 2 (Simple) | ⏱️ ~12 minutes

🐰 A pinned version here, a pinned version there,
No more unpinned LSPs floating in the air!
From Makefile to container with automated care,
The build stays solid, stable, and fair.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: pinning gopls and pyright LSP versions in the build toolchain, with clear scope and JIRA reference.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ACM-34129

Comment @coderabbitai help to get the list of available commands and usage tips.

@jnpacker
Copy link
Copy Markdown
Member Author

Implementation Summary

What changed

containerfiles/Containerfile.agents

  • Added ARG GOPLS_VERSION=0.21.1 and ARG PYRIGHT_VERSION=1.1.409 at the top-level ARG block alongside all other dependency versions
  • Re-declared both in the base-runtimes stage (required by Docker multi-stage ARG scoping rules)
  • Changed gopls@latestgopls@v${GOPLS_VERSION} in the go install command
  • Changed pip install pyrightpip install pyright==${PYRIGHT_VERSION} to pin the version

Makefile

  • Added GOPLS_VERSION ?= 0.21.1 and PYRIGHT_VERSION ?= 1.1.409 to the toolchain versions block
  • Extended the build-<img> rule env prefix to include GOPLS_VERSION=$(GOPLS_VERSION) PYRIGHT_VERSION=$(PYRIGHT_VERSION)
  • Extended update-deps with two new eval lines that fetch latest gopls from api.github.com/repos/golang/tools/releases and latest pyright from pypi.org/pypi/pyright/json
  • Added corresponding sed -i update lines for both new version variables

scripts/build.sh

  • Added --build-arg GOPLS_VERSION="${GOPLS_VERSION:-0.21.1}" and --build-arg PYRIGHT_VERSION="${PYRIGHT_VERSION:-1.1.409}" to the podman build invocation, with fallback defaults matching Makefile

plans/INDEX.md

  • Replaced all # ────────────────────────────────────────────────────────── headings with --- thematic breaks (lint fix)
  • Added session entry for ACM-34129

tests/test_lsp_version_pinning.sh (new)

  • 21 assertions verifying the full wiring: ARG declarations, stage re-declarations, install command references, Makefile variables, build.sh flags, update-deps fetch/update, and INDEX.md separator hygiene

Tests added

tests/test_lsp_version_pinning.sh — 21 assertions covering:

  • Containerfile ARG declarations and defaults
  • ARG re-declarations in base-runtimes stage
  • gopls and pyright install commands reference the version variables
  • Makefile variable declarations and build target propagation
  • update-deps fetches and sed-updates both versions
  • build.sh passes both as --build-arg with fallback defaults
  • plans/INDEX.md uses --- separators (no # ── headings)

Known gaps

  • No actual container build verification (requires podman + network access to pull base image)
  • The gopls version fetch in update-deps uses the golang/tools GitHub releases API filtered by startswith("gopls/") — this is the correct canonical source but depends on the release naming convention remaining stable

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/test_lsp_version_pinning.sh`:
- Around line 184-189: The test currently treats a missing plans/INDEX.md as a
pass because grep's non-zero exit is handled by the else branch; update the
check to fail fast if the file is missing by first testing the INDEX variable
with something like [ -f "$INDEX" ] || fail "plans/INDEX.md is missing", then
run the existing grep check (if grep -qP '^# ──' "$INDEX"; then fail
"plans/INDEX.md still contains # ── heading separators (should use ---)"; else
pass ...; fi). Reference INDEX and the grep invocation to locate where to add
the existence check and use the existing fail/pass functions.
- Around line 165-175: The test currently looks for occurrences like
GOPLS_VERSION="${GOPLS_VERSION which can pass even when the default-fallback
operator ':-' is missing; update the two grep checks in
tests/test_lsp_version_pinning.sh to match the explicit fallback form (search
for '\${GOPLS_VERSION:-' and '\${PYRIGHT_VERSION:-' respectively) and keep the
pass/fail messages, so the if blocks that reference BUILD_SH assert the presence
of the ':-' default operator in the build-arg lines.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: d4a5db66-19f3-4e14-829a-4b52852cf6a3

📥 Commits

Reviewing files that changed from the base of the PR and between 75b4267 and 0987d55.

📒 Files selected for processing (5)
  • Makefile
  • containerfiles/Containerfile.agents
  • plans/INDEX.md
  • scripts/build.sh
  • tests/test_lsp_version_pinning.sh

Comment on lines +165 to +175
if grep -q 'build-arg GOPLS_VERSION="${GOPLS_VERSION' "$BUILD_SH"; then
pass "--build-arg GOPLS_VERSION uses \${GOPLS_VERSION:-...} in build.sh"
else
fail "--build-arg GOPLS_VERSION does not use \${GOPLS_VERSION:-...} in build.sh"
fi

if grep -q 'build-arg PYRIGHT_VERSION="${PYRIGHT_VERSION' "$BUILD_SH"; then
pass "--build-arg PYRIGHT_VERSION uses \${PYRIGHT_VERSION:-...} in build.sh"
else
fail "--build-arg PYRIGHT_VERSION does not use \${PYRIGHT_VERSION:-...} in build.sh"
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Strengthen fallback-default assertions for build args.

Line 165 and Line 171 currently pass even if :-default is removed, so this can miss regressions in defaulting behavior.

Suggested test hardening
-if grep -q 'build-arg GOPLS_VERSION="${GOPLS_VERSION' "$BUILD_SH"; then
+if grep -qP 'build-arg GOPLS_VERSION="\$\{GOPLS_VERSION:-[^"]+\}"' "$BUILD_SH"; then
     pass "--build-arg GOPLS_VERSION uses \${GOPLS_VERSION:-...} in build.sh"
 else
     fail "--build-arg GOPLS_VERSION does not use \${GOPLS_VERSION:-...} in build.sh"
 fi
 
-if grep -q 'build-arg PYRIGHT_VERSION="${PYRIGHT_VERSION' "$BUILD_SH"; then
+if grep -qP 'build-arg PYRIGHT_VERSION="\$\{PYRIGHT_VERSION:-[^"]+\}"' "$BUILD_SH"; then
     pass "--build-arg PYRIGHT_VERSION uses \${PYRIGHT_VERSION:-...} in build.sh"
 else
     fail "--build-arg PYRIGHT_VERSION does not use \${PYRIGHT_VERSION:-...} in build.sh"
 fi
🧰 Tools
🪛 Shellcheck (0.11.0)

[info] 165-165: Expressions don't expand in single quotes, use double quotes for that.

(SC2016)


[info] 171-171: Expressions don't expand in single quotes, use double quotes for that.

(SC2016)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_lsp_version_pinning.sh` around lines 165 - 175, The test currently
looks for occurrences like GOPLS_VERSION="${GOPLS_VERSION which can pass even
when the default-fallback operator ':-' is missing; update the two grep checks
in tests/test_lsp_version_pinning.sh to match the explicit fallback form (search
for '\${GOPLS_VERSION:-' and '\${PYRIGHT_VERSION:-' respectively) and keep the
pass/fail messages, so the if blocks that reference BUILD_SH assert the presence
of the ':-' default operator in the build-arg lines.

Comment on lines +184 to +189
INDEX="${REPO_ROOT}/plans/INDEX.md"
if grep -qP '^# ──' "$INDEX"; then
fail "plans/INDEX.md still contains # ── heading separators (should use ---)"
else
pass "plans/INDEX.md uses --- separators (no # ── headings)"
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fail fast when plans/INDEX.md is missing.

Line 185 treats any non-zero grep result as success in the else branch; if the file is missing, this test incorrectly reports PASS.

Suggested fix
 INDEX="${REPO_ROOT}/plans/INDEX.md"
-if grep -qP '^# ──' "$INDEX"; then
+if [[ ! -f "$INDEX" ]]; then
+    fail "plans/INDEX.md not found"
+elif grep -qP '^# ──' "$INDEX"; then
     fail "plans/INDEX.md still contains # ── heading separators (should use ---)"
 else
     pass "plans/INDEX.md uses --- separators (no # ── headings)"
 fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
INDEX="${REPO_ROOT}/plans/INDEX.md"
if grep -qP '^# ──' "$INDEX"; then
fail "plans/INDEX.md still contains # ── heading separators (should use ---)"
else
pass "plans/INDEX.md uses --- separators (no # ── headings)"
fi
INDEX="${REPO_ROOT}/plans/INDEX.md"
if [[ ! -f "$INDEX" ]]; then
fail "plans/INDEX.md not found"
elif grep -qP '^# ──' "$INDEX"; then
fail "plans/INDEX.md still contains # ── heading separators (should use ---)"
else
pass "plans/INDEX.md uses --- separators (no # ── headings)"
fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_lsp_version_pinning.sh` around lines 184 - 189, The test currently
treats a missing plans/INDEX.md as a pass because grep's non-zero exit is
handled by the else branch; update the check to fail fast if the file is missing
by first testing the INDEX variable with something like [ -f "$INDEX" ] || fail
"plans/INDEX.md is missing", then run the existing grep check (if grep -qP '^#
──' "$INDEX"; then fail "plans/INDEX.md still contains # ── heading separators
(should use ---)"; else pass ...; fi). Reference INDEX and the grep invocation
to locate where to add the existence check and use the existing fail/pass
functions.

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