fix(#2247): compare managed content below sentinel as text - #6208
fix(#2247): compare managed content below sentinel as text#6208fullsend-ai-coder[bot] wants to merge 1 commit into
Conversation
The shim drift comparison in reconcile-repos.sh compared base64- encoded managed content that included the sentinel line itself. When the .fullsend repo template predated the sentinel addition but deployed shims already contained the sentinel (e.g. from a scaffold deploy), the sentinel line caused a structural mismatch against the full template content — producing a false-positive "stale" detection and a bogus update PR that stripped the sentinel (PR #2101). Replace managed_content_b64 with managed_content_text, which extracts content BELOW the sentinel (excluding the sentinel line) and returns plain text instead of base64. This lets the comparison work correctly whether or not either side has the sentinel/--- prefix. Command substitution normalizes trailing newlines on both sides. Add regression test (test 5) that reproduces the exact scenario: template without sentinel vs remote with sentinel and matching managed content — must not be flagged as stale. Note: pre-commit could not run in the sandbox due to network restrictions (git fetch origin --tags blocked). The post-script runs pre-commit authoritatively on the runner. Closes #2247
|
🤖 Finished Review · ✅ Success · Started 8:27 PM UTC · Completed 8:40 PM UTC Commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ReviewFindingsLow
Labels: PR fixes a bug in the scaffold enrollment reconciliation script (shell scripts under internal/scaffold/) Previous runReviewFindingsLow
Labels: PR fixes a bug in the scaffold enrollment reconciliation script |
|
/fs-review |
|
🤖 Finished Review · ✅ Success · Started 1:47 PM UTC · Completed 1:59 PM UTC Commit: |
There was a problem hiding this comment.
Note: The following inline comments could not be posted on the diff (GitHub returned 422) and are included here instead:
internal/scaffold/fullsend-repo/scripts/reconcile-repos.sh(file-level): Line 84 · [low] dead code
The extract_managed_content function no longer has any callers after this PR. Its only caller was managed_content_b64, which is replaced by managed_content_text using inline awk. The function definition and its comment (lines 81-89) remain in the file but are unreachable.
Suggested fix: Remove the extract_managed_content function (lines 81-89) to avoid confusion.
internal/scaffold/fullsend-repo/scripts/reconcile-repos.sh:158: [low] edge-case
When the sentinel is the very last line of the file (no content below it), the awk script finds the sentinel and sets found=1 but prints nothing. The below variable is therefore empty, and the function falls through to the else branch, returning the entire decoded content including the sentinel and any --- prefix. Meanwhile the template side (which may lack the sentinel) would return its full raw content. This causes a comparison mismatch and a false-positive stale detection for this edge case. In practice this scenario does not occur — deployed shims always have managed content below the sentinel — so the risk is theoretical.
internal/scaffold/fullsend-repo/scripts/reconcile-repos.sh:150: [low] comment-formatting
Double spaces after periods in comments (lines 150, 156, 414). The rest of the file consistently uses single space between sentences.
Suggested fix: Change double spaces to single spaces: 'comparison. The' (line 150), 'template). Trailing' (line 156), 'drift. Text' (line 414)
Summary
Fix false-positive shim drift detection in
reconcile-repos.shthat caused bogus update PRs (e.g., PR #2101) which stripped the sentinel and---lines from deployed shims.Changes
managed_content_b64()withmanaged_content_text()in the comparison logic. The new function extracts content below the sentinel line (excluding the sentinel itself) and returns plain text instead of base64. This prevents false-positive drift when one side has the sentinel/---prefix and the other doesn't.Root cause
When the
.fullsendrepo template predated the sentinel addition but deployed shims already included the sentinel (e.g., from a scaffold deploy), the oldmanaged_content_b64()function included the sentinel line in the extracted content on the remote side but returned the full template (without sentinel) on the expected side. This structural mismatch triggered a "stale" detection even though the actual managed content was identical.Testing
make lintcould not run due to sandbox network restrictions; post-script handles this authoritativelyCloses #2247
Post-script verification
agent/2247-fix-reconcile-comparison)8f8848417b246a8e2a84a39cb9d0a40290411589..HEAD)