Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
OrchestratorIDE.UnitTests/TestData/ContextFabric/*.txt text eol=lf
OrchestratorIDE.UnitTests/TestData/ContextFabric/*.json text eol=lf
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,7 @@ Tools/*.log
# packages). Business/product copy + pricing, kept local-only by default; not part
# of the source tree (decision 2026-06-23). Was previously only ignoring *.zip.
marketplace/

# Codex local scratch/test sandboxes — regenerable build output and one-off probes.
.codex-scratch-build/
.codex-testenv/
5 changes: 4 additions & 1 deletion OrchestratorIDE.Avalonia/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ public override void Initialize()
// Boot secret protection before any HIVE store access.
// DPAPI on Windows, AES-256-GCM (machine-key file) on Linux/macOS.
#if WINDOWS
SecretProtection.Initialize(new DpapiSecretProtector());
if (OperatingSystem.IsWindows())
SecretProtection.Initialize(new DpapiSecretProtector());
else
SecretProtection.Initialize(new AesGcmSecretProtector(OrchestratorIDE.Daemon.MachineKey.Load()));
#else
SecretProtection.Initialize(new AesGcmSecretProtector(OrchestratorIDE.Daemon.MachineKey.Load()));
#endif
Expand Down
1 change: 1 addition & 0 deletions OrchestratorIDE.Avalonia/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ await Dispatcher.UIThread.InvokeAsync(() =>

ShellTools.Register(_registry, ws, onSandboxBypass: sandboxBypass);
SearchTools.Register(_registry, ws);
FabricTools.Register(_registry, ws);
GraphTools.Register(_registry, ws);
TestTools.Register(_registry, ws);
WebTools.Register(_registry);
Expand Down
18 changes: 14 additions & 4 deletions OrchestratorIDE.Avalonia/OrchestratorIDE.Avalonia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,17 @@
<PackageReference Include="DiffPlex" Version="1.9.0" />
<PackageReference Include="LibGit2Sharp" Version="0.31.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.13.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.0" />
<PackageReference Include="System.Text.Json" Version="10.0.8" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.9" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="3.0.3" />
<PackageReference Include="SQLitePCLRaw.core" Version="3.0.3" />
<PackageReference Include="SQLitePCLRaw.provider.e_sqlite3" Version="3.0.3" />
<PackageReference Include="SQLitePCLRaw.lib.e_sqlite3" Version="3.50.3" />
<PackageReference Include="System.Text.Json" Version="10.0.9" />
<PackageReference Include="PdfPig" Version="0.1.9" />

<!-- Windows-only packages (target-OS conditioned, see _TargetsWindows above) -->
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="9.0.0" Condition="'$(_TargetsWindows)' == 'true'" />
<PackageReference Include="SharpAvi" Version="2.2.1" Condition="'$(_TargetsWindows)' == 'true'" />
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="10.0.9" Condition="'$(_TargetsWindows)' == 'true'" />
<PackageReference Include="SharpAvi" Version="3.0.1" Condition="'$(_TargetsWindows)' == 'true'" />
</ItemGroup>

<!-- ── Embedded resources (same as WPF project) ────────────────────────── -->
Expand Down Expand Up @@ -172,6 +177,10 @@
<Compile Include="..\OrchestratorIDE\Services\ContextFabric\FabricSegmenter.cs" />
<Compile Include="..\OrchestratorIDE\Services\ContextFabric\FabricLibraryRepository.cs" />
<Compile Include="..\OrchestratorIDE\Services\ContextFabric\FabricLibraryService.cs" />
<Compile Include="..\OrchestratorIDE\Services\ContextFabric\DocumentGraphRepository.cs" />
<Compile Include="..\OrchestratorIDE\Services\ContextFabric\FabricEvidenceGraphImporter.cs" />
<Compile Include="..\OrchestratorIDE\Services\ContextFabric\FabricNativeReaderService.cs" />
<Compile Include="..\OrchestratorIDE\Services\ContextFabric\FabricSearchService.cs" />
<!-- CodeGraph v1 (step 1+) — shared with WPF via explicit include (Avalonia_Migration.md discipline) -->
<Compile Include="..\OrchestratorIDE\Services\CodeGraph\GraphModels.cs" />
<Compile Include="..\OrchestratorIDE\Services\CodeGraph\ComplexityAnalyzer.cs" />
Expand Down Expand Up @@ -261,6 +270,7 @@

<!-- Tools -->
<Compile Include="..\OrchestratorIDE\Tools\FileTools.cs" />
<Compile Include="..\OrchestratorIDE\Tools\FabricTools.cs" />
<Compile Include="..\OrchestratorIDE\Tools\SearchTools.cs" />
<Compile Include="..\OrchestratorIDE\Tools\ShellTools.cs" />
<Compile Include="..\OrchestratorIDE\Tools\TestTools.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<Compile Include="..\OrchestratorIDE\Services\ContextFabric\ContextFabricBenchmarkExpansionWriter.cs" Link="ContextFabric\ContextFabricBenchmarkExpansionWriter.cs" />
<Compile Include="..\OrchestratorIDE\Services\ContextFabric\ContextFabricFeasibilityRunner.cs" Link="ContextFabric\ContextFabricFeasibilityRunner.cs" />
<Compile Include="..\OrchestratorIDE\Services\ContextFabric\ContextFabricReportWriter.cs" Link="ContextFabric\ContextFabricReportWriter.cs" />
<Compile Include="..\OrchestratorIDE\Services\ContextFabric\FabricBoundaryStitcher.cs" Link="ContextFabric\FabricBoundaryStitcher.cs" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion OrchestratorIDE.UITests/OrchestratorIDE.UITests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="FlaUI.UIA3" Version="4.0.0" />

<!-- Screen recording during tests (same library as main app F12 recorder) -->
<PackageReference Include="SharpAvi" Version="2.2.1" />
<PackageReference Include="SharpAvi" Version="3.0.1" />

<!-- Override System.Drawing.Common to a version without the critical CVE
(NU1904 — GHSA-rxg9-xrhp-64gj) pulled in transitively by FlaUI -->
Expand Down
29 changes: 20 additions & 9 deletions OrchestratorIDE.UITests/TestVideoRecorder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public GdiMjpegEncoder(int width, int height, int quality)
}

// IVideoEncoder
public FourCC Codec => KnownFourCCs.Codecs.MotionJpeg;
public FourCC Codec => CodecIds.MotionJpeg;
public BitsPerPixel BitsPerPixel => BitsPerPixel.Bpp24;

/// <summary>
Expand All @@ -238,25 +238,36 @@ public int EncodeFrame(byte[] source, int srcOffset,
out bool isKeyFrame)
{
isKeyFrame = true; // MJPEG — every frame is a keyframe
var jpeg = EncodeFrameToJpeg(source.AsSpan(srcOffset));
Buffer.BlockCopy(jpeg, 0, destination, destOffset, jpeg.Length);
return jpeg.Length;
}

// Copy raw BGR32 pixels into a temporary GDI bitmap
using var bmp = new Bitmap(_width, _height, PixelFormat.Format32bppRgb);
public int EncodeFrame(ReadOnlySpan<byte> source, Span<byte> destination, out bool isKeyFrame)
{
// ponytail: test-only adapter for SharpAvi 3 span API; keep array path as the single implementation.
isKeyFrame = true;
var jpeg = EncodeFrameToJpeg(source);
jpeg.CopyTo(destination);
return jpeg.Length;
}

private byte[] EncodeFrameToJpeg(ReadOnlySpan<byte> source)
{
var raw = source.ToArray();
using var bmp = new Bitmap(_width, _height, PixelFormat.Format32bppRgb);
var bits = bmp.LockBits(new Rectangle(0, 0, _width, _height),
ImageLockMode.WriteOnly,
PixelFormat.Format32bppRgb);
try
{
var stride = Math.Abs(bits.Stride);
Marshal.Copy(source, srcOffset, bits.Scan0, _height * stride);
Marshal.Copy(raw, 0, bits.Scan0, _height * stride);
Comment on lines +257 to +265

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

git ls-files 'OrchestratorIDE.UITests/TestVideoRecorder.cs'
wc -l OrchestratorIDE.UITests/TestVideoRecorder.cs
sed -n '220,290p' OrchestratorIDE.UITests/TestVideoRecorder.cs

Repository: hardcoreerik/TheOrc

Length of output: 2246


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n "EncodeFrameToJpeg|EncodeFrame\\(" OrchestratorIDE.UITests/TestVideoRecorder.cs OrchestratorIDE.UITests -g '!**/bin/**' -g '!**/obj/**'

Repository: hardcoreerik/TheOrc

Length of output: 1307


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,220p' OrchestratorIDE.UITests/TestVideoRecorder.cs

Repository: hardcoreerik/TheOrc

Length of output: 7842


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n "_height \\* stride|byteCount|ArgumentException|Marshal\\.Copy\\(" OrchestratorIDE.UITests/TestVideoRecorder.cs

Repository: hardcoreerik/TheOrc

Length of output: 293


Restore the frame-size check in EncodeFrameToJpeg. Marshal.Copy now handles short buffers implicitly, so a truncated frame raises a low-level exception instead of an explicit argument check. Add the length guard back before copying.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@OrchestratorIDE.UITests/TestVideoRecorder.cs` around lines 257 - 265, Restore
the explicit frame-size validation in EncodeFrameToJpeg before the Marshal.Copy
call, since the current path no longer rejects truncated input up front and can
fail with a low-level exception. Add the length guard back using the existing
raw buffer and bits/stride values in TestVideoRecorder so short frames are
detected and handled before copying into the Bitmap.

}
finally { bmp.UnlockBits(bits); }

// JPEG-encode into a MemoryStream, then copy into destination buffer
using var ms = new MemoryStream();
bmp.Save(ms, _jpegCodec, _encParams);

var jpeg = ms.ToArray();
Buffer.BlockCopy(jpeg, 0, destination, destOffset, jpeg.Length);
return jpeg.Length;
return ms.ToArray();
}
}
Loading
Loading