Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Decouple plugins from Go pipeline internals: parser test data, session facts, serializable records

Đang mở
#1,499 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, json, rust

Hướng nghiên cứu

Start with the referenced parser packages, core/pipeline/extensions.go, the three plugins that read session history, and core/session/store.go; the issue links to each entry point. First inspect how parsers create extensions and how the store builds session views. The stated done conditions cover fixtures and schemas, session facts, and removing per request Store.View calls, so this is broad work with open design questions.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement laptop

Part of #1437 (assessment: laptop data plane on Praxis) · prep work, useful to Cortex on its own

Status: there is no Cortex–Praxis integration today, and the interim path is not decided (LLM traffic to praxis-ai as an inference server, or all traffic through Praxis via #1491). Nothing here depends on that choice: each item is useful to Cortex now, and makes an eventual move to Praxis easier whichever path is taken.

Problem

If Cortex moves to Praxis, its plugins would move one at a time, as praxis-ai filters or PPE policy plugins. Three things would make each move harder than it needs to be, and two of them already cost Cortex today:

  1. Plugins share data through Go structs. The parsed request is read by most plugins as a Go type, with no written contract. Praxis passes data between filters as filter_metadata strings or structured_metadata JSON.
  2. Three plugins read session history, which Praxis does not keep, so they could not move at all as written.
  3. No saved test cases exist for the parsers, so a Rust port can only be checked by reading the Go code.

What Cortex does today

The parsed request is a Go struct.

Only three plugins read session history:

context-guru, session-budget, script and cpex read only Session.ID; tool-prune reads nothing from the session.

Building the view copies every event. Store.View copies the whole session for each request that hydrates one (forwardproxy/server.go:1471). With session.max_events unset (the default), that grows without limit. Not measured.

Plugin-to-plugin records. tool-prune reads the cost record as a Go value out of Extensions.Custom (toolprune/plugin.go:549).

Saved test data. The only testdata/ under core/ is core/cost/pricing/testdata.

Praxis has built-ins that cover three plugins:

  • opa (746 non-blank lines): PPE ships an OPA engine (praxis-proxy/policy, crates/builtins/src/pdps/opa).
  • jwt-validation (747): PPE identity_jwt.
  • static-inject (283): Praxis's header and credential_injection filters.

Proposal

  1. Saved test cases for the parsers. Add testdata/ to inference-parser, mcp-parser and a2a-parser: real request and response bodies (JSON and SSE), each paired with the expected extension JSON, driven by one table test per parser. A Rust port runs the same files.
  2. Write down the parsed-request contract. A JSON schema for InferenceExtension, MCPExtension and A2AExtension, generated or checked from the Go types, linked from docs/session-api.md. Move MCP Params/Result to RawJSON.
  3. Session facts instead of the session view.
    • Add a plain pctx.SessionID, and move the four ID-only plugins to it.
    • Give ibac, sparc and the router the one fact each needs: the last intent text; recent inference requests; the server the session last went to.
    • Each is maintained by the store when events are appended, rather than rebuilt from a copied view.
  4. Serializable records between plugins. Make the cost record a documented JSON shape, and read it through a decoder rather than a Go type assertion.
  5. Consider freezing opa, static-inject and jwt-validation: add no new features while the move to Praxis is being decided, since Praxis has built-ins for all three.

Design questions

  1. Fixture format: one file per case (request, response, expected), or one golden file per parser?
  2. Should session facts be fields on pctx, or a small SessionFacts interface the store implements?
  3. Should new policy checks be written for PPE / praxis-ai rather than as Go plugins? That depends on the path decision and is not proposed here.
  4. Which plugin would move first? tool-prune is the smallest with no session dependency; sparc is the smallest of the three that need facts.

Done when

  • Each parser has saved test cases that cover both directions and SSE, and a schema the tests check against.
  • ibac, sparc and inference-router no longer call pctx.Session views; no plugin reads Session.Events.
  • Store.View is no longer called per request on the forward path.
  • (If agreed) the plugin catalog marks the three frozen plugins.

Evidence read at main @ e455a04 (2026-10-25); not built or run.

Ngôn ngữ chính
Go
Star
18
Fork
42
Merge trung bình
12 giờ 20 phút
Pull request đã merge (30 ngày)
229

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rossoctl/cortex

Tất cả issue của rossoctl/cortex

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.