Skip to content

Fix silent comit for the rebasebot.#7

Open
mpryc wants to merge 3 commits intooadp-devfrom
rebasebot-fix-silent-commit
Open

Fix silent comit for the rebasebot.#7
mpryc wants to merge 3 commits intooadp-devfrom
rebasebot-fix-silent-commit

Conversation

@mpryc
Copy link
Copy Markdown
Contributor

@mpryc mpryc commented Feb 18, 2026

This requires a rebasebot to support new flag:

--conflict-policy strict

Requires PR: openshift-eng/rebasebot#78

Summary by CodeRabbit

  • Chores

    • Rebase automation updated to enforce a stricter conflict policy for both local and container workflows and provide clearer per-repo reporting.
  • Bug Fixes

    • Improved handling of filenames with hidden/control characters and safer file renames to avoid lost or malformed paths.
  • User-facing Reporting

    • Aggregated pull-request results and clearer final output when processing waves, with failures surfaced only when present.

@mpryc
Copy link
Copy Markdown
Contributor Author

mpryc commented Feb 18, 2026

/hold

@kaovilai
Copy link
Copy Markdown
Contributor

@coderabbitai full review

1 similar comment
@kaovilai
Copy link
Copy Markdown
Contributor

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 19, 2026

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 19, 2026

📝 Walkthrough

Walkthrough

Modified run-oadp-rebase.sh to add --conflict-policy strict, change run_wave to run per-repo rebase funcs in non-fatal subshells while capturing outputs/exit codes and aggregating PR-result lines; updated rebasebot-hook-scripts/fix-malformed-filenames-and-commit.sh to handle Unicode via byte literals, use bash substitution and git ls-files, and ensure target dirs before git mv.

Changes

Cohort / File(s) Summary
Rebase orchestration
run-oadp-rebase.sh
Added --conflict-policy strict positioning for both run_local_rebase and run_container_rebase; reworked run_wave to execute each rebase_func in a subshell, tee combined stdout/stderr to a shared temp file, write per-repo exit codes to temp files, convert those to rebase_rc, aggregate PR-result INFO lines into a summary temp file, adjust final logging/return logic and temp-file cleanup.
Filename fix hook
rebasebot-hook-scripts/fix-malformed-filenames-and-commit.sh
Replaced printf '\u....' usage with raw UTF-8 byte literals ($'\xNN'), switched filename cleaning from sed to bash parameter substitution ${var//$CHAR/}, iterate tracked files via git ls-files -z instead of find with escapes, and ensure destination directories (mkdir -p) before git mv.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through scripts with a whiskered grin,
Tweaked flags and bytes to tidy what's within.
Temp files hum, outputs gathered neat,
Directories ready for moves so fleet.
A small rabbit's cheer for changes complete.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

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.
Title check ❓ Inconclusive The title contains a typo ('comit' instead of 'commit') and is vague about what 'silent commit' means; the actual changes involve rebase conflict handling, filename normalization, and PR result logging. Clarify the title to accurately describe the main changes, such as 'Add conflict policy support and improve rebase logging' or fix the typo and provide more specificity about what issue is being addressed.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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 rebasebot-fix-silent-commit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

This requires a rebasebot to support new flag:

--conflict-policy strict

Signed-off-by: Michal Pryc <mpryc@redhat.com>
@kaovilai kaovilai force-pushed the rebasebot-fix-silent-commit branch from b355855 to d40a047 Compare April 8, 2026 19:52
@kaovilai
Copy link
Copy Markdown
Contributor

kaovilai commented Apr 8, 2026

openshift-eng/rebasebot#85 has now been opened in-place of a rebased 78

@kaovilai
Copy link
Copy Markdown
Contributor

kaovilai commented Apr 8, 2026

85 closed due to rebased 78

kaovilai added 2 commits April 8, 2026 17:50
…or better handling of malformed unicode characters

Signed-off-by: Tiger Kaovilai <passawit.kaovilai@gmail.com>
Signed-off-by: Tiger Kaovilai <passawit.kaovilai@gmail.com>
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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
run-oadp-rebase.sh (1)

326-337: ⚠️ Potential issue | 🟡 Minor

Remove duplicate --conflict-policy strict flags from command templates.

The --conflict-policy strict option is already specified earlier in both command templates (line 327 in local mode, line 421 in container mode), then appended again at lines 336–337 and 430–431. This duplication should be cleaned up.

Suggested cleanup
-  --github-cloner-key \"$SECRETS_DIR/oadp-rebasebot-cloner-key\" \
-  --conflict-policy strict"
+  --github-cloner-key \"$SECRETS_DIR/oadp-rebasebot-cloner-key\""
-  --github-cloner-key /secrets/oadp-rebasebot-cloner-key \
-  --conflict-policy strict"
+  --github-cloner-key /secrets/oadp-rebasebot-cloner-key"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@run-oadp-rebase.sh` around lines 326 - 337, The CMD command template includes
a duplicated flag "--conflict-policy strict"; remove the redundant occurrence so
the CMD variable (the rebasebot command construction) only contains a single
"--conflict-policy strict" option (keep the first instance and delete the
trailing duplicate near the end of the CMD string), and apply the same cleanup
to the container-mode CMD template to ensure neither CMD for local or container
mode repeats the flag.
🧹 Nitpick comments (1)
run-oadp-rebase.sh (1)

506-508: Avoid coupling the PR summary to rebasebot's current log wording.

This grep is keyed to free-form INFO messages from another project, so a small wording or log-level change will silently empty the summary. A stable marker or machine-readable output would make this much less brittle.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@run-oadp-rebase.sh` around lines 506 - 508, The current extraction using grep
on rebase_output_file for free-form INFO lines is brittle; change the
producer/consumer to use a stable machine-readable marker (e.g., have rebasebot
emit a dedicated tag or JSON line like "REBASEBOT_PR_STATUS:" or a JSON object)
and then update the consumer here to parse that marker instead of matching human
log text; modify the rebase output generation to include that marker and replace
the grep/sed on rebase_output_file -> pr_summary_file with a deterministic
extractor that looks for the marker (with a safe fallback to legacy parsing if
needed) so pr_summary_file is not tied to informal INFO wording.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rebasebot-hook-scripts/fix-malformed-filenames-and-commit.sh`:
- Around line 37-40: Before running git mv in the branch that checks if "$file"
!= "$clean_name", add a collision guard that detects if any other tracked path
already maps to the same "$clean_name" (e.g., using git ls-files or similar) or
if "$clean_name" already exists and is not the same as "$file"; if a collision
is detected, print a clear error mentioning both conflicting paths and exit
non-zero instead of attempting git mv to avoid partial renames. Update the block
around the existing variables "file" and "clean_name" to perform this check
prior to mkdir -p and git mv, and ensure the error message is deterministic and
aborts early so the hook does not continue under set -e.

---

Outside diff comments:
In `@run-oadp-rebase.sh`:
- Around line 326-337: The CMD command template includes a duplicated flag
"--conflict-policy strict"; remove the redundant occurrence so the CMD variable
(the rebasebot command construction) only contains a single "--conflict-policy
strict" option (keep the first instance and delete the trailing duplicate near
the end of the CMD string), and apply the same cleanup to the container-mode CMD
template to ensure neither CMD for local or container mode repeats the flag.

