Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a93cb0e921 | ||
|
|
6e4a7d5c10 | ||
|
|
bc30587a0c | ||
|
|
68b7fe0511 | ||
|
|
4e25b120af | ||
|
|
3eeb574e6b | ||
|
|
35234edb3f | ||
|
|
af60b89dcf | ||
|
|
e07cf9e7f1 | ||
|
|
69212ae01f |
No files matched your search
+22
-11
@@ -1,13 +1,26 @@
|
|||||||
when:
|
when:
|
||||||
event: [push, pull_request, manual]
|
- event: [pull_request, manual]
|
||||||
|
- event: push
|
||||||
|
branch: main
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
layout:
|
layout:
|
||||||
image: rust:1.100-bookworm
|
image: git.cflmy.cn/cflmy/marqdo-ci-shell:3.0.0-rc.5@sha256:8184439a201da451271f37596f4e38afeab16e044d7591853779887ef5ec28c1
|
||||||
commands:
|
commands:
|
||||||
- apt-get update && apt-get install -y --no-install-recommends ca-certificates git python3
|
|
||||||
- python3 scripts/check-layout.py
|
- python3 scripts/check-layout.py
|
||||||
- python3 -m unittest discover -s tests/integration
|
- python3 -m unittest discover -s tests/integration
|
||||||
|
|
||||||
|
checkouts:
|
||||||
|
image: git.cflmy.cn/cflmy/marqdo-ci-shell:3.0.0-rc.5@sha256:8184439a201da451271f37596f4e38afeab16e044d7591853779887ef5ec28c1
|
||||||
|
depends_on: [layout]
|
||||||
|
when: &needs_candidate
|
||||||
|
- event: manual
|
||||||
|
- event: [push, pull_request]
|
||||||
|
path:
|
||||||
|
# Governance, executable Markdown, packaging and unknown paths stay in scope.
|
||||||
|
exclude: [README.md, 'docs/evidence/*.md']
|
||||||
|
on_empty: true
|
||||||
|
commands:
|
||||||
- git submodule update --init
|
- git submodule update --init
|
||||||
- |
|
- |
|
||||||
set -eu
|
set -eu
|
||||||
@@ -19,14 +32,14 @@ steps:
|
|||||||
- python3 scripts/check-repo-conventions.py
|
- python3 scripts/check-repo-conventions.py
|
||||||
|
|
||||||
candidate:
|
candidate:
|
||||||
# Match the Linux/glibc environment already used by View for the RC.4 artifact.
|
image: git.cflmy.cn/cflmy/marqdo-ci-rust:3.0.0-rc.5@sha256:73481a35339157b1a3f3b23076517e96e302fbb5158e6ffcb1582acf22c6af94
|
||||||
image: mcr.microsoft.com/playwright:v1.49.0-noble
|
depends_on: [checkouts]
|
||||||
depends_on: [layout]
|
when: *needs_candidate
|
||||||
commands:
|
commands:
|
||||||
- |
|
- |
|
||||||
set -eu
|
set -eu
|
||||||
for attempt in 1 2 3; do
|
for attempt in 1 2 3; do
|
||||||
if apt-get -o Acquire::By-Hash=force -o Acquire::Retries=3 update --error-on=any; then
|
if apt-get -o Acquire::By-Hash=force -o Acquire::http::Timeout=30 update --error-on=any; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
if [ "$attempt" -eq 3 ]; then
|
if [ "$attempt" -eq 3 ]; then
|
||||||
@@ -34,8 +47,6 @@ steps:
|
|||||||
fi
|
fi
|
||||||
sleep 15
|
sleep 15
|
||||||
done
|
done
|
||||||
apt-get -o Acquire::Retries=3 install -y --no-install-recommends ca-certificates curl git python3 python3-jsonschema build-essential
|
apt-get -o Acquire::Retries=3 -o Acquire::http::Timeout=30 install -y --no-install-recommends python3-jsonschema util-linux
|
||||||
curl -fsSL --retry 3 https://sh.rustup.rs -o /tmp/marqdo-rustup.sh
|
unset MARQDO_BIN MARQDO_STDLIB_DIR
|
||||||
sh /tmp/marqdo-rustup.sh -y --profile minimal --default-toolchain 1.100.0 --no-modify-path
|
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
|
||||||
bash scripts/integration.sh
|
bash scripts/integration.sh
|
||||||
+3
-4
@@ -16,9 +16,8 @@ Rules:
|
|||||||
- Images are public for anonymous pull; CI never needs registry push credentials.
|
- Images are public for anonymous pull; CI never needs registry push credentials.
|
||||||
- Component lanes contain only their own `scripts/*` entry command. No per-repo
|
- Component lanes contain only their own `scripts/*` entry command. No per-repo
|
||||||
image variance, apt installs, Rust toolchain downloads or CLI rebuilds.
|
image variance, apt installs, Rust toolchain downloads or CLI rebuilds.
|
||||||
- Core CLI keeps its specialized Rust/Windows-cross gates; the root ecosystem
|
- Core CLI keeps its specialized Rust/Windows-cross gates. The root ecosystem
|
||||||
candidate keeps its Playwright/rustup image because it must build consumers and
|
candidate uses the shared Rust toolchain to build the fixed CLI/Worker/Bundle
|
||||||
run Docker archive checks. These two exceptions are documented in the
|
combination. View and Web keep browser coverage in their own workflows.
|
||||||
repository conventions, not copied per component.
|
|
||||||
- The images are CI infrastructure, not product releases; their provenance is
|
- The images are CI infrastructure, not product releases; their provenance is
|
||||||
recorded here and in `docs/evidence/`.
|
recorded here and in `docs/evidence/`.
|
||||||
+5
-1
@@ -35,7 +35,9 @@ bash scripts/integration.sh # 生态候选:真实 CLI 制品 +
|
|||||||
- 校验器读取 Git tree 中固定提交的 catalog,不以工作区改动替代候选;`--checkouts` 需要子模块已初始化,缺失、错误 HEAD、脏工作区、错误入口都明确 FAIL/UNVERIFIED,不静默跳过。CI 先验证并检出直属子模块,再用 `--domain-paths` 校验领域的子模块远端,最后逐个领域检出直属子库。
|
- 校验器读取 Git tree 中固定提交的 catalog,不以工作区改动替代候选;`--checkouts` 需要子模块已初始化,缺失、错误 HEAD、脏工作区、错误入口都明确 FAIL/UNVERIFIED,不静默跳过。CI 先验证并检出直属子模块,再用 `--domain-paths` 校验领域的子模块远端,最后逐个领域检出直属子库。
|
||||||
- 没有 active 领域时,新校验规则同样接受合法的直属功能组件,这不是历史协议兼容。
|
- 没有 active 领域时,新校验规则同样接受合法的直属功能组件,这不是历史协议兼容。
|
||||||
- 未知的 active 入口、未声明的 gitlink、目录与 catalog 不一致都必须让候选失败。`planned` 不进入验收计数。
|
- 未知的 active 入口、未声明的 gitlink、目录与 catalog 不一致都必须让候选失败。`planned` 不进入验收计数。
|
||||||
- 当前 CI 为 `layout` 与 `candidate` 两段;统一 CLI 制品准备、声明驱动调度与递归影响分析仍在推进(见 `.woodpecker/eco.yml` 与主仓库工单),不得以本文件描述当作已实现。
|
- `python3 scripts/check-layout.py --active-entries` 从已验证的根与领域 checkout 输出验收计划。根集成按依赖顺序使用同一次安装的 CLI 和 Bundle 执行计划,领域验收晚于其 active 子组件。通用入口接收 `MARQDO_BIN`、`MARQDO_STDLIB_DIR` 和 `MARQDO_CI_OUT`,已有公共契约、真实 Tool 冷安装等组合门禁继续使用各自的现有入口。
|
||||||
|
- 根 Web 组合检查对该次构建的 Preview Tool 执行冷安装、`check`、`preview` 和 `handoff`。生产浏览器验收由 Web 聚合仓已有的 `scripts/domain-acceptance.sh` 负责。
|
||||||
|
- 根 `eco` 在 PR、`main` 推送和显式手动运行时执行。PR 始终保留 `layout` 状态。仅改动根 `README.md` 或 `docs/evidence/` 下的 Markdown 记录时,自动运行只执行轻量结构校验和脚本测试。混合改动、其他路径、缺失变更列表和手动运行都执行递归检出及完整生态验收。
|
||||||
|
|
||||||
## 三层验收
|
## 三层验收
|
||||||
|
|
||||||
@@ -82,6 +84,8 @@ bash scripts/integration.sh # 生态候选:真实 CLI 制品 +
|
|||||||
|
|
||||||
正式发布对账使用 `python3 scripts/reconcile-releases.py --plan --published-after <ISO-8601 时间>`。从固定根及领域 tree 解析受管仓库,核对 Gitea tag、`release-evidence.json`、同 SHA Woodpecker 组件 CI 和资产字节摘要。根 `reconcile` 工作流从当前受保护的 `main` 串行运行,使用 `gitea_reconcile_token` 以专用非管理员账号写追踪工单。`historical-baseline` 表示已登记历史输入,`blocked` 表示发布验证未通过,`tracked` 表示已记录经验证的发布。消费者验收和父级接受均需各自的 CI 与 PR 证据。
|
正式发布对账使用 `python3 scripts/reconcile-releases.py --plan --published-after <ISO-8601 时间>`。从固定根及领域 tree 解析受管仓库,核对 Gitea tag、`release-evidence.json`、同 SHA Woodpecker 组件 CI 和资产字节摘要。根 `reconcile` 工作流从当前受保护的 `main` 串行运行,使用 `gitea_reconcile_token` 以专用非管理员账号写追踪工单。`historical-baseline` 表示已登记历史输入,`blocked` 表示发布验证未通过,`tracked` 表示已记录经验证的发布。消费者验收和父级接受均需各自的 CI 与 PR 证据。
|
||||||
|
|
||||||
|
对已验证的发布,`--plan` 计算直接 active 消费者的输入摘要。受保护 `--apply` 按发布和消费者登记一条任务,基线变化时在原任务中记录新输入。输入附精确资产、依赖、消费者基线和根追踪编号。下游独立 CI 及批准后的晋升基于各自的真实结果。
|
||||||
|
|
||||||
## 发行与回滚
|
## 发行与回滚
|
||||||
|
|
||||||
- 组件可独立 SemVer 发布;领域可发布经过验证的组合制品;根生态 release 固定整个 gitlink 树。独立版本不代表维护多套现行协议。
|
- 组件可独立 SemVer 发布;领域可发布经过验证的组合制品;根生态 release 固定整个 gitlink 树。独立版本不代表维护多套现行协议。
|
||||||
|
|||||||
+27
-2
@@ -423,18 +423,43 @@ def validate(revision, checkouts, expand_domains=False):
|
|||||||
return layers
|
return layers
|
||||||
|
|
||||||
|
|
||||||
|
def active_entries(layers):
|
||||||
|
root = layers[0]
|
||||||
|
root_domains = {root.repo / path: item["id"] for path, item in root.linked.items()
|
||||||
|
if item["kind"] == "domain"}
|
||||||
|
entries = {}
|
||||||
|
requirements = {}
|
||||||
|
for layer in layers:
|
||||||
|
parent = root_domains.get(layer.repo)
|
||||||
|
for path, item in sorted(layer.linked.items()):
|
||||||
|
if item["state"] != "active":
|
||||||
|
continue
|
||||||
|
component_id = item["id"]
|
||||||
|
relative = (layer.repo / path).relative_to(root.repo).as_posix()
|
||||||
|
entries[component_id] = (component_id, item["kind"], relative, item["entry"])
|
||||||
|
requirements[component_id] = list(item["requires"])
|
||||||
|
if parent in requirements:
|
||||||
|
requirements[parent].append(component_id)
|
||||||
|
for component_id in graphlib.TopologicalSorter(requirements).static_order():
|
||||||
|
yield entries[component_id]
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="Validate a Marqdo ecosystem Git tree")
|
parser = argparse.ArgumentParser(description="Validate a Marqdo ecosystem Git tree")
|
||||||
parser.add_argument("revision", nargs="?", default="HEAD")
|
parser.add_argument("revision", nargs="?", default="HEAD")
|
||||||
parser.add_argument("--checkouts", action="store_true")
|
parser.add_argument("--checkouts", action="store_true")
|
||||||
paths = parser.add_mutually_exclusive_group()
|
paths = parser.add_mutually_exclusive_group()
|
||||||
paths.add_argument("--active-paths", action="store_true", help="print only direct active component paths")
|
paths.add_argument("--active-paths", action="store_true", help="print only direct active component paths")
|
||||||
|
paths.add_argument("--active-entries", action="store_true", help="print validated active entries in dependency order")
|
||||||
paths.add_argument("--domain-paths", action="store_true", help="validate domain URLs and print domain paths")
|
paths.add_argument("--domain-paths", action="store_true", help="validate domain URLs and print domain paths")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
try:
|
try:
|
||||||
revision = git("rev-parse", "--verify", args.revision + "^{commit}").strip()
|
revision = git("rev-parse", "--verify", args.revision + "^{commit}").strip()
|
||||||
layers = validate(revision, args.checkouts, expand_domains=args.domain_paths)
|
layers = validate(revision, args.checkouts or args.active_entries, expand_domains=args.domain_paths)
|
||||||
if args.active_paths:
|
if args.active_entries:
|
||||||
|
for entry in active_entries(layers):
|
||||||
|
print("\t".join(entry))
|
||||||
|
elif args.active_paths:
|
||||||
for path, component in sorted(layers[0].linked.items()):
|
for path, component in sorted(layers[0].linked.items()):
|
||||||
if component["state"] == "active":
|
if component["state"] == "active":
|
||||||
print(path)
|
print(path)
|
||||||
|
|||||||
+88
-59
@@ -10,12 +10,30 @@ set -euo pipefail
|
|||||||
|
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
root="$PWD"
|
root="$PWD"
|
||||||
active="$(python3 scripts/check-layout.py --checkouts --active-paths)"
|
plan="$(python3 scripts/check-layout.py --active-entries)"
|
||||||
expected=$'cli\nextensions/web\nstdlib/collections\nstdlib/data\nstdlib/fs\nstdlib/io\nstdlib/system\nstdlib/text\ntests/conformance\ntools/knowledge\ntools/lint\ntools/prove\ntools/view'
|
declare -a gates=()
|
||||||
if [[ "$active" != "$expected" ]]; then
|
cli_smoke=
|
||||||
echo "UNVERIFIED: update the integration plan for the changed active component set" >&2
|
while IFS=$'\t' read -r id kind path entry; do
|
||||||
|
case "$kind:$id:$entry" in
|
||||||
|
core:cli:tools/release/smoke.py) cli_smoke="$path/$entry"; gate=core ;;
|
||||||
|
stdlib:*:scripts/test.sh) gate=stdlib ;;
|
||||||
|
test:conformance:scripts/build_all.sh) gate=conformance ;;
|
||||||
|
domain:web:scripts/domain-acceptance.sh) gate=web ;;
|
||||||
|
tool:view:scripts/acceptance.sh) gate=view ;;
|
||||||
|
tool:knowledge:scripts/ci.sh) gate=knowledge ;;
|
||||||
|
tool:prove:scripts/package-tool.sh) gate=prove ;;
|
||||||
|
tool:lint:scripts/package-tool.sh) gate=lint ;;
|
||||||
|
tool:*:scripts/ci.sh|tool:*:scripts/integration.sh|extension:*:scripts/ci.sh|extension:*:scripts/integration.sh|test:*:scripts/ci.sh|test:*:scripts/integration.sh)
|
||||||
|
gate=entry
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "UNVERIFIED: unsupported integration entry $id ($kind): $entry" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
|
gates+=("$gate")
|
||||||
|
done <<< "$plan"
|
||||||
|
test -n "$cli_smoke"
|
||||||
|
|
||||||
mkdir -p .integration-work
|
mkdir -p .integration-work
|
||||||
work="$(mktemp -d "$root/.integration-work/run.XXXXXX")"
|
work="$(mktemp -d "$root/.integration-work/run.XXXXXX")"
|
||||||
@@ -32,6 +50,7 @@ python3 --version
|
|||||||
python3 -c 'import jsonschema'
|
python3 -c 'import jsonschema'
|
||||||
python3 scripts/check-layout.py --checkouts > "$work/layout.txt"
|
python3 scripts/check-layout.py --checkouts > "$work/layout.txt"
|
||||||
cat "$work/layout.txt"
|
cat "$work/layout.txt"
|
||||||
|
printf '%s\n' "$plan" > "$work/active-entries.tsv"
|
||||||
|
|
||||||
# Recursive impact analysis against the accepted root commit: the change set
|
# Recursive impact analysis against the accepted root commit: the change set
|
||||||
# comes from the recursively expanded (global_id, parent, remote, SHA, state)
|
# comes from the recursively expanded (global_id, parent, remote, SHA, state)
|
||||||
@@ -75,7 +94,7 @@ python3 cli/tools/release/package.py \
|
|||||||
--source-sha "$source_sha" --version "$version" \
|
--source-sha "$source_sha" --version "$version" \
|
||||||
--stdlib-dir "$work/stdlib" --out-dir "$work/dist" | tee "$work/package.json"
|
--stdlib-dir "$work/stdlib" --out-dir "$work/dist" | tee "$work/package.json"
|
||||||
archive="$(find "$work/dist" -maxdepth 1 -name 'marqdo-*.tar.gz' -print -quit)"
|
archive="$(find "$work/dist" -maxdepth 1 -name 'marqdo-*.tar.gz' -print -quit)"
|
||||||
python3 cli/tools/release/smoke.py --archive "$archive"
|
python3 "$cli_smoke" --archive "$archive"
|
||||||
mkdir -p "$work/install"
|
mkdir -p "$work/install"
|
||||||
tar -xzf "$archive" -C "$work/install"
|
tar -xzf "$archive" -C "$work/install"
|
||||||
installed="$(find "$work/install" -mindepth 1 -maxdepth 1 -type d -print -quit)"
|
installed="$(find "$work/install" -mindepth 1 -maxdepth 1 -type d -print -quit)"
|
||||||
@@ -85,55 +104,39 @@ test "$(cat "$installed/SOURCE_SHA")" = "$source_sha"
|
|||||||
test "$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["version"])' "$installed/stdlib/stdlib.json")" = "$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["version"])' "$work/stdlib/stdlib.json")"
|
test "$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["version"])' "$installed/stdlib/stdlib.json")" = "$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["version"])' "$work/stdlib/stdlib.json")"
|
||||||
sha256sum "$archive" "$MARQDO_BIN" "$installed/marqdo-provider-worker"
|
sha256sum "$archive" "$MARQDO_BIN" "$installed/marqdo-provider-worker"
|
||||||
|
|
||||||
# 4. Root stdlib acceptance: component entries, explicit Packages, composition
|
# Tool consumers use the same candidate installation and the catalog order.
|
||||||
# fixtures and fail-closed negatives with the same installed CLI/Bundle.
|
|
||||||
python3 scripts/acceptance-stdlib.py \
|
|
||||||
--cli "$MARQDO_BIN" --bundle "$work/stdlib" \
|
|
||||||
--work "$work/stdlib-acceptance" --evidence "$work/stdlib-acceptance.json"
|
|
||||||
|
|
||||||
# 5. Frozen independent public-contract fixtures against the same CLI.
|
|
||||||
python3 cli/tools/ci/verify_extension_contracts.py \
|
|
||||||
--source-repo cli --tested-sha "$source_sha" --cli "$MARQDO_BIN" \
|
|
||||||
--release-info "$installed/RELEASE_INFO.json" \
|
|
||||||
--fixtures tests/conformance --out "$work/conformance.json"
|
|
||||||
|
|
||||||
|
|
||||||
# 5.5 Web domain: component entries from the pinned domain gitlink, then a cold
|
|
||||||
# install of the same-built web Tool with a generic check/preview/handoff run.
|
|
||||||
# The candidate image uses a minimal Rust profile; component entries run
|
# The candidate image uses a minimal Rust profile; component entries run
|
||||||
# fmt/clippy, so add those components once when the active toolchain lacks them.
|
# fmt/clippy, so add those components once when the active toolchain lacks them.
|
||||||
if command -v rustup >/dev/null 2>&1 \
|
if command -v rustup >/dev/null 2>&1 \
|
||||||
&& ! rustup component list --installed 2>/dev/null | grep -qx 'rustfmt.*'; then
|
&& ! rustup component list --installed 2>/dev/null | grep -qx 'rustfmt.*'; then
|
||||||
rustup component add rustfmt clippy
|
rustup component add rustfmt clippy
|
||||||
fi
|
fi
|
||||||
(
|
|
||||||
cd extensions/web/design
|
run_consumer() (
|
||||||
MARQDO_BIN="$MARQDO_BIN" scripts/ci.sh
|
cd "$root/$path"
|
||||||
)
|
export MARQDO_CI_OUT="$work/components/$id"
|
||||||
(
|
mkdir -p "$MARQDO_CI_OUT"
|
||||||
cd extensions/web/preview
|
case "$gate" in
|
||||||
MARQDO_BIN="$MARQDO_BIN" scripts/ci.sh
|
entry)
|
||||||
)
|
MARQDO_STDLIB_DIR="$installed/stdlib" "./$entry"
|
||||||
web_tool="$root/extensions/web/preview/dist/marqdo-web-preview/tool.json"
|
;;
|
||||||
test -f "$web_tool"
|
web)
|
||||||
export MARQDO_TOOL_HOME="$work/web-tool-home"
|
web_tool="$PWD/preview/dist/marqdo-web-preview/tool.json"
|
||||||
cli_before="$(sha256sum "$MARQDO_BIN" | cut -d' ' -f1)"
|
export MARQDO_TOOL_HOME="$MARQDO_CI_OUT/tool-home"
|
||||||
"$MARQDO_BIN" tool install "$web_tool"
|
cli_before="$(sha256sum "$MARQDO_BIN")"
|
||||||
"$MARQDO_BIN" web check extensions/web/examples/research-workspace/index.mq.md \
|
"$MARQDO_BIN" tool install "$web_tool"
|
||||||
--unit 工作台 --root extensions/web/examples/research-workspace
|
example=examples/research-workspace
|
||||||
"$MARQDO_BIN" web preview extensions/web/examples/research-workspace/index.mq.md \
|
"$MARQDO_BIN" web check "$example/index.mq.md" --unit 工作台 --root "$example"
|
||||||
--unit 工作台 --root extensions/web/examples/research-workspace --out "$work/web-preview"
|
"$MARQDO_BIN" web preview "$example/index.mq.md" --unit 工作台 --root "$example" \
|
||||||
test -f "$work/web-preview/index.html"
|
--out "$MARQDO_CI_OUT/preview"
|
||||||
"$MARQDO_BIN" web handoff extensions/web/examples/research-workspace/index.mq.md \
|
test -s "$MARQDO_CI_OUT/preview/index.html"
|
||||||
--unit 工作台 --root extensions/web/examples/research-workspace --out "$work/web-handoff.md"
|
"$MARQDO_BIN" web handoff "$example/index.mq.md" --unit 工作台 --root "$example" \
|
||||||
test -s "$work/web-handoff.md"
|
--out "$MARQDO_CI_OUT/handoff.md"
|
||||||
"$MARQDO_BIN" tool remove web
|
test -s "$MARQDO_CI_OUT/handoff.md"
|
||||||
cli_after="$(sha256sum "$MARQDO_BIN" | cut -d' ' -f1)"
|
"$MARQDO_BIN" tool remove web
|
||||||
test "$cli_before" = "$cli_after"
|
test "$(sha256sum "$MARQDO_BIN")" = "$cli_before"
|
||||||
echo "web domain: component entries + cold Tool install PASS"
|
;;
|
||||||
# 6. Existing consumers, same installed binary and adjacent Bundle.
|
view)
|
||||||
(
|
|
||||||
cd tools/view
|
|
||||||
export MARQDO_TOOL_HOME="$work/view-registry"
|
export MARQDO_TOOL_HOME="$work/view-registry"
|
||||||
scripts/package.sh
|
scripts/package.sh
|
||||||
"$MARQDO_BIN" tool install dist/marqdo-view/tool.json
|
"$MARQDO_BIN" tool install dist/marqdo-view/tool.json
|
||||||
@@ -167,24 +170,49 @@ echo "web domain: component entries + cold Tool install PASS"
|
|||||||
echo "view still dispatches after removal" >&2
|
echo "view still dispatches after removal" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
)
|
;;
|
||||||
(
|
knowledge)
|
||||||
cd tools/knowledge
|
|
||||||
MARQDO_TEST_BIN="$MARQDO_BIN" cargo test --locked --test core_cli --test compile
|
MARQDO_TEST_BIN="$MARQDO_BIN" cargo test --locked --test core_cli --test compile
|
||||||
)
|
;;
|
||||||
(
|
prove)
|
||||||
cd tools/prove
|
|
||||||
cargo test --locked --test analysis_document --test document_contract
|
cargo test --locked --test analysis_document --test document_contract
|
||||||
)
|
;;
|
||||||
(
|
lint)
|
||||||
cd tools/lint
|
|
||||||
export MARQDO_TOOL_HOME="$work/lint-registry"
|
export MARQDO_TOOL_HOME="$work/lint-registry"
|
||||||
scripts/package-tool.sh "$work/lint"
|
"./$entry" "$work/lint"
|
||||||
"$MARQDO_BIN" tool install "$work/lint/tool.json"
|
"$MARQDO_BIN" tool install "$work/lint/tool.json"
|
||||||
"$MARQDO_BIN" lint examples/nested/inventory.mq.md --format json
|
"$MARQDO_BIN" lint examples/nested/inventory.mq.md --format json
|
||||||
"$MARQDO_BIN" tool remove lint
|
"$MARQDO_BIN" tool remove lint
|
||||||
|
;;
|
||||||
|
esac
|
||||||
)
|
)
|
||||||
|
|
||||||
|
stdlib_accepted=false
|
||||||
|
index=0
|
||||||
|
while IFS=$'\t' read -r -u 3 id kind path entry; do
|
||||||
|
gate="${gates[index]}"
|
||||||
|
index=$((index + 1))
|
||||||
|
echo "candidate gate: $id ($path/$entry)"
|
||||||
|
case "$gate" in
|
||||||
|
core) ;; # CLI/Worker packaging and smoke ran before consumer gates.
|
||||||
|
stdlib)
|
||||||
|
if [ "$stdlib_accepted" = false ]; then
|
||||||
|
python3 scripts/acceptance-stdlib.py \
|
||||||
|
--cli "$MARQDO_BIN" --bundle "$work/stdlib" \
|
||||||
|
--work "$work/stdlib-acceptance" --evidence "$work/stdlib-acceptance.json"
|
||||||
|
stdlib_accepted=true
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
conformance)
|
||||||
|
python3 cli/tools/ci/verify_extension_contracts.py \
|
||||||
|
--source-repo cli --tested-sha "$source_sha" --cli "$MARQDO_BIN" \
|
||||||
|
--release-info "$installed/RELEASE_INFO.json" \
|
||||||
|
--fixtures "$path" --out "$work/conformance.json"
|
||||||
|
;;
|
||||||
|
*) run_consumer ;;
|
||||||
|
esac
|
||||||
|
done 3<<< "$plan"
|
||||||
|
|
||||||
# 7. Evidence identity for the accepted candidate.
|
# 7. Evidence identity for the accepted candidate.
|
||||||
root_commit="$(git rev-parse HEAD)"
|
root_commit="$(git rev-parse HEAD)"
|
||||||
python3 - "$work" "$root_commit" "$source_sha" "$bundle_digest" "$bundle_aliases" "$archive" <<'PY'
|
python3 - "$work" "$root_commit" "$source_sha" "$bundle_digest" "$bundle_aliases" "$archive" <<'PY'
|
||||||
@@ -202,6 +230,7 @@ evidence = {
|
|||||||
"stdlib_aliases_digest": sys.argv[5],
|
"stdlib_aliases_digest": sys.argv[5],
|
||||||
"archive": archive.name,
|
"archive": archive.name,
|
||||||
"archive_sha256": "sha256:" + hashlib.sha256(archive.read_bytes()).hexdigest(),
|
"archive_sha256": "sha256:" + hashlib.sha256(archive.read_bytes()).hexdigest(),
|
||||||
|
"active_entries": [line.split("\t") for line in (work / "active-entries.tsv").read_text().splitlines()],
|
||||||
"impact": (
|
"impact": (
|
||||||
{
|
{
|
||||||
"changed": impact["changed"],
|
"changed": impact["changed"],
|
||||||
|
|||||||
@@ -276,6 +276,38 @@ def identity_marker(entry):
|
|||||||
return f"<!-- marqdo:verified-release {entry['source_sha']} {entry['index_sha256']} -->"
|
return f"<!-- marqdo:verified-release {entry['source_sha']} {entry['index_sha256']} -->"
|
||||||
|
|
||||||
|
|
||||||
|
def consumer_inputs(entry, graph):
|
||||||
|
release_key = hashlib.sha256(
|
||||||
|
f"{entry['repository']}\n{entry['tag']}\n{entry['source_sha']}".encode()
|
||||||
|
).hexdigest()
|
||||||
|
release = {key: entry[key] for key in ("repository", "tag", "source_sha", "index_sha256")}
|
||||||
|
release["assets"] = sorted(entry["assets"], key=lambda asset: asset["name"])
|
||||||
|
release["dependencies"] = sorted(entry["dependencies"], key=lambda dependency: dependency["id"])
|
||||||
|
conflicts = [dependency["id"] for dependency in release["dependencies"]
|
||||||
|
if dependency["source_sha"] != graph[dependency["id"]]["sha"]]
|
||||||
|
tasks = []
|
||||||
|
for consumer_id in entry["direct_consumers"]:
|
||||||
|
consumer = graph[consumer_id]
|
||||||
|
remote = REPOSITORY.fullmatch(consumer.get("remote") or "")
|
||||||
|
require(remote is not None and match(SHA, consumer.get("sha")),
|
||||||
|
f"{consumer_id}: consumer is missing its managed repository or accepted SHA")
|
||||||
|
inputs = {
|
||||||
|
"release": release,
|
||||||
|
"consumer": {"id": consumer_id, "source_sha": consumer["sha"]},
|
||||||
|
"accepted_dependencies": [
|
||||||
|
{"id": dep, "source_sha": graph[dep]["sha"]} for dep in sorted(consumer["requires"])
|
||||||
|
if dep != entry["component"]
|
||||||
|
],
|
||||||
|
}
|
||||||
|
digest = hashlib.sha256(json.dumps(inputs, sort_keys=True, separators=(",", ":")).encode()).hexdigest()
|
||||||
|
key = hashlib.sha256(f"{release_key}\n{consumer_id}\n{digest}".encode()).hexdigest()
|
||||||
|
tasks.append({"consumer": consumer_id, "repository": remote[1], "key": key, "digest": digest,
|
||||||
|
"baseline_sha": consumer["sha"], "inputs": inputs,
|
||||||
|
"status": "waiting-for-dependencies" if conflicts else "pending",
|
||||||
|
"different_dependencies": conflicts})
|
||||||
|
return release_key, tasks
|
||||||
|
|
||||||
|
|
||||||
def tracking_body(entry):
|
def tracking_body(entry):
|
||||||
lines = [entry["marker"], f"## {entry['repository']} {entry['tag']}",
|
lines = [entry["marker"], f"## {entry['repository']} {entry['tag']}",
|
||||||
"", f"- Component: {entry['component']} ({entry['path']})",
|
"", f"- Component: {entry['component']} ({entry['path']})",
|
||||||
@@ -290,6 +322,8 @@ def tracking_body(entry):
|
|||||||
*(f"- {a['name']} ({a['target']}, {a['size']} bytes): {a['sha256']}" for a in entry["assets"]),
|
*(f"- {a['name']} ({a['target']}, {a['size']} bytes): {a['sha256']}" for a in entry["assets"]),
|
||||||
"", "## Pending consumer validation", "",
|
"", "## Pending consumer validation", "",
|
||||||
f"- Direct consumers: {', '.join(entry['direct_consumers']) or 'none'}",
|
f"- Direct consumers: {', '.join(entry['direct_consumers']) or 'none'}",
|
||||||
|
*(f"- {task['consumer']} at {task['baseline_sha']}: {task['status']} (inputs {task['digest']})"
|
||||||
|
for task in entry["consumer_tasks"]),
|
||||||
f"- Affected: {', '.join(entry['affected']) or 'none'}",
|
f"- Affected: {', '.join(entry['affected']) or 'none'}",
|
||||||
f"- Governance owner: {entry['governance_owner']}"])
|
f"- Governance owner: {entry['governance_owner']}"])
|
||||||
|
|
||||||
@@ -322,12 +356,66 @@ def verify_apply_context(client, root_sha):
|
|||||||
root = client.get(f"/repos/{ROOT_REPOSITORY}")
|
root = client.get(f"/repos/{ROOT_REPOSITORY}")
|
||||||
require(isinstance(root, dict) and root.get("default_branch") == "main",
|
require(isinstance(root, dict) and root.get("default_branch") == "main",
|
||||||
"apply requires the root default branch")
|
"apply requires the root default branch")
|
||||||
|
verify_root_base(client, root_sha)
|
||||||
|
|
||||||
|
|
||||||
|
def verify_root_base(client, root_sha):
|
||||||
branch = client.get(f"/repos/{ROOT_REPOSITORY}/branches/main")
|
branch = client.get(f"/repos/{ROOT_REPOSITORY}/branches/main")
|
||||||
require(isinstance(branch, dict) and branch.get("protected") is True
|
require(isinstance(branch, dict) and branch.get("protected") is True
|
||||||
and (branch.get("commit") or {}).get("id") == root_sha,
|
and (branch.get("commit") or {}).get("id") == root_sha,
|
||||||
"apply requires the current protected root commit")
|
"apply requires the current protected root commit")
|
||||||
|
|
||||||
|
|
||||||
|
def register_consumer_tasks(client, root_sha, entry, issue_cache):
|
||||||
|
for task in entry["consumer_tasks"]:
|
||||||
|
issues_url = f"/repos/{task['repository']}/issues"
|
||||||
|
marker = f"<!-- marqdo:upstream release={entry['release_key']} consumer={task['consumer']} -->"
|
||||||
|
body = "\n".join([
|
||||||
|
marker,
|
||||||
|
f"<!-- marqdo:candidate-inputs {task['key']} -->",
|
||||||
|
"",
|
||||||
|
f"- Root tracking issue: {FORGE}/{ROOT_REPOSITORY}/issues/{entry['issue']}",
|
||||||
|
f"- Root candidate: {root_sha}",
|
||||||
|
f"- Consumer baseline: {task['baseline_sha']}",
|
||||||
|
f"- Input digest: {task['digest']}",
|
||||||
|
f"- State: {task['status']}",
|
||||||
|
"",
|
||||||
|
"```json",
|
||||||
|
json.dumps(task["inputs"], ensure_ascii=False, sort_keys=True, indent=2),
|
||||||
|
"```",
|
||||||
|
])
|
||||||
|
try:
|
||||||
|
if issues_url not in issue_cache:
|
||||||
|
issue_cache[issues_url] = list(pages(client, issues_url, state="all", type="issues"))
|
||||||
|
issues = issue_cache[issues_url]
|
||||||
|
matches = [issue for issue in issues if is_writer(issue)
|
||||||
|
and (issue.get("body") or "").splitlines()[:1] == [marker]]
|
||||||
|
require(len(matches) <= 1, "multiple matching consumer tasks")
|
||||||
|
if matches:
|
||||||
|
issue = matches[0]
|
||||||
|
if issue["state"] == "open":
|
||||||
|
comments = tracking_comments(client, issues_url, issue)
|
||||||
|
key_line = f"<!-- marqdo:candidate-inputs {task['key']} -->"
|
||||||
|
baselines = [note.splitlines() for note in [issue["body"], *comments]
|
||||||
|
if note.splitlines()[:1] == [marker]]
|
||||||
|
if not {key_line, f"- Root candidate: {root_sha}"} <= set(baselines[-1]):
|
||||||
|
verify_root_base(client, root_sha)
|
||||||
|
client.post(f"{issues_url}/{issue['number']}/comments", {"body": body})
|
||||||
|
else:
|
||||||
|
task["registration"] = "closed"
|
||||||
|
else:
|
||||||
|
verify_root_base(client, root_sha)
|
||||||
|
issue = client.post(issues_url, {
|
||||||
|
"title": f"[upstream] {entry['component']} {entry['tag']} for {task['consumer']}",
|
||||||
|
"body": body,
|
||||||
|
})
|
||||||
|
issues.append(issue)
|
||||||
|
task["issue"] = issue["number"]
|
||||||
|
task.setdefault("registration", "recorded")
|
||||||
|
except ReconcileError as error:
|
||||||
|
task.update(registration="blocked", error=str(error))
|
||||||
|
|
||||||
|
|
||||||
def reconcile(client, root=PROJECT_ROOT, apply=False, report_out=None, cutoff=None):
|
def reconcile(client, root=PROJECT_ROOT, apply=False, report_out=None, cutoff=None):
|
||||||
root_sha, graph, managed = managed_repositories(root)
|
root_sha, graph, managed = managed_repositories(root)
|
||||||
cutoff_time = timestamp(cutoff) if cutoff else None
|
cutoff_time = timestamp(cutoff) if cutoff else None
|
||||||
@@ -337,7 +425,7 @@ def reconcile(client, root=PROJECT_ROOT, apply=False, report_out=None, cutoff=No
|
|||||||
verify_apply_context(client, root_sha)
|
verify_apply_context(client, root_sha)
|
||||||
labels = f"/repos/{ROOT_REPOSITORY}/labels"
|
labels = f"/repos/{ROOT_REPOSITORY}/labels"
|
||||||
label_id = next((x["id"] for x in pages(client, labels) if x.get("name") == LABEL), None) if apply else None
|
label_id = next((x["id"] for x in pages(client, labels) if x.get("name") == LABEL), None) if apply else None
|
||||||
results, errors = [], {}
|
results, errors, consumer_issues = [], {}, {}
|
||||||
for repository, component in managed.items():
|
for repository, component in managed.items():
|
||||||
known_tags = set()
|
known_tags = set()
|
||||||
try:
|
try:
|
||||||
@@ -383,6 +471,7 @@ def reconcile(client, root=PROJECT_ROOT, apply=False, report_out=None, cutoff=No
|
|||||||
if line.startswith("<!-- marqdo:verified-release ")}
|
if line.startswith("<!-- marqdo:verified-release ")}
|
||||||
require(not old or old == {identity_marker(entry)},
|
require(not old or old == {identity_marker(entry)},
|
||||||
"published release identity or index digest changed")
|
"published release identity or index digest changed")
|
||||||
|
entry["release_key"], entry["consumer_tasks"] = consumer_inputs(entry, graph)
|
||||||
except ReconcileError as error:
|
except ReconcileError as error:
|
||||||
entry.update(status="blocked", error=str(error))
|
entry.update(status="blocked", error=str(error))
|
||||||
|
|
||||||
@@ -391,7 +480,7 @@ def reconcile(client, root=PROJECT_ROOT, apply=False, report_out=None, cutoff=No
|
|||||||
if entry["status"] == "pending" and any(
|
if entry["status"] == "pending" and any(
|
||||||
identity_marker(entry) in body.splitlines() for body in recorded):
|
identity_marker(entry) in body.splitlines() for body in recorded):
|
||||||
entry["status"] = "tracked"
|
entry["status"] = "tracked"
|
||||||
elif apply and len(trackers) == 1 and entry["status"] in {"pending", "blocked"}:
|
if apply and len(trackers) == 1 and entry["status"] in {"pending", "tracked", "blocked"}:
|
||||||
ensure_tracking_note(client, issues_url, trackers[0], entry, comments)
|
ensure_tracking_note(client, issues_url, trackers[0], entry, comments)
|
||||||
elif apply and entry["status"] in {"pending", "blocked"}:
|
elif apply and entry["status"] in {"pending", "blocked"}:
|
||||||
require(label_id is not None, f"tracking label {LABEL!r} is missing")
|
require(label_id is not None, f"tracking label {LABEL!r} is missing")
|
||||||
@@ -402,6 +491,10 @@ def reconcile(client, root=PROJECT_ROOT, apply=False, report_out=None, cutoff=No
|
|||||||
entry["issue"] = created["number"]
|
entry["issue"] = created["number"]
|
||||||
if entry["status"] == "pending":
|
if entry["status"] == "pending":
|
||||||
entry["status"] = "created"
|
entry["status"] = "created"
|
||||||
|
if (apply and entry.get("consumer_tasks") and not entry.get("tracking_update")
|
||||||
|
and entry["status"] in {"created", "pending", "tracked"}
|
||||||
|
and (not trackers or trackers[0]["state"] == "open")):
|
||||||
|
register_consumer_tasks(client, root_sha, entry, consumer_issues)
|
||||||
results.append(entry)
|
results.append(entry)
|
||||||
prefix = f"<!-- marqdo:release-reconcile repository={repository} tag="
|
prefix = f"<!-- marqdo:release-reconcile repository={repository} tag="
|
||||||
for issue in issues:
|
for issue in issues:
|
||||||
@@ -460,7 +553,9 @@ def main(argv):
|
|||||||
return 1
|
return 1
|
||||||
print(json.dumps(report, ensure_ascii=False, indent=2))
|
print(json.dumps(report, ensure_ascii=False, indent=2))
|
||||||
return int(not report["scan_complete"] or any(
|
return int(not report["scan_complete"] or any(
|
||||||
item["status"] == "blocked" or "tracking_update" in item for item in report["results"]))
|
item["status"] == "blocked" or "tracking_update" in item
|
||||||
|
or any(task.get("registration") == "blocked" for task in item.get("consumer_tasks", []))
|
||||||
|
for item in report["results"]))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -334,6 +334,27 @@ class HierarchicalLayoutTests(unittest.TestCase):
|
|||||||
layout.validate("HEAD", True)
|
layout.validate("HEAD", True)
|
||||||
layout.validate("HEAD", False)
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_active_entries_use_the_dependency_order_and_include_a_new_leaf(self):
|
||||||
|
design = self.leaf("design")
|
||||||
|
catalog_text = DOMAIN.replace('state = "planned"', 'state = "active"').replace(
|
||||||
|
'checks_with = ["web-preview"]\nrelease = "optional"',
|
||||||
|
'checks_with = ["web-preview"]\nrelease = "optional"\nentry = "scripts/ci.sh"',
|
||||||
|
)
|
||||||
|
self.assemble(domain_catalog=catalog_text, design=design,
|
||||||
|
extra_domain_link=("components", design[1]), domain_modules={
|
||||||
|
"design": "https://git.cflmy.cn/cflmy/marqdo-web-design.git",
|
||||||
|
"preview": "https://git.cflmy.cn/cflmy/marqdo-web-preview.git",
|
||||||
|
"components": "https://git.cflmy.cn/cflmy/marqdo-web-components.git",
|
||||||
|
})
|
||||||
|
layers = layout.validate("HEAD", True)
|
||||||
|
entries = list(layout.active_entries(layers))
|
||||||
|
ids = [entry[0] for entry in entries]
|
||||||
|
self.assertIn(("web-components", "extension", "extensions/web/components", "scripts/ci.sh"), entries)
|
||||||
|
self.assertLess(ids.index("cli"), ids.index("web-design"))
|
||||||
|
self.assertLess(ids.index("web-design"), ids.index("web-preview"))
|
||||||
|
self.assertLess(ids.index("web-components"), ids.index("web"))
|
||||||
|
self.assertEqual(set(ids), {"cli", "web", "web-design", "web-preview", "web-components"})
|
||||||
|
|
||||||
def test_accepts_a_planned_domain_and_planned_child_gitlinks(self):
|
def test_accepts_a_planned_domain_and_planned_child_gitlinks(self):
|
||||||
web = WEB_DOMAIN.replace('state = "active"', 'state = "planned"').replace(
|
web = WEB_DOMAIN.replace('state = "active"', 'state = "planned"').replace(
|
||||||
'entry = "scripts/integration.sh"\n', '')
|
'entry = "scripts/integration.sh"\n', '')
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ TAG = "v0.1.0-rc.1"
|
|||||||
PUBLISHED = "2026-11-27T08:00:00+08:00"
|
PUBLISHED = "2026-11-27T08:00:00+08:00"
|
||||||
ASSET = "text-source.tar.gz"
|
ASSET = "text-source.tar.gz"
|
||||||
ISSUES = "/repos/cflmy/marqdo/issues"
|
ISSUES = "/repos/cflmy/marqdo/issues"
|
||||||
|
CONSUMER_ISSUES = "/repos/cflmy/marqdo-ext-archive/issues"
|
||||||
FORGE = reconcile.FORGE
|
FORGE = reconcile.FORGE
|
||||||
ACTOR = {"login": reconcile.RECONCILE_ACCOUNT}
|
ACTOR = {"login": reconcile.RECONCILE_ACCOUNT}
|
||||||
COMPONENT = {"id": "std-text", "sha": BASE, "path": "stdlib/text",
|
COMPONENT = {"id": "std-text", "sha": BASE, "path": "stdlib/text",
|
||||||
@@ -34,6 +35,7 @@ class FakeForge:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.writes = []
|
self.writes = []
|
||||||
self.issues = []
|
self.issues = []
|
||||||
|
self.consumer_issues = []
|
||||||
self.comments = {}
|
self.comments = {}
|
||||||
self.pages = []
|
self.pages = []
|
||||||
self.pipeline_reads = []
|
self.pipeline_reads = []
|
||||||
@@ -51,6 +53,7 @@ class FakeForge:
|
|||||||
"published_at": PUBLISHED}
|
"published_at": PUBLISHED}
|
||||||
self.releases = [self.release]
|
self.releases = [self.release]
|
||||||
self.protected = True
|
self.protected = True
|
||||||
|
self.root_sha = BASE
|
||||||
self.tag_sha = SOURCE
|
self.tag_sha = SOURCE
|
||||||
self.pipeline_sha = SOURCE
|
self.pipeline_sha = SOURCE
|
||||||
self.wrong_account = False
|
self.wrong_account = False
|
||||||
@@ -77,6 +80,7 @@ class FakeForge:
|
|||||||
records = {
|
records = {
|
||||||
f"/repos/{REPO}/releases": self.releases,
|
f"/repos/{REPO}/releases": self.releases,
|
||||||
ISSUES: self.issues,
|
ISSUES: self.issues,
|
||||||
|
CONSUMER_ISSUES: self.consumer_issues,
|
||||||
"/repos/cflmy/marqdo/labels": [{"id": 5, "name": reconcile.LABEL}],
|
"/repos/cflmy/marqdo/labels": [{"id": 5, "name": reconcile.LABEL}],
|
||||||
**self.comments,
|
**self.comments,
|
||||||
}.get(path, [])
|
}.get(path, [])
|
||||||
@@ -87,7 +91,7 @@ class FakeForge:
|
|||||||
f"/repos/{REPO}/tags/{TAG}": {"name": TAG, "commit": {"sha": self.tag_sha}},
|
f"/repos/{REPO}/tags/{TAG}": {"name": TAG, "commit": {"sha": self.tag_sha}},
|
||||||
"/repos/cflmy/marqdo": {"default_branch": "main"},
|
"/repos/cflmy/marqdo": {"default_branch": "main"},
|
||||||
"/repos/cflmy/marqdo/branches/main": {"protected": self.protected,
|
"/repos/cflmy/marqdo/branches/main": {"protected": self.protected,
|
||||||
"commit": {"id": BASE}},
|
"commit": {"id": self.root_sha}},
|
||||||
"/user": ({"login": "admin", "is_admin": True} if self.wrong_account
|
"/user": ({"login": "admin", "is_admin": True} if self.wrong_account
|
||||||
else {**ACTOR, "is_admin": False}),
|
else {**ACTOR, "is_admin": False}),
|
||||||
}[path]
|
}[path]
|
||||||
@@ -111,10 +115,11 @@ class FakeForge:
|
|||||||
|
|
||||||
def post(self, path, data):
|
def post(self, path, data):
|
||||||
self.writes.append((path, data))
|
self.writes.append((path, data))
|
||||||
item = {"body": data["body"], "user": ACTOR}
|
item = {"body": data["body"], "user": ACTOR, "state": "open"}
|
||||||
if path == ISSUES:
|
if path in {ISSUES, CONSUMER_ISSUES}:
|
||||||
item["number"] = 100 + len(self.issues)
|
issues = self.issues if path == ISSUES else self.consumer_issues
|
||||||
self.issues.append(item)
|
item["number"] = 100 + len(issues)
|
||||||
|
issues.append(item)
|
||||||
else:
|
else:
|
||||||
self.comments.setdefault(path, []).append(item)
|
self.comments.setdefault(path, []).append(item)
|
||||||
return item
|
return item
|
||||||
@@ -142,6 +147,62 @@ class ReconcileTest(unittest.TestCase):
|
|||||||
self.assertEqual(len(self.forge.downloads), 2)
|
self.assertEqual(len(self.forge.downloads), 2)
|
||||||
self.assertEqual(len(self.forge.pipeline_reads), 2)
|
self.assertEqual(len(self.forge.pipeline_reads), 2)
|
||||||
|
|
||||||
|
def test_consumer_inputs_are_tied_to_assets_dependencies_and_accepted_sha(self):
|
||||||
|
consumer = {"id": "archive", "state": "active", "sha": "c" * 40,
|
||||||
|
"remote": FORGE + "/cflmy/marqdo-ext-archive.git",
|
||||||
|
"requires": ["std-text", "cli"], "checks_with": []}
|
||||||
|
cli = {"id": "cli", "state": "active", "sha": "d" * 40,
|
||||||
|
"requires": [], "checks_with": []}
|
||||||
|
graph = {item["id"]: item for item in (COMPONENT, consumer, cli)}
|
||||||
|
with patch.object(reconcile, "managed_repositories", return_value=(BASE, graph, {REPO: COMPONENT})):
|
||||||
|
entry, = self.run_scan()["results"]
|
||||||
|
task, = entry["consumer_tasks"]
|
||||||
|
self.assertEqual(task["consumer"], "archive")
|
||||||
|
self.assertEqual(task["baseline_sha"], consumer["sha"])
|
||||||
|
self.assertEqual(task["inputs"]["release"]["assets"][0]["name"], ASSET)
|
||||||
|
self.assertEqual(task["inputs"]["accepted_dependencies"], [{"id": "cli", "source_sha": cli["sha"]}])
|
||||||
|
self.assertEqual(task["status"], "pending")
|
||||||
|
cli["sha"] = "e" * 40
|
||||||
|
first_key = task["key"]
|
||||||
|
entry, = self.run_scan()["results"]
|
||||||
|
task, = entry["consumer_tasks"]
|
||||||
|
self.assertNotEqual(task["key"], first_key)
|
||||||
|
self.forge.evidence["dependencies"] = [{"id": "cli", "source_sha": "d" * 40}]
|
||||||
|
self.forge.refresh_assets()
|
||||||
|
entry, = self.run_scan()["results"]
|
||||||
|
task, = entry["consumer_tasks"]
|
||||||
|
self.assertEqual(task["status"], "waiting-for-dependencies")
|
||||||
|
self.assertEqual(task["different_dependencies"], ["cli"])
|
||||||
|
self.assertEqual(self.forge.writes, [])
|
||||||
|
|
||||||
|
def test_apply_creates_one_consumer_issue_and_records_new_inputs_in_it(self):
|
||||||
|
consumer = {"id": "archive", "state": "active", "sha": "c" * 40,
|
||||||
|
"remote": FORGE + "/cflmy/marqdo-ext-archive.git",
|
||||||
|
"requires": ["std-text"], "checks_with": []}
|
||||||
|
graph = {item["id"]: item for item in (COMPONENT, consumer)}
|
||||||
|
with patch.object(reconcile, "managed_repositories", return_value=(BASE, graph, {REPO: COMPONENT})):
|
||||||
|
entry, = self.run_scan(apply=True)["results"]
|
||||||
|
task, = entry["consumer_tasks"]
|
||||||
|
self.assertEqual(task["registration"], "recorded")
|
||||||
|
self.assertEqual(task["issue"], 100)
|
||||||
|
self.assertIn(FORGE + "/cflmy/marqdo/issues/100", self.forge.consumer_issues[0]["body"])
|
||||||
|
self.run_scan(apply=True)
|
||||||
|
self.assertEqual(len(self.forge.writes), 2)
|
||||||
|
consumer["sha"] = "e" * 40
|
||||||
|
self.run_scan(apply=True)
|
||||||
|
self.assertEqual(len(self.forge.consumer_issues), 1)
|
||||||
|
self.assertEqual(len(self.forge.comments[CONSUMER_ISSUES + "/100/comments"]), 1)
|
||||||
|
self.run_scan(apply=True)
|
||||||
|
self.assertEqual(len(self.forge.comments[CONSUMER_ISSUES + "/100/comments"]), 1)
|
||||||
|
new_root = "f" * 40
|
||||||
|
self.forge.root_sha = new_root
|
||||||
|
with patch.object(reconcile, "managed_repositories", return_value=(new_root, graph, {REPO: COMPONENT})):
|
||||||
|
self.run_scan(apply=True)
|
||||||
|
self.run_scan(apply=True)
|
||||||
|
notes = self.forge.comments[CONSUMER_ISSUES + "/100/comments"]
|
||||||
|
self.assertEqual(len(notes), 2)
|
||||||
|
self.assertIn(f"- Root candidate: {new_root}", notes[-1]["body"])
|
||||||
|
|
||||||
def test_apply_creates_one_verified_tracker_then_rechecks_it(self):
|
def test_apply_creates_one_verified_tracker_then_rechecks_it(self):
|
||||||
entry, = self.run_scan(apply=True)["results"]
|
entry, = self.run_scan(apply=True)["results"]
|
||||||
self.assertEqual(entry["status"], "created")
|
self.assertEqual(entry["status"], "created")
|
||||||
|
|||||||
Reference in new issue
Block a user