Compare commits

..

1 Commits

Author SHA1 Message Date
cesnimda 41134d8f61 perf(analytics): combine stats scalar count queries 2026-11-18 13:20:57 +01:00
65 changed files with 809 additions and 260 deletions
@@ -0,0 +1,290 @@
using System.Data.Common;
using System.Text.Json;
using JobTrackerApi.Data;
using JobTrackerApi.Models;
using JobTrackerApi.Services;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Moq;
using Xunit;
using Xunit.Abstractions;
namespace JobTrackerApi.Tests;
public sealed class AnalyticsStatsQueryTests(ITestOutputHelper output)
{
[Theory]
[InlineData(0)]
[InlineData(250)]
[InlineData(2500)]
public async Task Stats_keep_narrow_server_aggregates_with_two_fewer_roundtrips(int size)
{
await using var fixture = await Fixture.Create();
var now = DateTime.Now;
fixture.Db.JobApplications.AddRange(Enumerable.Range(0, size).Select(i => fixture.Job("owner", "Applied", now.AddDays(-10))));
fixture.Db.JobApplications.Add(fixture.Job("foreign", "Private", now));
fixture.Db.JobApplications.Add(fixture.Job(null, "Unowned", now));
await fixture.Db.SaveChangesAsync();
fixture.Db.ChangeTracker.Clear();
fixture.Recorder.Commands.Clear();
var stats = await new AnalyticsService(fixture.Db).GetStatsAsync(default);
Assert.Equal(size, stats.Total);
Assert.Equal(size, stats.Active);
Assert.Equal(0, stats.Deleted);
Assert.Equal(size, stats.AppliedLast30Days);
Assert.Equal(size == 0 ? 0 : 10, stats.AverageDaysSinceApplied);
Assert.Equal(size == 0 ? 0 : 1, stats.ByStatus.Count);
if (size > 0) Assert.Equal(size, stats.ByStatus["Applied"]);
Assert.Empty(fixture.Db.ChangeTracker.Entries());
var rows = await fixture.Recorder.ReplayRows(fixture.Connection);
output.WriteLine(JsonSerializer.Serialize(new { Provider = "SQLite", OwnedRows = size, Commands = fixture.Recorder.Commands.Count, ReturnedRowsPerCommand = rows, Sql = fixture.Recorder.Commands.Select(x => x.Sql) }));
Assert.All(fixture.Recorder.Commands, command =>
{
Assert.DoesNotContain("Description", command.Sql);
Assert.DoesNotContain("CoverLetterText", command.Sql);
Assert.DoesNotContain("JobTitle", command.Sql);
});
Assert.Equal(size == 0 ? 2 : 3, fixture.Recorder.Commands.Count);
Assert.Equal(size == 0 ? 0 : size + 2, rows.Sum());
}
[Fact]
public async Task Stats_preserve_deleted_nullable_future_dates_status_keys_and_live_owner_filters()
{
await using var fixture = await Fixture.Create();
var now = DateTime.Now;
var statuses = new[] { "Applied", "Applied", "applied", "", " ", "Unknown", " Applied " };
DateTime?[] dates = [now.AddDays(-29.5), now.AddDays(-30.5), now.AddDays(-10.375), now.AddDays(2), null, null, null];
fixture.Db.JobApplications.AddRange(statuses.Select((status, i) => fixture.Job("owner", status, dates[i])));
fixture.Db.JobApplications.Add(fixture.Job("owner", "Deleted", now, deleted: true));
fixture.Db.JobApplications.Add(fixture.Job("owner", "Deleted", null, deleted: true));
fixture.Db.JobApplications.Add(fixture.Job("foreign", "Private", now.AddDays(-1)));
fixture.Db.JobApplications.Add(fixture.Job(null, "Unowned", now));
await fixture.Db.SaveChangesAsync();
var service = new AnalyticsService(fixture.Db);
var stats = await service.GetStatsAsync(default);
Assert.Equal(9, stats.Total);
Assert.Equal(7, stats.Active);
Assert.Equal(2, stats.Deleted);
Assert.Equal(3, stats.AppliedLast30Days); // Future dates still satisfy the existing lower bound.
Assert.Equal(17.6, stats.AverageDaysSinceApplied); // Nulls excluded; future age clamped to zero.
Assert.Equal(3, stats.ByStatus["Unknown"]);
Assert.Equal(2, stats.ByStatus["Applied"]);
Assert.Equal(1, stats.ByStatus["applied"]);
Assert.Equal(1, stats.ByStatus[" Applied "]);
Assert.Equal(4, stats.ByStatus.Count);
fixture.User.SetupGet(x => x.UserId).Returns("foreign");
Assert.Equal(1, (await service.GetStatsAsync(default)).Total);
fixture.User.SetupGet(x => x.UserId).Returns((string?)null);
var anonymous = await service.GetStatsAsync(default);
Assert.Equal(0, anonymous.Total);
Assert.Equal(0, anonymous.Active);
Assert.Equal(0, anonymous.AppliedLast30Days);
Assert.Equal(0, anonymous.AverageDaysSinceApplied);
Assert.Empty(anonymous.ByStatus);
}
[Theory]
[InlineData(true)]
[InlineData(false)]
public async Task Deleted_only_and_null_applied_dates_keep_zero_averages(bool deleted)
{
await using var fixture = await Fixture.Create();
fixture.Db.JobApplications.Add(fixture.Job("owner", "Saved", null, deleted));
await fixture.Db.SaveChangesAsync();
fixture.Recorder.Commands.Clear();
var stats = await new AnalyticsService(fixture.Db).GetStatsAsync(default);
Assert.Equal(1, stats.Total);
Assert.Equal(deleted ? 0 : 1, stats.Active);
Assert.Equal(deleted ? 1 : 0, stats.Deleted);
Assert.Equal(0, stats.AppliedLast30Days);
Assert.Equal(0, stats.AverageDaysSinceApplied);
Assert.Equal(deleted ? 2 : 3, fixture.Recorder.Commands.Count);
}
[Fact]
public async Task Applied_volume_keeps_the_exact_thirty_day_lower_bound_inclusive()
{
await using var fixture = await Fixture.Create();
var atBoundary = fixture.Job("owner", "Applied", null);
var beforeBoundary = fixture.Job("owner", "Applied", null);
fixture.Db.JobApplications.AddRange(atBoundary, beforeBoundary);
await fixture.Db.SaveChangesAsync();
var setBoundary = false;
fixture.Recorder.BeforeReader = () =>
{
var parameter = fixture.Recorder.Commands.Last().Parameters.FirstOrDefault(x => x.Key.Contains("last30", StringComparison.Ordinal));
if (setBoundary || parameter.Value is not DateTime cutoff) return;
// Use the service's captured cutoff, so this assertion cannot drift with the clock.
using var command = fixture.Connection.CreateCommand();
command.CommandText = "UPDATE JobApplications SET DateApplied = $date WHERE Id = $id";
command.Parameters.AddWithValue("$date", cutoff);
command.Parameters.AddWithValue("$id", atBoundary.Id);
command.ExecuteNonQuery();
command.Parameters["$date"].Value = cutoff.AddTicks(-1);
command.Parameters["$id"].Value = beforeBoundary.Id;
command.ExecuteNonQuery();
setBoundary = true;
};
var stats = await new AnalyticsService(fixture.Db).GetStatsAsync(default);
Assert.True(setBoundary);
Assert.Equal(1, stats.AppliedLast30Days);
Assert.Equal(30, stats.AverageDaysSinceApplied);
}
[Fact]
public async Task Repeated_stats_observe_mutations_without_caching()
{
await using var fixture = await Fixture.Create();
var job = fixture.Job("owner", "Saved", null);
fixture.Db.JobApplications.Add(job);
await fixture.Db.SaveChangesAsync();
var service = new AnalyticsService(fixture.Db);
var before = await service.GetStatsAsync(default);
Assert.Equal(1, before.Active);
job.IsDeleted = true;
job.DateApplied = DateTime.Now;
await fixture.Db.SaveChangesAsync();
var after = await service.GetStatsAsync(default);
Assert.Equal(1, after.Total);
Assert.Equal(0, after.Active);
Assert.Empty(after.ByStatus);
Assert.Equal(1, before.ByStatus["Saved"]);
}
[Fact]
public async Task Cancellation_reaches_the_native_command_and_stops_later_queries()
{
await using var fixture = await Fixture.Create();
using var cancellation = new CancellationTokenSource();
fixture.Recorder.Commands.Clear();
fixture.Recorder.BeforeReader = () => cancellation.Cancel();
await Assert.ThrowsAnyAsync<OperationCanceledException>(() => new AnalyticsService(fixture.Db).GetStatsAsync(cancellation.Token));
Assert.Single(fixture.Recorder.Commands);
Assert.Equal(cancellation.Token, fixture.Recorder.LastToken);
}
[Fact]
public async Task Pomelo_generates_the_actual_stats_aggregate_without_opening_a_database()
{
var connectionGuard = new ClosedConnectionGuard();
var capture = new PomeloCommandCapture();
var options = new DbContextOptionsBuilder<JobTrackerContext>()
.UseMySql("Server=127.0.0.1;Database=translation_only;User=none;Password=none;", new MariaDbServerVersion(new Version(12, 2, 2)))
.AddInterceptors(connectionGuard, capture).Options;
var user = new Mock<ICurrentUserService>();
user.SetupGet(x => x.UserId).Returns("owner");
await using var db = new JobTrackerContext(options, user.Object);
await Assert.ThrowsAsync<CapturedSqlException>(() => new AnalyticsService(db).GetStatsAsync(default));
Assert.Equal(System.Data.ConnectionState.Closed, db.Database.GetDbConnection().State);
Assert.Equal(1, connectionGuard.SuppressedOpenRequests);
Assert.Contains("COUNT(", capture.Sql);
Assert.Contains("CASE", capture.Sql);
Assert.Contains("`OwnerUserId`", capture.Sql);
Assert.Contains("`DateApplied`", capture.Sql);
Assert.Contains(">=", capture.Sql);
Assert.Contains("GROUP BY", capture.Sql);
Assert.DoesNotContain("Description", capture.Sql);
output.WriteLine("Pomelo SQL compiled but not executed: " + capture.Sql);
}
[Fact]
public async Task Legacy_null_status_still_merges_into_unknown()
{
var options = new DbContextOptionsBuilder<JobTrackerContext>().UseInMemoryDatabase(Guid.NewGuid().ToString(), config => config.EnableNullChecks(false)).Options;
var user = new Mock<ICurrentUserService>();
user.SetupGet(x => x.UserId).Returns("owner");
await using var db = new JobTrackerContext(options, user.Object);
db.JobApplications.AddRange(new JobApplication { OwnerUserId = "owner", Status = null! }, new JobApplication { OwnerUserId = "owner", Status = "Unknown" });
await db.SaveChangesAsync();
var stats = await new AnalyticsService(db).GetStatsAsync(default);
Assert.Equal(2, stats.ByStatus["Unknown"]);
}
private sealed class Fixture(SqliteConnection connection, JobTrackerContext db, Mock<ICurrentUserService> user, CommandRecorder recorder) : IAsyncDisposable
{
public SqliteConnection Connection => connection;
public JobTrackerContext Db => db;
public Mock<ICurrentUserService> User => user;
public CommandRecorder Recorder => recorder;
public JobApplication Job(string? owner, string status, DateTime? applied, bool deleted = false) => new()
{
OwnerUserId = owner, CompanyId = 1, JobTitle = "Synthetic", Status = status, DateApplied = applied, IsDeleted = deleted,
Description = new string('x', 4096), CoverLetterText = new string('y', 4096)
};
public static async Task<Fixture> Create()
{
var connection = new SqliteConnection("Data Source=:memory:");
await connection.OpenAsync();
var recorder = new CommandRecorder();
var user = new Mock<ICurrentUserService>();
user.SetupGet(x => x.UserId).Returns("owner");
var db = new JobTrackerContext(new DbContextOptionsBuilder<JobTrackerContext>().UseSqlite(connection).AddInterceptors(recorder).Options, user.Object);
await db.Database.EnsureCreatedAsync();
db.Users.AddRange(new ApplicationUser { Id = "owner" }, new ApplicationUser { Id = "foreign" });
db.Companies.Add(new Company { Id = 1, Name = "Synthetic", OwnerUserId = "owner" });
await db.SaveChangesAsync();
recorder.Commands.Clear();
return new Fixture(connection, db, user, recorder);
}
public async ValueTask DisposeAsync() { await db.DisposeAsync(); await connection.DisposeAsync(); }
}
private sealed class CommandRecorder : DbCommandInterceptor
{
public List<(string Sql, Dictionary<string, object?> Parameters)> Commands { get; } = [];
public Action? BeforeReader { get; set; }
public CancellationToken LastToken { get; private set; }
public override ValueTask<InterceptionResult<DbDataReader>> ReaderExecutingAsync(DbCommand command, CommandEventData eventData, InterceptionResult<DbDataReader> result, CancellationToken cancellationToken = default)
{
Commands.Add((command.CommandText, command.Parameters.Cast<DbParameter>().ToDictionary(p => p.ParameterName, p => p.Value)));
LastToken = cancellationToken;
BeforeReader?.Invoke();
return ValueTask.FromResult(result);
}
public async Task<List<int>> ReplayRows(SqliteConnection connection)
{
var rows = new List<int>();
foreach (var captured in Commands)
{
await using var command = connection.CreateCommand();
command.CommandText = captured.Sql;
foreach (var parameter in captured.Parameters) command.Parameters.AddWithValue(parameter.Key, parameter.Value ?? DBNull.Value);
var count = 0;
await using var reader = await command.ExecuteReaderAsync();
while (await reader.ReadAsync()) count++;
rows.Add(count);
}
return rows;
}
}
private sealed class CapturedSqlException : Exception;
private sealed class ClosedConnectionGuard : DbConnectionInterceptor
{
public int SuppressedOpenRequests { get; private set; }
public override InterceptionResult ConnectionOpening(DbConnection connection, ConnectionEventData eventData, InterceptionResult result)
{
SuppressedOpenRequests++;
return InterceptionResult.Suppress();
}
public override ValueTask<InterceptionResult> ConnectionOpeningAsync(DbConnection connection, ConnectionEventData eventData, InterceptionResult result, CancellationToken cancellationToken = default)
=> ValueTask.FromResult(ConnectionOpening(connection, eventData, result));
}
private sealed class PomeloCommandCapture : DbCommandInterceptor
{
public string Sql { get; private set; } = "";
public override ValueTask<InterceptionResult<DbDataReader>> ReaderExecutingAsync(DbCommand command, CommandEventData eventData, InterceptionResult<DbDataReader> result, CancellationToken cancellationToken = default)
{
Sql = command.CommandText;
throw new CapturedSqlException();
}
}
}
+12 -4
View File
@@ -25,10 +25,18 @@ namespace JobTrackerApi.Services
var last30 = now.AddDays(-30);
// Aggregate server-side (COUNT/GROUP BY) instead of pulling every row into memory.
var total = await _db.JobApplications.AsNoTracking().CountAsync(cancellationToken);
var active = await _db.JobApplications.AsNoTracking().CountAsync(j => !j.IsDeleted, cancellationToken);
var appliedLast30Days = await _db.JobApplications.AsNoTracking()
.CountAsync(j => !j.IsDeleted && j.DateApplied >= last30, cancellationToken);
var counts = await _db.JobApplications.AsNoTracking()
.GroupBy(_ => 1)
.Select(g => new
{
Total = g.Count(),
Active = g.Count(j => !j.IsDeleted),
AppliedLast30Days = g.Count(j => !j.IsDeleted && j.DateApplied >= last30)
})
.SingleOrDefaultAsync(cancellationToken);
var total = counts?.Total ?? 0;
var active = counts?.Active ?? 0;
var appliedLast30Days = counts?.AppliedLast30Days ?? 0;
var byStatus = await _db.JobApplications
.AsNoTracking()
@@ -0,0 +1,39 @@
# PERF-06 · Analytics stats aggregate queries
Application baseline `1db5f488f6138e4f0f33749452b7d9f47658f4b0`, isolated `codex/analytics-query-batch`. Roadmap source `271d37d1`, `docs/direct-roadmap/LATEST_CHECKPOINT.md` and PERF-06 in `ROADMAP_TODO.md`, required a measured baseline before combining queries. The only application edit is inside `AnalyticsService.GetStatsAsync`; controller, DTO, overview, schema, configuration, Career completeness and caching are unchanged.
## Native baseline and change
Before editing the service, a command interceptor recorded the SQL and parameters actually issued by GetStats against disposable in-memory **native SQLite** fixtures. Replaying those exact recorded commands/parameters against the unchanged fixture measured result-row counts. The diagnostic replay commands run after the service and are not included in its command count. Every fixture also contains a foreign-owned application and an unowned application, with wide synthetic text columns that must not appear in the selected projection.
| Owned active applications | Before service commands | After service commands | Before replay result rows | After replay result rows |
| ---: | ---: | ---: | --- | --- |
| 0 | 4 | 2 | `[1,1,1,0]` | `[0,0]` |
| 250 | 5 | 3 | `[1,1,1,1,250]` | `[1,1,250]` |
| 2,500 | 5 | 3 | `[1,1,1,1,2500]` | `[1,1,2500]` |
The baseline issued three separate scalar counts (total, non-deleted, non-deleted applied since the cutoff), then the existing status group query and, when active rows exist, the existing DateApplied projection. A constant-group aggregate now returns the same three counts in one command. An empty owned set produces no aggregate row, explicitly mapped to zero counts. Deleted-only tenants retain their total and skip the date query. Status grouping, whitespace-to-Unknown merging, dictionary order, date projection and client-side age calculation remain the existing code.
This proves **two fewer service database roundtrips** on these fixtures. It does not establish lower latency, fewer physical database rows examined, better query plans, or higher throughput. Active dates still return one row per non-deleted application with an applied date; memory/row growth for that existing projection is unchanged. No wide application blobs or tracked application entities are materialized by stats.
## Preservation checks
The final ten dedicated cases cover native SQLite command/row behavior at zero/250/2,500 owned rows; foreign and null-owner denial; live owner switching on the same context; deleted-only tenants; null applied dates; future dates included in the existing lower-bound applied-volume predicate but clamped to zero age; exact inclusive 30-day cutoff versus one tick before; status case/whitespace keys; repeat reads after a mutation; and cancellation reaching the native command and preventing later queries. The cutoff fixture uses the service's actual captured DateTime parameter, avoiding clock-boundary flakiness.
Nine of those dedicated cases execute SQLite. The legacy **null Status** case uses EF InMemory with null checks disabled because the current native SQLite schema requires Status; it verifies the unchanged defensive Unknown merge, not native nullable-column compatibility. One additional dedicated case checks Pomelo SQL generation as described below. The overview method's entire LF-normalized byte range is unchanged and hashed in the receipts. Existing related salary/stage/calendar/rules/ownership/query-parity cases also pass.
## Exact execution evidence
- Original service, first nine dedicated cases: **4 passed / 5 expected failures**. Only roundtrip budget assertions failed; captured native commands/result rows establish the baseline. This is red evidence, not an accepted test pass.
- Initial optimized run: **9/9 passed**. The exact-cutoff case was then added.
- Final Release run: **51/51 passed, zero skipped**, comprising ten dedicated cases plus 41 existing related cases: salary 1, stage 4, ownership 3, rules/prospect 5, calendar 10, query parity 18. This total includes the overlapping focused runs; it is not 51+9.
- Additional distinct Pomelo SQL-generation case: **1/1 passed**, after parent review requested provider translation evidence. With Pomelo 9.0.0 and explicit MariaDB 12.2.2 metadata, the test invokes the actual GetStats method, suppresses the connection-open request, captures its first compiled provider command, and throws a sentinel before reader execution. The MySqlConnection remains Closed. Generated SQL contains the conditional counts, tenant filter, inclusive applied-date predicate and GROUP BY, with no wide description projection. No hand-written duplicate aggregate or server contact is involved. Native `pomelo.trx` retains the SQL; this is translation-only, not actual database acceptance. The existing 51 cases were not repeated; run-specific test-source hashes distinguish the added case.
- Release API/test/stub compilation succeeded as part of those native test commands. Pinned SDK **9.0.317**, runtime 9.0.19, Windows x64, cached locked restore with an empty package-source config. All generated build/test/cache/temp artifacts are in the isolated E: workspace/evidence area. Existing global NuGet packages were selected explicitly; the initial isolated-home cache miss and successful cached retry are retained. No package versions or lock files changed and no external package source was contacted.
- Native stdout/stderr/TRX, exact commands/exits, source/overview hashes, SDK identity and original roadmap evidence are preserved in [evidence](perf-06/evidence/SOURCE_RECEIPTS.json). [Structured query measurements](perf-06/evidence/QUERY_MEASUREMENTS.json) and [reconciled test counts](perf-06/evidence/TEST_SUMMARY.json) are derived from the native TRX, with self-checks against the expected shapes.
- Final AST-only graph refresh after the Pomelo test: PASS, 19,928 nodes / 48,200 edges. Extractor/community-label warnings are retained; no model labeling was started. The newly generated untracked graph is retained in sibling `analytics-query-batch-evidence/graphify-out`, with artifact hashes; shared graphs are untouched.
## Separate gates and limits
**Actual MariaDB execution/server acceptance, EXPLAIN/rows examined, native cancellation and provider-specific status collation remain NOT RUN.** Pomelo SQL generation alone does not establish those properties. Before MariaDB qualification, execute the actual service against a disposable pinned MariaDB fixture with the same ownership/deletion/date/status cases and measure its command/plan behavior. SQLite results do not qualify the standard MariaDB deployment or infer throughput gains. The change adds no cross-query transaction snapshot; status/date queries remain separate, as before.
No full backend suite, frontend regression, browser, hosted CI, production workload, provider/model, deployment or orchestrator work was performed. Parent review/integration and real-provider qualification remain separate decisions. No main merge or push was performed by this worker.
Binary file not shown.
@@ -0,0 +1,150 @@
{
"baseline": [
{
"Provider": "SQLite",
"OwnedRows": 0,
"Commands": 4,
"ReturnedRowsPerCommand": [
1,
1,
1,
0
],
"Sql": [
"SELECT COUNT(*)\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0",
"SELECT COUNT(*)\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\")",
"SELECT COUNT(*)\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\") AND \"j\".\"DateApplied\" >= @__last30_0",
"SELECT \"j\".\"Status\", COUNT(*) AS \"Count\"\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\")\r\nGROUP BY \"j\".\"Status\""
]
},
{
"Provider": "SQLite",
"OwnedRows": 250,
"Commands": 5,
"ReturnedRowsPerCommand": [
1,
1,
1,
1,
250
],
"Sql": [
"SELECT COUNT(*)\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0",
"SELECT COUNT(*)\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\")",
"SELECT COUNT(*)\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\") AND \"j\".\"DateApplied\" >= @__last30_0",
"SELECT \"j\".\"Status\", COUNT(*) AS \"Count\"\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\")\r\nGROUP BY \"j\".\"Status\"",
"SELECT \"j\".\"DateApplied\"\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\") AND \"j\".\"DateApplied\" IS NOT NULL"
]
},
{
"Provider": "SQLite",
"OwnedRows": 2500,
"Commands": 5,
"ReturnedRowsPerCommand": [
1,
1,
1,
1,
2500
],
"Sql": [
"SELECT COUNT(*)\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0",
"SELECT COUNT(*)\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\")",
"SELECT COUNT(*)\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\") AND \"j\".\"DateApplied\" >= @__last30_0",
"SELECT \"j\".\"Status\", COUNT(*) AS \"Count\"\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\")\r\nGROUP BY \"j\".\"Status\"",
"SELECT \"j\".\"DateApplied\"\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\") AND \"j\".\"DateApplied\" IS NOT NULL"
]
}
],
"final": [
{
"Provider": "SQLite",
"OwnedRows": 0,
"Commands": 2,
"ReturnedRowsPerCommand": [
0,
0
],
"Sql": [
"SELECT COUNT(*) AS \"Total\", COUNT(CASE\r\n WHEN NOT (\"j0\".\"IsDeleted\") THEN 1\r\nEND) AS \"Active\", COUNT(CASE\r\n WHEN NOT (\"j0\".\"IsDeleted\") AND \"j0\".\"DateApplied\" >= @__last30_0 THEN 1\r\nEND) AS \"AppliedLast30Days\"\r\nFROM (\r\n SELECT \"j\".\"DateApplied\", \"j\".\"IsDeleted\", 1 AS \"Key\"\r\n FROM \"JobApplications\" AS \"j\"\r\n WHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0\r\n) AS \"j0\"\r\nGROUP BY \"j0\".\"Key\"\r\nLIMIT 2",
"SELECT \"j\".\"Status\", COUNT(*) AS \"Count\"\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\")\r\nGROUP BY \"j\".\"Status\""
]
},
{
"Provider": "SQLite",
"OwnedRows": 250,
"Commands": 3,
"ReturnedRowsPerCommand": [
1,
1,
250
],
"Sql": [
"SELECT COUNT(*) AS \"Total\", COUNT(CASE\r\n WHEN NOT (\"j0\".\"IsDeleted\") THEN 1\r\nEND) AS \"Active\", COUNT(CASE\r\n WHEN NOT (\"j0\".\"IsDeleted\") AND \"j0\".\"DateApplied\" >= @__last30_0 THEN 1\r\nEND) AS \"AppliedLast30Days\"\r\nFROM (\r\n SELECT \"j\".\"DateApplied\", \"j\".\"IsDeleted\", 1 AS \"Key\"\r\n FROM \"JobApplications\" AS \"j\"\r\n WHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0\r\n) AS \"j0\"\r\nGROUP BY \"j0\".\"Key\"\r\nLIMIT 2",
"SELECT \"j\".\"Status\", COUNT(*) AS \"Count\"\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\")\r\nGROUP BY \"j\".\"Status\"",
"SELECT \"j\".\"DateApplied\"\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\") AND \"j\".\"DateApplied\" IS NOT NULL"
]
},
{
"Provider": "SQLite",
"OwnedRows": 2500,
"Commands": 3,
"ReturnedRowsPerCommand": [
1,
1,
2500
],
"Sql": [
"SELECT COUNT(*) AS \"Total\", COUNT(CASE\r\n WHEN NOT (\"j0\".\"IsDeleted\") THEN 1\r\nEND) AS \"Active\", COUNT(CASE\r\n WHEN NOT (\"j0\".\"IsDeleted\") AND \"j0\".\"DateApplied\" >= @__last30_0 THEN 1\r\nEND) AS \"AppliedLast30Days\"\r\nFROM (\r\n SELECT \"j\".\"DateApplied\", \"j\".\"IsDeleted\", 1 AS \"Key\"\r\n FROM \"JobApplications\" AS \"j\"\r\n WHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0\r\n) AS \"j0\"\r\nGROUP BY \"j0\".\"Key\"\r\nLIMIT 2",
"SELECT \"j\".\"Status\", COUNT(*) AS \"Count\"\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\")\r\nGROUP BY \"j\".\"Status\"",
"SELECT \"j\".\"DateApplied\"\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\") AND \"j\".\"DateApplied\" IS NOT NULL"
]
}
],
"related": [
{
"Provider": "SQLite",
"OwnedRows": 0,
"Commands": 2,
"ReturnedRowsPerCommand": [
0,
0
],
"Sql": [
"SELECT COUNT(*) AS \"Total\", COUNT(CASE\r\n WHEN NOT (\"j0\".\"IsDeleted\") THEN 1\r\nEND) AS \"Active\", COUNT(CASE\r\n WHEN NOT (\"j0\".\"IsDeleted\") AND \"j0\".\"DateApplied\" >= @__last30_0 THEN 1\r\nEND) AS \"AppliedLast30Days\"\r\nFROM (\r\n SELECT \"j\".\"DateApplied\", \"j\".\"IsDeleted\", 1 AS \"Key\"\r\n FROM \"JobApplications\" AS \"j\"\r\n WHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0\r\n) AS \"j0\"\r\nGROUP BY \"j0\".\"Key\"\r\nLIMIT 2",
"SELECT \"j\".\"Status\", COUNT(*) AS \"Count\"\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\")\r\nGROUP BY \"j\".\"Status\""
]
},
{
"Provider": "SQLite",
"OwnedRows": 250,
"Commands": 3,
"ReturnedRowsPerCommand": [
1,
1,
250
],
"Sql": [
"SELECT COUNT(*) AS \"Total\", COUNT(CASE\r\n WHEN NOT (\"j0\".\"IsDeleted\") THEN 1\r\nEND) AS \"Active\", COUNT(CASE\r\n WHEN NOT (\"j0\".\"IsDeleted\") AND \"j0\".\"DateApplied\" >= @__last30_0 THEN 1\r\nEND) AS \"AppliedLast30Days\"\r\nFROM (\r\n SELECT \"j\".\"DateApplied\", \"j\".\"IsDeleted\", 1 AS \"Key\"\r\n FROM \"JobApplications\" AS \"j\"\r\n WHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0\r\n) AS \"j0\"\r\nGROUP BY \"j0\".\"Key\"\r\nLIMIT 2",
"SELECT \"j\".\"Status\", COUNT(*) AS \"Count\"\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\")\r\nGROUP BY \"j\".\"Status\"",
"SELECT \"j\".\"DateApplied\"\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\") AND \"j\".\"DateApplied\" IS NOT NULL"
]
},
{
"Provider": "SQLite",
"OwnedRows": 2500,
"Commands": 3,
"ReturnedRowsPerCommand": [
1,
1,
2500
],
"Sql": [
"SELECT COUNT(*) AS \"Total\", COUNT(CASE\r\n WHEN NOT (\"j0\".\"IsDeleted\") THEN 1\r\nEND) AS \"Active\", COUNT(CASE\r\n WHEN NOT (\"j0\".\"IsDeleted\") AND \"j0\".\"DateApplied\" >= @__last30_0 THEN 1\r\nEND) AS \"AppliedLast30Days\"\r\nFROM (\r\n SELECT \"j\".\"DateApplied\", \"j\".\"IsDeleted\", 1 AS \"Key\"\r\n FROM \"JobApplications\" AS \"j\"\r\n WHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0\r\n) AS \"j0\"\r\nGROUP BY \"j0\".\"Key\"\r\nLIMIT 2",
"SELECT \"j\".\"Status\", COUNT(*) AS \"Count\"\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\")\r\nGROUP BY \"j\".\"Status\"",
"SELECT \"j\".\"DateApplied\"\r\nFROM \"JobApplications\" AS \"j\"\r\nWHERE @__ef_filter__p_1 AND \"j\".\"OwnerUserId\" = @__ef_filter__CurrentUserId_0 AND NOT (\"j\".\"IsDeleted\") AND \"j\".\"DateApplied\" IS NOT NULL"
]
}
],
"pomelo": []
}
@@ -0,0 +1,244 @@
{
"baseline": "1db5f488f6138e4f0f33749452b7d9f47658f4b0",
"roadmapSource": "271d37d1",
"baselineServiceSha256Lf": "88968cfb23e298a8db0c541fc134d3f6e1a0864443baafa24ec9c70f5faeee11",
"sourceSha256Lf": {
"JobTrackerApi/Services/AnalyticsService.cs": "0859ad9202bbaf4de810f8b1bc9946cbed061f69105c02993f079715f59aa2b1",
"JobTrackerApi.Tests/AnalyticsStatsQueryTests.cs": "4c11c99c392c4fe770dae39e4e0a6af71869410268908425322ac9042b4caa25",
"JobTrackerApi/JobTrackerApi.csproj": "50164c5dceafc805cc73018bfcd444428736029f6fdad220e4ff07cf38e116c4",
"JobTrackerApi.Tests/JobTrackerApi.Tests.csproj": "6564ff0044af2ce8c55d557b180c57e16e238395424778878b56eb9e3e082c0d",
"JobTrackerApi/packages.lock.json": "f63bbf68503fd46effda290a29551ebacac84d0faf8c367fe28caa11ec404abf",
"JobTrackerApi.Tests/packages.lock.json": "548f67d1ef3b5a9acfe5fc6124891583b6073ac4b6ca515241330e097152bc4a"
},
"overviewUnchangedSha256Lf": "5ae34fbd456f76e3215b227c499154a700394acc5870e98baa10a25f82dd3f48",
"nativeReceipts": [
{
"path": "baseline.trx.gz",
"rawSha256": "0cfdd06a851cc8d8c98b3065dad540e2682f64c87b9d3b57bc1181a3d4251595",
"gzipSha256": "b7ed8ccc520c1e4f90a4a1bb497f590a5b5eb761579c51e2b11f57669ef16f9f",
"rawBytes": 33153
},
{
"path": "baseline.exit.json.gz",
"rawSha256": "f7efa5369267584aecf389b8b9ced993c802ca7510837a2f4bb6af64cabee00e",
"gzipSha256": "37a20ee637dd5cd7006728b330d6e1e5e97183dfdc5a1aa8858b73d03fcf9338",
"rawBytes": 469
},
{
"path": "baseline.stderr.txt.gz",
"rawSha256": "8a49c99e252f93ad5f0bfa72f828d8270f8d73378eb2057b645c365f4ef394d9",
"gzipSha256": "20a42b896bff92fb1de2561e32bbc96fe3495771ee3bee18ac00b509b7f6c8c7",
"rawBytes": 782
},
{
"path": "baseline.stdout.txt.gz",
"rawSha256": "24a0c4ebc1ec30b415616fff784993eaa6e4db34004c1f72ccaaf21e5f5393d2",
"gzipSha256": "e0ab1ccd0ca7fc340b85313e38e36064f09fd3273f8b2b14192698c723ed1c47",
"rawBytes": 18240
},
{
"path": "final.trx.gz",
"rawSha256": "9809164998214d6229ce2ae17a92bfda28f6df53d59881c52320b5e592e8a50d",
"gzipSha256": "22f3e05f63217755106fbc0e19fae97f547d10aa31d7a080bf8544dd0c475d2a",
"rawBytes": 19199
},
{
"path": "final.exit.json.gz",
"rawSha256": "56f04d240300a79b6b95f4e85c1ac7e71e28752ba43117e3af100414c6836f85",
"gzipSha256": "9f59b6aed0b6fd1d9ae3c8030f8ee7ac353008755afbfe958fccc1686d7433fd",
"rawBytes": 462
},
{
"path": "final.stderr.txt.gz",
"rawSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"gzipSha256": "46b50c321b39e89a491b6727a01628c34245605a30beb3e7414c5e01cff90e6e",
"rawBytes": 0
},
{
"path": "final.stdout.txt.gz",
"rawSha256": "0a310a146116711cc5acec5209f7e47fc09a74d7069e31a4a8e8de2cb102263b",
"gzipSha256": "32b865e89eb0f147ed3cd7d0cfd3196f0abb9590a878e1cd2051ff1c4e252303",
"rawBytes": 2500
},
{
"path": "graph-artifacts.json.gz",
"rawSha256": "525974fdd4376c3ffdc80a4c38d9125063ce53cebf252b3aa35d5be700fa2e04",
"gzipSha256": "4c6741770d72a2936903a0e56a7dfd4c17dcc25fb4ab4f36cd4281837613dfff",
"rawBytes": 424
},
{
"path": "graph-final-artifacts.json.gz",
"rawSha256": "bbf1cb9140faeb803f679135973503465b81e852c57a0f70fe8771c0a582f132",
"gzipSha256": "c90dfd8b0d7709883ebf921c050b388bfe15c727a1fe1cdfaf96d6fb93ae9ff4",
"rawBytes": 424
},
{
"path": "graph-final.exit.json.gz",
"rawSha256": "4f4f3be6ad6b528d4e936c80571d404779fbdce454abf3d361eec3365a03772e",
"gzipSha256": "4a6bbb34469691ad44f1c4490e3f8102c132a4ce1c8456a03b67ecf4d017cc7c",
"rawBytes": 94
},
{
"path": "graph-final.stderr.txt.gz",
"rawSha256": "8757dcf1461d6b3128c3bdc048447e23eabd3e05538514a1318d10af024586c2",
"gzipSha256": "1273c4e70d6b9fe6154bf42a0aa917e4a21b35a50776939735c6156e7e41b6fc",
"rawBytes": 725
},
{
"path": "graph-final.stdout.txt.gz",
"rawSha256": "d75537e648fdc2cea191d13d9a9342f5440dbc5bce6b98a4869c41bc263579cf",
"gzipSha256": "b752a37d98031e6f92228c2ecec2eb95fb3f6c73408c363175d6da022aba9cb2",
"rawBytes": 1169
},
{
"path": "graph.exit.json.gz",
"rawSha256": "2609a5c688566b24a0229f7f5ef328ab9d11c309f29048c3c87963e625066dea",
"gzipSha256": "a90f5c0ab24ac9d292395d12e048783821e2a33b00dde88ea5ce8b50035a9196",
"rawBytes": 94
},
{
"path": "graph.stderr.txt.gz",
"rawSha256": "252f13231cdf5188fedb3f87caa797600ea7eee4e589778807168be2fe7c20c1",
"gzipSha256": "742558330e5618c0487c801ccaa3b27a8fdbe6a6f8d8df1123d3411fa7eabca0",
"rawBytes": 669
},
{
"path": "graph.stdout.txt.gz",
"rawSha256": "c76c12ed748397c7fe062a6900f4719ee128d73b57c38196b10b1fb74b0fb971",
"gzipSha256": "9a5f15999b64f9d537315d3da6327b261ab7a1a6057d1c8cb1f61f15daa4ca47",
"rawBytes": 2928
},
{
"path": "NuGet.Config.gz",
"rawSha256": "2142cfb2dfa2c7feefbe40fabcc68b0dfecadafa99a1db9b70239d977cf2a7ef",
"gzipSha256": "f69b2177a7e14d14bbf0f5f66292e0aa0ec4e22ac56e016a63e407db01a41591",
"rawBytes": 113
},
{
"path": "pomelo.trx.gz",
"rawSha256": "78d6865a361821c39ff1314c3b39027acf15c411a3e5e718d3b2a937bb5d21d2",
"gzipSha256": "ab13f9032406fae9c6a6e18f1449c20dd7ef6a56a8f7f655f08317d57112f8ae",
"rawBytes": 3738
},
{
"path": "pomelo-generated-sql.txt.gz",
"rawSha256": "98e8ea948a12b98f33ed66946c629a41b83a71ab369794a8be4bb6742287c5ff",
"gzipSha256": "7b4d463080964e66980735df680e485833f406ddf282cf5c0f9f0ce764a74a68",
"rawBytes": 494
},
{
"path": "pomelo.exit.json.gz",
"rawSha256": "0fcda1c553282de3b85c8b398bfa6f3959424ab92ee0590023783e3ba4348578",
"gzipSha256": "d126bc2e72367ea43f96cdd0de58d15cf2d805884c91e2c66357b3a3d64998f5",
"rawBytes": 510
},
{
"path": "pomelo.stderr.txt.gz",
"rawSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"gzipSha256": "46b50c321b39e89a491b6727a01628c34245605a30beb3e7414c5e01cff90e6e",
"rawBytes": 0
},
{
"path": "pomelo.stdout.txt.gz",
"rawSha256": "514805b39aa81de333b4796dd1e622a5d0956202c911403bd08839b2c0a94059",
"gzipSha256": "59017c3ca6efec93ae7308f0f0ef1d60e468e9f637479d3949a15bd6a1e19506",
"rawBytes": 1470
},
{
"path": "related.trx.gz",
"rawSha256": "ee8f44ad2f3e67c69165a9d21722a58572633a588009884c76877273fed04074",
"gzipSha256": "dcefc964158456d1aa2d5b58ac630de579ab455137bdb3f052b3b156e39a91be",
"rawBytes": 82468
},
{
"path": "related-run-sources.json.gz",
"rawSha256": "3e4adeaa74793556ae789929e3844f109bfa619e940465fa0d8c379273797d02",
"gzipSha256": "62119f84bdeb87a83352c7a1b192c10fca32ad202228b442bc8628aa5d6af15a",
"rawBytes": 406
},
{
"path": "related.exit.json.gz",
"rawSha256": "ef658a012e34cd6722aa9edc904ea4ca8b13d7e950a357994c9ae38c01c8cfc9",
"gzipSha256": "3da9ed91394e419e8906e013a5d7b83e9a43dcdd5d99879bc80086343896517f",
"rawBytes": 722
},
{
"path": "related.stderr.txt.gz",
"rawSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"gzipSha256": "46b50c321b39e89a491b6727a01628c34245605a30beb3e7414c5e01cff90e6e",
"rawBytes": 0
},
{
"path": "related.stdout.txt.gz",
"rawSha256": "d983b3f3f4baa951a105e280ce8d93ffc167b6ca3fb617edd8d6f9d78d239df0",
"gzipSha256": "0aeb4b15a3946738c5878aaa01137e179c0cbe6f32d69efbb9ce388d72937da3",
"rawBytes": 8002
},
{
"path": "restore-cached.exit.json.gz",
"rawSha256": "337301aa9d2fff23a0ffbbffdcc77215cef28ed08fa3ddb2792d93931eef0e87",
"gzipSha256": "58bd0d2d31584b19d573d0fc7b33140f0f85b7ed4f623fb063daded0dc3dc159",
"rawBytes": 310
},
{
"path": "restore-cached.stderr.txt.gz",
"rawSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"gzipSha256": "46b50c321b39e89a491b6727a01628c34245605a30beb3e7414c5e01cff90e6e",
"rawBytes": 0
},
{
"path": "restore-cached.stdout.txt.gz",
"rawSha256": "271a7efafd57e4889a2094bd64280710a0c2fce0f12ccab9789e421b4241869f",
"gzipSha256": "d2155860fadba93e89eac27f7b44b6776530a4ce77c4f8e31a48b5f8669fcef7",
"rawBytes": 488
},
{
"path": "restore.exit.json.gz",
"rawSha256": "8bf4635a3f8301adfa741ea41bd86f16b8f13117734d8830feab4fb416d19d0e",
"gzipSha256": "2408933238d86fa9c532cb0ec583952b77778dea6119698efbde2b0cf67e885a",
"rawBytes": 310
},
{
"path": "restore.stderr.txt.gz",
"rawSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"gzipSha256": "46b50c321b39e89a491b6727a01628c34245605a30beb3e7414c5e01cff90e6e",
"rawBytes": 0
},
{
"path": "restore.stdout.txt.gz",
"rawSha256": "55a03484d9fec31f39414c5363f0bfe7a2dbf6836039d88b28d80769e241d973",
"gzipSha256": "8972df257e0b36320e9a8897ca72034507ae2451f815fa408236cd48d643c486",
"rawBytes": 10564
},
{
"path": "roadmap-checkpoint.txt.gz",
"rawSha256": "9ac029153db7b7265d00c11b6155d8fbf58d30cc9f0418f8440324f860138498",
"gzipSha256": "c337a0b2a70a1135e88829aaa54cb8a89c92524aa8a8ca749bb4f544d0443d53",
"rawBytes": 226686
},
{
"path": "roadmap-perf-source.txt.gz",
"rawSha256": "ac4cda9471ef29fd0a942ec986269b14354d46a3688eb00e9b4acd7c5826427f",
"gzipSha256": "94fbc0fa1f081065c183b202360a9e4476deca0f9f56c6de4c2ba7438f554326",
"rawBytes": 53575
},
{
"path": "sdk.exit.json.gz",
"rawSha256": "d752216624832dac2c78b4c38943cddf20fb970e7030fc556557917946de44e6",
"gzipSha256": "a8912a8383fc5a47d2238e48493a5e6e23055e090fa58eadf8bf51c8c06801a7",
"rawBytes": 115
},
{
"path": "sdk.stderr.txt.gz",
"rawSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"gzipSha256": "46b50c321b39e89a491b6727a01628c34245605a30beb3e7414c5e01cff90e6e",
"rawBytes": 0
},
{
"path": "sdk.stdout.txt.gz",
"rawSha256": "ebeeab4ff7b83567d77106097e9d5fce8fff28a7cb8cb1ff5aeca16453104a7a",
"gzipSha256": "b5ec27efd8af9856eff8962e44fc8be8ff49ef6fdee5f2018bbecdd17f948230",
"rawBytes": 1251
}
]
}
@@ -0,0 +1,74 @@
{
"baseline": {
"total": "9",
"executed": "9",
"passed": "4",
"failed": "5",
"error": "0",
"timeout": "0",
"aborted": "0",
"inconclusive": "0",
"passedButRunAborted": "0",
"notRunnable": "0",
"notExecuted": "0",
"disconnected": "0",
"warning": "0",
"completed": "0",
"inProgress": "0",
"pending": "0"
},
"final": {
"total": "9",
"executed": "9",
"passed": "9",
"failed": "0",
"error": "0",
"timeout": "0",
"aborted": "0",
"inconclusive": "0",
"passedButRunAborted": "0",
"notRunnable": "0",
"notExecuted": "0",
"disconnected": "0",
"warning": "0",
"completed": "0",
"inProgress": "0",
"pending": "0"
},
"related": {
"total": "51",
"executed": "51",
"passed": "51",
"failed": "0",
"error": "0",
"timeout": "0",
"aborted": "0",
"inconclusive": "0",
"passedButRunAborted": "0",
"notRunnable": "0",
"notExecuted": "0",
"disconnected": "0",
"warning": "0",
"completed": "0",
"inProgress": "0",
"pending": "0"
},
"pomelo": {
"total": "1",
"executed": "1",
"passed": "1",
"failed": "0",
"error": "0",
"timeout": "0",
"aborted": "0",
"inconclusive": "0",
"passedButRunAborted": "0",
"notRunnable": "0",
"notExecuted": "0",
"disconnected": "0",
"warning": "0",
"completed": "0",
"inProgress": "0",
"pending": "0"
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,23 +0,0 @@
# Discovery to application: connected native boundary
18 November 2026. Test-only increment on existing `1db5f488` application/export/API, with pinned dependencies unchanged. The two new cases extend the existing `phase7-discovery.spec.ts` fixture and preserve its external-traffic guard. No provider, model or additional international source was activated.
## Verified journey
English/light/1440 desktop and Bokmål/dark/390 phone: discover a synthetic NAV vacancy, open its synthetic source advert, return to results, explicitly review its import preview, choose an existing company, create one actual tracked application, revisit it through the applications interface and verify its full workspace. Search, external advert HTML and import-preview responses are intercepted. Company setup, application creation (201), subsequent API reads, duplicate lookup and foreign-owner denial (404) execute against the isolated actual API and disposable SQLite database.
The application GET DTO does not expose canonical job provenance. A read-only SQLite query joins the linked job with both owner IDs constrained, proving retained source `nav` and country `NO`; the existing generated fixture-root/path guard and query-only connection prevent mutation. Career Profile and company data remain unchanged. Advert language is independently `nb`, including during English UI execution. There is one explicit create, with no automatic creation or alternative-application chooser.
Final result: **2/2 passed, zero skips/unexpected/flaky; four scoped axe scans with zero violations; four retained screenshots**, zero root horizontal overflow. Final TypeScript and scoped ESLint passed. These two cases are additional connected coverage, not a full regression or final A3 acceptance.
The original two failures were verifier mistakes: provenance was asserted on the application DTO rather than its linked job. After correcting that boundary, one desktop assertion still assumed a link where the real keyboard-enabled table exposes a row; the phone exposes a link. Both original and intermediate outputs are retained. No application changes were made to satisfy those assumptions.
## Visual review and limits
The retained desktop workspace shows the approved right-side context and flat section hierarchy. The phone workspace stacks context below content and uses the hybrid bottom navigation. These are full-page captures at the journey's current scroll position: sticky header/bottom navigation appear within the stitched phone image, and the route heading is partly under the header in that capture. This is a capture/scroll review limitation requiring a controlled viewport check, not proof that every screen or header state is accepted. The Bokmål activity entry still displays the server event text `Created`; synthetic company content is English. These captures do not establish complete native-language acceptance or resolve the existing visual discrepancy register.
The fixture advert deadline is historical synthetic data. This package does not exercise live NAV access, provider rights, saved-run ingestion, provider dismissal persistence, extraction/model quality, physical devices, assistive technology, browser zoom, or production. The frozen backend predates the later checklist error-classification correction and analytics aggregate change: combined affected browser validation remains separate.
Exact original/intermediate/final reports, native logs, screenshots, audits, request boundaries, readbacks and LF-normalised source hashes are retained in [evidence receipts](evidence/connected-discovery/SOURCE_RECEIPTS.json). The source test is the rollback unit; no application/data rollback or migration is needed.
AST-only graph refresh passed: 19,963 nodes / 49,440 edges. Existing optional PDF/SQL extractors and symbol-free generated-input warnings remain; no model labeling was run.
@@ -1,110 +0,0 @@
{
"baseline": "1db5f488f6138e4f0f33749452b7d9f47658f4b0",
"qualification": "Test-only connected journeys against frozen existing export/API, no provider/model execution. Native readbacks and four scoped axe scans, not full visual acceptance.",
"stats": {
"startTime": "2026-11-18T17:40:00.807Z",
"duration": 25672.649,
"expected": 2,
"skipped": 0,
"unexpected": 0,
"flaky": 0
},
"sourcesLfSha256": {
"job-tracker-ui/e2e/phase7-discovery.spec.ts": "bcf2c84d0bc86d6fa6fdf43b62eaa70e066acf3ba1425b9496b6c9ea5ac7de46",
"job-tracker-ui/package-lock.json": "7ebd728f99a1ed9a5334542fb578b30127b4a0c7984efe2913266e89e2fbfbd3",
"job-tracker-ui/playwright.config.ts": "9252c961ac2779485bb72b24c31d526773d7c09f764eca638c4c1d47235e9f65",
"job-tracker-ui/src/i18n/translations.ts": "2b29e81921fc44fba95df62497dba18fb8d91568340aa529f7d25eef93b032ab"
},
"artifacts": [
{
"file": "focused.json.gz",
"bytes": 147829,
"sha256": "1124afe68404328500a5134be29b51b0039efdc035146c147539f03900fb29e8"
},
{
"file": "focused.log.gz",
"bytes": 2437,
"sha256": "62fef0f99dfb844ff1562186e01ca819c7e4014b00aa2b1ccb5b859a0e3fb190"
},
{
"file": "corrected.json.gz",
"bytes": 233327,
"sha256": "8de56092bc1e8f90606293b63e55e84ea5842027790b888c6dfdf2dcec23b9e0"
},
{
"file": "corrected.log.gz",
"bytes": 2273,
"sha256": "7a79a52766d2f1d58a0cea5cfdd539f8f27742cd950555d818aae430b53482c9"
},
{
"file": "final.json.gz",
"bytes": 358425,
"sha256": "866e94ea9dc5043b46e3645afdd82a40434061b1ef1740e418e0f2b14c277c37"
},
{
"file": "final.log.gz",
"bytes": 1384,
"sha256": "e98d65b77b35182f0015c55feaa42429e822bd7a28d6e5845e2d56a6fba0d851"
},
{
"file": "en-p7-discovery-en-light-1440-connected-fixture-result-return-audit.json",
"bytes": 10842,
"sha256": "e4e1d4f32458c44791fca7bd034fe9d45700316c9b6052cb776f197e2929ea22"
},
{
"file": "en-p7-discovery-en-light-1440-connected-fixture-result-return.png",
"bytes": 93797,
"sha256": "bc28e6a338769f4baf7ad7dae14e0516c98a19e312114992b8f9326862e838f7"
},
{
"file": "en-connected-native-tracker-readbacks.json",
"bytes": 3739,
"sha256": "e078245f64ce5513057710f0d3c9395f159b9b72438bf38858ebf21a857b7e98"
},
{
"file": "en-p7-discovery-en-light-1440-connected-native-workspace-audit.json",
"bytes": 9268,
"sha256": "e115a6a6872110091799baa9484906779365bf33d36e70053a858288bbfaa07a"
},
{
"file": "en-p7-discovery-en-light-1440-connected-native-workspace.png",
"bytes": 122650,
"sha256": "556c5e697bc05f1094a183ed9493403971643dbbb26e2dd74c2e35e2a69a24b1"
},
{
"file": "en-discovery-request-boundary.json",
"bytes": 1264,
"sha256": "1b566579e51d569be46ed43d6fc8fb8b4cf4959831493bccb0dd67086fe2ed30"
},
{
"file": "nb-p7-discovery-nb-dark-390-connected-fixture-result-return-audit.json",
"bytes": 11333,
"sha256": "f9a09992219a3a5ff0f9848785227eccb34f336af3281c4343fc6665aab4e52d"
},
{
"file": "nb-p7-discovery-nb-dark-390-connected-fixture-result-return.png",
"bytes": 41080,
"sha256": "907ab5bba5793caa220a974506b791b28183e1e1b1bde82b26bb8ba3d69634e7"
},
{
"file": "nb-connected-native-tracker-readbacks.json",
"bytes": 3737,
"sha256": "88610906a3b65175350b5a83b55795e029b878b90cf5967bcead821ed50991ce"
},
{
"file": "nb-p7-discovery-nb-dark-390-connected-native-workspace-audit.json",
"bytes": 14328,
"sha256": "714231108ce7ee9781e16d3ac6a4780eaada0685e15c2b03ec7e3be713c40614"
},
{
"file": "nb-p7-discovery-nb-dark-390-connected-native-workspace.png",
"bytes": 81638,
"sha256": "eacdcadd05b014cb45e0038486513fa828a7a099f004c73d3468ebd5d597db1b"
},
{
"file": "nb-discovery-request-boundary.json",
"bytes": 1264,
"sha256": "1b566579e51d569be46ed43d6fc8fb8b4cf4959831493bccb0dd67086fe2ed30"
}
]
}
@@ -1 +0,0 @@
{"sample":{"language":"en","theme":"light","width":1440,"height":900},"job":{"id":"connected-en","title":"Faglærer i kunst og håndverk — æøå","company":"Synthetic community learning centre","location":"TRONDHEIM","modifiedAt":"2026-10-09T10:00:00Z","deadline":"2026-10-20T23:59:59Z","url":"https://arbeidsplassen.nav.no/stillinger/stilling/connected-en","source":"nav","sourceName":"NAV Arbeidsplassen","acquisitionType":"searched","retrievedAt":"2026-10-10T10:00:00Z","countryCode":"NO"},"readback":{"id":1,"companyId":1,"company":{"id":1,"ownerUserId":"c3b9c5f7-7ffe-4e21-8dfc-0b68365e85ed","name":"Synthetic community learning centre","location":"Trondheim","source":"User","recruiterName":null,"recruiterEmail":null,"recruiterLinkedIn":null,"lastContactedAt":null,"nextContactAt":null,"pipelineStage":null},"jobTitle":"Faglærer i kunst og håndverk — æøå","status":"Saved","dateApplied":null,"savedAt":"2026-11-18T17:40:14.1198041","responseReceived":false,"responseDate":null,"notes":null,"coverLetterText":null,"jobUrl":"https://arbeidsplassen.nav.no/stillinger/stilling/connected-en","description":"Syntetisk stilling: planlegg aktiviteter og undervisning i kunst og håndverk. Kilden beholdes ordrett — æøå.","translatedDescription":null,"descriptionLanguage":"nb","tags":null,"deadline":"2026-10-20T00:00:00","location":"TRONDHEIM","salary":null,"salaryMin":null,"salaryMax":null,"salaryCurrency":null,"salaryPeriod":null,"nextAction":null,"followUpAt":null,"feedbackRequestedAt":null,"hasResume":false,"hasCoverLetter":false,"hasPortfolio":false,"hasOtherAttachment":false,"isDeleted":false,"deletedAt":null,"daysSince":null,"needsFollowUp":false,"followUpReason":null,"tailoredCvText":null,"workflowSignal":{"actionKey":"follow-up","reason":"No response yet and no follow-up is scheduled.","workspaceTab":"follow-up","followMode":"waiting-update","needsAttention":true,"hasPackageGap":false,"needsInterviewPrep":false,"needsFollowUpAction":true,"hasTailoredCv":false,"hasSavedApplicationAnswerDraft":false,"hasInterviewPrepNotes":false},"shortSummary":null,"fullSummary":null,"version":1},"opportunity":{"source":"nav","countryCode":"NO"},"duplicates":{"hasDuplicates":true,"matches":[{"id":1,"jobTitle":"Faglærer i kunst og håndverk — æøå","company":"Synthetic community learning centre","jobUrl":"https://arbeidsplassen.nav.no/stillinger/stilling/connected-en","status":"Saved","dateApplied":null,"reason":"same URL, same company and similar title"}]},"trackerWrites":[{"method":"POST","path":"/api/jobapplications","query":{},"body":{"jobTitle":"Faglærer i kunst og håndverk — æøå","companyId":1,"status":"Saved","location":"TRONDHEIM","salary":"","salaryMin":null,"salaryMax":null,"salaryCurrency":null,"salaryPeriod":null,"nextAction":null,"followUpAt":null,"jobUrl":"https://arbeidsplassen.nav.no/stillinger/stilling/connected-en","source":"nav","countryCode":"NO","description":"Syntetisk stilling: planlegg aktiviteter og undervisning i kunst og håndverk. Kilden beholdes ordrett — æøå.","translatedDescription":null,"descriptionLanguage":"nb","tags":null,"deadline":"2026-10-20","notes":"","coverLetterText":null,"dateApplied":"2026-11-18"}}],"searches":1,"previews":1,"detailViews":1,"choosers":[],"qualification":"Search, original-source popup HTML and import preview are explicitly synthetic route fixtures, with no provider fetch. Company setup/job POST/readbacks/duplicate check/foreign denial are actual disposable API. Source/country checked on the linked opportunity through a guarded read-only query of this fixture SQLite only; application DTO does not expose them. No full provider integration, canonical geography, import parser or automatic duplicate blocking claim."}
@@ -1 +0,0 @@
{"providerBoundary":"Saved-search list/create/alert PATCH/delete and readbacks use the real isolated owner API and disposable SQLite. Browser vacancy-provider /search and owner /saved-searches/{id}/run responses are intercepted because the server provider has an external NAV base URL. Intercepted runs do not create SavedJobSearchResults: successful intercepted Dismiss establishes presentation only, never runner/history/dismiss persistence or alert delivery. A real missing-result Dismiss 404 is exercised separately. The unchanged saved-search-repair suite and backend fake-provider SQLite tests retain owner/anonymous and real runner/history contracts. External browser traffic and unregistered provider-dependent requests are blocked.","requests":[{"method":"GET","path":"/api/job-discovery/saved-searches","query":{},"body":null},{"method":"GET","path":"/api/job-discovery/search","query":{"q":"kunstlærer","location":"Trondheim"},"body":null}],"blockedProviderRequests":[],"blockedExternalRequests":[],"qualification":"Browser request log contains only method/path/query/JSON payload, with no cookies or authorization/CSRF/session headers. Direct API fixture reads are verified in individual tests; this log is not a server outbound-traffic measurement."}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

@@ -1 +0,0 @@
{"sample":{"language":"nb","theme":"dark","width":390,"height":844},"job":{"id":"connected-nb","title":"Faglærer i kunst og håndverk — æøå","company":"Synthetic community learning centre","location":"TRONDHEIM","modifiedAt":"2026-10-09T10:00:00Z","deadline":"2026-10-20T23:59:59Z","url":"https://arbeidsplassen.nav.no/stillinger/stilling/connected-nb","source":"nav","sourceName":"NAV Arbeidsplassen","acquisitionType":"searched","retrievedAt":"2026-10-10T10:00:00Z","countryCode":"NO"},"readback":{"id":2,"companyId":2,"company":{"id":2,"ownerUserId":"33728467-11f1-4863-97d8-fc14a6b2421d","name":"Synthetic community learning centre","location":"Trondheim","source":"User","recruiterName":null,"recruiterEmail":null,"recruiterLinkedIn":null,"lastContactedAt":null,"nextContactAt":null,"pipelineStage":null},"jobTitle":"Faglærer i kunst og håndverk — æøå","status":"Saved","dateApplied":null,"savedAt":"2026-11-18T17:40:22.5290878","responseReceived":false,"responseDate":null,"notes":null,"coverLetterText":null,"jobUrl":"https://arbeidsplassen.nav.no/stillinger/stilling/connected-nb","description":"Syntetisk stilling: planlegg aktiviteter og undervisning i kunst og håndverk. Kilden beholdes ordrett — æøå.","translatedDescription":null,"descriptionLanguage":"nb","tags":null,"deadline":"2026-10-20T00:00:00","location":"TRONDHEIM","salary":null,"salaryMin":null,"salaryMax":null,"salaryCurrency":null,"salaryPeriod":null,"nextAction":null,"followUpAt":null,"feedbackRequestedAt":null,"hasResume":false,"hasCoverLetter":false,"hasPortfolio":false,"hasOtherAttachment":false,"isDeleted":false,"deletedAt":null,"daysSince":null,"needsFollowUp":false,"followUpReason":null,"tailoredCvText":null,"workflowSignal":{"actionKey":"follow-up","reason":"No response yet and no follow-up is scheduled.","workspaceTab":"follow-up","followMode":"waiting-update","needsAttention":true,"hasPackageGap":false,"needsInterviewPrep":false,"needsFollowUpAction":true,"hasTailoredCv":false,"hasSavedApplicationAnswerDraft":false,"hasInterviewPrepNotes":false},"shortSummary":null,"fullSummary":null,"version":1},"opportunity":{"source":"nav","countryCode":"NO"},"duplicates":{"hasDuplicates":true,"matches":[{"id":2,"jobTitle":"Faglærer i kunst og håndverk — æøå","company":"Synthetic community learning centre","jobUrl":"https://arbeidsplassen.nav.no/stillinger/stilling/connected-nb","status":"Saved","dateApplied":null,"reason":"same URL, same company and similar title"}]},"trackerWrites":[{"method":"POST","path":"/api/jobapplications","query":{},"body":{"jobTitle":"Faglærer i kunst og håndverk — æøå","companyId":2,"status":"Saved","location":"TRONDHEIM","salary":"","salaryMin":null,"salaryMax":null,"salaryCurrency":null,"salaryPeriod":null,"nextAction":null,"followUpAt":null,"jobUrl":"https://arbeidsplassen.nav.no/stillinger/stilling/connected-nb","source":"nav","countryCode":"NO","description":"Syntetisk stilling: planlegg aktiviteter og undervisning i kunst og håndverk. Kilden beholdes ordrett — æøå.","translatedDescription":null,"descriptionLanguage":"nb","tags":null,"deadline":"2026-10-20","notes":"","coverLetterText":null,"dateApplied":"2026-11-18"}}],"searches":1,"previews":1,"detailViews":1,"choosers":[],"qualification":"Search, original-source popup HTML and import preview are explicitly synthetic route fixtures, with no provider fetch. Company setup/job POST/readbacks/duplicate check/foreign denial are actual disposable API. Source/country checked on the linked opportunity through a guarded read-only query of this fixture SQLite only; application DTO does not expose them. No full provider integration, canonical geography, import parser or automatic duplicate blocking claim."}
@@ -1 +0,0 @@
{"providerBoundary":"Saved-search list/create/alert PATCH/delete and readbacks use the real isolated owner API and disposable SQLite. Browser vacancy-provider /search and owner /saved-searches/{id}/run responses are intercepted because the server provider has an external NAV base URL. Intercepted runs do not create SavedJobSearchResults: successful intercepted Dismiss establishes presentation only, never runner/history/dismiss persistence or alert delivery. A real missing-result Dismiss 404 is exercised separately. The unchanged saved-search-repair suite and backend fake-provider SQLite tests retain owner/anonymous and real runner/history contracts. External browser traffic and unregistered provider-dependent requests are blocked.","requests":[{"method":"GET","path":"/api/job-discovery/saved-searches","query":{},"body":null},{"method":"GET","path":"/api/job-discovery/search","query":{"q":"kunstlærer","location":"Trondheim"},"body":null}],"blockedProviderRequests":[],"blockedExternalRequests":[],"qualification":"Browser request log contains only method/path/query/JSON payload, with no cookies or authorization/CSRF/session headers. Direct API fixture reads are verified in individual tests; this log is not a server outbound-traffic measurement."}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

-115
View File
@@ -1,9 +1,6 @@
import AxeBuilder from '@axe-core/playwright';
import { spawnSync } from 'node:child_process';
import path from 'node:path';
import { expect, test as base, type APIRequestContext, type APIResponse, type Locator, type Page, type Response, type TestInfo } from '@playwright/test';
import { translations } from '../src/i18n/translations';
import type { Company, JobApplication } from '../src/types';
const apiUrl = 'http://localhost:5302/api';
const savedUrl = `${apiUrl}/job-discovery/saved-searches`;
@@ -213,118 +210,6 @@ async function capture(page: Page, info: TestInfo, sample: Sample, state: string
expect(axe.violations, `${name} complete axe violations`).toEqual([]);
}
for (const sample of [desktop, { language: 'nb', theme: 'dark', width: 390, height: 844 }] as Sample[]) {
test(`[P7-05 connected tracker] ${sample.language}/${sample.width} reviewed provider fixture becomes one durable owned application`, async ({ page, context, playwright, session }, info) => {
test.setTimeout(180_000);
const t = translations[sample.language];
const employer = await json<Company>(await page.request.post(`${apiUrl}/companies`, { headers: session.owner.headers,
data: { name: 'Synthetic community learning centre', location: 'Trondheim', source: 'User' } }), 201);
const canonical = await json<unknown>(await page.request.get(`${apiUrl}/career/profile`));
const job = { ...vacancy(`connected-${sample.language}`, 'Faglærer i kunst og håndverk — æøå'), company: employer.name };
const description = 'Syntetisk stilling: planlegg aktiviteter og undervisning i kunst og håndverk. Kilden beholdes ordrett — æøå.';
let searches = 0; let previews = 0; let detailViews = 0;
const trackerWrites: RequestRecord[] = [];
const choosers: string[] = [];
page.on('filechooser', () => choosers.push('unexpected chooser'));
page.on('request', request => {
const url = new URL(request.url());
if (request.method() !== 'GET' && /^\/api\/(?:jobapplications|companies|attachments)(?:\/|$)/.test(url.pathname)) {
trackerWrites.push({ method: request.method(), path: url.pathname, query: Object.fromEntries(url.searchParams), body: request.postData() ? request.postDataJSON() : null });
}
});
await page.route(`${searchUrl}**`, route => { searches++; return route.fulfill({ json: [job] }); });
await context.route(job.url, route => {
detailViews++;
return route.fulfill({ contentType: 'text/html; charset=utf-8', body: `<!doctype html><html lang="nb"><head><title>Synthetic listing detail</title><link rel="icon" href="data:,"></head><body><main><h1>${job.title}</h1><p>${description}</p></main></body></html>` });
});
await page.route(`${apiUrl}/jobimport/preview`, route => {
expect(route.request().method()).toBe('POST'); expect(route.request().postDataJSON()).toEqual({ url: job.url }); previews++;
return route.fulfill({ json: { success: true, title: job.title, company: employer.name, location: job.location,
description, language: 'nb', translatedDescription: null, sourceUrl: job.url, source: job.source, countryCode: job.countryCode, deadline: job.deadline, tags: [] } });
});
await enter(page, session.owner, sample);
await draftFilters(page, 'kunstlærer', 'Trondheim', sample.language);
await keyboardActivate(page, page.getByRole('button', { name: t.jobDiscoverySearchNav, exact: true }));
const row = article(page, job);
await expect(row.getByText('NAV Arbeidsplassen', { exact: true })).toBeVisible();
await expect(row.getByRole('link', { name: t.jobDiscoveryViewListing, exact: true })).toHaveAttribute('href', job.url);
const opening = page.waitForEvent('popup');
await keyboardActivate(page, row.getByRole('link', { name: t.jobDiscoveryViewListing, exact: true }));
const detail = await opening;
await expect(detail).toHaveURL(job.url);
await expect(detail.getByRole('heading', { name: job.title, exact: true })).toBeVisible();
await expect(detail.getByText(description, { exact: true })).toBeVisible();
await detail.close();
expect(detailViews).toBe(1); expect(searches).toBe(1);
await expect(page.getByLabel(t.jobDiscoveryRoleCompany, { exact: true })).toHaveValue('kunstlærer');
expect(trackerWrites).toEqual([]);
await capture(page, info, sample, 'connected-fixture-result-return');
const previewed = response(page, 'POST', `${apiUrl}/jobimport/preview`);
await keyboardActivate(page, row.getByRole('button', { name: t.jobDiscoverySaveTracker, exact: true }));
expect((await previewed).status()).toBe(200);
const dialog = page.getByRole('dialog');
await expect(dialog).toBeVisible();
await expect(dialog.getByLabel(t.addJobModalJobTitle, { exact: true })).toHaveValue(job.title);
await expect(dialog.getByLabel(t.addJobModalDescriptionOriginal, { exact: true })).toHaveValue(description);
await expect(dialog.getByLabel(t.addJobModalDescriptionLanguage, { exact: true })).toHaveValue('nb');
await expect(dialog.getByLabel(t.addJobModalJobUrl, { exact: true })).toHaveValue(job.url);
expect(previews).toBe(1); expect(trackerWrites).toEqual([]);
await keyboardActivate(page, dialog.getByRole('button', { name: t.continue, exact: true }));
for (let step = 2; step <= 4; step++) await keyboardActivate(page, dialog.getByRole('button', { name: t.skipAndContinue, exact: true }));
const createdResponse = response(page, 'POST', `${apiUrl}/jobapplications`);
await keyboardActivate(page, dialog.getByRole('button', { name: t.createJob, exact: true }));
const created = await json<JobApplication>(await createdResponse, 201);
await expect(dialog).toHaveCount(0);
const readback = await json<JobApplication>(await page.request.get(`${apiUrl}/jobapplications/${created.id}`));
expect(readback).toMatchObject({ id: created.id, jobTitle: job.title, companyId: employer.id, status: 'Saved', jobUrl: job.url,
description, descriptionLanguage: 'nb', followUpAt: null });
// Source/country belong to the linked opportunity, not the compatibility application DTO.
const dataRoot = String(info.config.metadata.isolatedDataRoot);
expect(path.basename(dataRoot)).toMatch(/^jobtracker-e2e-/);
const proof = spawnSync(process.platform === 'win32' ? 'python' : 'python3', ['-c', String.raw`
import json, sqlite3, sys
from pathlib import Path
from contextlib import closing
root = Path(sys.argv[1]).resolve(strict=True)
database = (root / 'jobtracker.db').resolve(strict=True)
assert root.name.startswith('jobtracker-e2e-') and database.parent == root
with closing(sqlite3.connect(database.as_uri() + '?mode=ro', uri=True)) as connection:
connection.execute('PRAGMA query_only=ON')
row = connection.execute('SELECT j.Source, j.CountryCode FROM JobApplications a JOIN Jobs j ON a.JobId=j.Id WHERE a.Id=? AND a.OwnerUserId=? AND j.OwnerUserId=?', (int(sys.argv[2]), sys.argv[3], sys.argv[3])).fetchone()
assert row is not None
print(json.dumps({'source': row[0], 'countryCode': row[1]}))
`, dataRoot, String(created.id), session.owner.id], { encoding: 'utf8' });
expect(proof.status, proof.stderr).toBe(0);
const opportunity = JSON.parse(proof.stdout) as { source: string; countryCode: string };
expect(opportunity).toEqual({ source: 'nav', countryCode: 'NO' });
expect(readback.deadline?.slice(0, 10)).toBe(job.deadline.slice(0, 10));
expect(trackerWrites).toHaveLength(1);
expect(trackerWrites[0]).toMatchObject({ method: 'POST', path: '/api/jobapplications', body: { companyId: employer.id, jobUrl: job.url, status: 'Saved', source: 'nav', countryCode: 'NO' } });
expect(choosers).toEqual([]);
await page.reload();
const tracked = page.getByRole(sample.width >= 768 ? 'row' : 'link', {
name: t.jobTableOpenJob.replace('{title}', job.title).replace('{company}', employer.name), exact: true });
await expect(tracked).toBeVisible();
const workspace = response(page, 'GET', `${apiUrl}/jobapplications/${created.id}/workspace`);
await keyboardActivate(page, tracked);
expect(await json<{ id: number; jobTitle: string; jobUrl: string; description: string }>(await workspace)).toMatchObject({ id: created.id, jobTitle: job.title, jobUrl: job.url, description });
await expect(page).toHaveURL(new RegExp(`/jobs/${created.id}$`));
const duplicates = await json<{ hasDuplicates: boolean; matches: Array<{ id: number }> }>(await page.request.get(`${apiUrl}/jobapplications/duplicate-check`, { params: { companyId: employer.id, jobTitle: job.title, jobUrl: job.url } }));
expect(duplicates.hasDuplicates).toBe(true); expect(duplicates.matches.map(match => match.id)).toContain(created.id);
const other = await playwright.request.newContext();
try {
await login(other, 'e2e@example.test');
expect((await other.get(`${apiUrl}/jobapplications/${created.id}`)).status()).toBe(404);
} finally { await other.dispose(); }
expect(await json<unknown>(await page.request.get(`${apiUrl}/career/profile`))).toEqual(canonical);
expect(await json<Company>(await page.request.get(`${apiUrl}/companies/${employer.id}`))).toMatchObject({ id: employer.id, name: employer.name, location: 'Trondheim', source: 'User' });
expect(trackerWrites).toHaveLength(1); expect(previews).toBe(1);
await info.attach('connected-native-tracker-readbacks', { body: JSON.stringify({ sample, job, readback, opportunity, duplicates, trackerWrites, searches, previews, detailViews, choosers,
qualification: 'Search, original-source popup HTML and import preview are explicitly synthetic route fixtures, with no provider fetch. Company setup/job POST/readbacks/duplicate check/foreign denial are actual disposable API. Source/country checked on the linked opportunity through a guarded read-only query of this fixture SQLite only; application DTO does not expose them. No full provider integration, canonical geography, import parser or automatic duplicate blocking claim.' }), contentType: 'application/json' });
await capture(page, info, sample, 'connected-native-workspace');
});
}
test('[P7-05 Discovery] saved A to manual search clears saved-result context and preserves native saved rows', async ({ page, session }, info) => {
const t = translations.en;
const saved = await createSaved(page, session.owner, 'Recorded saved search A');