Skip to content
This repository was archived by the owner on Oct 11, 2026. It is now read-only.

feat(ei): add bounded WvW V2 process adapter - #343

Merged
Roddygithub merged 3 commits into
mainfrom
feat/ei-v2-process-adapter
Oct 11, 2026
Merged

Roddygithub merged 3 commits into
mainfrom
feat/ei-v2-process-adapter

Conversation

@Roddygithub

Copy link
Copy Markdown
Owner

Adds the bounded Elite Insights WvwExportV2 process adapter prototype on top of the certified V2 contract merged in #342.

Authoritative candidate:
bb2a17da60161933ddb7f7de7d3635037ea27625

Base main:
7d24ed65a5937e7ea176034e652bc6bf6d8b4987

Certified Elite Insights V2 reference:
445eeb80e373b4597b0b38f9fbf90099c475fefc
(parser_version = 3.26.0.0)

Independent review:
PASS — READY_FOR_PROCESS_ADAPTER_PR

Scope

This PR adds only:

  • apps/api/src/gw2analytics_api/services/ei_v2_process_adapter.py
  • tests/scripts/test_ei_v2_process_adapter.py

Key properties

  • argv-vector EI subprocess invocation; no shell interpolation
  • WvwExportV2 only
  • isolated per-invocation workspace
  • exactly one fresh export required
  • validation through the certified WvwExportV2 model
  • certified parser-version guard (3.26.0.0)
  • typed configuration/process/output/contract/version failures
  • stable absolute executable resolution
  • malformed JSON and invalid UTF-8 handled as typed format failures
  • workspace filesystem failures mapped to typed workspace errors
  • no shared per-invocation state

Validation

Independent final review:
PASS — READY_FOR_PROCESS_ADAPTER_PR

Focused adapter tests:

  • 36 passed

Also validated:

  • V1 export tests
  • V2 contract tests
  • certification harness tests
  • parser-boundary tests
  • gw2_core tests
  • tests/scripts
  • ruff
  • formatting
  • mypy
  • git diff --check

Known bounded limitations

  • the certified EI exporter currently emits source_commit = null, so the adapter verifies parser_version, not exact producing Git commit identity
  • cleanup failure remains non-fatal and is logged as a warning

Explicitly out of scope

This PR does NOT:

  • cut production ingestion over to EI
  • modify parser_adapter
  • remove the legacy parser
  • add V1 or legacy-parser fallbacks
  • change API behavior
  • change database schema
  • change frontend behavior
  • modify Elite Insights source or semantics

Add EiV2ProcessAdapter, the process-infrastructure side of the parser
boundary: it invokes a configured Elite Insights CLI with the certified
V2 settings, isolates each invocation in its own temporary workspace,
requires exactly one fresh _wvw_export_v2.json output, and validates it
with the certified gw2_core WvwExportV2 contract. Failures are typed
(configuration, workspace, timeout, non-zero exit, missing/ambiguous
output, malformed JSON, contract violation) with metadata-safe
diagnostics, and workspaces are cleaned on success and failure. The
adapter is not wired into production ingestion; the legacy parser
adapter remains the only production parse path. Tests use a fake EI
executable, so no private corpus, database, or real EI build is
required.

Signed-off-by: Roland Salardon <r.salardon@gmail.com>
Reject valid-looking V2 exports produced by an unexpected EI parser
version via a typed EiProcessVersionError, defaulting to the certified
candidate's 3.26.0.0. Because the certified exporter writes
source_commit=null, the guard verifies the certified parser version,
not the exact Git commit of the producing build. Wrap the adapter-owned
config write and export read so material workspace filesystem failures
surface as EiProcessWorkspaceError instead of a raw OSError, and
require a positive finite timeout (rejecting +/-inf and NaN). Focused
tests cover version acceptance/rejection, the extended timeout matrix,
and both wrapped filesystem failures; all 25 pre-existing adapter tests
keep passing.

Signed-off-by: Roland Salardon <r.salardon@gmail.com>
Resolve the EI executable to an absolute, symlink-stable path at
construction time so a later working-directory change cannot alter
which binary a stored command invokes. Surface undecodable export
bytes (UnicodeDecodeError as well as JSONDecodeError) through the
typed EiProcessOutputFormatError with the original exception chained,
and wrap workspace-enumeration OSError in EiProcessWorkspaceError so
the typed filesystem contract is internally consistent. Cleanup,
version/provenance policy, and all other adapter properties are
unchanged; focused tests cover relative-path stability, symlink
resolution, adversarial invalid-UTF-8 bytes, and enumeration failure.

Signed-off-by: Roland Salardon <r.salardon@gmail.com>
@Roddygithub
Roddygithub merged commit c5576fc into main Oct 11, 2026
10 of 11 checks passed
@Roddygithub
Roddygithub deleted the feat/ei-v2-process-adapter branch October 11, 2026 08:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant