Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.
Python agentic-aiai-securityalert-triageblue-teamcybersecuritydetection-engineeringincident-responselanggraphllm-agentsmcpmitre-attackmodel-context-protocolpurple-teamsecurity-operationsself-hostedsiemsoarsocthreat-detectionthreat-intelligence
Three of the eight publishable packages could not be built (#725)
Beenu Arorae5b7141ac1a4
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 0ec859092..5b20a5ec6 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -693,7 +693,7 @@ jobs:-e packages/plugin-sdk-py \-e packages/sdk-py \-e packages/aisoc-cli \- pytest pytest-asyncio pytest-httpx+ pytest pytest-asyncio pytest-httpx build- name: Run aisoc-plugin-sdk testsrun: pytest packages/plugin-sdk-py/tests/ -v --tb=short- name: Run aisoc-sdk testsdiff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 69104311a..4b5a4c320 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -293,7 +293,13 @@ jobs:run: pnpm install --frozen-lockfile --ignore-scripts- name: Build ${{ matrix.pkg }}- run: pnpm --filter ${{ matrix.pkg }} build+ # The `...` suffix means "and its workspace dependencies", built+ # topologically. Without it, `aisoc` and `@aisoc/mcp` fail with+ # `Could not resolve "@aisoc/report-card"`: that dependency's `main`+ # points at `./dist/index.js`, a build artifact, and a plain+ # `--filter <pkg>` never builds it. The failure only shows up on a tag,+ # because nothing else builds these packages in isolation.+ run: pnpm --filter '${{ matrix.pkg }}...' build- name: Pack tarballid: packdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex ff000e05c..7856cc126 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -184,6 +184,19 @@ Claim-to-gate matrix: **108 rows — 99 GATED, 9 PARTIAL, 0 NO GATE**.### Fixed+- **Three of the eight publishable packages could not be built.** The release+ pipeline builds and packs every package on each tag precisely so it cannot+ rot while the upload is credential-gated — and on this tag it earned that+ design back. `aisoc` and `@aisoc/mcp` failed with+ `Could not resolve "@aisoc/report-card"`: that workspace dependency's `main`+ points at a build artifact and `pnpm --filter <pkg> build` never builds+ dependencies, so the `...` suffix was missing. `aisoc-cli` could not produce+ a wheel at all — `pyproject.toml` declared `packages = ["src/aisoc_cli"]`+ *and* a `force-include` mapping the same templates directory to the same+ wheel path, so hatchling refused on the duplicate. Both would have blocked+ the first real publish, and neither was visible anywhere but a tag.+ `test_packaging.py` now builds the wheel and looks inside it, because a test+ that read the config would have declared both fine.- **The sandbox determinism test compared a timer.** Its `VOLATILE` list namedfour fields the CLI does not emit — the real one is `elapsed_ms` — so thecomparison included a wall-clock value and failed whenever two runsdiff --git a/packages/aisoc-cli/pyproject.toml b/packages/aisoc-cli/pyproject.tomlindex db2a2744d..49dfed3b9 100644--- a/packages/aisoc-cli/pyproject.toml+++ b/packages/aisoc-cli/pyproject.toml@@ -49,11 +49,20 @@ Documentation = "https://github.com/beenuar/AiSOC#readme"Repository = "https://github.com/beenuar/AiSOC"[tool.hatch.build.targets.wheel]+# `packages` already carries everything under src/aisoc_cli, templates+# included, so they reach the wheel at aisoc_cli/templates/... where+# `importlib.resources` expects them.+#+# There used to be a `force-include` mapping that same directory to that same+# destination. Hatchling then tried to add each template twice and refused:+# ValueError: A second file is being added to the wheel archive at the same+# path: aisoc_cli/templates/connector/README.md.tmpl+# Nothing built this wheel except a tag, so the failure was invisible until+# the release ran — and it would have blocked the first real publish.+# `test_templates_reach_the_wheel` in tests/ now asserts the templates are+# present, so removing the redundant mapping cannot quietly drop them.packages = ["src/aisoc_cli"]-[tool.hatch.build.targets.wheel.force-include]-"src/aisoc_cli/templates" = "aisoc_cli/templates"-[tool.hatch.build.targets.sdist]include = ["src/aisoc_cli",diff --git a/packages/aisoc-cli/tests/test_packaging.py b/packages/aisoc-cli/tests/test_packaging.pynew file mode 100644index 000000000..300840d8a--- /dev/null+++ b/packages/aisoc-cli/tests/test_packaging.py@@ -0,0 +1,77 @@+"""The built wheel must carry the scaffold templates.++`aisoc plugin new` reads them through `importlib.resources.files("aisoc_cli")`,+so a wheel without them installs cleanly and then fails on first use — the+worst shape of packaging bug, because `pip install` reports success.++This exists because the opposite mistake shipped: `pyproject.toml` declared+`packages = ["src/aisoc_cli"]` *and* a `force-include` mapping the same+templates directory to the same wheel path, so hatchling tried to add each+file twice and refused to build at all:++ ValueError: A second file is being added to the wheel archive at the same+ path: aisoc_cli/templates/connector/README.md.tmpl++Nothing built this wheel except a release tag, so it was invisible until the+release ran, and it would have blocked the first real publish. Removing the+redundant mapping is only safe if something checks the templates still arrive.+"""++from __future__ import annotations++import importlib.util+import subprocess+import sys+import zipfile+from pathlib import Path++import pytest++PACKAGE_ROOT = Path(__file__).resolve().parents[1]+TEMPLATE_ROOT = PACKAGE_ROOT / "src" / "aisoc_cli" / "templates"++#: The five plugin types `aisoc plugin new --type` accepts.+EXPECTED_TYPES = {"connector", "detection", "enricher", "responder", "widget"}+++def _source_templates() -> set[str]:+ return {str(p.relative_to(TEMPLATE_ROOT)) for p in TEMPLATE_ROOT.rglob("*.tmpl")}+++def test_the_source_tree_has_a_template_for_every_plugin_type() -> None:+ present = {p.name for p in TEMPLATE_ROOT.iterdir() if p.is_dir()}+ assert EXPECTED_TYPES <= present, f"missing template dirs: {sorted(EXPECTED_TYPES - present)}"++[email protected](importlib.util.find_spec("build") is None, reason="python -m build is required to build the wheel")+def test_templates_reach_the_wheel(tmp_path: Path) -> None:+ """Build the real wheel and look inside it.++ Slower than inspecting config, and the only check that would have caught+ either the duplicate-path failure or a silently dropped template. A test+ that reads `pyproject.toml` would have declared both fine.+ """+ try:+ subprocess.run(+ [sys.executable, "-m", "build", "--wheel", "--outdir", str(tmp_path)],+ cwd=PACKAGE_ROOT,+ check=True,+ capture_output=True,+ text=True,+ timeout=600,+ )+ except subprocess.CalledProcessError as exc: # pragma: no cover - real failure+ pytest.fail(f"wheel build failed:\n{exc.stdout}\n{exc.stderr}")++ wheels = sorted(tmp_path.glob("*.whl"))+ assert wheels, "no wheel was produced"++ in_wheel = {+ name[len("aisoc_cli/templates/") :] for name in zipfile.ZipFile(wheels[-1]).namelist() if name.startswith("aisoc_cli/templates/") and name.endswith(".tmpl")+ }+ missing = _source_templates() - in_wheel+ assert not missing, f"{len(missing)} template(s) are in the source tree but not the wheel: {sorted(missing)[:5]}"++ # And no duplicates, which is the failure that blocked the build.+ names = [n for n in zipfile.ZipFile(wheels[-1]).namelist() if n.startswith("aisoc_cli/")]+ assert len(names) == len(set(names)), "the wheel contains duplicate entries"