fix: verify server snapshots and recover whole migration sessions (#3)
This commit is contained in:
1 parent
3d4101ecc0
commit
8569871a17
29 files changed
+1923
-133
No files matched your search
@@ -2,10 +2,10 @@
|
||||
|
||||
Repository: https://git.mchus.pro/mchus/QuoteForge
|
||||
|
||||
Six issues (#2-#7) remain open. Their initial fixes were merged into `main`
|
||||
in [PR #8](https://git.mchus.pro/mchus/QuoteForge/pulls/8), with release notes
|
||||
in v3.50. Acceptance and remaining rule compliance work continue sequentially
|
||||
on `fix/issue-acceptance-and-migration-safety`.
|
||||
Scope: issues #2-#7. Initial fixes were merged into `main` in
|
||||
[PR #8](https://git.mchus.pro/mchus/QuoteForge/pulls/8), with release notes in v3.50.
|
||||
The follow-up adds completed acceptance checks and server migration recovery
|
||||
required by the shared rules. Each issue has its own implementation/acceptance commit.
|
||||
|
||||
| Order | Issue | Implementation and acceptance | Status |
|
||||
| --- | --- | --- | --- |
|
||||
@@ -13,7 +13,7 @@ on `fix/issue-acceptance-and-migration-safety`.
|
||||
| 2 | [#4](https://git.mchus.pro/mchus/QuoteForge/issues/4) | Move LOT-bearing cart/rental events to delegated listeners and escaped data attributes; escape BOM and sync output; share HTML escaping; render toast as text. Malicious LOT regression checks and headless Chrome DOM checks pass. | Acceptance passed |
|
||||
| 3 | [#7](https://git.mchus.pro/mchus/QuoteForge/issues/7) | Require a fresh verified archive outside rotation before reset, refuse unsynced/legacy states without explicit force, use transactional deletion, remove environment-triggered reset. Verified refusal, ZIP restore, backup failure, rollback and CLI startup after restore. | Acceptance passed |
|
||||
| 4 | [#5](https://git.mchus.pro/mchus/QuoteForge/issues/5) | Persist TLS mode/CA in SQLite, expose setup controls, share policy across setup/sync/migration DSNs. Verified certificate trust, hostname checks, fallback policy, settings round-trip and live MariaDB 11.8 transport. | Acceptance passed |
|
||||
| 5 | [#3](https://git.mchus.pro/mchus/QuoteForge/issues/3) | Keep each migration file in one session, execute verify headers before history insertion, propagate FK failures. Verify failed queries/checks never enter history. | Implemented |
|
||||
| 5 | [#3](https://git.mchus.pro/mchus/QuoteForge/issues/3) | Keep each migration file in one session, execute verify headers before history insertion, propagate FK failures. Failed queries/checks restore the entire session. Verified snapshots, literal-aware SQL parsing, trigger preservation and crash recovery pass synthetic tests and production-dump rehearsal on MariaDB 11.8.3. | Acceptance passed |
|
||||
| 6 | [#6](https://git.mchus.pro/mchus/QuoteForge/issues/6) | Require Go 1.27.3, update vulnerable dependencies, block release on pinned govulncheck. Tests, vet, security scan, cross-platform builds and release failure checks pass. | Acceptance passed |
|
||||
|
||||
## Decisions
|
||||
@@ -28,22 +28,15 @@ on `fix/issue-acceptance-and-migration-safety`.
|
||||
encryption. The setup form explains this distinction.
|
||||
- `go 1.27.3` enforces the minimum compiler, including with `GOTOOLCHAIN=local`.
|
||||
A redundant `toolchain go1.27.3` is removed by Go tooling and is unnecessary.
|
||||
- The local ignored `.claude/skills/release/SKILL.md` was updated with the security
|
||||
prerequisite; the shared Makefile and release script enforce it in git.
|
||||
|
||||
## Validation and handoff
|
||||
|
||||
Passed: `go test ./...`, `go vet ./...`, `node scripts/tests/html-security.cjs`,
|
||||
`make security-check`, shell syntax and diff checks, and CGO-free builds for
|
||||
macOS arm64 and Windows amd64.
|
||||
|
||||
Govulncheck reports zero reachable vulnerabilities and one module-level advisory
|
||||
whose affected code is not called. Gin's transitive quic-go was explicitly raised
|
||||
to v0.59.1 after the first scan identified a reachable advisory in v0.59.0.
|
||||
|
||||
The checks use temporary SQLite databases and synthetic certificates. They do
|
||||
not exercise a live MariaDB server or browser automation. The original implementation PR is merged. Remaining acceptance work and
|
||||
rule compliance are tracked below; issue state changes are separate.
|
||||
The original implementation PR is merged. Current acceptance results are listed
|
||||
below. Govulncheck reports zero reachable vulnerabilities and one module-level
|
||||
advisory whose affected code is not called. Initial cross-platform builds and
|
||||
all Go/JavaScript checks pass; final verification also covers the recovery change.
|
||||
Production-dump rehearsal also passes on MariaDB 11.8.3 with the production
|
||||
collation. No production migration or new release is performed by this work.
|
||||
|
||||
## Acceptance follow-up
|
||||
|
||||
@@ -101,3 +94,37 @@ failing Go scanner in an isolated directory and confirms all five release build
|
||||
targets and `scripts/release.sh` stop before compilation or artifact creation.
|
||||
The scanner reports zero reachable vulnerabilities and one uncalled module-level
|
||||
advisory. No release is published by these acceptance checks.
|
||||
|
||||
### Issue #3
|
||||
|
||||
The parser, mandatory server snapshots, restore-readiness checks, reverse step
|
||||
recovery and explicit crash restore are implemented; see
|
||||
[server migration recovery decision](decisions/2026-10-26-server-migration-recovery.md).
|
||||
`go test -tags integration ./internal/models -run TestSQLMigrationSafetyMariaDB -count=1`
|
||||
passes on a disposable MariaDB 11.8: session variables and two verify checks,
|
||||
semicolon literals, a later failed verify, a real FK errno 150 after successful
|
||||
DDL, reverse recovery of prior files, interrupted-session refusal/restore/retry,
|
||||
unsupported-schema refusal, active-client refusal and backup failure.
|
||||
Restored schema, binary/NULL/empty/decimal/timestamp data and history are compared
|
||||
to the original snapshot. Unit tests cover snapshot format/digests, symlink path
|
||||
refusal and all embedded migration SQL syntax.
|
||||
|
||||
The supplied `2026-10-26_RFQ_LOG.sql` dump (45 tables, 27 triggers) is loaded
|
||||
read-only into a new disposable MariaDB **11.8.3** container with
|
||||
`utf8mb4_uca1400_ai_ci`, matching the production version and collation.
|
||||
`TestProductionDumpMigrationMariaDB` verifies a full snapshot restore, rebuilds
|
||||
the pre-035 schema only in that clone, applies the real embedded migration 035,
|
||||
forces a subsequent DDL/verify failure, verifies reverse recovery against the
|
||||
complete pre-session snapshot, then applies 035 successfully and restores the
|
||||
exact original dump state. Trigger bodies, definers and order are preserved;
|
||||
triggers never fire during row loading. No production schema or dump file is changed.
|
||||
|
||||
Run this optional, destructive-to-its-own-container rehearsal with an existing
|
||||
`mariadb:11.8.3` image and `QFS_TEST_PRODUCTION_DUMP=/outside/repository/dump.sql`:
|
||||
|
||||
```bash
|
||||
go test -tags integration ./internal/models -run TestProductionDumpMigrationMariaDB -count=1 -v
|
||||
```
|
||||
|
||||
The environment variable supplies the source file only; no externally supplied
|
||||
DSN is accepted. The test owns and removes its container and temporary archives.
|
||||
Reference in new issue
Block a user