Skip to content

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

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

[SPIKE option C] Flatten Event; additive /edge (INTER-2457)#225
JuroUhlar wants to merge 6 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 single model. Generated from openapi#465. Not the earlier all-SDK union spike (#224), which wraps Event in actual_instance.

  • Event is still one class: identification optional, source: Optional[EventSource].
  • Additive analyze_request_for_automation_intelligenceEventEdge, plus EdgeRequest.
  • sync.sh defaults to fingerprint-server-api-v4-flat.yaml (404 until the OpenAPI package publishes that file).

Known: Event field order

Generated field order follows flattened EventDevice (source moved down). Keyword construction and JSON are unchanged. Positional Event("id", 123, ...) would shift; almost all usage is keywords.

Huge Event.py diff

Mostly reorder plus /edge models. Getter/field names are the same set as main.

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

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

☂️ Code Coverage

current status: ✅

Overall Coverage

Statements Covered Coverage Threshold Status
3446 2439 71% 0% 🟢

New Files

File Coverage Status
fingerprint_server_sdk/models/edge_request.py 58% 🟢
fingerprint_server_sdk/models/edge_request_headers_inner.py 61% 🟢
fingerprint_server_sdk/models/event_edge.py 66% 🟢
TOTAL 62% 🟢

Modified Files

File Coverage Status
fingerprint_server_sdk/init.py 100% 🟢
fingerprint_server_sdk/api/fingerprint_api.py 76% 🟢
fingerprint_server_sdk/models/init.py 100% 🟢
fingerprint_server_sdk/models/event.py 73% 🟢
TOTAL 87% 🟢

updated for commit: c93a704 by action🐍

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 regenerates the SDK from a flattened Event schema (single Event model with optional source) while adding an additive Automation Intelligence /edge endpoint with new request/response models and updated docs/schema.

Changes:

  • Added POST /edge endpoint (analyze_request_for_automation_intelligence) and new models EdgeRequest, EdgeRequestHeadersInner, and EventEdge.
  • Updated Event model ordering/fields to accommodate edge-derived data (e.g., ip_info, bot_info, vpn_methods) while keeping Event as one class.
  • Updated OpenAPI schema snapshot and generated documentation/README references; adjusted search_events query parameter ordering.

Reviewed changes

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

Show a summary per file
File Description
test/test_fingerprint_api.py Keeps URL param serialization expectations aligned with updated query param ordering.
sync.sh Switches default schema URL to the flattened Event spec (now points to v4-flat).
res/fingerprint-server-api.yaml Adds /edge path + EdgeRequest/EventEdge schemas; updates docs links and query param ordering.
README.pypi.md Documents the new /edge endpoint and new models.
README.md Documents the new /edge endpoint and new models.
fingerprint_server_sdk/models/event.py Reorders/extends flattened Event fields and serialization for edge-related nested models.
fingerprint_server_sdk/models/event_edge.py Adds EventEdge response model for /edge.
fingerprint_server_sdk/models/edge_request.py Adds EdgeRequest request model for /edge.
fingerprint_server_sdk/models/edge_request_headers_inner.py Adds header-entry model used by EdgeRequest.headers.
fingerprint_server_sdk/models/init.py Exports newly generated models.
fingerprint_server_sdk/api/fingerprint_api.py Adds /edge client method and updates docstrings/query param ordering.
fingerprint_server_sdk/init.py Re-exports newly generated models at package top level.
docs/FingerprintApi.md Documents /edge endpoint; updates get_event and search_events docs.
docs/EventEdge.md Adds documentation for EventEdge.
docs/Event.md Updates flattened Event documentation to reflect edge-vs-device semantics.
docs/EdgeRequestHeadersInner.md Adds documentation for header entry model.
docs/EdgeRequest.md Adds documentation for EdgeRequest.
.openapi-generator/FILES Includes the newly generated files in the generator manifest.
Suppressed comments (3)

fingerprint_server_sdk/api/fingerprint_api.py:635

  • EventDevice is referenced in this docstring, but the SDK does not define an EventDevice model. The method returns Event.
        Get a detailed analysis of an individual event, including Smart Signals.  Use `event_id` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `event_id`.  Returns `EventDevice` when `source` is `device`, and `EventEdge` when `source` is `edge`.

docs/FingerprintApi.md:212

  • This section says get_event returns EventDevice, but the SDK provides Event (single model) and does not define EventDevice.
Returns `EventDevice` when `source` is `device`, and `EventEdge` when `source` is `edge`.

fingerprint_server_sdk/api/fingerprint_api.py:710

  • EventDevice is referenced in this docstring, but the SDK does not define an EventDevice model. The method returns Event.
        Get a detailed analysis of an individual event, including Smart Signals.  Use `event_id` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `event_id`.  Returns `EventDevice` when `source` is `device`, and `EventEdge` when `source` is `edge`.

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

Comment thread fingerprint_server_sdk/api/fingerprint_api.py Outdated
Comment thread res/fingerprint-server-api.yaml Outdated
Comment thread docs/FingerprintApi.md
# Create an instance of the API class
api_instance = fingerprint_server_sdk.FingerprintApi(configuration)

edge_request: EdgeRequest = fingerprint_server_sdk.EdgeRequest() #
Comment thread fingerprint_server_sdk/models/edge_request.py Outdated
)
vpn_confidence: Optional[VpnConfidence] = None
vpn_methods: Optional[VpnMethods] = None
source: EventSource
Comment on lines +70 to +74
@validate_call
def analyze_request_for_automation_intelligence(
self,
edge_request: EdgeRequest,
_request_timeout: Union[
Comment on lines +41 to +54
ipv4_address: Optional[StrictStr] = Field(
default=None, description='Client IPv4 address observed by your server.'
)
ipv6_address: Optional[StrictStr] = Field(
default=None, description='Client IPv6 address observed by your server.'
)
linked_id: Optional[StrictStr] = Field(
default=None, description='A customer-provided id that was sent with the request.'
)
tags: Optional[dict[str, Any]] = Field(
default=None,
description='A customer-provided value or an object that was sent with the identification request or updated later.',
)
__properties: ClassVar[list[str]] = [
Comment thread sync.sh Outdated
Comment on lines 6 to 7
schemaUrl="${1:-$defaultBaseUrl/schemas/fingerprint-server-api-v4-flat.yaml}"
examplesBaseUrl="${2:-$defaultBaseUrl/examples}"
Comment thread res/fingerprint-server-api.yaml Outdated
Comment thread docs/EdgeRequest.md Outdated
@github-actions

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

@copilot review

…idation, sync.sh fallback, /edge tests

Co-authored-by: JuroUhlar <11249993+JuroUhlar@users.noreply.github.com>

Copilot AI commented Aug 31, 2026

Copy link
Copy Markdown

@copilot review

Addressed the remaining unresolved review items in ecf38fc:

  • EventEdge.source is now Literal['edge'] matching the spec's const: edge, instead of the full EventSource enum.
  • EdgeRequest now validates that at least one of ipv4_address/ipv6_address is set.
  • sync.sh falls back to the existing v4 schema when the default flat schema URL 404s (only when no explicit URL argument is passed).
  • Added /edge unit tests (happy path + 400 error) with a mock response fixture.
  • Updated docs/EventEdge.md for the source field change.

Left the docs/FingerprintApi.md example calling EdgeRequest() without required args as-is, since it follows the same generated-doc pattern used for every other required-body model in that file (e.g. EventUpdate()), so it's a pre-existing generator limitation rather than something specific to this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants