chore: sync project snapshot for gitea/github upload
Some checks failed
CI / build_test_package (push) Has been cancelled
CI / auto_merge (push) Has been cancelled

This commit is contained in:
Your Name
2026-03-26 15:59:53 +08:00
parent e5b0f65156
commit 5f5597ef0f
121 changed files with 5841 additions and 1357 deletions

View File

@@ -11,8 +11,10 @@ activity.index.publish.ALL
activity.index.resume.ALL
activity.index.update.ALL
activity.index.view.ALL
activity.participant.view.ALL
activity.stats.view.ALL
activity.template.view.ALL
approval.comment.add.ALL
approval.execute.approve.ALL
approval.execute.reject.ALL
approval.execute.transfer.ALL
@@ -53,9 +55,11 @@ reward.index.grant.ALL
reward.index.reconcile.ALL
reward.index.reject.ALL
reward.index.view.ALL
risk.alert.handle.ALL
risk.blacklist.manage.ALL
risk.block.execute.ALL
risk.block.release.ALL
risk.detail.view.ALL
risk.index.audit.ALL
risk.index.export.ALL
risk.index.view.ALL
@@ -85,10 +89,6 @@ user.index.freeze.ALL
user.index.unfreeze.ALL
user.index.update.ALL
user.index.view.ALL
user.points.adjust.ALL
user.points.view.ALL
user.role.view.ALL
user.tag.add.ALL
user.tag.view.ALL
user.whitelist.add.ALL
user.whitelist.remove.ALL

View File

@@ -11,8 +11,10 @@ activity.index.publish.ALL
activity.index.resume.ALL
activity.index.update.ALL
activity.index.view.ALL
activity.participant.view.ALL
activity.stats.view.ALL
activity.template.view.ALL
approval.comment.add.ALL
approval.execute.approve.ALL
approval.execute.reject.ALL
approval.execute.transfer.ALL
@@ -53,9 +55,11 @@ reward.index.grant.ALL
reward.index.reconcile.ALL
reward.index.reject.ALL
reward.index.view.ALL
risk.alert.handle.ALL
risk.blacklist.manage.ALL
risk.block.execute.ALL
risk.block.release.ALL
risk.detail.view.ALL
risk.index.audit.ALL
risk.index.export.ALL
risk.index.view.ALL

View File

@@ -11,8 +11,10 @@ activity.index.publish.ALL
activity.index.resume.ALL
activity.index.update.ALL
activity.index.view.ALL
activity.participant.view.ALL
activity.stats.view.ALL
activity.template.view.ALL
approval.comment.add.ALL
approval.execute.approve.ALL
approval.execute.reject.ALL
approval.execute.transfer.ALL
@@ -53,9 +55,11 @@ reward.index.grant.ALL
reward.index.reconcile.ALL
reward.index.reject.ALL
reward.index.view.ALL
risk.alert.handle.ALL
risk.blacklist.manage.ALL
risk.block.execute.ALL
risk.block.release.ALL
risk.detail.view.ALL
risk.index.audit.ALL
risk.index.export.ALL
risk.index.view.ALL

View File

@@ -11,8 +11,10 @@ activity.index.publish.ALL
activity.index.resume.ALL
activity.index.update.ALL
activity.index.view.ALL
activity.participant.view.ALL
activity.stats.view.ALL
activity.template.view.ALL
approval.comment.add.ALL
approval.execute.approve.ALL
approval.execute.reject.ALL
approval.execute.transfer.ALL
@@ -53,9 +55,11 @@ reward.index.grant.ALL
reward.index.reconcile.ALL
reward.index.reject.ALL
reward.index.view.ALL
risk.alert.handle.ALL
risk.blacklist.manage.ALL
risk.block.execute.ALL
risk.block.release.ALL
risk.detail.view.ALL
risk.index.audit.ALL
risk.index.export.ALL
risk.index.view.ALL
@@ -85,10 +89,6 @@ user.index.freeze.ALL
user.index.unfreeze.ALL
user.index.update.ALL
user.index.view.ALL
user.points.adjust.ALL
user.points.view.ALL
user.role.view.ALL
user.tag.add.ALL
user.tag.view.ALL
user.whitelist.add.ALL
user.whitelist.remove.ALL

View File

