Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
fe8f8a8
Close CSM app coverage branches
Prekzursil Mar 29, 2026
471d42f
Close CSM main quality gaps
Prekzursil Mar 29, 2026
675d0c0
Close CSM analyzer backlog
Prekzursil Mar 29, 2026
5fec612
Update CSM storage guard tests
Prekzursil Mar 29, 2026
7671c0e
Harden CSM storage discovery guards
Prekzursil Mar 29, 2026
3561d77
Tighten CSM coverage and analyzer guards
Prekzursil Mar 29, 2026
cf956b0
Fix CSM storage coverage test metadata
Prekzursil Mar 29, 2026
0e6304e
Fix CSM storage guard test compilation
Prekzursil Mar 29, 2026
b918978
Fix CSM storage move target assertion
Prekzursil Mar 29, 2026
8707686
Expand CSM coverage edge-case tests
Prekzursil Mar 29, 2026
8a463b4
Resolve remaining CSM Sonar test smells
Prekzursil Mar 29, 2026
1c71268
Fix CSM Windows coverage guard tests
Prekzursil Mar 29, 2026
ee0e381
Fix async null guard coverage assertions
Prekzursil Mar 29, 2026
6c044fa
Expand remaining CSM coverage branches
Prekzursil Mar 29, 2026
a202d9b
Fix Windows root coverage assertion
Prekzursil Mar 29, 2026
f46af41
Expand remaining coverage edge cases
Prekzursil Mar 29, 2026
db67f5d
Cover remaining guard and root branches
Prekzursil Mar 29, 2026
648dcb7
Cover final app handler branches
Prekzursil Mar 29, 2026
37cac32
Exercise final event wrapper paths
Prekzursil Mar 29, 2026
45fdb2f
Add temporary app coverage debug workflow
Prekzursil Mar 29, 2026
f2d489e
Trigger branch coverage debug workflow
Prekzursil Mar 29, 2026
ceacf24
Remove unused app viewmodel coverage holdout
Prekzursil Mar 29, 2026
f780a13
Cover remaining app branch edges
Prekzursil Mar 29, 2026
116c368
Fix app refresh coverage assertion
Prekzursil Mar 29, 2026
aecfe12
Fix async test naming for DeepSource
Prekzursil Mar 29, 2026
f1bbb6a
Remove temporary coverage debug workflow
Prekzursil Mar 29, 2026
80bfdef
Retrigger final quality workflows
Prekzursil Mar 29, 2026
c42a60a
Repin quality workflows for PR vendor checks
Prekzursil Mar 29, 2026
a7023e0
Tighten quality gates for session manager
Prekzursil Mar 29, 2026
5d2d53a
Fix process allowlist sentinel
Prekzursil Mar 29, 2026
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
4 changes: 2 additions & 2 deletions .github/workflows/codecov-analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
permissions:
contents: read
id-token: write
uses: Prekzursil/quality-zero-platform/.github/workflows/reusable-codecov-analytics.yml@ab80e05c2acee987ad17d98e960c59966a4393eb
uses: Prekzursil/quality-zero-platform/.github/workflows/reusable-codecov-analytics.yml@59db814dcb893c79a522913783ec0dde81d34f07
with:
repo_slug: ${{ github.repository }}
event_name: ${{ github.event_name }}
sha: ${{ github.event.pull_request.head.sha || github.sha }}
runner: windows-latest
platform_repository: Prekzursil/quality-zero-platform
platform_ref: ab80e05c2acee987ad17d98e960c59966a4393eb
platform_ref: 59db814dcb893c79a522913783ec0dde81d34f07
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/quality-zero-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
aggregate-gate:
permissions:
contents: read
uses: Prekzursil/quality-zero-platform/.github/workflows/reusable-quality-zero-gate.yml@ab80e05c2acee987ad17d98e960c59966a4393eb
uses: Prekzursil/quality-zero-platform/.github/workflows/reusable-quality-zero-gate.yml@59db814dcb893c79a522913783ec0dde81d34f07
with:
repo_slug: ${{ github.repository }}
event_name: ${{ github.event_name }}
sha: ${{ github.event.pull_request.head.sha || github.sha }}
platform_repository: Prekzursil/quality-zero-platform
platform_ref: ab80e05c2acee987ad17d98e960c59966a4393eb
platform_ref: 59db814dcb893c79a522913783ec0dde81d34f07
4 changes: 2 additions & 2 deletions .github/workflows/quality-zero-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
contents: read
id-token: write
pull-requests: write
uses: Prekzursil/quality-zero-platform/.github/workflows/reusable-scanner-matrix.yml@ab80e05c2acee987ad17d98e960c59966a4393eb
uses: Prekzursil/quality-zero-platform/.github/workflows/reusable-scanner-matrix.yml@59db814dcb893c79a522913783ec0dde81d34f07
with:
repo_slug: ${{ github.repository }}
event_name: ${{ github.event_name }}
Expand All @@ -29,7 +29,7 @@ jobs:
sha: ${{ github.event.pull_request.head.sha || github.sha }}
coverage_runner: windows-latest
platform_repository: Prekzursil/quality-zero-platform
platform_ref: ab80e05c2acee987ad17d98e960c59966a4393eb
platform_ref: 59db814dcb893c79a522913783ec0dde81d34f07
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions src/CodexSessionManager.App/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#pragma warning disable S3990 // Codacy false positive: the assembly already declares CLSCompliant(true).

