Skip to content

Stabilize SQLite backups, settings events, and the Windows outbox test - #3734

Open
pournasserian wants to merge 4 commits into
mainfrom
feature/stabilize-preview-2
Open

pournasserian wants to merge 4 commits into
mainfrom
feature/stabilize-preview-2

Conversation

@pournasserian

Copy link
Copy Markdown
Member

Closes #3730
Closes #3724
Closes #3725
Closes #3727

What

  • Outbox shutdown (#3731): Fix the Windows regression fixture so stopping one worker cancels its wait, not the shared plugin-state read. The test checks the first delivery, the two returned rows and their eventual delivery without duplication. No production outbox shutdown behavior changed.
  • SQLite backup (#3733): Refuse unsafe destinations before opening SQLite (FCMS3254). A linked media root and safe file links are supported; nested directory links and junctions are refused. Verify each local original named by the database snapshot against the staged ZIP by exact key, byte length and SHA-256 before replacing the previous archive (FCMS3255). Remote storage and media retention are unchanged.
  • Settings (#3732): Commit the settings row and its durable settings.changed event in one transaction on write, reset and import. Prepare secrets and resolve handlers before taking the write lock; invalidate the cache and notify handlers only after commit.
  • Release checklist: Track live Azure OpenAI and Entra/OIDC verification and the ship-or-defer decisions for the docs site, agent-readable docs, agent instructions and frontend starters. These items remain open. No public API freeze or release is part of this PR.

Why

A backup could replace the live database or report success with an original missing. A settings change could commit without its event. The separate Windows nightly failure was reproduced and isolated to the test fixture, so no change to production delivery was necessary.

Dependencies: No new packages. Backup path checks use Windows and POSIX system APIs. See the backup guide for link policy, ambiguous paths and the stable-mount assumption.

Checklist

  • Linked to maintainer-confirmed issues and the three merged checkpoint PRs.
  • Regression tests and operator documentation updated. On the combined local tree, the Release build produced zero warnings or errors; 366 focused cases passed, with seven platform/provider skips.
  • Confirmed the feature branch at bfe425f1 has exactly the reviewed Git tree (41e204db); git diff --check passed.
  • No tool-generated co-author trailers or footers.

Full CI for the integrated feature revision passed, including the full Windows suite, SQLite, PostgreSQL, SQL Server 2019/2025, and admin end-to-end tests on the host and image. The optional Firefox/WebKit jobs were not requested. GitHub runs separate PR checks against main.

Leave this PR unmerged for maintainer review; auto-merge is not requested.

…3731)

Closes #3730

## What

Keep the plugin-state query alive when a stopping outbox worker stops
waiting for it. The fixture now holds the real shared query until the
first worker has returned; a live reader can join it and the restarted
drain delivers the remaining events. No production code changes.

## Why

The [Windows
nightly](https://github.com/fluentcms/FluentCMS/actions/runs/46039772897/job/140644299577)
returned both remaining rows pending, unleased, and with no attempts,
but observed no subsequent deliveries. The old interceptor threw the
stopped worker’s cancellation into a query shared with the restart.
Holding that query reproduced the original assertion; removing only the
injected throw made that same schedule pass.

**Dependencies:** None.

## Checklist

- [x] Linked to the issue and approved stabilization scope.
- [x] Updated the regression; verified the first delivery, two returned
rows, live reader and all three deliveries in order.
- [x] Final exact case passed, then all 15 `PluginSiteTests` passed on
the local Windows x64 runtime with nightly seed `1975392936` and four
collection threads. Local x64 is emulated; hosted CI is separate.
- [x] No tool-generated co-author trailers or footers.

Checkpoint into `feature/stabilize-preview-2`; leave unmerged for
maintainer review.
#3733)

Closes #3724
Closes #3725

## What

- Refuse a backup destination that could replace SQLite, its journals,
or fall inside the local media directory (`FCMS3254`). Check it before
opening SQLite or creating files. The output must name a file, not an
existing directory or a link to one. Ordinary sibling archives remain
replaceable. A linked media root is supported; nested directory
symlinks/junctions are refused, not traversed or silently skipped. A
file link is allowed only if its target resolves and the archive cannot
replace it. The preflight and copy phases enforce the same policy.
- Before replacing the previous archive, verify each local original
named by the private snapshot against the staged ZIP: exact entry name,
length and SHA-256 (`FCMS3255`). Include snapshot-required named `.tmp`
originals but not unrelated scratch files. A newer upload is allowed;
cloud originals stay the storage operator’s responsibility. No changes
to retention or SVG handling.
- Link the 1.0 verification checklist from the release runbook. Azure
OpenAI and Entra/OIDC are not marked verified; the public API is not
frozen.

## Why

An output mistake could replace the live database. Independently,
replacing media during backup could produce a successful archive whose
database names a file the archive does not contain. Either refusal
leaves protected inputs and the prior archive intact. Verifying the
staged bytes adds a read of the archived originals.

**Dependencies:** No new packages. Path resolution uses existing
Windows/POSIX system APIs. As documented, ambiguous path spellings are
refused; use a distinct backup directory and a trusted, stable mount
layout. The command does not detect two bind mounts or shares exposing
the same storage.

## Checklist

- [x] Linked to both issues and the approved stabilization scope.
- [x] Added regression and operator documentation for both error codes.
Tested concurrent replacement, wrong bytes/case, local originals with
remote active storage, legitimate `.tmp` originals, unrelated scratch
files, and preservation of the previous archive.
- [x] On the final Windows tree, `BackupDestinationTests`: 10 passed, 5
skipped (4 POSIX-only and 1 requiring Windows file-symlink privilege);
data `BackupCommandTests`: 24 passed, 2 platform/provider cases skipped.
Regression cases cover nested junctions and cycles, a link added after
snapshot, and a linked root whose contents were backed up correctly.
[Feature CI on the final
head](https://github.com/fluentcms/FluentCMS/actions/runs/46089143943)
passed on Windows and Ubuntu. The Ubuntu TRX confirms that the
linked-file target, external directory link and POSIX link traversal
regressions actually ran and passed.
- [x] Full solution Release build passed with warnings as errors; the
four changed Markdown files passed lint.
- [x] No tool-generated co-author trailers or footers.

Checkpoint into `feature/stabilize-preview-2`; leave unmerged for
maintainer review.
Closes #3727

## What

Commit each settings write, reset or import together with its durable
`settings.changed` event. Prepare protected values and the matching
outbox handlers before taking the write lock; save the prepared rows on
the mutation context, then invalidate the cache and notify handlers
after commit. Other outbox callers keep their existing behavior.

## Why

A cancellation or failed outbox insert could leave a committed setting
with no event. Resolving plugin handlers inside the transaction would
also require a second database connection on a cold cache, which can
block a small connection pool.

**Dependencies:** None. No public API change.

## Checklist

- [x] Linked to the issue and approved stabilization scope.
- [x] Regression coverage for insert, update, reset, import, stage
failure, actor/site attribution, postcommit interruption, conflicts and
no-ops. The original implementation failed the five new atomicity
assertions as expected.
- [x] On the revised Windows/SQLite implementation: six event cases, two
cold-cache transaction cases, and two reset conflict/no-op cases passed.
The two cold-cache cases failed before moving handler lookup.
- [x] Independent re-review of both provider-specific findings.
PostgreSQL and SQL Server execution remains for the full CI data matrix;
local validation used SQLite.
- [x] No tool-generated co-author trailers or footers.

Checkpoint into `feature/stabilize-preview-2`; leave unmerged for
maintainer review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant