Skip to content

Fix for missing rules in backups - #2860

Merged
dwwoelfel merged 3 commits into
mainfrom
backups-fixes
Aug 12, 2026
Merged

Fix for missing rules in backups#2860
dwwoelfel merged 3 commits into
mainfrom
backups-fixes

Conversation

@dwwoelfel

@dwwoelfel dwwoelfel commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Fixes missing rules in the backup (I was passing app-id instead of {:app-id app-id}).

It also includes the authorized redirect URIs (those are stored in our db instead of the triples table) and more metadata about the backup.

Retore will now restore the redirect URIs and it will show a warning if you're importing a backup that might be missing the rules.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c1688cb2-2fc5-4d4d-a75c-8316c0cb7feb

📥 Commits

Reviewing files that changed from the base of the PR and between 733eda1 and 6ec72a3.

📒 Files selected for processing (1)
  • server/src/instant/backup.clj
🚧 Files skipped from review as they are similar to previous changes (1)
  • server/src/instant/backup.clj

📝 Walkthrough

Walkthrough

Backup archives now preserve authorized redirect origins and additional metadata. Restore initialization recreates those origins. The restore form inspects selected ZIP files and warns when the backup lacks an app ID.

Changes

Backup and restore flow

Layer / File(s) Summary
Backup configuration export
server/src/instant/backup.clj
Backup generation retrieves app-scoped rules and authorized redirect origins. It adds origins, app ID, timestamp, ISN, and a default description to the configuration.
Redirect-origin restoration
server/src/instant/restore.clj
App initialization recreates authorized redirect origins with their services and parameters.
Restore archive inspection
client/www/app/intern/restore/content.tsx
The restore form reads config.json from selected ZIP files, ignores stale selection results, and warns when appId is missing. The warning clears when selection is removed or restore succeeds.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Backup as Backup generation
  participant OriginModel as Authorized redirect-origin model
  participant Archive as Backup archive
  participant Restore as Restore initialization
  participant RestoreForm as Restore form
  Backup->>OriginModel: Retrieve app redirect origins
  OriginModel-->>Backup: Return authorized origins
  Backup->>Archive: Write origins and metadata to config.json
  Restore->>Archive: Read backup configuration
  Restore->>OriginModel: Create authorized redirect origins
  OriginModel-->>Restore: Confirm restored origins
  RestoreForm->>Archive: Read config.json from selected ZIP
  Archive-->>RestoreForm: Return parsed configuration
  RestoreForm-->>RestoreForm: Warn when appId is missing
Loading

Possibly related PRs

Suggested reviewers: nezaj, stopachka

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: fixing missing rules in backups.
Description check ✅ Passed The description accurately covers the backup fix, redirect URI support, metadata, restore behavior, and warning.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

View Vercel preview at instant-www-js-backups-fixes-jsv.vercel.app.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@client/www/app/intern/restore/content.tsx`:
- Around line 104-110: Update onFileChange so each file selection, including
clearing the selection, invalidates earlier readBackupConfig results before they
can update rulesWarning. Track a per-selection token or cancel the prior
inspection, and only apply missingRulesWarning(config) when the result belongs
to the current selection.
- Around line 198-200: Update the file input’s styling in the restore upload
control so it remains visually hidden but focusable and keyboard-operable
instead of using className="hidden". Preserve the existing onChange handler and
label-based file selection behavior, ensuring keyboard users can activate the
picker through the associated control.
- Around line 64-65: Update missingRulesWarning to validate that config is a
non-array object containing the required schema key before checking
config.appId. Only return the warning for this valid backup-config shape when
appId is absent; leave other values, including empty objects, arrays, and
strings, without a warning.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5b0d02ec-2445-4d4b-a01f-3774f5e7cc55

📥 Commits

Reviewing files that changed from the base of the PR and between 244237f and f06f5cc.

📒 Files selected for processing (3)
  • client/www/app/intern/restore/content.tsx
  • server/src/instant/backup.clj
  • server/src/instant/restore.clj

Comment thread client/www/app/intern/restore/content.tsx
Comment thread client/www/app/intern/restore/content.tsx
Comment thread client/www/app/intern/restore/content.tsx
@dwwoelfel dwwoelfel changed the title [WIP] Fixes for backups Fix for missing rules in backups Aug 12, 2026
@dwwoelfel
dwwoelfel marked this pull request as ready for review August 12, 2026 18:35

@nezaj nezaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@dwwoelfel
dwwoelfel merged commit 018ac5c into main Aug 12, 2026
34 checks passed
@dwwoelfel
dwwoelfel deleted the backups-fixes branch August 12, 2026 19:59
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.

2 participants