Repository navigation
feat: add FULLSEND_PER_REPO_INSTALL guard variable - #967
Conversation
Prevent per-org enrollment from overriding per-repo installations. Per-repo install sets FULLSEND_PER_REPO_INSTALL=true as a repo variable; per-org enrollment (both CLI and reconcile-repos.sh) checks it and skips repos with the guard active. Three-state logic: - true: per-repo active, skip enrollment - false: admin cleared guard, confirm before enrolling (interactive) - not found: normal enrollment Add GetRepoVariable to forge.Client for reading variable values. Signed-off-by: Wayne Sun <gsun@redhat.com>
|
fullsend review is working on this — view logs |
Site previewPreview: https://60c4d1ce-site.fullsend-ai.workers.dev Commit: |
Review: #967Head SHA: de5877f SummaryThe Go code for the guard variable feature is well-structured — the interface extension, fake client, enrollment layer, CLI integration, and tests are all solid. However, the shell script's FindingsCritical
Medium
Low
Info
FooterOutcome: request-changes Previous runReview: #967Head SHA: dd66120 SummaryThis PR adds a well-designed guard mechanism ( FindingsMediumNone Low
Info
FooterOutcome: approve Previous run (2)Review: #967Head SHA: bb9cfdb SummaryThe guard variable mechanism is well-designed with proper fail-closed semantics in Go code, good test coverage, and clean three-state logic. However, the FindingsHigh
Medium
Low
Info
FooterOutcome: request-changes Previous run (3)Review: #967Head SHA: 468b048 SummaryThe PR adds a FindingsHigh
Medium
Low
FooterOutcome: request-changes Previous run (4)Review: #967Head SHA: 90605f1 SummaryThis PR implements a FindingsMedium
Low
Info
FooterOutcome: comment-only Previous run (5)Review: #967Head SHA: 210ee36 SummaryThis PR introduces a well-designed guard variable ( FindingsMedium
Low
Info
FooterOutcome: approve Previous run (6)Review: #967Head SHA: 722b2d0 SummaryThis PR adds a FindingsHigh
Medium
Low
FooterOutcome: request-changes Previous run (7)Review: #967Head SHA: e8183e6 SummaryThe PR introduces a FindingsHigh
Medium
Low
FooterOutcome: request-changes |
|
fullsend fix is working on this — view logs |
- Switch Analyze from RepoVariableExists (boolean) to GetRepoVariable (value-aware) so guard=false is not treated as per-repo active - Handle GetRepoVariable errors fail-closed in per-org enrollment instead of silently ignoring with _ - Log warning on guard check error in per-repo install path - Add guard check to reconcile-repos.sh Phase 2 (unenrollment) to prevent removal PRs for per-repo managed repos - Move Phase 1 guard check after stale PR cleanup so per-repo repos still get stale unenrollment PRs cleaned up - Add guard check for disabled repos in Analyze - Use constant for guard variable name in admin.go - Initialize VariableValues in NewFakeClient - Add tests: guard=false, disabled repos with guard Signed-off-by: Wayne Sun <gsun@redhat.com>
|
fullsend review is working on this — view logs |
|
fullsend fix is working on this — view logs |
- Move guard variable check before adding to repoVars in per-repo install, so status messages reflect actual state. Add warning when overriding a previously-disabled guard (guard="false"). - Export perRepoGuardVar as forge.PerRepoGuardVar to eliminate duplicate constant definitions in admin.go and enrollment.go. - Fail loudly when all repos are skipped due to guard-check errors in per-org enrollment (likely missing actions:read scope). - Defer bufio.NewReader creation to where it's actually needed. - Make reconcile-repos.sh fail-closed on guard-check API errors, consistent with Go code's behavior. - Use NewFakeClient() in enrollment tests to avoid nil map panics. Addresses review feedback on #967 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: fullsend-fix <fullsend-code@users.noreply.github.com>
🔧 Fix agent — iteration 1 (bot-triggered)Addressed 6 of 7 review findings. Fixed guard-check ordering in per-repo install, exported shared constant, added all-skipped error detection, deferred bufio.NewReader, made reconcile-repos.sh fail-closed, and hardened tests. Disagreed with 1 finding (Analyze guard-trust) because per-repo repos intentionally use a different shim template. Fixed (6):
Disagreed (1):
Tests: passed Decision points
Updated by fullsend fix agent |
|
fullsend review is working on this — view logs |
ralphbean
left a comment
There was a problem hiding this comment.
LGTM. Three minor notes inline — all deferred.
| _, err := l.client.GetFileContent(ctx, l.org, repo, shimWorkflowPath) | ||
| guardVal, guardExists, err := l.client.GetRepoVariable(ctx, l.org, repo, forge.PerRepoGuardVar) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("checking per-repo guard for %s: %w", repo, err) |
There was a problem hiding this comment.
[moderate] Analyze returns a hard error here, but admin.go and reconcile-repos.sh both degrade gracefully on the same failure (log + skip). If one repo out of 50 has a permissions quirk, Analyze aborts entirely. Worth aligning in a follow-up — e.g., add the error to report.Details and continue. Deferred.
| echo "::warning::Skipping $REPO — per-repo installation active (FULLSEND_PER_REPO_INSTALL=true)" | ||
| SKIPPED=$((SKIPPED + 1)) | ||
| continue | ||
| fi |
There was a problem hiding this comment.
[moderate] When the guard exists but isn't "true" (e.g., "false"), the script falls through silently. An info log like echo " Per-repo guard exists but value is '$PER_REPO_VAR' — proceeding" would help debugging. Same in the unenrollment block. Deferred.
- ADR 0033: document FULLSEND_PER_REPO_INSTALL guard variable in coexistence section, update migration steps, fix stale CLI flags (--gcp-auth-mode removed in PR #905), update repo variables list - Installation guide: fix WIF attribute condition from assertion.repository == 'org/.fullsend' to assertion.repository_owner == 'org' (PR #920 fix), fix WIF principal from attribute.repository/org/.fullsend to attribute.repository_owner/org Signed-off-by: Wayne Sun <gsun@redhat.com>
|
fullsend review is working on this — view logs |
- Extract check_per_repo_guard() helper in reconcile-repos.sh to DRY enrollment/unenrollment guard checks with fail-closed error handling - Use jq JSON parsing instead of grep for 404 detection in shell - Log notice when guard variable exists but is not "true" - Soft-fail on guard API errors in enrollment Analyze (skip repo instead of aborting entire analysis) - Fix eligibleCount to use actual filtered count instead of allRepos-1 - Remove stale --gcp-auth-mode reference from ADR 0033 - Add WIF org-wide scope security callout to installation guide Signed-off-by: Wayne Sun <gsun@redhat.com>
|
fullsend review is working on this — view logs |
|
fullsend fix is working on this — view logs |
- Change `2>&1` to `2>/dev/null` in check_per_repo_guard so $resp contains clean JSON, fixing jq 404 detection that was broken by stderr contamination (would incorrectly skip all repos without the guard variable) - Sanitize variable values before echoing into GitHub Actions workflow command annotations to prevent command injection via crafted values - Split skip count reporting to distinguish per-repo installed repos from guard-check errors in enrollment summary message Signed-off-by: Wayne Sun <gsun@redhat.com>
|
fullsend review is working on this — view logs |
|
fullsend fix is working on this — view logs |
🔧 Fix agent — iteration 2 (bot-triggered)Addressed all 5 review findings: fixed broken 404 detection in reconcile-repos.sh (HIGH), elevated WIF docs security warning (MEDIUM), added all-repos-failed threshold in enrollment Analyze (MEDIUM), extracted checkGuard helper (LOW), fixed test initialization (INFO). All 20 enrollment tests pass. Fixed (5):
Tests: passed Decision points
Updated by fullsend fix agent |
- Fix broken 404 detection in check_per_repo_guard(): GitHub's REST API
404 responses use {"message": "Not Found"}, not {"status": "404"}.
Without this fix, all repos without the guard variable would be
incorrectly skipped from enrollment/unenrollment.
- Elevate WIF security note to a warning callout with explicit guidance
for per-org-only setups to use the tighter assertion.repository
condition, and document the discrepancy with auto-provisioned providers.
- Add all-repos-failed threshold warning in enrollment Analyze(), similar
to the eligibleCount == skippedErrors check in admin.go CLI path.
- Extract checkGuard helper in enrollment.go to reduce duplication
between enabled-repos and disabled-repos loops.
- Use NewFakeClient() instead of struct literals in tests for
MixedPerRepoAndOrg and DisabledWithPerRepoGuard to initialize all maps.
Addresses review feedback on #967
Signed-off-by: fullsend-fix <fullsend-code@users.noreply.github.com>
|
fullsend review is working on this — view logs |
- Fix broken 404 detection in check_per_repo_guard(): GitHub's REST API
404 responses use {"message": "Not Found"}, not {"status": "404"}.
Without this fix, all repos without the guard variable would be
incorrectly skipped from enrollment/unenrollment.
- Elevate WIF security note to a warning callout with explicit guidance
for per-org-only setups to use the tighter assertion.repository
condition, and document the discrepancy with auto-provisioned providers.
- Add all-repos-failed threshold warning in enrollment Analyze(), similar
to the eligibleCount == skippedErrors check in admin.go CLI path.
- Extract checkGuard helper in enrollment.go to reduce duplication
between enabled-repos and disabled-repos loops.
- Use NewFakeClient() instead of struct literals in tests for
MixedPerRepoAndOrg and DisabledWithPerRepoGuard to initialize all maps.
Addresses review feedback on #967
Signed-off-by: fullsend-fix <fullsend-code@users.noreply.github.com>
Signed-off-by: Wayne Sun <gsun@redhat.com>
dd66120 to
de5877f
Compare
|
fullsend review is working on this — view logs |
|
fullsend fix is working on this — view logs |
🔧 Fix agent — iteration 3 (bot-triggered)PR #967 is in MERGED state. No fixes can be applied to a merged PR. The review feedback would need to be addressed in a follow-up PR. Disagreed (1):
Tests: passed Updated by fullsend fix agent |
The FULLSEND_PER_REPO_INSTALL guard (PR fullsend-ai#967) fails in reconcile workflows because the fullsend role token lacks the variables:read fine-grained permission. The GET /repos/{owner}/{repo}/actions/variables endpoint returns 403, causing all repos to be skipped. - Add Variables field to AppPermissions struct and fullsend App manifest - Add variables:read to fullsend role in mint rolePermissions - Fix misleading "actions:read" error message in enrollment analyzer - Include API error message in reconcile-repos.sh warning output Signed-off-by: Wayne Sun <gsun@redhat.com>
Summary
FULLSEND_PER_REPO_INSTALLrepo variable as a guard to prevent per-org enrollment from overriding per-repo installationsfullsend admin install <owner/repo>) sets the guard totruereconcile-repos.sh) checks the guard and skips repos with active per-repo installationGetRepoVariabletoforge.Clientinterface for reading variable values (not just existence)Three-state guard logic
truefalseChanges
internal/forge/forge.go— addGetRepoVariable(ctx, owner, repo, name) (string, bool, error)to Client interfaceinternal/forge/github/github.go— implementGetRepoVariableusing Actions variables APIinternal/forge/fake.go— addVariableValuesmap +GetRepoVariableto FakeClientinternal/cli/admin.go— set guard in per-repo install, filter per-repo repos in per-org enrollment with interactive promptinternal/scaffold/fullsend-repo/scripts/reconcile-repos.sh— skip repos withFULLSEND_PER_REPO_INSTALL=true(both enrollment and shim updates, since per-repo uses a different shim template)internal/layers/enrollment.go— detect guard inAnalyze, report as "per-repo install, skipped"internal/layers/enrollment_test.go— 3 new tests for guard skip, mixed mode, and error propagationTest plan
go test ./internal/layers/ -run TestEnrollment -v— 18/18 passgo test ./internal/...— all 19 packages passgo vet ./internal/...— cleanFULLSEND_PER_REPO_INSTALL=trueon a test repo, runreconcile-repos.sh, confirm skipfullsend admin install <org>with a per-repo repo present, confirm skip message