Repository navigation
Fix the CLI, backup and restore follow-ups of M4 and M6 - #3122
Merged
Merged
Conversation
…wups # Conflicts: # src/FluentCMS.Cli/CliErrorCodes.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3068
The low items of the review of M4 and M6 for
fluentcms, themcpproxy,backupandrestore, and the items of the two comments. Each one is fixed with a test, except the GET stream ofmcpand a second way to find a host on the rollback journal (see Declined). The second commit fixes the findings of the PR review.Decisions
restorecompares the schema hash and the applied migrations of every stream inbackup.jsonwith the host before it writes. A different hash, a stream the host does not have, or a migration the host's set lacks is refused withFCMS3249. The schema check has its own option,--allow-schema-mismatch, so--forcekeeps meaning only "replace the existing database and media files" and the usual restore over a database is still checked. With the option the restore goes on, and the difference is printed as a warning once the database is in place, so a later refusal (FCMS3245,FCMS3246,FCMS3242) never follows a "restored" line. A migration the host has and the backup had not is pending, not a difference.FCMS3244text and the guide say to stop every host first, because one on the rollback journal is not seen. No second detection was added (see Declined).IDatabaseFile.CheckrunsPRAGMA quick_checkon the unpacked file, and refuses an empty one, before the database is touched. The refusal isFCMS3242.Restoremoves the database and its-wal,-shmand-journalaside together. If one of them or the snapshot cannot be moved, it moves them back. It deletes them only after the snapshot is in place.FCMS3307) names the<db>.<guid>.replaced*files.docs/backups.mdsays how to keep the archive.--token(also--token=and--token:) replaced by***.@fileresponse file. System.CommandLine expanded one before the key could be masked; a test showed it.docs/docker.mdshows an MCP client configuration with the key inenv.InstanceOptions.Resolvenow warns withFCMS3363(once, for every--urlcommand) and refuses a key with a character outside!to~withFCMS3316before any request.--siteofexportandimportgets the same check as bad usage.--urlgets a termination timeout of 10 seconds: Ctrl+C or SIGTERM cancels it and it cleans up. It exits 1, or 130 (Ctrl+C) or 143 (SIGTERM) if it is not done by then.schema diff --urlwithout--schema, which runs the host for its schema and so behaves like a project command, as all project commands do: no timeout, and the host is not killed.mcp.BoundedLineReader, which decodes UTF-8 itself and takes what each read gives.StreamReader.ReadAsynckept reading while each read filled its 1 KiB buffer, so a line of exactly 1024 or 2048 bytes stalled on a pipe.initializeis sent without the session and the protocol version, and a 404 to a request that named the session clears both.1answers1.0and1e-30is not0.FCMS3317).PrintableTextin Core, writes control characters and bidi controls as\uXXXX.lastErrorincluded;doctor, where only the host's own refusals keep their line breaks;schema diff;generatewarnings;schema validatenotes;SchemaBuilderandSchemaValidator.Literalescapes the same characters, andFCMS3370now says ASCII.user add-role --urlreads the pages ofGET /usersuntil it finds the address or reaches the total. No API change.--help,-hand-?as help only where an option or an argument stands. As the value of an option (--name=-h, handed on as--name -h) they are that value.ErrorCodeRegistry, and the spec's range sentences say so. No log event id was added.FCMS3249: the restore schema mismatch, the next free code of the backup and restore block (FCMS3240toFCMS3259), inTransferCommandErrorCodes.FCMS3317: the MCP size cap, in the tool's range (FCMS3310toFCMS3319).Declined
mcp. The plugin serves statelessly and sends everything on the answer to each POST, as 6.1 says. Opening a stream for servers with sessions is a feature, not a follow-up. A request that such a server accepts without an answer now gets a JSON-RPC error instead of hanging./proc) do not work across containers or need a new runtime mechanism. The refusal texts and the guide say so instead.Tests
tests/FluentCMS.Cli.Tests:InstanceCommandTests: paging ofuser add-role;FCMS3363for every--urlcommand; a key or a site with a line break; escaped problem, job error, doctor report (line breaks included) and diff; an export cancelled mid-read leaves no file.McpProxyTests:StreamReaderpath;ParserTests: no key in a usage error; no response file; the termination timeout only for--urlwithout a host; the unchecked field type note;--allow-schema-mismatchhanded on.GenerateTextTests: the TypeScript literal, select options, an escapedFCMS3370and its ASCII wording.tests/FluentCMS.Core.Tests:PrintableTextTests: the helper, schema reader and validator messages, the import report.CommandParserTests:--name=-hand--name -h.tests/FluentCMS.Data.Tests:BackupCommandTests:FCMS3249refused even with--force, and allowed with--allow-schema-mismatch, with the warning only after the swap;FCMS3244text.DatabaseFileTests: a failed swap puts the database and its journals back;Checkon whole, cut, text and empty files.Full CI run: 43661544445 on cde51d1 (success); the first round was 43656743485 on fe261a8 (success).