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
29 changes: 0 additions & 29 deletions .github/workflows/codecov-analytics.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/quality-zero-backlog.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/quality-zero-gate.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/quality-zero-platform.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/quality-zero-remediation.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/semgrep.yml

This file was deleted.

70 changes: 0 additions & 70 deletions .github/workflows/sonarcloud.yml

This file was deleted.

18 changes: 9 additions & 9 deletions src/CodexSessionManager.App/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public MainWindow()
MaintenanceActionComboBox.ItemsSource = Enum.GetValues<MaintenanceAction>();
MaintenanceActionComboBox.SelectedItem = MaintenanceAction.Archive;
LocalDataRootProvider = () =>
Path.Combine(
Path.Join(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"CodexSessionManager");
RepositoryFactory = databasePath => new SessionCatalogRepository(databasePath);
Expand Down Expand Up @@ -80,11 +80,11 @@ private async Task InitializeAsync()
{
var localDataRoot = LocalDataRootProvider();
Directory.CreateDirectory(localDataRoot);
await RunOnUiThreadAsync(() => DestinationRootTextBox.Text = Path.Combine(localDataRoot, "maintenance", "archive"));
await RunOnUiThreadAsync(() => DestinationRootTextBox.Text = Path.Join(localDataRoot, "maintenance", "archive"));

_repository = RepositoryFactory(Path.Combine(localDataRoot, "catalog.db"));
_repository = RepositoryFactory(Path.Join(localDataRoot, "catalog.db"));
_workspaceIndexer = WorkspaceIndexerFactory(_repository);
_maintenanceExecutor = MaintenanceExecutorFactory(Path.Combine(localDataRoot, "checkpoints"));
_maintenanceExecutor = MaintenanceExecutorFactory(Path.Join(localDataRoot, "checkpoints"));

await _repository.InitializeAsync(CancellationToken.None);
await LoadSessionsFromCatalogAsync();
Expand Down Expand Up @@ -178,7 +178,7 @@ private Task<T> RunOnUiThreadValueAsync<T>(Func<T> func)

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

if (!deepScan)
Expand Down Expand Up @@ -361,7 +361,7 @@ await RunOnUiThreadAsync(() =>

if (string.IsNullOrWhiteSpace(destinationRoot))
{
destinationRoot = Path.Combine(
destinationRoot = Path.Join(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"CodexSessionManager",
"maintenance",
Expand Down Expand Up @@ -411,12 +411,12 @@ private async void ExecuteMaintenanceButton_OnClick(object _, RoutedEventArgs __

private static string GetLiveSqliteStatus()
{
var codexHome = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".codex");
var codexHome = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".codex");
return GetLiveSqliteStatus(
new[]
{
Path.Combine(codexHome, "state_5.sqlite"),
Path.Combine(codexHome, "codex-sqlite", "canonical", "state_5.sqlite")
Path.Join(codexHome, "state_5.sqlite"),
Path.Join(codexHome, "codex-sqlite", "canonical", "state_5.sqlite")
},
path => DescribeSqlitePath(path, fileInfoFactory: null));
}
Expand Down
13 changes: 9 additions & 4 deletions src/CodexSessionManager.Storage/Discovery/KnownStoreLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,23 @@ public static class KnownStoreLocator
{
public static IReadOnlyList<KnownSessionStore> GetKnownStores(string codexHome)
{
// Preserve the previous fail-fast contract: Path.Combine threw on a null
// root, whereas Path.Join does not. Keep the explicit guard so behavior
// is unchanged after the Path.Combine -> Path.Join migration.
ArgumentNullException.ThrowIfNull(codexHome);

return // nosemgrep: codacy.csharp.security.null-dereference -- false positive after constructor/guard validation.
[
new KnownSessionStore(
codexHome,
SessionStoreKind.Live,
Path.Combine(codexHome, "sessions"),
Path.Combine(codexHome, "session_index.jsonl")),
Path.Join(codexHome, "sessions"),
Path.Join(codexHome, "session_index.jsonl")),
new KnownSessionStore(
codexHome,
SessionStoreKind.Backup,
Path.Combine(codexHome, "sessions_backup"),
Path.Combine(codexHome, "session_index.jsonl"))
Path.Join(codexHome, "sessions_backup"),
Path.Join(codexHome, "session_index.jsonl"))
];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ private static KnownSessionStore CreateKnownSessionStore(SessionStoreRoot root)

return root.StoreKind switch // nosemgrep: codacy.csharp.security.null-dereference -- false positive after constructor/guard validation.
{
SessionStoreKind.Live => new KnownSessionStore(normalizedRoot, root.StoreKind, Path.Combine(normalizedRoot, "sessions"), Path.Combine(normalizedRoot, "session_index.jsonl")), // nosemgrep: codacy.csharp.security.null-dereference -- false positive after constructor/guard validation.
SessionStoreKind.Live => new KnownSessionStore(normalizedRoot, root.StoreKind, Path.Join(normalizedRoot, "sessions"), Path.Join(normalizedRoot, "session_index.jsonl")), // nosemgrep: codacy.csharp.security.null-dereference -- false positive after constructor/guard validation.
SessionStoreKind.Backup when normalizedRoot.EndsWith(@"\sessions_backup", StringComparison.OrdinalIgnoreCase)
=> new KnownSessionStore(normalizedBackupWorkspaceRoot, root.StoreKind, normalizedRoot, Path.Combine(normalizedBackupWorkspaceRoot, "session_index.jsonl")), // nosemgrep: codacy.csharp.security.null-dereference -- false positive after constructor/guard validation.
_ => new KnownSessionStore(normalizedRoot, root.StoreKind, normalizedRoot, Path.Combine(normalizedRoot, "session_index.jsonl")) // nosemgrep: codacy.csharp.security.null-dereference -- false positive after constructor/guard validation.
=> new KnownSessionStore(normalizedBackupWorkspaceRoot, root.StoreKind, normalizedRoot, Path.Join(normalizedBackupWorkspaceRoot, "session_index.jsonl")), // nosemgrep: codacy.csharp.security.null-dereference -- false positive after constructor/guard validation.
_ => new KnownSessionStore(normalizedRoot, root.StoreKind, normalizedRoot, Path.Join(normalizedRoot, "session_index.jsonl")) // nosemgrep: codacy.csharp.security.null-dereference -- false positive after constructor/guard validation.
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,28 +116,32 @@ private static async Task<Dictionary<string, string>> LoadSessionIndexAsync(stri
}

var lines = await File.ReadAllLinesAsync(sessionIndexPath, cancellationToken); // nosemgrep: codacy.csharp.security.null-dereference -- false positive after constructor/guard validation.
foreach (var line in lines.Where(static value => !string.IsNullOrWhiteSpace(value)))
foreach (var document in lines
.Where(static value => !string.IsNullOrWhiteSpace(value))
.Select(static line => JsonDocument.Parse(line)))
{
using var document = JsonDocument.Parse(line);
var root = document.RootElement;
if (!root.TryGetProperty("id", out var idElement) || idElement.ValueKind is not JsonValueKind.String)
using (document)
{
continue;
}
var root = document.RootElement;
if (!root.TryGetProperty("id", out var idElement) || idElement.ValueKind is not JsonValueKind.String)
{
continue;
}

var sessionId = idElement.GetString();
if (string.IsNullOrWhiteSpace(sessionId))
{
continue;
}
var sessionId = idElement.GetString();
if (string.IsNullOrWhiteSpace(sessionId))
{
continue;
}

var threadName = root.TryGetProperty("thread_name", out var threadNameElement) && threadNameElement.ValueKind is JsonValueKind.String
? threadNameElement.GetString()
: null;
var threadName = root.TryGetProperty("thread_name", out var threadNameElement) && threadNameElement.ValueKind is JsonValueKind.String
? threadNameElement.GetString()
: null;

if (!string.IsNullOrWhiteSpace(threadName))
{
results[sessionId] = threadName!;
if (!string.IsNullOrWhiteSpace(threadName))
{
results[sessionId] = threadName!;
}
}
}

Expand Down
Loading
Loading