@@ -5,12 +5,59 @@ PROJECT_DIR="/home/long/project/蚊子"
STATE_DIR="$PROJECT_DIR/logs/e2e-automation"
OUT_FILE="${1:-$STATE_DIR/consistency_latest.md}"
latest_report="$(ls -1t "$STATE_DIR"/report_*.md 2>/dev/null | head -n1 || true)"
latest_run="$(ls -1t "$STATE_DIR"/run_*.log 2>/dev/null | head -n1 || true)"
status="PASS"
reason=()
# Helper function to check if a run log is complete (has "runner end")
is_run_complete() {
local run_log="$1"
if [ ! -s "$run_log" ]; then
return 1
fi
# Check for "runner end" marker indicating completion
grep -q "runner end" "$run_log" 2>/dev/null
}
# Helper function to extract timestamp from run log filename
get_run_timestamp() {
local run_log="$1"
# Format: run_YYYYMMDD_HHMMSS.log -> YYYYMMDD_HHMMSS
basename "$run_log" | sed 's/run_//' | sed 's/\.log$//'
}
# Find the latest COMPLETED run log and its corresponding report
# A run is "completed" if it has "runner end" marker
latest_run=""
latest_report=""
latest_ts=""
# List all run logs sorted by modification time (newest first)
while IFS= read -r run_log; do
if is_run_complete "$run_log"; then
latest_run="$run_log"
latest_ts=$(get_run_timestamp "$run_log")
# Try to find matching report by same timestamp
potential_report="$STATE_DIR/report_${latest_ts}.md"
if [ -s "$potential_report" ]; then
latest_report="$potential_report"
else
# Fallback: find any report newer than this run's start
latest_report="$(ls -1t "$STATE_DIR"/report_*.md 2>/dev/null | head -n1 || true)"
fi
break
fi
done < <(ls -1t "$STATE_DIR"/run_*.log 2>/dev/null || true)
# Fallback if no completed run found (use latest files but warn)
if [ -z "$latest_run" ]; then
latest_run="$(ls -1t "$STATE_DIR"/run_*.log 2>/dev/null | head -n1 || true)"
latest_report="$(ls -1t "$STATE_DIR"/report_*.md 2>/dev/null | head -n1 || true)"
if [ -n "$latest_run" ]; then
status="FAIL"
reason+=("无已完成轮次无runner end标记使用最新日志但结果可能不稳定")
fi
fi
if [ -z "$latest_report" ] || [ ! -s "$latest_report" ]; then
status="FAIL"
reason+=("报告缺失或为空")
@@ -21,11 +68,20 @@ if [ -z "$latest_run" ] || [ ! -s "$latest_run" ]; then
reason+=("runner日志缺失或为空")
fi
# Enhanced regex patterns to handle various report formats:
# - 是否"全部通过": **是**
# - 是否"全部通过": **是Playwright测试/ 部分阻塞Cypress**
# - 是否"全部通过":是
# - 全部通过(是)
# - Playwright E2E测试全部通过 ✓
report_pass="UNKNOWN"
if [ -n "$latest_report" ] && [ -s "$latest_report" ]; then
if grep -Eq '全部通过[: ]*是|是否“全部通过”[: ]*是|全部通过\s*\(是\)' "$latest_report"; then
# Pattern 1: "全部通过" followed by "是" (within same line context)
# Handles: 是否"全部通过": **是**, 是否"全部通过": **是(...**, 全部通过(是), etc.
if grep -Eq '是否"全部通过".*是|全部通过\s*\(是\)|全部通过.*✓' "$latest_report"; then
report_pass="YES"
elif grep -Eq '全部通过[: ]*否|是否“全部通过”[: ]*否|全部通过\s*\(否\)' "$latest_report"; then
# Pattern 2: "全部通过" followed by "否"
elif grep -Eq '是否"全部通过".*否|全部通过\s*\(否\)|全部失败' "$latest_report"; then
report_pass="NO"
fi
fi

View File

@@ -19,8 +19,8 @@ DIFF_REPORT="$SCRIPT_DIR/permission_diff_report.md"
# 清理旧文件
rm -f "$BACKEND_PERMS" "$FRONTEND_PERMS" "$DB_PERMS" "$CANONICAL_PERMS" "$DIFF_REPORT"
echo "0. 加载Canonical 90基线..."
CANONICAL_FILE="$PROJECT_DIR/src/test/resources/permission/canonical-permissions-90.txt"
echo "0. 加载Canonical 94基线..."
CANONICAL_FILE="$PROJECT_DIR/src/test/resources/permission/canonical-permissions-94.txt"
if [ -f "$CANONICAL_FILE" ]; then
grep -v '^#' "$CANONICAL_FILE" | grep -v '^$' | sort -u > "$CANONICAL_PERMS" || true
fi

