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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/frontend/src/gen/** linguist-generated=true
/gen/go/** linguist-generated=true
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dev: clean build
# Generate protobuf/Connect code
proto-gen:
buf generate
buf generate --template buf.gen.operations.yaml

# Lint protobuf schemas
proto-lint:
Expand Down
20 changes: 20 additions & 0 deletions buf.gen.operations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: v2
plugins:
- remote: buf.build/connectrpc/go
out: gen/go
opt:
- paths=source_relative
types:
- google.longrunning.Operations
- remote: buf.build/bufbuild/es:v2.12.1
out: frontend/src/gen
opt:
- target=ts
types:
- google.longrunning
- google.rpc.Status
inputs:
- module: buf.build/googleapis/googleapis
types:
- google.longrunning
- google.rpc.Status
4 changes: 3 additions & 1 deletion buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ plugins:
out: gen/go
opt:
- paths=source_relative
- remote: buf.build/bufbuild/es
types:
- lapp.web.v1.WorkspaceService
- remote: buf.build/bufbuild/es:v2.12.1
out: frontend/src/gen
opt:
- target=ts
Expand Down
6 changes: 6 additions & 0 deletions buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Generated by buf. DO NOT EDIT.
version: v2
deps:
- name: buf.build/googleapis/googleapis
commit: c17df5b2beca46928cc87d5656bd5343
digest: b5:648a01e0170d4512dea7d564016165decd1ed6e34bef79fe54753e51ad7e27545709ad9157d7551270147d551155c595a2fb0bf5bb33b1c83040ddbce915c604
7 changes: 7 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
version: v2
modules:
- path: proto
deps:
- buf.build/googleapis/googleapis
lint:
use:
- STANDARD
ignore_only:
RPC_REQUEST_RESPONSE_UNIQUE:
- proto/lapp/web/v1/web.proto
RPC_RESPONSE_STANDARD_NAME:
- proto/lapp/web/v1/web.proto
breaking:
use:
- FILE
10 changes: 5 additions & 5 deletions docs/adr/0003-protobuf-connect-api-with-aip-resources.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Protobuf schema-first API with Connect and AIP resources

LAPP Web uses protobuf service definitions as the API contract, served through Connect RPC and consumed by generated Go and TypeScript code. API shapes should follow AIP resource-oriented design where it fits, while using custom methods for actions such as starting a discovery run that do not fit standard CRUD semantics.
LAPP Web uses protobuf service definitions as the API contract, served through Connect RPC and consumed by generated Go and TypeScript code. API shapes follow AIP resource design where it fits. Work that may take significant time follows AIP 151 and returns `google.longrunning.Operation`.

The first API resources use simple names: `Workspace`, `LogFile`, `DiscoveryRun`, and `Pattern`. Pattern resources belong to the discovery run that produced them. Pattern resource IDs use the generated `semantic_id`, which must be unique within a discovery run; duplicate semantic IDs are resolved with a numeric suffix.
The first API resources use simple names: `Workspace`, `LogFile`, `ImportRun`, `DiscoveryRun`, and `Pattern`. Pattern resources belong to the discovery run that produced them. Pattern resource IDs use the generated `semantic_id`, which must be unique within a discovery run; duplicate semantic IDs are resolved with a numeric suffix.

Discovery runs are started with `CreateDiscoveryRun`. Progress steps use user-facing stage names: reading logs, merging entries, discovering patterns, labeling patterns, and writing results.
Import and discovery runs are started with Create methods that return standard Operations. The operation metadata contains the run resource while work is active. A successful operation response contains the completed run resource. An execution failure is returned through `Operation.error`.

Uploading or deleting log files does not automatically start discovery. Discovery is an explicit action and can be started whenever the user chooses.

Each workspace may have at most one running discovery run at a time because discovery writes generated workspace results.
Each workspace may have at most one running import or discovery operation at a time. A parallel Create request returns `ABORTED`.

Log files cannot be uploaded or deleted while a discovery run is running for the same workspace.

Expand All @@ -18,7 +18,7 @@ Discovery run history is retained so failures and prior runs can be inspected. T

DiscoveryRun IDs use UUIDv7. Unlike Pattern IDs, DiscoveryRun IDs are operational record identifiers, not user-facing semantic handles.

The first version reports discovery progress through polling `GetDiscoveryRun`, not streaming.
Clients poll `google.longrunning.Operations.GetOperation` for standard operation state. `GetImportRun`, `ListImportRuns`, `GetDiscoveryRun`, and `ListDiscoveryRuns` remain available because runs are retained domain resources and history.

Discovery results belong to the discovery run that produced them. Workspace views may present a selected discovery run's results instead of treating generated results as anonymous global workspace state.

Expand Down
4 changes: 2 additions & 2 deletions docs/web-app-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ LAPP Web is a local web app for working with local LAPP workspaces. It starts fr
- Dashboard is a simple entry point for listing, creating, opening, and permanently deleting workspaces.
- Workspace detail is the primary analysis surface.
- Discovery is explicit. Uploading or deleting log files does not automatically start discovery.
- Discovery runs are asynchronous, one-time task executions. A completed run is not synchronized with later log file changes.
- Discovery runs are asynchronous, one time task executions. Create returns a standard long running Operation. A completed run is not synchronized with later log file changes.
- Workspace views default to the latest successful discovery run.
- DiscoveryRun creation requires at least one log file and rejects concurrent runs for the same workspace at the API layer.
- DiscoveryRun creation requires at least one log file. A parallel run request returns `ABORTED`.
- If the web server starts and finds local `QUEUED` or `RUNNING` DiscoveryRuns from a previous process, it marks them as failed because no worker is still attached to them.
- Semantic labeling runs in batches of 25 patterns with default concurrency 12, a per-batch timeout, and up to 3 attempts per batch.
- DiscoveryRun records store structured `progress` and `error` fields. Backend code records facts; frontend code renders user-facing text.
Expand Down
23 changes: 21 additions & 2 deletions frontend/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
import { createRegistry } from "@bufbuild/protobuf";
import { createClient } from "@connectrpc/connect";
import { createConnectTransport } from "@connectrpc/connect-web";
import { WorkspaceService } from "./gen/lapp/web/v1/web_pb";
import { Operations } from "./gen/google/longrunning/operations_pb";
import {
DiscoveryRunMetadataSchema,
DiscoveryRunSchema,
ImportRunMetadataSchema,
ImportRunSchema,
WorkspaceService
} from "./gen/lapp/web/v1/web_pb";

const typeRegistry = createRegistry(
DiscoveryRunMetadataSchema,
DiscoveryRunSchema,
ImportRunMetadataSchema,
ImportRunSchema
);

const transport = createConnectTransport({
baseUrl: window.location.origin,
useBinaryFormat: false
useBinaryFormat: false,
jsonOptions: {
registry: typeRegistry
}
});

export const workspaceClient = createClient(WorkspaceService, transport);
export const operationsClient = createClient(Operations, transport);
38 changes: 38 additions & 0 deletions frontend/src/gen/google/api/annotations_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

86 changes: 86 additions & 0 deletions frontend/src/gen/google/api/client_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading