Correzioni della revisione di C6: installatore, CI senza jq, caratteri e schermate senza Node

Le 14 osservazioni della revisione di funzione/senza-terzi, ciascuna con la prova che l'avrebbe trovata.

Installatore: un aggiornamento senza /D= va nella cartella già installata (InstallLocation)
invece che in quella predefinita, che lasciava la vecchia copia. Una cartella senza permessi
non sembra più «Febe aperto». La dimensione in «App installate» conta solo i due file
dell'installatore. I file in sola lettura si sostituiscono e si tolgono. «Febe» in Esegui
all'avvio si toglie solo se avvia quella copia, non un Febe portatile. Febe parte alla fine
solo con «Fine» e la casella spuntata. /PROVA= rifiuta la radice di un disco.

CI: jq non c'era ed era un componente esterno. JSON letto e scritto con .gitea/scripts/json.sh
(json-campi.awk e json-stringa.awk sul lettore json.awk) per gitleaks, Trivy e la release.
Le credenziali del registro stanno solo in un DOCKER_CONFIG temporaneo della pubblicazione,
con plugin, contesti e contesto corrente del runner, tolto alla fine. Le prove del rilascio
girano in debian:trixie con Chromium, come la verifica, senza prove saltate. Ogni flusso usa
shell: bash.

Caratteri: tolti fonts-liberation e fonts-noto-color-emoji dall'immagine e dalle prove della
CI, perché Chromium non li chiede. Resta fonts-dejavu-core.

Icone: la prova della griglia legge davvero i percorsi SVG (tutti i comandi, archi e curve) e
i punti. La lettura dei nomi delle icone vede ogni forma con cui l'interfaccia li chiede.

Schermate: tools/schermate (Node) diventa tools/Febe.Schermate, in C# con ClientWebSocket e
System.Text.Json, nessun pacchetto, solo verso indirizzi di questo computer. Provato contro
una dimostrazione con Edge su Windows.

Documenti: CLAUDE.md, processo, guida, LEGGIMI e docker.md aggiornati. Righe nuove in
decisioni.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-18 16:04:39 +01:00
1 parent 525d7dfdaa
commit be662f2d28
46 files changed
+2091 -283

No files matched your search

