api7 / api7/aisix

E2E: verify DP handles P0c kine fields (enforcement_mode, mandatory, direction) in real guardrail flow

Open
#414 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

cross-repo enhancement priority-normal
Dominant language
Rust
Stars
157
Forks
32
Avg merge
1h 25m
Merged PRs (30d)
145

Description

Context

ai-gateway PR #411 adds enforcement_mode, mandatory, and direction to the outer aisix_core::Guardrail struct with #[serde(default)]. Unit tests (including p0c_fields_dont_trip_keyword_config_deny_unknown_fields) confirm the serde routing is correct.

However, there is no E2E test that boots a real DP, pushes a kine payload from AISIX-Cloud PR #516 that includes these three fields, and verifies the DP:

  1. Parses the payload without error
  2. Reads enforcement_mode=monitor correctly (i.e. does not block when it should only monitor)
  3. Reads mandatory=true correctly
  4. Reads direction=input correctly and applies it to hook filtering (when direction filtering is implemented)

What to add

Add an E2E test in the aisix-e2e compose suite under flows/ or live/ that:

  • Creates a guardrail with enforcement_mode=monitor, mandatory=false, direction=both via the CP API
  • Attaches it to an env-scope
  • Sends a chat request that would trigger the guardrail keyword match
  • Asserts the request is allowed through (monitor mode, not block)
  • Asserts the usage event records the guardrail match with enforcement_mode=monitor

Priority

LOW — the DP unit tests pin the serde contract; this E2E test verifies the full CP→kine→DP pipeline. Should be added before the enforcement_mode field is used in product UI (i.e. before the dashboard exposes it as a real control).

Related

  • ai-gateway PR #411
  • AISIX-Cloud PR #516
  • #379 P0c checklist

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the aisix-e2e compose suite under flows/ or live/ and its existing CP API flows, then trace the real CP→kine→DP path. Create the specified guardrail and env-scope, send a keyword-triggering chat request, and verify it is allowed while the usage event records the match and enforcement_mode=monitor.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design, testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.