Skip to content

fix(#2247): compare decoded text in shim drift detection#9

Closed
guyoron1 wants to merge 10 commits into
mainfrom
fix/shim-drift-comparison
Closed

fix(#2247): compare decoded text in shim drift detection#9
guyoron1 wants to merge 10 commits into
mainfrom
fix/shim-drift-comparison

Conversation

@guyoron1

@guyoron1 guyoron1 commented Jun 15, 2026

Copy link
Copy Markdown
Owner

The stale-shim comparison in reconcile-repos.sh used managed_content_b64() which decoded base64, extracted managed content, then re-encoded to base64. Bash command substitution strips trailing newlines, so the re-encoded base64 could differ from the original even when the decoded text was identical. This caused false-positive drift detection, leading to bogus update PRs (e.g. PR fullsend-ai#2101) that removed the sentinel lines.

Replace the base64-to-base64 comparison with decoded text comparison: decode both sides, strip carriage returns, and compare the resulting strings directly.

Mirrors upstream fullsend-ai#2254.


Closes fullsend-ai#2247

Base64 encoding can differ between implementations (line wrapping,
padding). Compare decoded text instead to avoid false-positive
stale shim updates.

Mirrors upstream fullsend-ai#2254.
@fullsend-ai-review

fullsend-ai-review Bot commented Jun 15, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 11:23 AM UTC · Completed 11:30 AM UTC
Commit: 4365b3d · View workflow run →

@fullsend-ai-review

fullsend-ai-review Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review

Reason: stale-head

The review agent reviewed commit efb61c2bf0734e1149b9aeca8886f1f3f1619243 but the PR HEAD is now e4a5199faedb72e1784d11e1b6279887f1594cbf. This review was discarded to avoid approving unreviewed code.

Previous run

Review

Reason: stale-head

The review agent reviewed commit d4ded43ab0edfdd574693c5718bac42e9e047e62 but the PR HEAD is now efb61c2bf0734e1149b9aeca8886f1f3f1619243. This review was discarded to avoid approving unreviewed code.

Previous run (2)

Review

Reason: stale-head

The review agent reviewed commit f5f56fdde7aa8df14572334ecf0afbc67005ffa6 but the PR HEAD is now d4ded43ab0edfdd574693c5718bac42e9e047e62. This review was discarded to avoid approving unreviewed code.

Previous run (3)

Review

Findings

Critical

  • [logic-error] internal/scaffold/fullsend-repo/scripts/reconcile-repos.sh:276 — The diff renames EXPECTED_B64 to EXPECTED_TEXT (decoded plaintext) in the comparison block, but the subsequent call to write_shim_to_branch_from_default on line 276 still references $EXPECTED_B64. Since the script runs with set -u (line 13: set -euo pipefail), this will trigger an "unbound variable" error and abort the script whenever a repo has a stale shim. Additionally, even if the variable were renamed to $EXPECTED_TEXT, it would pass decoded plaintext to a function that sends it to the GitHub blobs API with encoding: "base64" (line 175), corrupting the blob content.
    Remediation: Add a separate variable for the base64 content needed by the API call. For example, before the write_shim_to_branch_from_default call, add: EXPECTED_B64=$(shim_content_b64). Then pass $EXPECTED_B64 to write_shim_to_branch_from_default. Alternatively, call $(shim_content_b64) inline. Do NOT pass $EXPECTED_TEXT (decoded plaintext) to this function.

Low

  • [edge-case] internal/scaffold/fullsend-repo/scripts/reconcile-repos.sh:265 — The new approach pipes GitHub's base64 content through base64 -d and compares the decoded text using shell string comparison. If the YAML template ever contains NUL bytes or trailing newlines that differ between implementations, the shell comparison may silently truncate or mangle content. In practice this is very unlikely for YAML workflow files, but the original base64-level comparison was immune to this class of issue.

Info

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See the review comment for full details.

if [ "$REMOTE_B64" = "$EXPECTED_B64" ]; then
# File exists — compare decoded text to avoid base64 encoding differences.
EXPECTED_TEXT=$(shim_content_b64 | base64 -d)
REMOTE_TEXT=$(printf '%s' "$REMOTE_CONTENT" | base64 -d)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] edge-case

The new approach pipes GitHub's base64 content through base64 -d and compares the decoded text using shell string comparison. If the YAML template ever contains NUL bytes or trailing newlines that differ between implementations, the shell comparison may silently truncate or mangle content. In practice this is very unlikely for YAML workflow files.

@guyoron1

Copy link
Copy Markdown
Owner Author

/fs quality

@fullsend-ai-review

fullsend-ai-review Bot commented Jun 15, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 11:41 AM UTC · Completed 11:52 AM UTC
Commit: 4365b3d · View workflow run →

@fullsend-ai-review

Copy link
Copy Markdown

/fs-review

@fullsend-ai-review

fullsend-ai-review Bot commented Jun 15, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 11:53 AM UTC · Completed 12:04 PM UTC
Commit: 4365b3d · View workflow run →

@fullsend-ai-review

Copy link
Copy Markdown

/fs-review

@fullsend-ai-review

fullsend-ai-review Bot commented Jun 15, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 12:06 PM UTC · Completed 12:18 PM UTC
Commit: 4365b3d · View workflow run →

@fullsend-ai-review

Copy link
Copy Markdown

/fs-review

@github-actions

Copy link
Copy Markdown

QualityFlow Pipeline Summary

Stage Agent Status
1 STP Builder
2 STP Reviewer
3 STP Refiner
4 STD Builder
5 STD Reviewer
6 STD Refiner
7 Test Generator

Test Output

Language Count Location
Go 8 files qf-tests/GH-2247/go/

Issue: GH-2247


Generated by QualityFlow

@guyoron1

Copy link
Copy Markdown
Owner Author

Closing — QF infrastructure updated on main, will re-create with improved pipeline.

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.

reconcile-repos.sh produces shim blob without sentinel, creating bogus update PR

1 participant