diff --git a/.gitattributes b/.gitattributes index 066abb179..d92409d42 100644 --- a/.gitattributes +++ b/.gitattributes @@ -11,7 +11,11 @@ media/**/*.pptx filter=lfs diff=lfs merge=lfs -text media/**/*.png filter=lfs diff=lfs merge=lfs -text media/**/*.ico filter=lfs diff=lfs merge=lfs -text media/**/*.icns filter=lfs diff=lfs merge=lfs -text -*.woff2 filter=lfs diff=lfs merge=lfs -text *.afpub filter=lfs diff=lfs merge=lfs -text *.afdesign filter=lfs diff=lfs merge=lfs -text -*.afphoto filter=lfs diff=lfs merge=lfs -text \ No newline at end of file +*.afphoto filter=lfs diff=lfs merge=lfs -text + +# Files which the app or the runtime ships never go into Git LFS: the pipeline and the Flatpak check +# out without LFS, so a release would ship the pointer instead of the file. WebRootFilesTests checks +# the files the app embeds. +*.woff2 binary \ No newline at end of file diff --git a/app/MindWork AI Studio/wwwroot/changelog/v26.11.2.md b/app/MindWork AI Studio/wwwroot/changelog/v26.11.2.md index a9d9095f6..7e9969bdb 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v26.11.2.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v26.11.2.md @@ -22,4 +22,5 @@ - Fixed the translation, agenda, and e-mail assistants checking your input again and again in the background, about once a second, even while you weren't typing. - Fixed the translation assistant complaining about a missing text before you had typed anything, e.g., right after you switched the live translation on or off. - Fixed text fields in assistants and dialogs which kept showing a missing or invalid input while you typed, until you left the field. They now check your input again half a second after you stop typing. -- Fixed AI Studio claiming that the provider had returned an invalid tool calling response when you stopped an answer while the AI was still thinking and could use tools. The same false message no longer follows a timeout or a lost connection either, which AI Studio reports on its own. \ No newline at end of file +- Fixed AI Studio claiming that the provider had returned an invalid tool calling response when you stopped an answer while the AI was still thinking and could use tools. The same false message no longer follows a timeout or a lost connection either, which AI Studio reports on its own. +- Fixed the fonts of AI Studio, which were missing from all released versions. Your computer used fonts of its own instead; now, texts and code appear in the fonts we chose for AI Studio. \ No newline at end of file diff --git a/app/MindWork AI Studio/wwwroot/fonts/JetBrainsMono-Regular.woff2 b/app/MindWork AI Studio/wwwroot/fonts/JetBrainsMono-Regular.woff2 index e8e836bbc..66c54672c 100644 Binary files a/app/MindWork AI Studio/wwwroot/fonts/JetBrainsMono-Regular.woff2 and b/app/MindWork AI Studio/wwwroot/fonts/JetBrainsMono-Regular.woff2 differ diff --git a/app/MindWork AI Studio/wwwroot/fonts/lucide.woff2 b/app/MindWork AI Studio/wwwroot/fonts/lucide.woff2 index f2572643c..dce894a40 100644 Binary files a/app/MindWork AI Studio/wwwroot/fonts/lucide.woff2 and b/app/MindWork AI Studio/wwwroot/fonts/lucide.woff2 differ diff --git a/app/MindWork AI Studio/wwwroot/fonts/roboto-v30-latin-300.woff2 b/app/MindWork AI Studio/wwwroot/fonts/roboto-v30-latin-300.woff2 index 53c8d9ef0..60681387e 100644 Binary files a/app/MindWork AI Studio/wwwroot/fonts/roboto-v30-latin-300.woff2 and b/app/MindWork AI Studio/wwwroot/fonts/roboto-v30-latin-300.woff2 differ diff --git a/app/MindWork AI Studio/wwwroot/fonts/roboto-v30-latin-500.woff2 b/app/MindWork AI Studio/wwwroot/fonts/roboto-v30-latin-500.woff2 index 274bbfe67..29342a8de 100644 Binary files a/app/MindWork AI Studio/wwwroot/fonts/roboto-v30-latin-500.woff2 and b/app/MindWork AI Studio/wwwroot/fonts/roboto-v30-latin-500.woff2 differ diff --git a/app/MindWork AI Studio/wwwroot/fonts/roboto-v30-latin-700.woff2 b/app/MindWork AI Studio/wwwroot/fonts/roboto-v30-latin-700.woff2 index b3acbb2c7..771fbeccc 100644 Binary files a/app/MindWork AI Studio/wwwroot/fonts/roboto-v30-latin-700.woff2 and b/app/MindWork AI Studio/wwwroot/fonts/roboto-v30-latin-700.woff2 differ diff --git a/app/MindWork AI Studio/wwwroot/fonts/roboto-v30-latin-regular.woff2 b/app/MindWork AI Studio/wwwroot/fonts/roboto-v30-latin-regular.woff2 index 1c04a1def..020729ef8 100644 Binary files a/app/MindWork AI Studio/wwwroot/fonts/roboto-v30-latin-regular.woff2 and b/app/MindWork AI Studio/wwwroot/fonts/roboto-v30-latin-regular.woff2 differ diff --git a/app/Tests/Tools/AppAccess/WebRootFilesTests.cs b/app/Tests/Tools/AppAccess/WebRootFilesTests.cs index bd2063790..026c00087 100644 --- a/app/Tests/Tools/AppAccess/WebRootFilesTests.cs +++ b/app/Tests/Tools/AppAccess/WebRootFilesTests.cs @@ -1,4 +1,5 @@ using System.Runtime.CompilerServices; +using System.Text; using System.Text.RegularExpressions; using AIStudio.Assistants.ERI; @@ -13,15 +14,47 @@ namespace AIStudio.Tests.Tools.AppAccess; /// can serve every file which the page of the app loads. /// /// +/// /// The changelogs and the ERI specifications come from the files embedded into the app, not from a /// request to its own server. A file which is missing there would leave the changelog or the ERI /// assistant empty without any error. The release serves its static files from the same embedded /// files; one which is missing there leaves the window without styles, or without any interaction /// at all, while a debug build keeps working. +/// +/// +/// The pipeline checks the repository out without Git LFS, and so does the Flatpak build. A file in +/// Git LFS would therefore be embedded as its pointer, a short text, and the release would ship that +/// pointer instead of the file: a font, for example, would turn every icon into a box. Locally, with +/// Git LFS installed, the files are there and these checks pass anyway; the job verify of the +/// pipeline, which every release build waits for, is where they catch it. +/// /// [TestFixture] public sealed class WebRootFilesTests { + /// + /// The first line of every Git LFS pointer, see https://github.com/git-lfs/git-lfs/blob/main/docs/spec.md. + /// + private const string GIT_LFS_POINTER_START = "version https://git-lfs.github.com/spec/v1"; + + /// + /// The first four bytes of every WOFF2 font. + /// + private const string WOFF2_SIGNATURE = "wOF2"; + + private static string[] EmbeddedFiles() => typeof(WebRootFiles).Assembly.GetManifestResourceNames(); + + /// + /// Reads the start of an embedded file, never the whole of it, with one character per byte. + /// + private static string ReadStart(string resourceName, int length) + { + using var stream = typeof(WebRootFiles).Assembly.GetManifestResourceStream(resourceName)!; + var buffer = new byte[length]; + var read = stream.ReadAtLeast(buffer, length, throwOnEndOfStream: false); + return Encoding.Latin1.GetString(buffer, 0, read); + } + private static IEnumerable ChangelogFiles() => Changelog.LOGS.Select(log => log.Filename); private static IEnumerable SpecificationVersions() => Enum.GetValues().Where(version => version.WasSpecificationSelected); @@ -50,6 +83,34 @@ public sealed class WebRootFilesTests Assert.That(file.Length, Is.GreaterThan(0), $"The release would serve '{path}' as an empty file."); } + [Test] + public void NoEmbeddedFileIsAGitLfsPointer() + { + var pointers = EmbeddedFiles() + .Where(name => ReadStart(name, GIT_LFS_POINTER_START.Length) == GIT_LFS_POINTER_START) + .ToList(); + + Assert.That(pointers, Is.Empty, "The release would ship these Git LFS pointers instead of the files. Take them out of Git LFS, see .gitattributes."); + } + + [Test] + public void EveryEmbeddedFontIsAWoff2Font() + { + var fonts = EmbeddedFiles() + .Where(name => name.EndsWith(".woff2", StringComparison.OrdinalIgnoreCase)) + .ToList(); + + var broken = fonts + .Where(name => ReadStart(name, WOFF2_SIGNATURE.Length) != WOFF2_SIGNATURE) + .ToList(); + + using (Assert.EnterMultipleScope()) + { + Assert.That(fonts, Has.Some.EndsWith("lucide.woff2"), "The test no longer finds the icon font among the embedded files."); + Assert.That(broken, Is.Empty, "The release would ship these fonts broken: the app would show no icons, and its texts in a font of the system."); + } + } + [TestCaseSource(nameof(ChangelogFiles))] public async Task EveryChangelogCanBeRead(string filename) {