Vendor shared SEO rule engine + CI drift guard (no pipeline wiring yet)
src/seo/rules.py is a byte-for-byte copy of the canonical seo_rules.py (git.chemavx.xyz/chemavx/chemavx-seo-tools). CI step "Verify vendored SEO engine" clones the canonical and fails the build on any divergence; `make sync-seo` / `make check-seo-sync` cover the local-canonical workflow. Nothing imports this in a runtime path yet — generate_seo_fields integration comes next behind SEO_AUTOFILL. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
b6dc5192b8
commit
89aa8d6030
@@ -0,0 +1,30 @@
|
||||
# ResearchOwl — developer tasks.
|
||||
#
|
||||
# SEO engine vendoring: src/seo/rules.py is a byte-for-byte copy of the canonical
|
||||
# seo_rules.py (repo git.chemavx.xyz/chemavx/chemavx-seo-tools; local working copy
|
||||
# ~/seo-tools). These targets keep the vendored copy in sync; CI enforces it too.
|
||||
|
||||
SEO_TOOLS_DIR ?= $(HOME)/seo-tools
|
||||
CANON := $(SEO_TOOLS_DIR)/seo_rules.py
|
||||
VENDORED := src/seo/rules.py
|
||||
HEADER := src/seo/_vendor_header.py
|
||||
MARKER := BEGIN VENDORED seo_rules.py
|
||||
|
||||
.PHONY: sync-seo check-seo-sync
|
||||
|
||||
sync-seo: ## Re-copy canonical seo_rules.py into the vendored file + record hash
|
||||
@test -f "$(CANON)" || { echo "canonical not found at $(CANON)"; exit 1; }
|
||||
@cat "$(HEADER)" "$(CANON)" > "$(VENDORED)"
|
||||
@sha256sum "$(CANON)" | cut -d' ' -f1 > src/seo/.rules.sha256
|
||||
@echo "synced $(VENDORED) from $(CANON) (sha $$(cat src/seo/.rules.sha256))"
|
||||
|
||||
check-seo-sync: ## Fail if the vendored copy diverges from the local canonical
|
||||
@test -f "$(CANON)" || { echo "canonical not found at $(CANON) — skipping (run on a machine with seo-tools)"; exit 0; }
|
||||
@N=$$(grep -n "$(MARKER)" "$(VENDORED)" | head -1 | cut -d: -f1); \
|
||||
tail -n +$$((N+1)) "$(VENDORED)" > /tmp/_vendored_body.py; \
|
||||
if cmp -s /tmp/_vendored_body.py "$(CANON)"; then \
|
||||
echo "seo engine in sync ($(VENDORED) == $(CANON))"; \
|
||||
else \
|
||||
echo "SEO ENGINE DRIFT: $(VENDORED) != $(CANON). Run 'make sync-seo' and commit."; \
|
||||
diff -u "$(CANON)" /tmp/_vendored_body.py | head -40; exit 1; \
|
||||
fi
|
||||
Reference in New Issue
Block a user