+9 -1
View File
@@ -109,7 +109,15 @@ internal sealed record CommandLine
}
else if (argument.StartsWith("/PROVA=", StringComparison.OrdinalIgnoreCase))
{
line = line with { TestRoot = Folder(argument[7..], "/PROVA=") };
// A folder of its own: its name becomes the registry key of the test (Locations.ForTest), and a root
// has no name.
var root = Folder(argument[7..], "/PROVA=");
if (Path.GetFileName(root).Length == 0)
{
throw new ArgumentException("/PROVA= vuole una cartella, non la radice di un disco.");
}
line = line with { TestRoot = root };
}
else if (argument.StartsWith("/_?=", StringComparison.Ordinal))
{
+11 -1
View File
@@ -41,7 +41,17 @@ internal static class Program
private static int RunOnWindows(CommandLine line)
{
var self = Environment.ProcessPath;
var locations = line.TestRoot is { } root ? Locations.ForTest(root) : Locations.ForUser();
Locations locations;
try
{
locations = line.TestRoot is { } root ? Locations.ForTest(root) : Locations.ForUser();
}
catch (ArgumentException ex)
{
// CommandLine.Parse already refuses what ForTest refuses: this is the last net, said like a wrong line.
return Report(ex.Message, line.Silent ? ["/S"] : []);
}
// With /S the reason of a failure goes to the standard error, in UTF-8 whatever the code page of the console.
ISetupInterface ui = line.Silent
? new SilentInterface(new StreamWriter(Console.OpenStandardError(), new System.Text.UTF8Encoding(false)) { AutoFlush = true })
+51 -11
View File
@@ -22,8 +22,11 @@ internal sealed class SetupActions(ISystemAccess system, Locations locations)
public Locations Locations => locations;
/// <summary>
/// True when Febe.exe in <paramref name="installFolder"/> is running: a running program cannot be opened for
/// writing, so it could be neither replaced nor deleted.
/// True when Febe.exe in <paramref name="installFolder"/> is running: Windows refuses to open a running program
/// for writing with a sharing violation (an <see cref="IOException"/>), so it could be neither replaced nor deleted.
/// A refusal of the permissions (read-only file, an access list) is not an open Febe: «Riprova» could never help,
/// so it is not reported here; the installation clears the read-only attribute of its own files, and what is still
/// refused comes out of the copy as «Windows non permette di scrivere qui».
/// </summary>
public static bool IsFebeOpen(string installFolder)
{
@@ -38,11 +41,11 @@ internal sealed class SetupActions(ISystemAccess system, Locations locations)
using var stream = new FileStream(executable, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite | FileShare.Delete);
return false;
}
catch (IOException)
{
return true;
}
catch (UnauthorizedAccessException)
{
return false;
}
catch (IOException)
{
return true;
}
@@ -51,6 +54,19 @@ internal sealed class SetupActions(ISystemAccess system, Locations locations)
/// <summary>The version recorded by an earlier installation, null for none.</summary>
public string? InstalledVersion() => system.ReadUserString(locations.UninstallKey, "DisplayVersion");
/// <summary>
/// The program folder recorded by an earlier installation (InstallLocation of the uninstall entry), null when
/// there is none or it is not a full path: an installation without <c>/D=</c> goes where Febe already is, so an
/// update replaces that program instead of leaving it behind with no entry in Apps installed.
/// </summary>
public string? InstalledFolder()
{
var folder = system.ReadUserString(locations.UninstallKey, "InstallLocation")?.Trim();
return folder is { Length: > 0 } && Path.IsPathFullyQualified(folder) && Path.GetFileName(Path.TrimEndingDirectorySeparator(folder)).Length > 0
? Path.TrimEndingDirectorySeparator(folder)
: null;
}
/// <summary>
/// The version of the WebView2 runtime of Microsoft, null when it is missing. The Evergreen runtime is installed for
/// the whole computer (32-bit node of the registry on 64-bit Windows) or for the user only; «0.0.0.0» means removed.
@@ -154,12 +170,12 @@ internal sealed class SetupActions(ISystemAccess system, Locations locations)
DeleteFile(locations.StartMenuShortcut);
DeleteFile(locations.DesktopShortcut);
// «Start Febe with the computer» would point to a program that is no longer there.
system.DeleteUserValue(locations.RunKey, Product.AutostartValue);
// «Start Febe with the computer» would point to a program that is no longer there. Only the values that start
// this Febe.exe, «Febe» included: a portable Febe with the default Data folder writes «Febe» for itself.
var command = $"\"{executable}\"";
foreach (var name in system.UserValueNames(locations.RunKey))
{
if (name.StartsWith(Product.AutostartPrefix, StringComparison.OrdinalIgnoreCase)
if ((name.Equals(Product.AutostartValue, StringComparison.OrdinalIgnoreCase) || name.StartsWith(Product.AutostartPrefix, StringComparison.OrdinalIgnoreCase))
&& system.ReadUserString(locations.RunKey, name) is { } value
&& value.StartsWith(command, StringComparison.OrdinalIgnoreCase))
{
@@ -195,6 +211,7 @@ internal sealed class SetupActions(ISystemAccess system, Locations locations)
try
{
write(partial);
ClearReadOnly(path);
File.Move(partial, path, overwrite: true);
}
catch
@@ -208,10 +225,24 @@ internal sealed class SetupActions(ISystemAccess system, Locations locations)
{
if (File.Exists(path))
{
ClearReadOnly(path);
File.Delete(path);
}
}
/// <summary>
/// A file of the program left read-only (by a copy, a restore, an archive): Windows refuses to replace or delete
/// it while the attribute is there. Only the attribute: an access list that says no stays a refusal.
/// </summary>
private static void ClearReadOnly(string path)
{
var file = new FileInfo(path);
if (file.Exists && file.IsReadOnly)
{
file.IsReadOnly = false;
}
}
/// <summary>The uninstaller that started this one may take a moment to end and release its file.</summary>
private void DeleteUninstaller(string path)
{
@@ -229,12 +260,21 @@ internal sealed class SetupActions(ISystemAccess system, Locations locations)
}
}
/// <summary>
/// The size for Apps installed: only the two files the installation writes. Never a walk of the folder, which may
/// be large or a drive root (<c>/D=D:\</c>) with folders nobody may read, and would fail after the program has
/// already been replaced.
/// </summary>
private static int EstimatedSizeInKb(string folder)
{
long bytes = 0;
foreach (var file in new DirectoryInfo(folder).EnumerateFiles("*", SearchOption.AllDirectories))
foreach (var name in new[] { Product.Executable, Product.Uninstaller })
{
bytes += file.Length;
var file = new FileInfo(Path.Combine(folder, name));
if (file.Exists)
{
bytes += file.Length;
}
}
return (int)Math.Min(int.MaxValue, bytes / 1024);
+3 -1
View File
@@ -88,7 +88,9 @@ internal sealed class SetupFlow(ISystemAccess system, Locations locations, ISetu
/// <summary>The installer: <paramref name="packagePath"/> is this program, with Febe.exe inside.</summary>
public int Install(string packagePath, PackageInfo package, CommandLine line)
{
var folder = line.InstallFolder ?? locations.DefaultInstallFolder;
// Without /D= an update goes where Febe already is, not to the default folder: otherwise the old program would
// stay there, orphaned, while the entry and the shortcuts moved to a second copy.
var folder = line.InstallFolder ?? _actions.InstalledFolder() ?? locations.DefaultInstallFolder;
var desktop = ui.Welcome(package.Version, _actions.InstalledVersion(), folder);
if (desktop is null)
{
@@ -6,7 +6,7 @@ namespace Febe.Installer.Windows;
[SupportedOSPlatform("windows")]
internal sealed class DialogInterface(Locations locations) : ISetupInterface
{
private const int Yes = 100;
internal const int Yes = 100;
private const int Cancel = TaskDialog.CancelId;
@@ -55,7 +55,7 @@ internal sealed class DialogInterface(Locations locations) : ISetupInterface
public bool Installed()
{
var (_, run) = TaskDialog.Show(Texts.InstallTitle, new DialogPage(
var (button, run) = TaskDialog.Show(Texts.InstallTitle, new DialogPage(
Texts.Installed,
Texts.InstalledText,
[(Yes, Texts.Finish)])
@@ -63,9 +63,15 @@ internal sealed class DialogInterface(Locations locations) : ISetupInterface
Verification = Texts.RunFebe,
VerificationChecked = true,
});
return run;
return StartsFebe(button, run);
}
/// <summary>
/// «Apri Febe adesso» counts only with «Fine»: Esc or the close button dismiss the page and start nothing, even
/// with the box ticked (Windows gives back its state on a cancel too).
/// </summary>
internal static bool StartsFebe(int button, bool runChecked) => button == Yes && runChecked;
public bool ConfirmUninstall()
{
var (button, _) = TaskDialog.Show(Texts.UninstallTitle, new DialogPage(
+3 -3
View File
@@ -248,9 +248,9 @@ scrive mai nella libreria vera e non usa la rete.
## Schermate (§10.7)
`bash tools/schermate/tutte.sh 8490` rifà le schermate di `docs/schermate/` da una dimostrazione avviata su quella
porta; `node tools/schermate/schermata.mjs <indirizzo> <file.png> [larghezza] [altezza] [attesa] [passo.js]` ne fa
una (scala 1,25, passi in `tools/schermate/passi/`). Accetta solo indirizzi di questo computer. Le differenze
`dotnet run --project tools/Febe.Schermate -- 8490` rifà le schermate di `docs/schermate/` da una dimostrazione avviata
su quella porta; `dotnet run --project tools/Febe.Schermate -- una <indirizzo> <file.png> [larghezza] [altezza] [attesa]
[passo.js]` ne fa una (scala 1,25, passi in `tools/Febe.Schermate/passi/`). Accetta solo indirizzi di questo computer. Le differenze
rimaste dai mockup sono in `docs/schermate/differenze.md`.
## Prove