fix(scaffold): preserve user-added headers across shim reconciliation#1779
fix(scaffold): preserve user-added headers across shim reconciliation#1779waynesun09 wants to merge 1 commit into
Conversation
Site previewPreview: https://0a0b1232-site.fullsend-ai.workers.dev Commit: |
aef817f to
8366f0d
Compare
ReviewFindingsLow
Info
Previous runReviewFindingsLow
Info
Previous run (2)ReviewFindingsMedium
Low
Info
|
8366f0d to
ef689c3
Compare
| local header | ||
| header=$(printf '%s\n' "$remote_raw" | extract_user_header) | ||
|
|
||
| # Only preserve headers that are pure comments/blanks — reject non-comment |
There was a problem hiding this comment.
[info] content-injection
Prior medium-severity content-injection finding remediated. shim_with_header_b64 now validates all header lines match ^(#|$), discarding non-comment content. Fix is correct and sufficient.
The reconcile script compared and replaced the shim workflow file
wholesale, stripping any content users added (e.g. license headers
required by their CI). This caused repos like conforma/policy to fail
lint checks after each shim update.
Add a sentinel comment ("# --- fullsend managed below - do not edit ---")
to the shim template. The reconcile script now:
- Compares only the managed portion (from sentinel onward) for drift
- Preserves any user content above the sentinel when writing updates
- Falls back to full-file comparison for pre-sentinel shims
Signed-off-by: Wayne Sun <gsun@redhat.com>
ef689c3 to
87166e6
Compare
|
I think the easier fix for this was adding our own license header, as this file is produced by fullsend and should be kept to fullsend license. I don't think this feature is really useful for users. |
Problem
The reconcile script compared and replaced the shim workflow file wholesale, stripping any content users added above the template (e.g. license headers required by their repo CI). This caused repos like conforma/policy to fail
addlicenselint checks after each shim update (CI run).Solution
Add a sentinel comment
# --- fullsend managed below - do not edit ---to the top of the shim template. The reconcile script now:Changes
templates/shim-workflow-call.yaml— added sentinel line at topscripts/reconcile-repos.sh— addedSENTINELconstant, 4 helper functions (extract_managed_content,extract_user_header,shim_with_header_b64,managed_content_b64), updated drift detection and write pathscripts/reconcile-repos-test.sh— fixed base64 mock to not strip newlines during decode, added blob content capture, added 2 new test cases (header preservation on stale update, no false drift on up-to-date shim with header)Test plan
bash internal/scaffold/fullsend-repo/scripts/reconcile-repos-test.sh # Expected: PASS x3Related