Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .coderabbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ reviews:
collapse_walkthrough: false
profile: "chill"
high_level_summary: true
request_changes_workflow: true
request_changes_workflow: false
poem: false
in_progress_fortune: false
sequence_diagrams: false
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/lychee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,16 @@ jobs:
echo "</details>" >> lychee/formatted.md

# Hard truncate as a final guardrail for sticky PR comments
python - <<'PY'
python -c "
from pathlib import Path
p = Path("lychee/formatted.md")
p = Path('lychee/formatted.md')
if p.exists():
max_chars = 60000
text = p.read_text(encoding="utf-8")
text = p.read_text(encoding='utf-8')
if len(text) > max_chars:
note = "\n\n_Comment truncated to avoid GitHub body limit. Download the artifact for full details._\n"
p.write_text(text[: max_chars - len(note)] + note, encoding="utf-8")
PY
note = '\n\n_Comment truncated to avoid GitHub body limit. Download the artifact for full details._\n'
p.write_text(text[:max_chars - len(note)] + note, encoding='utf-8')
"
Comment on lines +162 to +171
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set +e
python3 -c "
            from pathlib import Path
            p = Path('lychee/formatted.md')
            if p.exists():
              max_chars = 60000
              text = p.read_text(encoding='utf-8')
              if len(text) > max_chars:
                note = '\n\n_Comment truncated to avoid GitHub body limit. Download the artifact for full details._\n'
                p.write_text(text[:max_chars - len(note)] + note, encoding='utf-8')
"
status=$?
printf 'python3 exit code: %s\n' "$status"

Repository: prisma/web

Length of output: 182


🏁 Script executed:

# Check the actual file content at the specified lines
head -n 171 .github/workflows/lychee.yml | tail -n 15

Repository: prisma/web

Length of output: 761


🏁 Script executed:

# Test the proposed heredoc fix to ensure it works correctly
python3 - <<'PY'
from pathlib import Path

p = Path('lychee/formatted.md')
if p.exists():
    max_chars = 60000
    text = p.read_text(encoding='utf-8')
    if len(text) > max_chars:
        note = '\n\n_Comment truncated to avoid GitHub body limit. Download the artifact for full details._\n'
        p.write_text(text[:max_chars - len(note)] + note, encoding='utf-8')
PY
echo "Exit code: $?"

Repository: prisma/web

Length of output: 66


Fix the Python indentation error that breaks the comment truncation step.

The python -c script at lines 162–171 has leading whitespace from YAML indentation that becomes part of the Python source code. When Python executes it, the first statement (from pathlib import Path) raises IndentationError: unexpected indent, causing the cleanup step to fail and preventing the automatic truncation safeguard from running.

Switch to a here-document to avoid this issue:

Fix
-            python -c "
-            from pathlib import Path
-            p = Path('lychee/formatted.md')
-            if p.exists():
-              max_chars = 60000
-              text = p.read_text(encoding='utf-8')
-              if len(text) > max_chars:
-                note = '\n\n_Comment truncated to avoid GitHub body limit. Download the artifact for full details._\n'
-                p.write_text(text[:max_chars - len(note)] + note, encoding='utf-8')
-            "
+            python - <<'PY'
+from pathlib import Path
+
+p = Path('lychee/formatted.md')
+if p.exists():
+    max_chars = 60000
+    text = p.read_text(encoding='utf-8')
+    if len(text) > max_chars:
+        note = '\n\n_Comment truncated to avoid GitHub body limit. Download the artifact for full details._\n'
+        p.write_text(text[:max_chars - len(note)] + note, encoding='utf-8')
+PY
📝 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
python -c "
from pathlib import Path
p = Path("lychee/formatted.md")
p = Path('lychee/formatted.md')
if p.exists():
max_chars = 60000
text = p.read_text(encoding="utf-8")
text = p.read_text(encoding='utf-8')
if len(text) > max_chars:
note = "\n\n_Comment truncated to avoid GitHub body limit. Download the artifact for full details._\n"
p.write_text(text[: max_chars - len(note)] + note, encoding="utf-8")
PY
note = '\n\n_Comment truncated to avoid GitHub body limit. Download the artifact for full details._\n'
p.write_text(text[:max_chars - len(note)] + note, encoding='utf-8')
"
python - <<'PY'
from pathlib import Path
p = Path('lychee/formatted.md')
if p.exists():
max_chars = 60000
text = p.read_text(encoding='utf-8')
if len(text) > max_chars:
note = '\n\n_Comment truncated to avoid GitHub body limit. Download the artifact for full details._\n'
p.write_text(text[:max_chars - len(note)] + note, encoding='utf-8')
PY
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/lychee.yml around lines 162 - 171, The python -c block
fails due to YAML indentation being included in the inline Python string;
replace the inline "python -c" invocation with a here-document (heredoc) so the
Python source (starting with "from pathlib import Path") is passed verbatim;
keep the same logic using Path('lychee/formatted.md'), p.read_text,
p.write_text, max_chars and note, and ensure the heredoc delimiter is quoted to
prevent shell interpolation so the truncation logic runs without
IndentationError.

else
# Ensure sticky PR comment always has content even if Lychee output is missing
cat > lychee/formatted.md <<'EOF'
Expand Down
Loading