fix: tool: disinto backup create — export Forgejo issues + disinto-ops git bundle (#1057) #1062
No reviewers
Labels
No labels
action
backlog
blocked
bug-report
cannot-reproduce
in-progress
in-triage
needs-triage
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
rejected
reproduced
tech-debt
underspecified
vision
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#1062
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-1057"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #1057
Changes
AI Review
Summary
New
disinto backup createcommand. Fetches Forgejo issues (open + closed, paginated) for both the main repo and the ops repo, creates a git bundle of the ops repo, writes metadata, and packs a tarball. Logic is correct end-to-end except for one shell-correctness defect in the cleanup path.Blocker
high
lib/backup.sh:78: EXIT trap captures$tmpdirby reference (single-quoted), buttmpdiris a local variable inbackup_create. After the function returns successfully,tmpdiris no longer in scope. When the shell exits, the trap fires and underset -u(active in bothbin/disinto:25andbackup.sh:9) bash aborts withtmpdir: unbound variableand exits non-zero. The tarball is already written correctly, but the process reports failure — any caller checking$?sees an error.Fix: before the function returns, clear the trap and clean up manually:
The trap still fires (and sees
$tmpdirin scope) for any early-exit/error path before this point.Notes (non-blocking)
lib/backup.sh:1-9:#!/usr/bin/env bashshebang andset -euo pipefailare redundant in a sourced file — the shebang is ignored and the options are already set bybin/disinto. Not harmful, just noise.lib/backup.sh:3: Doc comment listsFORGE_URL, FORGE_TOKEN, FORGE_REPO, FORGE_OPS_REPO, OPS_REPO_ROOTas requirements but the function also consumesFORGE_API_BASE. This is fine at runtime becauselib/env.shexports it, but the header is incomplete. Consider addingFORGE_API_BASEto the list (or noting it is derived fromFORGE_URLbyenv.sh).Verdict
REQUEST_CHANGES — EXIT trap references a local variable ($tmpdir) after the function returns — under set -u the process exits with 'unbound variable' error on every successful backup
Reviewed at
526b7fb| AGENTS.mdAI Review: REQUEST_CHANGES — EXIT trap references a local variable ($tmpdir) after the function returns — under set -u the process exits with 'unbound variable' error on every successful backup
526b7fb73atocb8c131bc4AI Re-review (round 2)
Previous Findings
$tmpdirafter function returns → FIXED:trap - EXIT+rm -rf "$tmpdir"added atlib/backup.sh:132-133before the function returns. Variable is in scope at that point; early error paths retain the trap. Fix matches required shape exactly.Verdict
APPROVE — Previous blocker fixed: trap cleared and tmpdir removed before return, while variable is still in scope
Reviewed at
cb8c131| Previous:526b7fb| AGENTS.mdAI Re-review (round 2): APPROVE — Previous blocker fixed: trap cleared and tmpdir removed before return, while variable is still in scope