---

Nitpick comments:
In `@run-oadp-rebase.sh`:
- Around line 506-508: The current extraction using grep on rebase_output_file
for free-form INFO lines is brittle; change the producer/consumer to use a
stable machine-readable marker (e.g., have rebasebot emit a dedicated tag or
JSON line like "REBASEBOT_PR_STATUS:" or a JSON object) and then update the
consumer here to parse that marker instead of matching human log text; modify
the rebase output generation to include that marker and replace the grep/sed on
rebase_output_file -> pr_summary_file with a deterministic extractor that looks
for the marker (with a safe fallback to legacy parsing if needed) so
pr_summary_file is not tied to informal INFO wording.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: c8b18457-1b0c-420b-983f-650c5d329e4c

📥 Commits

Reviewing files that changed from the base of the PR and between d40a047 and 8888209.

📒 Files selected for processing (2)
  • rebasebot-hook-scripts/fix-malformed-filenames-and-commit.sh
  • run-oadp-rebase.sh

Comment on lines 37 to 40
if [[ "$file" != "$clean_name" ]]; then
echo "Renaming: $file -> $clean_name"
mkdir -p "$(dirname "$clean_name")"
git mv "$file" "$clean_name"
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

Guard against normalized-name collisions before git mv.

If two tracked paths normalize to the same clean_name, Line 40 will fail and abort the hook (set -e), potentially after partial renames. Add an explicit collision check and fail with a clear message.

Suggested patch
+declare -A seen_targets=()
 while IFS= read -r -d '' file; do
     clean_name="$file"
     clean_name="${clean_name//$LRM/}"
     clean_name="${clean_name//$RLM/}"
     clean_name="${clean_name//$ZWSP/}"
     if [[ "$file" != "$clean_name" ]]; then
+        if [[ -n "${seen_targets[$clean_name]:-}" ]]; then
+            echo "Collision after normalization: '$file' -> '$clean_name'" >&2
+            exit 1
+        fi
+        if [[ -e "$clean_name" && "$file" != "$clean_name" ]]; then
+            echo "Target already exists after normalization: '$file' -> '$clean_name'" >&2
+            exit 1
+        fi
+        seen_targets["$clean_name"]=1
         echo "Renaming: $file -> $clean_name"
         mkdir -p "$(dirname "$clean_name")"
         git mv "$file" "$clean_name"
         found=1
     fi
 done < <(git ls-files -z)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rebasebot-hook-scripts/fix-malformed-filenames-and-commit.sh` around lines 37
- 40, Before running git mv in the branch that checks if "$file" !=
"$clean_name", add a collision guard that detects if any other tracked path
already maps to the same "$clean_name" (e.g., using git ls-files or similar) or
if "$clean_name" already exists and is not the same as "$file"; if a collision
is detected, print a clear error mentioning both conflicting paths and exit
non-zero instead of attempting git mv to avoid partial renames. Update the block
around the existing variables "file" and "clean_name" to perform this check
prior to mkdir -p and git mv, and ensure the error message is deterministic and
aborts early so the hook does not continue under set -e.

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