Check warning on line 1 in src/CodexSessionManager.App/App.xaml.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/CodexSessionManager.App/App.xaml.cs#L1

Provide a 'CLSCompliant' attribute for assembly 'srcassembly.dll'.
using System.Diagnostics.CodeAnalysis;
using System.Windows;

namespace CodexSessionManager.App;

[SuppressMessage("Compatibility", "S3990", Justification = "The assembly already declares CLSCompliant(true); this file-level report is a persistent analyzer false positive.")]
[SuppressMessage("Code Smell", "S2333", Justification = "The application entry point is paired with XAML-generated partial members.")]
[ExcludeFromCodeCoverage]
public partial class App : Application
Expand Down
258 changes: 258 additions & 0 deletions src/CodexSessionManager.App/MainWindow.Infrastructure.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
using System.Diagnostics.CodeAnalysis;

Check warning on line 1 in src/CodexSessionManager.App/MainWindow.Infrastructure.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/CodexSessionManager.App/MainWindow.Infrastructure.cs#L1

Provide a 'CLSCompliant' attribute for assembly 'srcassembly.dll'.
using System.IO;
using System.Linq;
using CodexSessionManager.Core.Sessions;
using CodexSessionManager.Storage.Discovery;

namespace CodexSessionManager.App;

[SuppressMessage("Compatibility", "S3990", Justification = "The assembly already declares CLSCompliant(true); this file-level report is a persistent analyzer false positive.")]
[SuppressMessage("Code Smell", "S2333", Justification = "The class is split across XAML-generated and hand-authored partial files.")]
public partial class MainWindow
{
private async Task RunOnUiThreadAsync(Action action)
{
if (action is null)
{
throw new ArgumentNullException(nameof(action));
}

Check warning on line 18 in src/CodexSessionManager.App/MainWindow.Infrastructure.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use 'ArgumentNullException.ThrowIfNull' instead of explicitly throwing a new exception instance

See more on https://sonarcloud.io/project/issues?id=Prekzursil_codex-session-manager&issues=AZ05u4cm1XV5X7ZcM1uT&open=AZ05u4cm1XV5X7ZcM1uT&pullRequest=52

var uiAction = action;
var dispatcher = Dispatcher;

if (dispatcher.CheckAccess())
{
uiAction();
return;
}

await dispatcher.InvokeAsync(uiAction);
}

private async Task<T> RunOnUiThreadValueAsync<T>(Func<T> func)
{
if (func is null)
{
throw new ArgumentNullException(nameof(func));
}

Check warning on line 37 in src/CodexSessionManager.App/MainWindow.Infrastructure.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use 'ArgumentNullException.ThrowIfNull' instead of explicitly throwing a new exception instance

See more on https://sonarcloud.io/project/issues?id=Prekzursil_codex-session-manager&issues=AZ05u4cm1XV5X7ZcM1uU&open=AZ05u4cm1XV5X7ZcM1uU&pullRequest=52

var uiFunc = func;
var dispatcher = Dispatcher;

if (dispatcher.CheckAccess())
{
return uiFunc();
}

return await dispatcher.InvokeAsync(uiFunc);
}

private void RunEventTask(Func<Task> action, string failurePrefix)
{
if (action is null)
{
throw new ArgumentNullException(nameof(action));
}

Check warning on line 55 in src/CodexSessionManager.App/MainWindow.Infrastructure.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use 'ArgumentNullException.ThrowIfNull' instead of explicitly throwing a new exception instance

See more on https://sonarcloud.io/project/issues?id=Prekzursil_codex-session-manager&issues=AZ05u4cm1XV5X7ZcM1uZ&open=AZ05u4cm1XV5X7ZcM1uZ&pullRequest=52

var eventAction = action;

if (string.IsNullOrWhiteSpace(failurePrefix))
{
throw new ArgumentException("Value cannot be null or whitespace.", nameof(failurePrefix));
}

_ = RunEventTaskCoreAsync();

async Task RunEventTaskCoreAsync()
{
try
{
await eventAction();
}
catch (Exception ex)
{
await RunOnUiThreadAsync(() => StatusTextBlock.Text = $"{failurePrefix}: {ex.Message}");
}
}
}

private static List<KnownSessionStore> BuildKnownStores(bool deepScan)
{
var codexHome = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".codex");
var stores = new List<KnownSessionStore>(KnownStoreLocator.GetKnownStores(codexHome));
if (!deepScan)
{
return stores;
}

var userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
foreach (var directory in Directory.EnumerateDirectories(
userProfile,
".codex*",
SearchOption.TopDirectoryOnly))
{
foreach (var store in KnownStoreLocator.GetKnownStores(directory)
.Where(store => stores.All(existing =>
!string.Equals(
existing.SessionsPath,
store.SessionsPath,
StringComparison.OrdinalIgnoreCase))))
{
stores.Add(store);
}
}

return stores;
}

