feat(logs): collapse large run log data and serve client manifest
CI / changes (pull_request) Successful in 6s
CI / version (pull_request) Skipped
CI / server (pull_request) Successful in 1m30s
CI / client (pull_request) Successful in 1m31s
CI / image (pull_request) Skipped

- collapse run log data blocks whose pretty-printed JSON exceeds a byte
  or line limit, with a per-block toggle and an expand/collapse-all
  button next to the Logs heading
- align data blocks and toggles with the context/message column
- add a "Copy logs" button that copies the filtered logs as plain text
  with every data block expanded
- add GET /manifest.json with the app name, version and run log data
  limits (RUN_LOG_DATA_COLLAPSE_BYTES / RUN_LOG_DATA_COLLAPSE_LINES)
- load the manifest in the client stale-while-revalidate: localStorage
  copy first, refetched per page load and on tab focus after a while
- show the server version in the sidebar footer, with a reload hint
  when it differs from the client build

Closes #3
This commit is contained in:
ars9 committed 2026-10-02 14:05:49 +03:00
1 parent 4e55d14599
commit 718a12c2f4
25 files changed
+623 -36

No files matched your search

+2
View File
@@ -12,6 +12,7 @@ import { EnvironmentModule } from "./environment/environment.module";
import { FileModule } from "./file/file.module";
import { HealthModule } from "./health/health.module";
import { ImportModule } from "./import/import.module";
import { ManifestModule } from "./manifest/manifest.module";
import { McpModule } from "./mcp/mcp.module";
import { ScenarioModule } from "./scenario/scenario.module";
import { SnippetModule } from "./snippet/snippet.module";
@@ -43,6 +44,7 @@ import { SnippetModule } from "./snippet/snippet.module";
ImportModule,
McpModule,
HealthModule,
ManifestModule,
],
})
export class AppModule {}
+1
View File
@@ -9,6 +9,7 @@ const SERVER_ROUTES = [
"/docs{*path}",
"/health",
"/healthz",
"/manifest.json",
];
/**
+10
View File
@@ -64,6 +64,16 @@ export class AppConfig {
@IsEnum(TraceMode)
// Off by default: traces with screenshots and snapshots easily reach ~10 MB per run
PLAYWRIGHT_TRACE_MODE: TraceMode = TraceMode.Off;
/** Run log data blocks over this many bytes (pretty-printed) start collapsed in the UI. */
@IsInt()
@Min(0)
RUN_LOG_DATA_COLLAPSE_BYTES: number = 256;
/** Run log data blocks over this many lines (pretty-printed) start collapsed in the UI. */
@IsInt()
@Min(0)
RUN_LOG_DATA_COLLAPSE_LINES: number = 5;
}
export function validateAppConfig(config: Record<string, unknown>): AppConfig {
+1
View File
@@ -51,6 +51,7 @@ async function bootstrap() {
{ path: "health", method: RequestMethod.ALL },
{ path: "healthz", method: RequestMethod.ALL },
{ path: "mcp", method: RequestMethod.ALL },
{ path: "manifest.json", method: RequestMethod.ALL },
],
});
@@ -0,0 +1,29 @@
import { Controller, Get, Header } from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import { ApiOkResponse, ApiOperation, ApiTags } from "@nestjs/swagger";
import { AppConfig } from "../config/app.config";
import { ManifestDto } from "./manifest.dto";
@ApiTags("manifest")
@Controller()
export class ManifestController {
constructor(private readonly config: ConfigService<AppConfig, true>) {}
@Get("manifest.json")
// Clients cache the manifest themselves; the browser just revalidates it (ETag)
@Header("Cache-Control", "no-cache")
@ApiOperation({ summary: "Public client configuration and app version" })
@ApiOkResponse({ type: ManifestDto })
manifest(): ManifestDto {
return {
name: this.config.get("APP_NAME"),
version: this.config.get("APP_VERSION"),
runLogs: {
dataLimits: {
bytes: this.config.get("RUN_LOG_DATA_COLLAPSE_BYTES"),
lines: this.config.get("RUN_LOG_DATA_COLLAPSE_LINES"),
},
},
};
}
}
+31
View File
@@ -0,0 +1,31 @@
import { ApiProperty } from "@nestjs/swagger";
export class RunLogDataLimitsDto {
@ApiProperty({
description: "Data blocks over this many bytes (pretty-printed) start collapsed",
example: 256,
})
bytes!: number;
@ApiProperty({
description: "Data blocks over this many lines (pretty-printed) start collapsed",
example: 5,
})
lines!: number;
}
export class RunLogsManifestDto {
@ApiProperty({ type: RunLogDataLimitsDto })
dataLimits!: RunLogDataLimitsDto;
}
export class ManifestDto {
@ApiProperty({ example: "liqa" })
name!: string;
@ApiProperty({ example: "1.4.0" })
version!: string;
@ApiProperty({ type: RunLogsManifestDto })
runLogs!: RunLogsManifestDto;
}
+7
View File
@@ -0,0 +1,7 @@
import { Module } from "@nestjs/common";
import { ManifestController } from "./manifest.controller";
@Module({
controllers: [ManifestController],
})
export class ManifestModule {}
+2 -1
View File
@@ -44,6 +44,7 @@ import { EnvironmentModule } from "../src/environment/environment.module";
import { ScenarioModule } from "../src/scenario/scenario.module";
import { McpModule } from "../src/mcp/mcp.module";
import { HealthController } from "../src/health/health.controller";
import { ManifestController } from "../src/manifest/manifest.controller";
import { HttpExceptionFilter } from "../src/filters/http-exception.filter";
import { LoggingInterceptor } from "../src/interceptors/logging.interceptor";
import { validateAppConfig } from "../src/config/app.config";
@@ -74,7 +75,7 @@ export async function buildTestApp(): Promise<INestApplication> {
ImportModule,
McpModule,
],
controllers: [HealthController],
controllers: [HealthController, ManifestController],
}).compile();
const app = module.createNestApplication<NestExpressApplication>();
+12
View File
@@ -35,6 +35,11 @@ class RootRoutesController {
return { status: "ok" };
}
@Get("manifest.json")
manifest() {
return { version: "1.0.0" };
}
@Post("mcp")
mcp() {
return { jsonrpc: "2.0" };
@@ -59,6 +64,7 @@ async function buildApp(clientDir: string): Promise<INestApplication> {
exclude: [
{ path: "health", method: RequestMethod.ALL },
{ path: "mcp", method: RequestMethod.ALL },
{ path: "manifest.json", method: RequestMethod.ALL },
],
});
await app.init();
@@ -132,6 +138,12 @@ describe("Client static serving", () => {
expect(res.text).not.toContain("liqa</html>");
});
it("leaves /manifest.json to the server", async () => {
await request(app.getHttpServer())
.get("/manifest.json")
.expect(200, { version: "1.0.0" });
});
it("serves nothing when no client directory is configured", async () => {
const bare = await buildApp("");
await request(bare.getHttpServer()).get("/").expect(404);
+40
View File
@@ -0,0 +1,40 @@
import { INestApplication } from "@nestjs/common";
import request from "supertest";
import { appPackage } from "../src/common/app-package";
import { buildTestApp } from "./app.harness";
describe("GET /manifest.json", () => {
let app: INestApplication;
afterEach(async () => {
delete process.env.RUN_LOG_DATA_COLLAPSE_BYTES;
delete process.env.RUN_LOG_DATA_COLLAPSE_LINES;
await app?.close();
});
it("returns the app version and default run log data limits", async () => {
app = await buildTestApp();
const res = await request(app.getHttpServer())
.get("/manifest.json")
.expect(200);
expect(res.body).toEqual({
name: appPackage().name,
version: appPackage().version,
runLogs: { dataLimits: { bytes: 256, lines: 5 } },
});
expect(res.headers["cache-control"]).toBe("no-cache");
expect(res.headers["etag"]).toBeDefined();
});
it("takes the run log data limits from the configuration", async () => {
process.env.RUN_LOG_DATA_COLLAPSE_BYTES = "1024";
process.env.RUN_LOG_DATA_COLLAPSE_LINES = "20";
app = await buildTestApp();
const res = await request(app.getHttpServer())
.get("/manifest.json")
.expect(200);
expect(res.body.runLogs.dataLimits).toEqual({ bytes: 1024, lines: 20 });
});
});