Skip to content

[SPIKE option C] Flatten Event; additive /edge (INTER-2457) - #102

Closed
JuroUhlar wants to merge 8 commits into
mainfrom
spike/INTER-2457-option-c
Closed

JuroUhlar wants to merge 8 commits into
mainfrom
spike/INTER-2457-option-c

Conversation

@JuroUhlar

@JuroUhlar JuroUhlar commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

SPIKE. Do not merge. Option C: Event stays a struct. Generated from openapi#465. Not the earlier all-SDK union spike (#101), which turned Event into a pointer-pair sum type.

  • Event still has Identification and Source *EventSource.
  • Additive AnalyzeRequestForAutomationIntelligence → *EventEdge. Re-exports EventEdge, EdgeRequest.
  • bin/sync.sh already used fingerprint-server-api-v4-normalized.yaml.

Known: Event field order

Struct field order follows flattened EventDevice (Source moved below the VPN block). JSON tags are unchanged. Named composite literals are fine. Unnamed Event{"id", 123, ...} would fail to compile.

INTER-2457 option C. Event stays a single model; EventEdge is additive for POST /edge.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This spike updates the OpenAPI inputs and generated Go SDK surface to support the new Automation Intelligence /edge endpoint while keeping Event as a single flattened struct that can represent both device and edge events (distinguished via source).

Changes:

  • Added /edge POST endpoint (analyzeRequestForAutomationIntelligence) with EdgeRequest payload and EventEdge response.
  • Introduced new generated models (EdgeRequest, EdgeRequestHeadersInner, EventEdge) and re-exported them from the public package.
  • Updated Event schema/model to include edge-related fields in the flattened Event struct (field reordering; JSON tags unchanged), plus doc/link updates.

Reviewed changes

Copilot reviewed 11 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
res/fingerprint-server-api-v4.yaml Adds /edge path + new schemas; updates Event schema/docs and link text
internal/openapi/api/openapi.yaml Generated OpenAPI used for SDK generation; includes /edge + new schemas/docs
internal/openapi/api_fingerprint.go Generated API client adds AnalyzeRequestForAutomationIntelligence request/execute methods
internal/openapi/model_event.go Updates flattened Event struct ordering/fields and serialization mapping
internal/openapi/model_event_edge.go Adds EventEdge model with required fields + (unconstrained) source
internal/openapi/model_edge_request*.go Adds EdgeRequest + header-entry model
models.go Re-exports EdgeRequest, EdgeRequestHeadersInner, EventEdge
fingerprint.go Re-exports APIAnalyzeRequestForAutomationIntelligenceRequest alias
README.md / docs/*.md Adds model docs/links for the new types
functional_test/functional_test.go Extends mock interface for the new API method
options_test.go Extends test stub implementation to satisfy updated FingerprintAPI interface
internal/openapi/.openapi-generator/FILES Registers newly generated files
bin/sync.sh Updates schema sync comment for flattened Event context
Files not reviewed (6)
  • internal/openapi/api_fingerprint.go: Generated file
  • internal/openapi/model_edge_request.go: Generated file
  • internal/openapi/model_edge_request_headers_inner.go: Generated file
  • internal/openapi/model_event.go: Generated file
  • internal/openapi/model_event_edge.go: Generated file
  • models.go: Generated file
Suppressed comments (3)

internal/openapi/api/openapi.yaml:1533

  • In the EventEdge example, event_id and timestamp are shown as empty strings. event_id should be a non-empty string and timestamp should be an integer (Unix ms), otherwise the example is invalid and can mislead users.
        event_id: ""
        timestamp: ""

internal/openapi/api/openapi.yaml:1608

  • EventEdge represents an Automation Intelligence (/edge) event, so the example source value should be edge (not device).
        source: device

res/fingerprint-server-api-v4.yaml:1303

  • Typo in the header-forwarding guidance: "with with" is duplicated, which reads incorrectly in generated docs and code comments.
            included, but with with their value set to an empty string. This

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread res/fingerprint-server-api-v4.yaml Outdated
Comment thread internal/openapi/api/openapi.yaml Outdated
@JuroUhlar

Copy link
Copy Markdown
Contributor Author

@copilot review

Copilot AI commented Aug 31, 2026

Copy link
Copy Markdown

@copilot review

Reviewed the current state of the branch: go build ./... and go vet ./... are clean, functional/mock tests pass (only the env-gated TestApiFunctional fails locally due to missing API key, unrelated to this change), and the previously flagged EventDevice doc references are already fixed in 272a439. No further issues found.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

⚠️ This PR doesn't contain any changesets. If there are user-facing changes, don't forget to run:

pnpm exec changeset

to create a changeset.

@JuroUhlar

Copy link
Copy Markdown
Contributor Author

This was a prototype done as part of a spike. Closing now, still usable as a reference during the production implementation.

@JuroUhlar JuroUhlar closed this Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants