Skip to content

fix(backup): move settings paths with restored data - #1563

Merged
frahlg merged 1 commit into
masterfrom
codex/stable-backup-relocation-20261011
Oct 11, 2026
Merged

frahlg merged 1 commit into
masterfrom
codex/stable-backup-relocation-20261011

Conversation

@frahlg

@frahlg frahlg commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

Restoring a backup from /app/data to /var/lib/ftw left active state.cold_dir at the old location. Core could start while reading archives from the wrong directory. Restore now moves owned paths in verified staging before it replaces destination data, for both active SQLite settings and legacy YAML.

New backups record the source directory and config file. Older manifests infer the source only from a path that matches the archived database. A move with unresolved external paths stops before activation; same-location recovery retains external mounts. Settings, secrets, unknown fields and revision stay in the stored document. Revert keeps the previous destination as it was.

Validation: the regression fails on the previous restore code in all four YAML/SQLite and old/new-manifest cases. Real Parquet rows, preserved credentials and goals, nested config paths, external-path rejection and revert pass. make verify passes. Separate Linux ARM64 checks with published 2.3.2 and 3.8 helpers passed path mapping, archive bytes, two config loads, credentials, goals, identity, continued writes, source-core return and revert. Those checks also found a distinct stored-resolution export defect: retained Parquet summaries disappear from points=0 responses after file cleanup. #1564 tracks it; Parquet migration is not yet qualified.

Refs #1562. This fix does not qualify every old installation path or explain the initial field write delay (tracked in #1554). A new exact beta and field trial remain required.

@frahlg
frahlg marked this pull request as ready for review October 11, 2026 20:48
@frahlg
frahlg merged commit 1cc469c into master Oct 11, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T20:51:39.502286Z c39848a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c39848adb1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if !backupPathInside(".", filepath.Join(base, value)) {
return "", fmt.Errorf("%s leaves the backup; copy it into the data directory before moving", name)
}
return value, nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Rebase runtime-relative paths during relocation

When a backup is restored to a different directory and nova.key_path or an OCPP TLS path is relative, this branch preserves the relative text after validating it against the seed directory. Those paths are consumed directly by main.go/the OCPP server and therefore resolve against the process working directory, not the config file; the restored files can consequently be ignored in favor of files at the old working directory, or Nova can create a new identity. Rebase these fields to the restored target according to their actual runtime resolution semantics.

AGENTS.md reference: AGENTS.md:L24-L25

Useful? React with 👍 / 👎.

Comment on lines +882 to +885
seed := manifest.ConfigFile
if seed == "" {
seed = "config.yaml"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Locate custom seed files in legacy manifests

When restoring a legacy schema-1 archive created with a non-default ConfigPath, ConfigFile is absent and this fallback only examines config.yaml. For a YAML-authoritative archive whose actual seed is, for example, settings/site.yaml, RelocateBackup finds neither that seed nor stored SQLite settings and returns successfully without rewriting it, so starting Core with the original -config path can continue using absolute paths into the source installation. Locate the archived seed or reject an ambiguous legacy restore rather than reporting success with hidden stale configuration.

AGENTS.md reference: AGENTS.md:L20-L25

Useful? React with 👍 / 👎.

@frahlg
frahlg deleted the codex/stable-backup-relocation-20261011 branch November 11, 2026 09:14
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.

1 participant