Handle missing group param in version routes and align branch files with RuboCop#2
Merged
makaiver merged 2 commits intoMay 27, 2026
Conversation
Copilot
AI
changed the title
[WIP] Fix NoMethodError for nil group param in webapp
Handle missing May 27, 2026
group param in version routes and align branch files with RuboCop
makaiver
approved these changes
May 27, 2026
makaiver
marked this pull request as ready for review
May 27, 2026 17:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/node/version/viewand/node/version/diffscould raise whengroup=was omitted because downstream code expected a string-like value. This change set hardens group handling for those routes and cleans up style offenses in the two branch-modified files.Route input normalization (
lib/oxidized/web/webapp.rb)params[:group]to''at request parsing boundaries.nilonly when calling backend diff/version APIs that expectnilfor ungrouped nodes.@info[:group]is nevernil.Regression coverage (
spec/web/node/version_spec.rb)/node/version/viewand/node/version/diffsrequests wheregroupis absent.niltoget_diff.RuboCop compliance in changed files
spec/web/node/version_spec.rb(hash key alignment), leaving logic unchanged.Original prompt
Please run
bundle exec rubocopon thefix/nil-group-param-nomethoderrorbranch and fix any offenses in the files changed by this branch:lib/oxidized/web/webapp.rbspec/web/node/version_spec.rbThe branch fixes a
NoMethodErrorcaused byparams[:group]beingnilwhen thegroup=query param is absent from/node/version/viewand/node/version/diffsrequests.Steps:
bundle exec rubocop lib/oxidized/web/webapp.rb spec/web/node/version_spec.rbbundle exec rubocop --auto-correct lib/oxidized/web/webapp.rb spec/web/node/version_spec.rbto apply auto-correctionslib/oxidized/web/webapp.rbandspec/web/node/version_spec.rbunless rubocop requires itIf rubocop already passes with no offenses, just confirm that and make no changes.
The following is the prior conversation context from the user's chat exploration (may be truncated):
Assistant: ```dockerfile
RUN
# ── Patch oxidized-web: nil group param causes NoMethodError ──────────────
# ytti#441
# https://github.com/makaiver/oxidized-web/tree/fix/nil-group-param-nomethoderror
# Safe to remove once a fixed oxidized-web gem version is installed.
WEBAPP=$(ls "${GEM_HOME}"/gems/oxidized-web-*/lib/oxidized/web/webapp.rb 2>/dev/null || true);
if [ -z "${WEBAPP}" ]; then
echo "oxidized-web webapp.rb not found - skipping nil-group patches.";
else
if grep -q "group: params[:group]," "${WEBAPP}" 2>/dev/null; then
echo "Applying nil-group NoMethodError patch to oxidized-web...";
sed -i "s/group: params[:group],/group: (params[:group] || ''),/g" "${WEBAPP}";
echo "Patch 1/2 applied.";
else
echo "Patch 1/2 not needed (already fixed upstream or pattern changed) - skipping.";
fi;
if grep -q "nodes.get_diff node, @info[:group]" "${WEBAPP}" 2>/dev/null; then
echo "Applying get_diff nil-group patch to oxidized-web...";
sed -i "s/nodes.get_diff node, @info[:group]/nodes.get_diff node, (@info[:group].empty? ? nil : @info[:group])/g" "${WEBAPP}";
echo "Patch 2/2 applied.";
else
echo "Patch 2/2 not needed (already fixed upstream or pattern changed) - skipping.";
fi;
fi
grep: "group: params[:group],"
grep: "nodes.get_diff node, @info[:group]"