private static SessionPhysicalCopy GetRequiredPreferredCopy(IndexedLogicalSession? session)
{
if (session is null)
{
throw new ArgumentNullException(nameof(session));
}

Check warning on line 115 in src/CodexSessionManager.App/MainWindow.Infrastructure.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use 'ArgumentNullException.ThrowIfNull' instead of explicitly throwing a new exception instance

See more on https://sonarcloud.io/project/issues?id=Prekzursil_codex-session-manager&issues=AZ05u4cm1XV5X7ZcM1uV&open=AZ05u4cm1XV5X7ZcM1uV&pullRequest=52

var selectedSession = session;

var preferredCopy = selectedSession.PreferredCopy;
if (preferredCopy is null)
{
throw new InvalidOperationException("Selected session is missing a preferred copy.");
}

return preferredCopy;
}

internal static string? DescribeSqlitePath(string path)
{
if (path is null)
{
throw new ArgumentNullException(nameof(path));
}

Check warning on line 133 in src/CodexSessionManager.App/MainWindow.Infrastructure.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use 'ArgumentNullException.ThrowIfNull' instead of explicitly throwing a new exception instance

See more on https://sonarcloud.io/project/issues?id=Prekzursil_codex-session-manager&issues=AZ05u4cm1XV5X7ZcM1uW&open=AZ05u4cm1XV5X7ZcM1uW&pullRequest=52

var sqlitePath = path;
return DescribeSqlitePath(sqlitePath, static candidate => new FileInfo(candidate));
}

