CI / Rust Checks (pull_request) Failing after 13m41s
CI / UI Checks (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Deploy (pull_request) Skipped
Community Release / release (push) Failing after 13m33s
Recovery delivery of the accumulated, TL-accepted Epic 3 work that had never been
committed to Git (stories 3.6-3.17, see the crank board). Story 3.18 is not accepted
yet and is deliberately excluded: its logging surface, its capability registration,
its oracle projections and its tests are not part of this tree.
Accepted scope
- 3.6 typed static Resource Drafts; 3.7 publication and exact binding of static
Resource Versions; 3.8 MCP discovery/read and revocation of static Resources;
- 3.9 Resource import/export in API and UI plus TLS dependency maintenance;
3.10 REST-backed Resource templates; 3.11 shared REST read runtime and the MCP
revision/capability foundation;
- 3.12 parameterised Prompt Drafts with preview; 3.13 Prompt publication and exact
version binding to Agents; 3.14 MCP prompts; 3.15 Prompt import/export;
- 3.16 composite Prompts with published Resources (dependency content scan plus
dynamic read through the accepted 3.11 runtime, admin preview and MCP prompts/get);
- 3.17 bounded MCP completion suggestions from typed published schemas and the
resources/list admission fix for bound template publications.
Accepted evidence being reused (unchanged code paths)
- 3.16 candidate: core 7, admin-api 22, registry 4, mcp-server 4, UI 6; one final
`just verify` run 1651 passed / 0 failed / 2 ignored.
- 3.17 candidate: full run 1672 passed / 0 failed / 2 ignored, QA targeted reruns and
a real MCP Inspector 2.12.0 client smoke.
Delivery engineering in this commit
- CI: one event per change (feature branches are gated by their pull request, push
runs only on main), story events run the changed packages, the full workspace suite
stays the feature/release gate; no cache/sharding without a measured runner check.
- Release: the packaged archives, checksums and SBOM are now uploaded to the Gitea
release entry of the tag instead of dying with the runner workspace.
Not included on purpose: Story 3.18 work, build caches, runtime databases, local
credentials and scratch evidence.
Refs: crank kanban t_e39d7263; baseline 1b6db09bd1.
171 lines
5.9 KiB
Rust
171 lines
5.9 KiB
Rust
//! AT-3.6-06: содержимое не попадает в тела отказов (RED + зафиксированный GAP по sink-ам).
|
||
//!
|
||
//! Источник: SPEC v4 §2 (AT-3.6-06), §6 (секреты/логи), §7 (захват logs/errors/telemetry и
|
||
//! положительные контроли sink-а); QA test-design run77:117–119.
|
||
//!
|
||
//! Проверяется наблюдаемое на реальном HTTP: ни одна отказная ветвь не возвращает байты
|
||
//! содержимого, отказ несёт `x-trace-id` (то есть событие отказа атрибутируется), а валидный
|
||
//! follow-up той же сессии проходит. Захват writer/span/metric sink-ов здесь **не** ставится:
|
||
//! глобальный tracing-подписчик процесса уже назначается модулем
|
||
//! `integration::openapi_source::telemetry` через `set_global_default(...).expect(...)`;
|
||
//! второй глобальный default в том же тестовом бинаре конфликтует и ломает существующий тест,
|
||
//! поэтому coverage логов/span-ов/метрик — отчётный GAP/NOT_PROVEN, а не доказательство.
|
||
|
||
use super::helpers::{
|
||
create_draft, created_resource_id, draft_metadata, error_signature, post_draft_raw,
|
||
read_preview, read_response, spawn_authorized,
|
||
};
|
||
use reqwest::StatusCode;
|
||
use serde_json::json;
|
||
use serial_test::serial;
|
||
|
||
#[tokio::test(flavor = "multi_thread")]
|
||
#[serial]
|
||
async fn story36_at06_content_never_enters_logs_errors_or_telemetry() {
|
||
const CANARY: &str = "C36-CONTENT-CANARY";
|
||
|
||
let (_registry, server, client) = spawn_authorized("story36_canary").await;
|
||
|
||
// (1) malformed JSON: canary внутри отклоняемого содержимого
|
||
let malformed = format!("{{\"leak\":\"{CANARY}\"");
|
||
let meta = draft_metadata(
|
||
"crank://canary/json",
|
||
"canary_json",
|
||
"json",
|
||
"application/json",
|
||
"internal",
|
||
);
|
||
let (status, traceable, text, body) = post_draft_raw(
|
||
&client,
|
||
&server,
|
||
&meta,
|
||
malformed.as_bytes(),
|
||
"application/json",
|
||
)
|
||
.await;
|
||
assert!(
|
||
traceable,
|
||
"(1) a refusal must carry `x-trace-id` so the rejection is attributable (SPEC §7)"
|
||
);
|
||
assert!(
|
||
!text.contains(CANARY),
|
||
"(1) refusal must not echo content bytes: {text}"
|
||
);
|
||
assert_eq!(
|
||
status,
|
||
StatusCode::UNPROCESSABLE_ENTITY,
|
||
"(1) expected resource_content_invalid_json; observed {} body={text}",
|
||
error_signature(status, &body)
|
||
);
|
||
assert_eq!(
|
||
body["error"]["code"],
|
||
json!("resource_content_invalid_json")
|
||
);
|
||
|
||
// (2) invalid UTF-8: canary + повреждённая последовательность
|
||
let invalid_utf8 = [CANARY.as_bytes(), &[0xC3, 0x28]].concat();
|
||
let meta = draft_metadata(
|
||
"crank://canary/utf8",
|
||
"canary_utf8",
|
||
"text",
|
||
"text/plain",
|
||
"internal",
|
||
);
|
||
let (status, traceable, text, body) =
|
||
post_draft_raw(&client, &server, &meta, &invalid_utf8, "text/plain").await;
|
||
assert!(traceable, "(2) a refusal must carry `x-trace-id`");
|
||
assert!(
|
||
!text.contains(CANARY),
|
||
"(2) refusal must not echo content bytes: {text}"
|
||
);
|
||
assert_eq!(
|
||
status,
|
||
StatusCode::UNPROCESSABLE_ENTITY,
|
||
"(2) expected resource_content_invalid_utf8; observed {} body={text}",
|
||
error_signature(status, &body)
|
||
);
|
||
assert_eq!(
|
||
body["error"]["code"],
|
||
json!("resource_content_invalid_utf8")
|
||
);
|
||
|
||
// (3) duplicate uri: принятый Draft + повторный create с canary в содержимом
|
||
let meta = draft_metadata(
|
||
"crank://canary/dup",
|
||
"canary_dup",
|
||
"text",
|
||
"text/plain",
|
||
"internal",
|
||
);
|
||
create_draft(
|
||
&client,
|
||
&server,
|
||
&meta,
|
||
b"safe payload",
|
||
"draft.txt",
|
||
"text/plain",
|
||
)
|
||
.await;
|
||
let (status, _traceable, text, body) =
|
||
post_draft_raw(&client, &server, &meta, CANARY.as_bytes(), "text/plain").await;
|
||
assert!(
|
||
!text.contains(CANARY),
|
||
"(3) refusal must not echo content bytes: {text}"
|
||
);
|
||
assert_eq!(
|
||
status,
|
||
StatusCode::CONFLICT,
|
||
"(3) expected resource_uri_duplicate; observed {} body={text}",
|
||
error_signature(status, &body)
|
||
);
|
||
|
||
// (4) отсутствующий Resource: отказ не раскрывает metadata
|
||
let (status, text, body) = read_response(
|
||
client
|
||
.get(format!("{server}/resources/res_story36_canary_missing"))
|
||
.send()
|
||
.await
|
||
.expect("missing resource request must complete"),
|
||
)
|
||
.await;
|
||
assert!(
|
||
!text.contains(CANARY),
|
||
"(4) refusal must not echo content bytes: {text}"
|
||
);
|
||
assert_eq!(
|
||
status,
|
||
StatusCode::NOT_FOUND,
|
||
"(4) expected resource_not_found; observed {} body={text}",
|
||
error_signature(status, &body)
|
||
);
|
||
|
||
// (5) positive control: валидный create + preview той же сессии
|
||
let safe = draft_metadata(
|
||
"crank://canary/ok",
|
||
"canary_ok",
|
||
"text",
|
||
"text/plain",
|
||
"internal",
|
||
);
|
||
let created = create_draft(
|
||
&client,
|
||
&server,
|
||
&safe,
|
||
b"safe payload",
|
||
"draft.txt",
|
||
"text/plain",
|
||
)
|
||
.await;
|
||
let id = created_resource_id(&created);
|
||
let (status, text, body) = read_preview(&client, &server, &id).await;
|
||
assert_eq!(
|
||
status,
|
||
StatusCode::OK,
|
||
"(5) valid follow-up preview must succeed: {text}"
|
||
);
|
||
assert!(
|
||
!body.to_string().contains(CANARY),
|
||
"(5) the canary must never surface in a successful read of another Draft"
|
||
);
|
||
}
|