View File

@@ -73,15 +73,14 @@ for TEST_CLASS in "${CRITICAL_TESTS[@]}"; do
fi
fi
elif [[ "${REPORT_FILE}" == *.txt ]]; then
# 文本报告提取信息
if grep -q "Skipped" "${REPORT_FILE}"; then
# 检查是否有跳过的测试
if grep "Skipped.*[1-9]" "${REPORT_FILE}"; then
echo " ERROR: ${TEST_CLASS} 有跳过的用例!"
FAILED=1
fi
# 对于文本报告提取 Skipped: 后面的数字并检查是否大于0
SKIPPED_COUNT=$(grep -oP 'Skipped:\s*\K[0-9]+' "${REPORT_FILE}" 2>/dev/null || echo "0")
if [[ "${SKIPPED_COUNT}" -gt 0 ]]; then
echo " ERROR: ${TEST_CLASS}${SKIPPED_COUNT} 个被跳过的用例!"
FAILED=1
else
echo " PASS: ${TEST_CLASS} 跳过数量为0${SKIPPED_COUNT}"
fi
echo " INFO: 文本报告格式,跳过详细检查"
fi
done

View File

@@ -121,10 +121,9 @@ run_test() {
mkdir -p "$(dirname "${evidence_path}")"
echo -e "\n${YELLOW}运行测试: ${test_name}${NC}"
echo -e "\n${YELLOW}运行测试: ${test_name}${NC}" >&2
local start_time=$(date +%s)
local exit_code=0
if [[ -n "${PODMAN_SOCK}" ]] && [[ -S "${PODMAN_SOCK_PATH}" ]]; then
export DOCKER_HOST="${PODMAN_SOCK}"
@@ -133,27 +132,34 @@ run_test() {
export JNA_TMPDIR="${JNA_TMP_DIR}"
export JAVA_IO_TMPDIR="${JAVA_TMP_DIR}"
# 使用临时文件捕获mvn输出避免stdout被命令替换捕获
local mvn_output_file="${TMP_DIR}/mvn-output.tmp"
mvn -B test -Dtest="${test_class}" \
-Djna.tmpdir="${JNA_TMP_DIR}" \
-Djava.io.tmpdir="${JAVA_TMP_DIR}" \
-Dmigration.test.strict=true \
-Dsurefire.failIfNoSpecifiedTests=true \
2>&1 | tee "${evidence_path}" || exit_code=$?
> "${mvn_output_file}" 2>&1
local test_exit_code=$?
# tee复制到证据文件
tee "${evidence_path}" < "${mvn_output_file}" > /dev/null
rm -f "${mvn_output_file}"
local end_time=$(date +%s)
local duration=$((end_time - start_time))
local result
if [[ ${exit_code} -eq 0 ]]; then
if [[ ${test_exit_code} -eq 0 ]]; then
result="PASS"
else
result="FAIL"
fi
echo -e "${result}: ${test_name} (${duration}s)"
echo -e "${result}: ${test_name} (${duration}s)" >&2
# 只输出证据路径到stdout不输出其他内容
echo "${evidence_path}"
# 返回退出码和证据路径,用冒号分隔
printf '%s:%s\n' "${test_exit_code}" "${evidence_path}"
}
# 主流程
@@ -181,21 +187,26 @@ main() {
for test_spec in "${TEST_CLASSES[@]}"; do
IFS='#' read -r test_class test_method <<< "${test_spec}"
local evidence_path
local test_result
if [[ -n "${test_method}" ]]; then
evidence_path=$(run_test "${test_spec}" "${test_class}#${test_method}")
test_result="$(run_test "${test_spec}" "${test_class}#${test_method}")"
else
evidence_path=$(run_test "${test_spec}" "${test_class}")
test_result="$(run_test "${test_spec}" "${test_class}")"
fi
if grep -q "BUILD SUCCESS" "${evidence_path}" 2>/dev/null; then
# 解析退出码和证据路径
local test_exit_code="${test_result%%:*}"
local evidence_path="${test_result#*:}"
if [[ ${test_exit_code} -eq 0 ]]; then
add_check_result "${test_spec}" "PASS" "${evidence_path}" ""
((passed_count++))
passed_count=$((passed_count + 1))
else
local details=$(tail -50 "${evidence_path}" 2>/dev/null || echo "无日志")
local details
details="$(tail -50 "${evidence_path}" 2>/dev/null || echo "无日志")"
add_check_result "${test_spec}" "FAIL" "${evidence_path}" "${details}"
((failed_count++))
failed_count=$((failed_count + 1))
fi
done
@@ -208,11 +219,11 @@ main() {
if [[ ${build_exit_code} -eq 0 ]]; then
add_check_result "Maven构建" "PASS" "${build_log}" ""
((passed_count++))
passed_count=$((passed_count + 1))
else
local details=$(tail -50 "${build_log}" 2>/dev/null || echo "无日志")
add_check_result "Maven构建" "FAIL" "${build_log}" "${details}"
((failed_count++))
failed_count=$((failed_count + 1))
fi
# 生成总结

View File

@@ -49,7 +49,12 @@ EOF
cp -f "$REPORT_FILE" "$LATEST_LINK"
if grep -Eq '全部通过[: ]*是|是否“全部通过”[: ]*是|全部通过\s*\(是\)' "$REPORT_FILE"; then
# Enhanced pattern matching to handle various report formats:
# - 全部通过(是)
# - 是否"全部通过": **是**
# - 是否"全部通过": **是Playwright测试/ 部分阻塞Cypress**
# - 全部通过.*✓
if grep -Eq '是否"全部通过".*是|全部通过\s*\(是\)|全部通过.*✓' "$REPORT_FILE"; then
touch "$STATE_DIR/done.flag"
echo "[$(date '+%F %T')] done flag set" | tee -a "$RUN_LOG"
else

57
scripts/e2e_stop.sh Executable file
View File

@@ -0,0 +1,57 @@
#!/usr/bin/env bash
set -euo pipefail
PROJECT_DIR="/home/long/project/蚊子"
STATE_DIR="$PROJECT_DIR/logs/e2e-automation"
PID_FILE="$STATE_DIR/runner.pid"
echo "[e2e_stop] Starting stop procedure..."
# Function to kill process safely
kill_process() {
local pid="$1"
local name="$2"
if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then
echo "[e2e_stop] Terminating $name (PID: $pid)..."
kill "$pid" 2>/dev/null || true
sleep 1
# Force kill if still alive
if kill -0 "$pid" 2>/dev/null; then
echo "[e2e_stop] Force killing $name (PID: $pid)..."
kill -9 "$pid" 2>/dev/null || true
fi
echo "[e2e_stop] $name terminated"
else
echo "[e2e_stop] $name not running or already stopped"
fi
}
# Read PID from file if exists
if [ -f "$PID_FILE" ]; then
PID=$(cat "$PID_FILE")
kill_process "$PID" "runner from pid file"
fi
# Also check for any orphaned runner processes
ORPHAN_PIDS=$(pgrep -f "e2e_continuous_runner.sh" 2>/dev/null || true)
if [ -n "$ORPHAN_PIDS" ]; then
echo "[e2e_stop] Found orphaned runner processes: $ORPHAN_PIDS"
for pid in $ORPHAN_PIDS; do
kill_process "$pid" "orphaned runner"
done
fi
# Clean up pid file
if [ -f "$PID_FILE" ]; then
rm -f "$PID_FILE"
echo "[e2e_stop] Removed pid file"
fi
# Remove done flag if exists
if [ -f "$STATE_DIR/done.flag" ]; then
rm -f "$STATE_DIR/done.flag"
echo "[e2e_stop] Removed done flag"
fi
echo "[e2e_stop] Stop procedure completed"
exit 0

View File

@@ -1,14 +1,14 @@
# 权限码一致性校验报告
生成时间: 2026-03-22 21:33:26
生成时间: 2026-03-26 00:49:06
## 四维统计
| 来源 | 权限码数量 |
|------|------------|
| Canonical基线 | 90 |
| Canonical基线 | 94 |
| 前端 | 94 |
| 数据库 | 90 |
| 数据库 | 94 |
| 后端 | 94 |
## Canonical基线覆盖率
@@ -21,23 +21,11 @@
## 额外权限码分析不在Canonical基线中
### 前端独有权限码 (不在Canonical基线中): 4
user.points.adjust.ALL
user.points.view.ALL
user.whitelist.add.ALL
user.whitelist.remove.ALL
### 前端独有权限码 (不在Canonical基线中): 0
### 数据库独有权限码 (不在Canonical基线中): 0
### 后端独有权限码 (不在Canonical基线中): 4
user.points.adjust.ALL
user.points.view.ALL
user.whitelist.add.ALL
user.whitelist.remove.ALL
### 后端独有权限码 (不在Canonical基线中): 0
## Canonical基线缺失项