Severity: Warning
Files:
src/Servy.Core/Config/AppConfig.cs lines 514, 535
src/Servy.CLI/Commands/ImportServiceCommand.cs line 114
src/Servy/Services/ServiceCommands.cs line 582
src/Servy.Manager/Services/ServiceCommands.cs line 667
src/Servy.Core/Services/XmlServiceValidator.cs line 40
src/Servy.Core/Services/JsonServiceValidator.cs line 40
Two separate import-size limits exist with no documented relationship and they enforce different ceilings:
public const int MaxConfigFileSizeMB = 10; // file-size gate (~10MB)
public const int MaxImportPayloadSizeChars = 1_024_000; // payload-char gate (~2MB UTF-16)
The CLI/desktop/manager all gate the file at 10 MB before reading. The XmlServiceValidator/JsonServiceValidator then reject anything over 1,024,000 chars (~1MB raw text, ~2MB in UTF-16 RAM). For a typical ASCII XML/JSON config:
- A 1.5 MB file passes both gates → OK.
- A 3 MB file passes the file-size gate, then fails the payload-char gate with
XML payload exceeds the maximum allowed size of 1024000 characters. → confusing UX, the user was told the limit was 10 MB.
- A 12 MB file is rejected by the file-size gate → consistent.
Anything in the 2–10 MB range trips a confusing two-stage rejection where the user-visible error is about the inner limit even though the outer gate advertised 10 MB.
Suggested fix (pick one):
- Make the file-size gate match the payload limit:
MaxConfigFileSizeMB = 2 (or 1).
- Raise
MaxImportPayloadSizeChars to ~10,000,000 to match the file gate.
- Document the relationship in XML doc on both constants and unify the user-visible error message so it explains both layers.
Severity: Warning
Files:
src/Servy.Core/Config/AppConfig.cslines 514, 535src/Servy.CLI/Commands/ImportServiceCommand.csline 114src/Servy/Services/ServiceCommands.csline 582src/Servy.Manager/Services/ServiceCommands.csline 667src/Servy.Core/Services/XmlServiceValidator.csline 40src/Servy.Core/Services/JsonServiceValidator.csline 40Two separate import-size limits exist with no documented relationship and they enforce different ceilings:
The CLI/desktop/manager all gate the file at 10 MB before reading. The
XmlServiceValidator/JsonServiceValidatorthen reject anything over 1,024,000 chars (~1MB raw text, ~2MB in UTF-16 RAM). For a typical ASCII XML/JSON config:XML payload exceeds the maximum allowed size of 1024000 characters.→ confusing UX, the user was told the limit was 10 MB.Anything in the 2–10 MB range trips a confusing two-stage rejection where the user-visible error is about the inner limit even though the outer gate advertised 10 MB.
Suggested fix (pick one):
MaxConfigFileSizeMB = 2(or 1).MaxImportPayloadSizeCharsto ~10,000,000 to match the file gate.