Skip to content

🧪 Test(e2e): migrate the ext-knowledge mock into the formal framework and repair the daily knowledge cases - #4090

Merged
jeffwu-1999 merged 7 commits into
developfrom
test-ext-knowledge-mock-v2
Oct 15, 2026
Merged

jeffwu-1999 merged 7 commits into
developfrom
test-ext-knowledge-mock-v2

Conversation

@cj2026-bit

@cj2026-bit cj2026-bit commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

  1. The daily formal baseline (HEAD 9843997, 636 cases / 579 PASS) left four knowledge-domain cases unexecuted or failing for harness reasons after the frontend redesign (feat(frontend): redesign agent and chat workflows #4058): API-AUTO-FC03F18034CB0D51 raised TypeError on a stale delete signature, PW-KB-LOCAL-01 and PW-FILE-01 still targeted the retired agent-card / composer controls, and PW-KB-AIDP-01 had no execution binding, script or page object at all.
  2. The ext-knowledge mock contract existed only as a standalone service draft (PR 🧪 Test: add ext-knowledge mock service for external knowledge adapters #3997) with no formal ownership inside the test framework: no attach/identity/lock/reset mechanism, no evidence export, and none of its eight formal consumers ran against it; a committed copy could silently drift from the checkout.

Fix

  • Framework ownership: the contract now lives in test-e2e/infra/mock-services/ext-knowledge-mock/ (single-source package + seeds, Docker context builder with a manifest hash, dual compose overlays for the runner and product networks, README and deployment descriptor).
  • Attach mechanism: new test-e2e/infra/tools/ext_attach.py verifies the mock identity, guards one instance per endpoint (file lock), probes both sides, resets per case and exports evidence; the suite worker attaches it before any other preparation. validate_execution gained the required_mock_services enum and the new profile_selection field, and the publisher whitelists the four new evidence files.
  • Eight consumers migrated onto the framework-managed instance: AGT-001/002, API-AUTO-FC03F18034CB0D51, CTR-016/017/046/047, PERF-09, REL-02 (runner/product addresses, fault-model base URL and seed assertions).
  • Four daily cases repaired: the D2 delete now passes a real http_request and isolates the audit sink at its actual lookup site, keeping every original redis / pending / fallback / permission assertion; PW-KB-LOCAL-01 uses the current agent-card 配置 action and the AddKnowledgeDrawer autosave; PW-FILE-01 uses the current composer / attachment panel and the refreshed-chat sidebar selector; PW-KB-AIDP-01 is implemented end to end (case-local spec, AidpKnowledgePage, mock / real_smoke profile selection through the machine-local config) proving branch exclusivity, KB selection, the real aidp_search tool-config autosave, Agent Debug recall with the oracle text and source citation, refresh persistence, and a released-version conversation recall.
  • Fidelity suite: test/ext_components/ext_knowledge/ runs the original 57 fidelity tests plus 6 new regressions (63 total) that drive the real adapters (DataMate / Dify / iData / RAGFlow / Haotian / AIDP / fault) against a session-private live mock; CI collects it via test/ext_components.
  • Shared helper drift found under live execution is repaired in the D4 page objects (collapsible editor sections, tool-config autosave evidence, high-fidelity conversation guide, collaborator drawer tabs and version evidence, guardrail modal, agent publish before a new conversation).
  • No product code changed.

Verification

  • Fidelity suite: 63 passed (test/ext_components/ext_knowledge, runs in CI through test/run_all_test.py).
  • Offline: mock-service unit tests, attach tool tests, publisher tests and the implementation-phase asset validator all green.
  • Live end to end against a dockerized local-latest deployment built from this branch (one-off data root, ext-knowledge mock attached over the product network): a single local batch passed 11/11 (the eight migrated consumers + PW-FILE-01 + PW-KB-LOCAL-01); PW-KB-AIDP-01 passed its full mock-profile journey (4 preconditions / 7 steps / 4 assertions, clean cleanup); the shared-helper regression PW-AGENT-02 passed with the repaired helpers.
  • Test-asset validator (implementation phase) green; feature navigation regenerated (only the PW-KB-AIDP-01 status line changed: blocked → active).
  • Review-fix pass (2 follow-up commits): the worker keeps prerequisite-failure receipts (a foreign mock identity now yields BLOCKED_BY_DEPENDENCY with the concrete reason on disk — verified live, not only by unit tests); the mock port is loopback-only per D-001; the attach release state is decided before the lock drops; the fidelity conftest clears the wire log per test and restores its identity environment; the control plane validates the whole /_reset list first and checks AIDP sub-app response codes. CI and codecov/patch re-ran green on both pushes.
  • Minimum-regression re-run against a fresh one-off deployment on the review-fix code: PW-TASK-01 and AGT-001 passed; PW-KB-AIDP-01 passed its full mock-profile journey again (acceptance obligations bound). The repaired helpers were exercised successfully wherever reached (PW-CHAT-01 step 1, PW-CHAT-05 steps 1–3, PW-PROMPT-02 preconditions, PW-AGENT-01 precondition 3).
image

Notes

  • Mock-profile environment requirement (also recorded in the change records and aidp-journey.example.yaml): the controlled KB must be registered for the journey tenant (aidp_kb_permission_t ACTIVE row owned by the tenant admin) because the product intersects the AIDP catalog with local permission rows and has no HTTP flow to register an existing remote KB; the deployment must seed it once.
  • Minimum regression set status (executed, not green): the five remaining consumers fail on their own pre-existing post-feat(frontend): redesign agent and chat workflows #4058 drift, each attributed — PW-AGENT-01 and PW-VERSION-01 in the unchanged AgentPage.create() flow (old 创建智能体 dialog / 新建 entry), PW-PROMPT-01 on the retired 请输入智能体描述 placeholder, PW-PROMPT-02 on the retired 智能体角色 tab, PW-CHAT-01 on the retired 执行 mode button, PW-CHAT-05 on the retired 知识库: scope button. These locators are outside this PR's changed surface and remain recorded as known drift.
  • Other known out-of-scope drift after feat(frontend): redesign agent and chat workflows #4058 (recorded, intentionally not touched here): PW-CHAT-02 / PW-MEDIA-STT-01 still inline the retired 发送消息... composer placeholder, and the tab-based bindTool / bindSkill / openToolsSkills helpers plus their four callers still target the pre-redesign tools/skills tab.

@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

… and repair the daily knowledge cases

- Move the ext-knowledge mock contract into test-e2e/infra/mock-services/ext-knowledge-mock
  (single-source build context, runner/product dual compose overlays, per-case attach tooling
  with identity check, endpoint lock, full reset and evidence export, suite-worker integration,
  validate_execution mock-service enum + profile selection, publisher evidence whitelist).
- Migrate the eight formal mock consumers (AGT-001/002, CTR-016/017/046/047, PERF-09, REL-02)
  onto the framework-managed instance; API-AUTO-FC03F18034CB0D51 is repaired separately below.
- Repair the four daily knowledge cases: the D2 delete signature and audit isolation,
  PW-KB-LOCAL-01 (agent-card configure action + AddKnowledgeDrawer autosave),
  PW-FILE-01 (composer/attachment and refreshed-chat drift), and the new PW-KB-AIDP-01 journey
  with explicit mock/real_smoke profile selection.
- Add the fidelity suite test/ext_components/ext_knowledge (57 original + 6 regressions = 63 tests)
  driving the real adapters against the mock; CI collects it through test/ext_components.
- Repair shared D4 helper drift found under live execution (collapsible agent editor sections,
  tool-config autosave evidence, high-fidelity conversation guide, collaborator drawer,
  guardrail modal, agent publish before a new conversation).
- No product code changed.
…ployment with D-001

Review-fix pass on the framework migration:
- Bind RESULT_DIR in the worker process itself and adopt any prerequisite
  receipt (not only preparation-step failures), so attach and dependency
  failures report BLOCKED_BY_DEPENDENCY with their concrete reason instead
  of a bare AUTOMATION_ERROR. Regression tests cover the classification and
  the worker wiring (the previous tests set RESULT_DIR themselves and thus
  masked the gap).
- Publish the mock port on loopback only per design D-001; product-side
  callers keep using the compose-network DNS name. The registration test
  now pins the loopback binding.
- Decide the instance's released/unknown state before releasing the attach
  lock (removes the unlock-vs-rewrite race); the schema description now
  matches the allowed host-mode equality of runner_url/product_url.
- Fidelity conftest clears the wire log per test and restores the identity
  environment variables at teardown.
- Control plane validates the whole /_reset service list before executing
  and checks the AIDP sub-app response codes on fail-next/fail-reset.
- PW-KB-AIDP-01 syncs the contract text with the implemented evidence
  model and gains acceptance obligations and bindings; drop an unused
  variable and a stray blank line.
@cj2026-bit
cj2026-bit force-pushed the test-ext-knowledge-mock-v2 branch from 7b15fc5 to 2e7ca27 Compare October 14, 2026 06:19
Minimum-regression re-run against a fresh one-off deployment on the
review-fix code: PW-TASK-01 and AGT-001 passed, PW-KB-AIDP-01 passed its
full mock-profile journey, and the repaired helpers were exercised
successfully wherever reached (PW-CHAT-01 step 1, PW-CHAT-05 steps 1-3,
PW-PROMPT-02 preconditions, PW-AGENT-01 precondition 3). The remaining
cases fail on their own pre-existing post-#4058 drift (AgentPage.create()
flow, retired 请输入智能体描述 placeholder, 智能体角色 tab, 执行 mode button,
知识库: scope button), recorded per case and left untouched. The negative
attach path was verified live: a foreign identity yields
BLOCKED_BY_DEPENDENCY with the concrete reason written to the case
runtime receipt.
@cj2026-bit cj2026-bit self-assigned this Oct 14, 2026
… mock README

Documents what a human enters when binding the mocked services as agent
tools (fields, product-side base URLs, credential shapes, runtime input
names incl. iData's question + required rerank_model_id) and the full seed
catalog the pickers list per service, including the AIDP startup rename
and the permission-table registration note. Markdown only; no behavior or
test change.
…e files

Satisfies develop's new copyright-check workflow (#4087), generated with
its official fixer (scripts/check_copyright.py --fix): one header comment
line plus a separator per file, after any shebang/coding line. Comments
only — no behavior change; fidelity suite (63), attach/worker tests (31)
and mock-services tests (26) re-run green after the insertion.
Comment thread test-e2e/infra/tools/ext_attach.py
Comment thread test-e2e/infra/tools/ext_attach.py
…-mock-v2

# Conflicts:
#	test-e2e/infra/tools/suite_publish.py
#	test-e2e/infra/tools/tests/test_suite_publish.py
…lock on an unusable profile contract

Review fixes (jeffwu-1999):
- _attach_locked: the exception path released the lock before rewriting the
  released state, the reverse of the release() rule fixed earlier — a
  concurrent attacher could read the pre-failure released=False in that
  window and false-block with 'previous attach state was not released
  cleanly'. The state is now decided while the lock is still held; a failed
  reset still keeps the unknown state.
- resolve_profile_selection: an unreadable case.yaml or a missing
  execution.profiles entry for the selected profile silently produced an
  empty dependency set, letting attach() skip the mock identity check, lock
  and reset while the batch report looked clean. Both paths now raise a
  typed dependency failure with the concrete reason; a legitimately empty
  required_services entry (real_smoke) is unchanged.
- Four regression tests: state-at-unlock snapshots for both failure
  orderings, plus both blocking paths of the profile contract.

Offline: attach/worker 35 passed, fidelity 63 passed, mock-services 26
passed, asset validator green.
@jeffwu-1999
jeffwu-1999 merged commit bb4cdad into develop Oct 15, 2026
7 checks passed
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.

2 participants