Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

门禁与测试不再甄别历史名称:文档漂移检查只保留核心概念、架构图和版本一致性检查,删除旧业务名、
旧注册宏、已移除接口与路径的黑名单;LayerGuard 和治理检查删除针对已不存在头文件、接口和旧术语的
规则;固定已删除字段、命令或参数名的测试改为通用的未知字段检查或删除。元测试删除对 `ci.yml`
文本的逐字断言和 CTest 标签检查器自身的自测。

精简未使用的扩展点:批次上限只在 IoBinding 上声明,删除 Converter 的 `max_batch_size`(及
`EffectiveMaxBatchSize`),Catalog 的 Converter 不再导出该字段;字段 Control 只保留整体替换的
`ReplaceFields`,删除 `PatchFields` 及其策略枚举;端口存活期只接受 `request` 与 `session`,删除
Expand Down
111 changes: 8 additions & 103 deletions scripts/check_architecture_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,6 @@ echo "================================================================"

FAILED=0

report_matches() {
local matches="$1"
local failure_message="$2"
local success_message="$3"
if [[ -z "${matches}" ]]; then
echo "✅ ${success_message}"
return
fi
echo "❌ ${failure_message}"
echo "${matches}"
FAILED=1
}

require_concepts() {
local document="$1"
local concept
Expand All @@ -36,90 +23,8 @@ require_concepts() {
done
}

find_deprecated_registration_macros() {
grep -rnE "\bREGISTER_NODE\([A-Za-z0-9_]+\)" \
"${ACTIVE_DOCS[@]}" 2>/dev/null | grep -v "#define REGISTER_NODE" || true
grep -rnE "\bREGISTER_ENGINE\([A-Za-z0-9_]+,[[:space:]]*[A-Za-z0-9_]+\)" \
"${ACTIVE_DOCS[@]}" 2>/dev/null | grep -v "#define REGISTER_ENGINE" || true
grep -rnE '\bREGISTER_ENGINE_WITH_DEFINITION[[:space:]]*\([[:space:]]*"' \
"${ACTIVE_DOCS[@]}" 2>/dev/null || true
}

ACTIVE_DOCS=(
"${DOC_ROOT}/architecture.md"
"${DOC_ROOT}/developer_guide.md"
"${DOC_ROOT}/dev_guide"
"${DOC_ROOT}/README.md"
"${DOC_ROOT}/architecture_classes.puml"
"${DOC_ROOT}/architecture_flow.puml"
"${DOC_ROOT}/assets/architecture_class_diagram.svg"
"${DOC_ROOT}/assets/architecture_flow.svg"
"${DOC_ROOT}/assets/framework_overview.svg"
"${ROOT_DIR}/README.md"
"${ROOT_DIR}/CONTRIBUTING.md"
"${ROOT_DIR}/AGENTS.md"
"${ROOT_DIR}/.github/copilot-instructions.md"
"${ROOT_DIR}/.agents/skills"
"${ROOT_DIR}/src"
"${ROOT_DIR}/include"
"${ROOT_DIR}/demo"
"${ROOT_DIR}/configs"
)

# 1. 检查权威文档与资产中是否存在旧业务名 (包含 SVG 资产)
echo "[Check 1/8] Checking for legacy business names and identifiers..."
LEGACY_BIZ=$(grep -rnE "(doc_qa_embedding_v1|doc_qa_rerank_v1|(keyword_match|entity_extract|translate|smart_doc_qa|dialogue_compliance_audit)_v1|dense_cross_rerank_scoring|multimodal_ocr_invoice_qa|speech_audio_asr_intent_slot|compliance_audit|ocr_doc_qa|audio_asr_(cpu|mock|demo))" \
"${ACTIVE_DOCS[@]}" 2>/dev/null || true)
report_matches "${LEGACY_BIZ}" \
"Found deprecated business names in active docs, assets or codebase:" \
"No legacy business names found."

# 2. 检查旧注册宏 (REGISTER_NODE( / REGISTER_ENGINE( / REGISTER_ENGINE_WITH_DEFINITION("str", ...))
echo "[Check 2/8] Checking for deprecated registration macros..."
LEGACY_MACROS="$(find_deprecated_registration_macros)"
report_matches "${LEGACY_MACROS}" \
"Found deprecated registration macro invocations:" \
"No deprecated registration macro invocations found in active docs/source."

# 3. 检查虚构生产节点 (PassthroughNode, ComplianceReportPostNode)
echo "[Check 3/8] Checking for fictitious production nodes..."
FICTITIOUS_NODES=$(grep -rnE "\b(PassthroughNode|ComplianceReportPostNode)\b" "${ACTIVE_DOCS[@]}" 2>/dev/null || true)
report_matches "${FICTITIOUS_NODES}" \
"Found fictitious production nodes in active docs or codebase:" \
"No fictitious production nodes found."

# 4. 检查当前治理入口是否引用已移除的 Engine / Biz Node 架构或已迁移的仓库路径。
echo "[Check 4/8] Checking active governance for removed architecture identifiers..."
REMOVED_ARCH=$(grep -rnE \
'(IModelEngine|include/engine/engine_interface\.h|REGISTER_ENGINE_WITH_DEFINITION|src/business/|src/biz/|26 production nodes)' \
"${ACTIVE_DOCS[@]}" 2>/dev/null || true)
report_matches "${REMOVED_ARCH}" \
"Found removed architecture identifiers in active governance/docs:" \
"Active governance matches the Model/Backend and Common Node architecture."
MOVED_PATHS=$(grep -rnE \
'(src/tools/|scripts/(dev_recipe|scaffold_custom_node)\.py|(^|[^_[:alnum:]])architecture(_v2)?\.puml|\./show([[:space:]]|$))' \
"${ACTIVE_DOCS[@]}" 2>/dev/null || true)
report_matches "${MOVED_PATHS}" \
"Found moved repository paths in active governance/docs:" \
"Active governance uses current tool and diagram paths."

OVERVIEW_DOCS=(
"${DOC_ROOT}/architecture.md"
"${DOC_ROOT}/architecture_classes.puml"
"${DOC_ROOT}/architecture_flow.puml"
"${DOC_ROOT}/assets/architecture_class_diagram.svg"
"${DOC_ROOT}/assets/architecture_flow.svg"
"${DOC_ROOT}/assets/framework_overview.svg"
)
REMOVED_C_ABI=$(grep -nE \
'\bAlg_(Init|Create|Process|Control|Destroy|DeInit)\b|C ABI[[:space:]]*(/|或)[[:space:]]*Operator' \
"${OVERVIEW_DOCS[@]}" 2>/dev/null || true)
report_matches "${REMOVED_C_ABI}" \
"Found removed C ABI entrypoints or alternate C ABI access in active architecture overviews:" \
"Architecture overviews use the current Operator entrypoint."

# 5. 检查架构文档核心概念完备性 (ValidatedPipelinePlan, BlackboardKey, NodeBase, FixedBatchExecutor)
echo "[Check 5/8] Verifying core architectural concepts in architecture documents..."
# 1. 检查架构文档核心概念完备性 (ValidatedPipelinePlan, BlackboardKey, NodeBase, FixedBatchExecutor)
echo "[Check 1/4] Verifying core architectural concepts in architecture documents..."
require_concepts "${DOC_ROOT}/architecture.md" \
"ValidatedPipelinePlan" "BlackboardKey" "NodeBase" "FixedBatchExecutor"
require_concepts "${DOC_ROOT}/developer_guide.md" \
Expand All @@ -130,14 +35,14 @@ if [ ${FAILED} -eq 0 ]; then
echo "✅ All core architectural concepts verified in architecture docs."
fi

# 6. 检查当前部署解析、计划与 Node 注册流程
echo "[Check 6/8] Checking current deployment and runtime planning concepts..."
# 2. 检查当前部署解析、计划与 Node 注册流程
echo "[Check 2/4] Checking current deployment and runtime planning concepts..."
require_concepts "${DOC_ROOT}/architecture_flow.puml" \
"PrepareDeploymentDocument" "ValidatedIoPlan" "ValidatedPipelinePlan" \
"REGISTER_FUNCTION_NODE"

# 7. 检查 PlantUML 与 SVG 资产存在性与非空
echo "[Check 7/8] Verifying architecture diagrams exist and are non-empty..."
# 3. 检查 PlantUML 与 SVG 资产存在性与非空
echo "[Check 3/4] Verifying architecture diagrams exist and are non-empty..."
for diagram in \
"${DOC_ROOT}/architecture_classes.puml" \
"${DOC_ROOT}/architecture_flow.puml" \
Expand All @@ -150,8 +55,8 @@ for diagram in \
fi
done

# 8. 检查 CMake、生成版本头和活跃文档是否共享同一产品/ABI 版本。
echo "[Check 8/8] Verifying product and ABI version single source of truth..."
# 4. 检查 CMake、生成版本头和活跃文档是否共享同一产品/ABI 版本。
echo "[Check 4/4] Verifying product and ABI version single source of truth..."
PRODUCT_VERSION="$({
sed -nE 's/^project\(LLMEdgeFlow VERSION ([0-9]+\.[0-9]+\.[0-9]+) LANGUAGES C CXX\)$/\1/p' \
"${ROOT_DIR}/CMakeLists.txt"
Expand Down
8 changes: 0 additions & 8 deletions scripts/check_governance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,4 @@ if [[ "${QUALITY_GATE_CALLS}" -ne 1 ]]; then
fail "GitHub delivery must invoke the canonical quality gate exactly once"
fi

if grep -rnE '(six-stage|6-stage|六阶段|7 CTest|src/business/|src/biz/|IModelEngine|REGISTER_ENGINE_WITH_DEFINITION)' \
"${ROOT_DIR}/AGENTS.md" \
"${ROOT_DIR}/CONTRIBUTING.md" \
"${ROOT_DIR}/.github/copilot-instructions.md" \
"${ROOT_DIR}/.agents/skills"; then
fail "active governance contains obsolete architecture or test-count guidance"
fi

echo "Governance sources, routing, and delivery safety invariants are consistent."
38 changes: 9 additions & 29 deletions scripts/check_layer_isolation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -289,20 +289,7 @@ if [ -n "$WHISPER_VENDOR_OUTSIDE_BACKEND" ]; then
fi
echo "✅ [LayerGuard PASS] The whisper.h vendor header stays inside its concrete Backend."

# 规则 5:中性的 TraceableItem 契约只有一个规范 include 路径。
LEGACY_TRACEABLE_HEADER="$REPO_ROOT/include/core/traceable_item.h"
LEGACY_TRACEABLE_INCLUDES=$(grep -rnE \
'#include\s*["<]core/traceable_item\.h[">]' \
"$REPO_ROOT/include" "$REPO_ROOT/src" "$REPO_ROOT/demo" \
"$REPO_ROOT/dev_support" "$REPO_ROOT/tests" 2>/dev/null || true)
if [ -e "$LEGACY_TRACEABLE_HEADER" ] || [ -n "$LEGACY_TRACEABLE_INCLUDES" ]; then
echo "❌ [LayerGuard ERROR] Legacy core/traceable_item.h compatibility path remains:"
echo "$LEGACY_TRACEABLE_INCLUDES"
exit 1
fi
echo "✅ [LayerGuard PASS] TraceableItem uses the neutral contracts include path."

# 规则 6:Node 支持代码只消费抽取出的已校验 Node 计划,
# 规则 5:Node 支持代码只消费抽取出的已校验 Node 计划,
# 而不是完整的编排层 Validator 实现契约。
NODE_SUPPORT_HEADER="$REPO_ROOT/include/nodes/node_base.h"
if [ ! -f "$NODE_SUPPORT_HEADER" ] || \
Expand All @@ -313,7 +300,7 @@ if [ ! -f "$NODE_SUPPORT_HEADER" ] || \
fi
echo "✅ [LayerGuard PASS] Node support is decoupled from PipelineValidator."

# 规则 7:CMake 中的源码归属必须保持四个编译期分层和显式的组合根。
# 规则 6:CMake 中的源码归属必须保持四个编译期分层和显式的组合根。
for OWNERSHIP in \
"src/engine/CMakeLists.txt:edgeflow_model_execution_objects" \
"src/common_nodes/CMakeLists.txt:edgeflow_capability_nodes_objects" \
Expand All @@ -328,11 +315,11 @@ for OWNERSHIP in \
exit 1
fi
done
LEGACY_SOURCE_OWNERSHIP=$(grep -rn 'target_sources(edgeflow_runtime_objects' \
AGGREGATE_SOURCE_OWNERSHIP=$(grep -rn 'target_sources(edgeflow_runtime_objects' \
"$REPO_ROOT/src" 2>/dev/null || true)
if [ -n "$LEGACY_SOURCE_OWNERSHIP" ]; then
echo "❌ [LayerGuard ERROR] Layer sources still use the legacy aggregate target:"
echo "$LEGACY_SOURCE_OWNERSHIP"
if [ -n "$AGGREGATE_SOURCE_OWNERSHIP" ]; then
echo "❌ [LayerGuard ERROR] Layer sources must not be attached to the aggregate runtime target:"
echo "$AGGREGATE_SOURCE_OWNERSHIP"
exit 1
fi
if ! grep -q 'target_sources(edgeflow_composition_objects' \
Expand All @@ -346,7 +333,7 @@ if ! grep -q 'target_sources(edgeflow_composition_objects' \
fi
echo "✅ [LayerGuard PASS] CMake source ownership preserves all four layers and the composition root."

# 规则 8:用标准 C 编译器检查纯 C11 语法与 ABI 合规性
# 规则 7:用标准 C 编译器检查纯 C11 语法与 ABI 合规性
GENERATED_VERSION_INCLUDE="$(mktemp -d "${TMPDIR:-/tmp}/edgeflow-version-header.XXXXXX")"
cleanup_generated_version() {
rm -rf "${GENERATED_VERSION_INCLUDE}"
Expand Down Expand Up @@ -397,7 +384,7 @@ else
echo "⚠️ [LayerGuard WARN] Neither gcc nor clang found for C11 syntax-only check."
fi

# 规则 9:Demo 层 (demo/) 绝不能直接 include SDK 内部头文件
# 规则 8:Demo 层 (demo/) 绝不能直接 include SDK 内部头文件
# (adapter/、core/、biz/、business/、engine/、src/)
VIOLATIONS_DEMO_INTERNAL=$(grep -rnE '#include\s*["<](adapter/|core/|biz/|business/|engine/|src/)' "$REPO_ROOT/demo" || true)

Expand All @@ -409,7 +396,7 @@ if [ -n "$VIOLATIONS_DEMO_INTERNAL" ]; then
fi
echo "✅ [LayerGuard PASS] Zero Demo -> Internal SDK header violations."

# 规则 10:LLM 厂商运行时与模型语义边界。
# 规则 9:LLM 厂商运行时与模型语义边界。
LLAMA_VENDOR_OUTSIDE_BACKEND=$(grep -rnE '#include\s*["<]llama\.h[">]' \
"$REPO_ROOT/include" "$REPO_ROOT/src" \
--exclude-dir=backends 2>/dev/null || true)
Expand Down Expand Up @@ -451,13 +438,6 @@ if ! grep -rq 'ITextGenerationSession' \
exit 1
fi

LLM_NODE_LEGACY=$(grep -nE 'ILlmEngine|engine_interface' \
"$REPO_ROOT/src/common_nodes/llm_generate_node.cpp" 2>/dev/null || true)
if [ -n "$LLM_NODE_LEGACY" ]; then
echo "❌ [LayerGuard ERROR] LlmGenerateNode still depends on the legacy engine interface:"
echo "$LLM_NODE_LEGACY"
exit 1
fi
echo "✅ [LayerGuard PASS] Backend vendor resources and Qwen generation semantics are isolated."

python3 "$(dirname "${BASH_SOURCE[0]}")/check_layer_dependencies.py" --root "${REPO_ROOT}"
Expand Down
7 changes: 3 additions & 4 deletions src/custom_nodes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,15 @@ cmake --build build --target edgeflow_test_nodes_runner -j 4
prompt_prefix 中的花括号保留原文,不再作为模板解析。未知占位符、无效生成参数
和非法 stop_words 在原生校验与初始化时拒绝。

`prompt_prefix` 是普通输入文本前缀,非空时在模板前追加一行;旧的节点字段
`system_prompt` 已改名并拒绝使用。模型的 `model_config.system_prompt` 仍表示真正的
system 消息,不能用节点前缀替代该角色。
`prompt_prefix` 是普通输入文本前缀,非空时在模板前追加一行。真正的 system 消息由模型的
`model_config.system_prompt` 设置,不能用节点前缀替代该角色。

TextTemplate 的 `missing_variable_policy` 也适用于内置变量。`fail` 会拒绝未连接的
引用或缺失的主输入样本;需要保留占位符或填空时显式使用 `preserve/empty`。
聚合输入批次存在而某请求没有结果时,仍表示合法的空上下文。

模型失败、输出数量不符或 `(req_id, sub_id)` 不符时,节点返回错误且不发布结果。
`fallback_text` 已删除并明确拒绝;业务降级应携带可辨识的状态,不能伪装成功。
业务降级应携带可辨识的状态,不能伪装成功。

## 复用与边界

Expand Down
75 changes: 0 additions & 75 deletions tests/contract/architecture/test_architecture_docs_drift_gate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,42 +23,6 @@ run_fixture_gate() {

./scripts/check_architecture_docs.sh >/dev/null 2>&1

echo "<!-- doc_qa_embedding_v1 -->" >> \
"${FIXTURE_DOC_ROOT}/assets/architecture_flow.svg"
if run_fixture_gate; then
echo "❌ Docs drift gate missed a legacy business name in SVG"
exit 1
fi
cp doc/assets/architecture_flow.svg \
"${FIXTURE_DOC_ROOT}/assets/architecture_flow.svg"

for legacy_name in \
keyword_match_v1 smart_doc_qa_v1 dense_cross_rerank_scoring \
compliance_audit.operator.v1 ocr_doc_qa.operator.v1 audio_asr_cpu; do
echo "${legacy_name}" >> "${FIXTURE_DOC_ROOT}/developer_guide.md"
if run_fixture_gate; then
echo "❌ Docs drift gate missed legacy business identifier '${legacy_name}'"
exit 1
fi
cp doc/developer_guide.md "${FIXTURE_DOC_ROOT}/developer_guide.md"
done

echo "REGISTER_NODE(OldNode);" >> "${FIXTURE_DOC_ROOT}/developer_guide.md"
if run_fixture_gate; then
echo "❌ Docs drift gate missed a deprecated registration macro"
exit 1
fi
cp doc/developer_guide.md "${FIXTURE_DOC_ROOT}/developer_guide.md"

echo "REGISTER_NODE(OldTutorialNode);" >> \
"${FIXTURE_DOC_ROOT}/dev_guide/first_custom_node.md"
if run_fixture_gate; then
echo "❌ Docs drift gate missed a deprecated registration macro in a tutorial"
exit 1
fi
cp doc/dev_guide/first_custom_node.md \
"${FIXTURE_DOC_ROOT}/dev_guide/first_custom_node.md"

rm "${FIXTURE_DOC_ROOT}/assets/framework_overview.svg"
if run_fixture_gate; then
echo "❌ Docs drift gate missed the missing README overview SVG"
Expand All @@ -67,19 +31,6 @@ fi
cp doc/assets/framework_overview.svg \
"${FIXTURE_DOC_ROOT}/assets/framework_overview.svg"

for removed_api in \
Alg_Init Alg_Create Alg_Process Alg_Control Alg_Destroy Alg_DeInit \
"C ABI / Operator" "C ABI 或 Operator"; do
echo "<!-- ${removed_api} -->" >> \
"${FIXTURE_DOC_ROOT}/assets/framework_overview.svg"
if run_fixture_gate; then
echo "❌ Docs drift gate missed removed C ABI access '${removed_api}' in the README SVG"
exit 1
fi
cp doc/assets/framework_overview.svg \
"${FIXTURE_DOC_ROOT}/assets/framework_overview.svg"
done

sed -i.bak 's/ValidatedIoPlan/ObsoleteIoPlan/g' \
"${FIXTURE_DOC_ROOT}/architecture_flow.puml"
rm -f "${FIXTURE_DOC_ROOT}/architecture_flow.puml.bak"
Expand All @@ -89,32 +40,6 @@ if run_fixture_gate; then
fi
cp doc/architecture_flow.puml "${FIXTURE_DOC_ROOT}/architecture_flow.puml"

for moved_path in \
"src/tools/pipeline_authoring.h" "./scripts/scaffold_custom_node.py" \
"scripts/dev_recipe.py" "architecture_v2.puml" "(architecture.puml)" "./show --web"; do
echo "${moved_path}" >> "${FIXTURE_DOC_ROOT}/dev_guide/first_custom_node.md"
if run_fixture_gate; then
echo "❌ Docs drift gate missed moved path '${moved_path}'"
exit 1
fi
cp doc/dev_guide/first_custom_node.md \
"${FIXTURE_DOC_ROOT}/dev_guide/first_custom_node.md"
done

echo "PassthroughNode" >> "${FIXTURE_DOC_ROOT}/developer_guide.md"
if run_fixture_gate; then
echo "❌ Docs drift gate missed a fictitious production node"
exit 1
fi
cp doc/developer_guide.md "${FIXTURE_DOC_ROOT}/developer_guide.md"

echo "IModelEngine" >> "${FIXTURE_DOC_ROOT}/developer_guide.md"
if run_fixture_gate; then
echo "❌ Docs drift gate missed a removed architecture identifier"
exit 1
fi
cp doc/developer_guide.md "${FIXTURE_DOC_ROOT}/developer_guide.md"

CURRENT_PRODUCT_VERSION="$(sed -nE 's/^project\(LLMEdgeFlow VERSION ([0-9]+\.[0-9]+\.[0-9]+) LANGUAGES C CXX\)$/\1/p' CMakeLists.txt)"
if [[ -z "${CURRENT_PRODUCT_VERSION}" ]]; then
echo "❌ Failed to parse project VERSION from CMakeLists.txt"
Expand Down
Loading
Loading