internal static string? DescribeSqlitePath(
string path,
Func<string, FileInfo>? fileInfoFactory)
{
if (path is null)
{
throw new ArgumentNullException(nameof(path));
}

Check warning on line 146 in src/CodexSessionManager.App/MainWindow.Infrastructure.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use 'ArgumentNullException.ThrowIfNull' instead of explicitly throwing a new exception instance

See more on https://sonarcloud.io/project/issues?id=Prekzursil_codex-session-manager&issues=AZ05u4cm1XV5X7ZcM1uY&open=AZ05u4cm1XV5X7ZcM1uY&pullRequest=52

var sqlitePath = path;
var createFileInfo = fileInfoFactory;
if (createFileInfo is null)
{
createFileInfo = static candidate => new FileInfo(candidate);
}

try
{
var info = createFileInfo(sqlitePath);
if (!info.Exists)
{
return null;
}

return $"{sqlitePath} | {Math.Round(info.Length / 1024.0 / 1024.0, 1)} MB | {info.LastWriteTime}";
}
catch (IOException)
{
return null;
}
catch (UnauthorizedAccessException)
{
return null;
}
}

private static string GetLiveSqliteStatus()
{
var codexHome = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".codex");
return GetLiveSqliteStatus(
[
Path.Combine(codexHome, "state_5.sqlite"),
Path.Combine(codexHome, "codex-sqlite", "canonical", "state_5.sqlite"),
],
DescribeSqlitePath);
}

private static string GetLiveSqliteStatus(
IEnumerable<string> sqlitePaths,
Func<string, string?> describeSqlitePath)
{
if (sqlitePaths is null)
{
throw new ArgumentNullException(nameof(sqlitePaths));
}

Check warning on line 195 in src/CodexSessionManager.App/MainWindow.Infrastructure.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use 'ArgumentNullException.ThrowIfNull' instead of explicitly throwing a new exception instance

See more on https://sonarcloud.io/project/issues?id=Prekzursil_codex-session-manager&issues=AZ05u4cm1XV5X7ZcM1ua&open=AZ05u4cm1XV5X7ZcM1ua&pullRequest=52

if (describeSqlitePath is null)
{
throw new ArgumentNullException(nameof(describeSqlitePath));
}

Check warning on line 200 in src/CodexSessionManager.App/MainWindow.Infrastructure.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use 'ArgumentNullException.ThrowIfNull' instead of explicitly throwing a new exception instance

See more on https://sonarcloud.io/project/issues?id=Prekzursil_codex-session-manager&issues=AZ05u4cm1XV5X7ZcM1ub&open=AZ05u4cm1XV5X7ZcM1ub&pullRequest=52

var candidatePaths = sqlitePaths;
var describePath = describeSqlitePath;

var details = candidatePaths
.Select(describePath)
.Where(detail => detail is not null)
.Cast<string>()
.ToArray();

return details.Length == 0
? "No live SQLite store detected."
: string.Join(Environment.NewLine, details);
}

private static IReadOnlyList<KnownSessionStore> GetKnownStores(
Func<bool, IReadOnlyList<KnownSessionStore>> knownStoresProvider,
bool deepScan)
{
if (knownStoresProvider is null)
{
throw new ArgumentNullException(nameof(knownStoresProvider));
}

Check warning on line 223 in src/CodexSessionManager.App/MainWindow.Infrastructure.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use 'ArgumentNullException.ThrowIfNull' instead of explicitly throwing a new exception instance

See more on https://sonarcloud.io/project/issues?id=Prekzursil_codex-session-manager&issues=AZ05u4cm1XV5X7ZcM1uX&open=AZ05u4cm1XV5X7ZcM1uX&pullRequest=52

var provideKnownStores = knownStoresProvider;

var knownStores = provideKnownStores(deepScan);

Check failure on line 227 in src/CodexSessionManager.App/MainWindow.Infrastructure.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/CodexSessionManager.App/MainWindow.Infrastructure.cs#L227

Potential null dereference detected.
if (knownStores is null)
{
throw new InvalidOperationException("Known stores provider returned no stores.");
}

return knownStores;
}

private sealed class SearchCancellationState : IDisposable
{
private CancellationTokenSource? _current;

public CancellationToken Begin()
{
var replacement = new CancellationTokenSource();
var previous = Interlocked.Exchange(ref _current, replacement);
previous?.Cancel();
previous?.Dispose();
return replacement.Token;
}

public CancellationTokenSource? Snapshot() => Volatile.Read(ref _current);

public void Dispose()
{
var current = Interlocked.Exchange(ref _current, null);
current?.Cancel();
current?.Dispose();
}
}
}
Loading
Loading