From 0daed814cbc67cfdc4d03ad7fe0c52e220c44dd6 Mon Sep 17 00:00:00 2001 From: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com> Date: Sun, 15 Nov 2026 07:20:08 -0500 Subject: [PATCH] ci: check that hack/core.sh is release-tools' xhandler/core.sh The three libraries' hack/core.sh were identical only by convention. release-tools now holds the original (xhandler/core.sh); make verify-core-script compares this copy with it and CI runs it, so a copy that drifts fails. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 2 ++ CONTRIBUTING.md | 3 +++ Makefile | 11 ++++++++++- hack/core.sh | 4 +++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28ef857..0fce91e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,3 +34,5 @@ jobs: - run: uv run mypy src # The committed core is the xhandler.wasm of the xhandler-rust release in its VERSION - run: make verify-core + # hack/core.sh is release-tools' xhandler/core.sh + - run: make verify-core-script diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6d233a3..033a425 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,6 +31,9 @@ XHANDLER_E2E=true uv run pytest tests/test_e2e.py # crea, firma y envía una fa conformidad (`testdata/conformance/`). No los edites a mano. La versión del paquete es la del núcleo, y una versión solo se publica con el núcleo de la versión igual de xhandler-rust: `make verify-core` lo comprueba. + `hack/core.sh` es una copia del `xhandler/core.sh` de + [release-tools](https://github.com/project-openubl/release-tools): cámbialo allá y luego cópialo + (`make verify-core-script` lo comprueba). - En Python está lo que necesita IO: el cliente HTTP (httpx), los reintentos y el caché de tokens (`src/xhandler/xsender/`). - Los nombres (`FileSender`, `SunatClient`, `SigningKey`...) se mantienen iguales en Go, Python y diff --git a/Makefile b/Makefile index 8202989..936fcab 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ # make sync CORE= the xhandler-rust v release # make sync a checkout of xhandler-rust (RUST_REPO), for development # make verify-core checks that the committed core is the one released as its VERSION +# make verify-core-script checks that hack/core.sh is release-tools' xhandler/core.sh # make verify-release TAG=v # what releasing requires: syncing the xhandler-rust # release of the same version changes nothing @@ -15,7 +16,7 @@ DIST := $(if $(CORE),.dist,$(RUST_REPO)/dist) SYNCED := src/xhandler/_core/xhandler.wasm src/xhandler/_core/VERSION src/xhandler/xbuilder/models.py testdata/conformance -.PHONY: sync dist verify-core verify-release test lint +.PHONY: sync dist verify-core verify-core-script verify-release test lint sync: dist cp $(DIST)/xhandler.wasm $(DIST)/VERSION src/xhandler/_core/ @@ -33,6 +34,14 @@ endif verify-core: ./hack/core.sh verify src/xhandler/_core/xhandler.wasm src/xhandler/_core/VERSION +# hack/core.sh is a copy: change release-tools' xhandler/core.sh, then copy it here +CORE_SCRIPT := https://raw.githubusercontent.com/project-openubl/release-tools/main/xhandler/core.sh + +verify-core-script: + @original=$$(mktemp) && trap 'rm -f "$$original"' EXIT && \ + curl -fsSL -o "$$original" $(CORE_SCRIPT) && \ + { diff -u "$$original" hack/core.sh || { echo "error: hack/core.sh differs from $(CORE_SCRIPT): change it there first, then copy it" >&2; exit 1; }; } + verify-release: ./hack/core.sh verify-release $(TAG) src/xhandler/_core/xhandler.wasm src/xhandler/_core/VERSION $(MAKE) --no-print-directory sync CORE=$(TAG:v%=%) diff --git a/hack/core.sh b/hack/core.sh index b78452b..e588034 100755 --- a/hack/core.sh +++ b/hack/core.sh @@ -1,7 +1,9 @@ #!/usr/bin/env bash # The xhandler core (xhandler.wasm, its models and the conformance corpus) comes from the # releases of xhandler-rust, which attach xhandler-dist-.tar.gz, xhandler.wasm and -# SHA256SUMS. This script is identical in xhandler-go, xhandler-python and xhandler-java. +# SHA256SUMS. The original is project-openubl/release-tools' xhandler/core.sh: change it there, +# then copy it to xhandler-go, xhandler-python and xhandler-java (`make verify-core-script` there +# checks the copy). # # core.sh download # extracts the release's dist into