From 89e295648a827b4c51df8c6e6c0941ebc8a0ecd9 Mon Sep 17 00:00:00 2001 From: Agent IX Date: Sun, 15 Nov 2026 17:26:41 -0800 Subject: [PATCH 1/4] PLAT-1650: add US and EU default profiles --- pyproject.toml | 2 + .../profiles/eu-device-gdpr-ai-act.yaml | 17 +++++ .../us-device-cybersecurity-hipaa.yaml | 14 ++++ tests/test_profiles.py | 71 +++++++++++++++++-- 4 files changed, 100 insertions(+), 4 deletions(-) create mode 100644 spec_objects_security/profiles/eu-device-gdpr-ai-act.yaml create mode 100644 spec_objects_security/profiles/us-device-cybersecurity-hipaa.yaml diff --git a/pyproject.toml b/pyproject.toml index 8912a92..62a6936 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,8 @@ quire = { version = "^0.61.0", source = "internal-pypi" } # `quality_attribute` field, which spec-artifacts-iso owns. spec-artifacts-iso = { version = "^0.25.0", source = "internal-pypi" } platform-test-kit = {version = "0.5.6", source = "internal-pypi"} +spec-clauses-us-health = { version = "^0.1.0", source = "internal-pypi" } +spec-clauses-eu-law = { version = "^0.1.0", source = "internal-pypi" } [tool.poetry.scripts] build-tools = "scripts.build_tools:main" diff --git a/spec_objects_security/profiles/eu-device-gdpr-ai-act.yaml b/spec_objects_security/profiles/eu-device-gdpr-ai-act.yaml new file mode 100644 index 0000000..2ca6b28 --- /dev/null +++ b/spec_objects_security/profiles/eu-device-gdpr-ai-act.yaml @@ -0,0 +1,17 @@ +schemaVersion: source-profile-v1 +name: eu-device-gdpr-ai-act +title: EU device, GDPR, and AI Act +description: EU medical-device, data-protection, and high-risk AI sources. +clauseSets: + - authority: eu + id: mdr-2017-745 + version: 2026-07-19 + - authority: eu-mdcg + id: mdcg-2019-16 + version: rev1 + - authority: eu + id: gdpr-2016-679 + version: 2016-05-04 + - authority: eu + id: ai-act-2024-1689 + version: 2026-07-27 diff --git a/spec_objects_security/profiles/us-device-cybersecurity-hipaa.yaml b/spec_objects_security/profiles/us-device-cybersecurity-hipaa.yaml new file mode 100644 index 0000000..40e1d6b --- /dev/null +++ b/spec_objects_security/profiles/us-device-cybersecurity-hipaa.yaml @@ -0,0 +1,14 @@ +schemaVersion: source-profile-v1 +name: us-device-cybersecurity-hipaa +title: US device cybersecurity and HIPAA +description: US device cybersecurity statute, FDA guidance, and HIPAA Security Rule sources. +clauseSets: + - authority: us-congress + id: fdca-524b + version: 2026-10-15 + - authority: us-fda + id: premarket-cybersecurity + version: 2026-02-03 + - authority: us-hhs + id: 45-cfr-164-subpart-c + version: 2026-11-12 diff --git a/tests/test_profiles.py b/tests/test_profiles.py index 8fdafd5..2d4b8cc 100644 --- a/tests/test_profiles.py +++ b/tests/test_profiles.py @@ -8,9 +8,11 @@ from __future__ import annotations +import importlib import json import os import pathlib +import re import subprocess import pytest @@ -214,6 +216,41 @@ def test_web_app_baseline_profile_is_shipped_with_only_its_public_sets() -> None assert "context" not in profile +@pytest.mark.trace("TC-206", "FR-021-AC-1", "FR-021-AC-2", "FR-021-AC-4") +def test_us_device_profile_names_the_published_public_sets() -> None: + path = PROFILES_DIR / "us-device-cybersecurity-hipaa.yaml" + assert path.is_file() + profile = validate_profile(path) + assert profile["clauseSets"] == [ + {"authority": "us-congress", "id": "fdca-524b", "version": "2026-10-15"}, + { + "authority": "us-fda", + "id": "premarket-cybersecurity", + "version": "2026-02-03", + }, + { + "authority": "us-hhs", + "id": "45-cfr-164-subpart-c", + "version": "2026-11-12", + }, + ] + assert "context" not in profile + + +@pytest.mark.trace("TC-206", "FR-021-AC-1", "FR-021-AC-2", "FR-021-AC-4") +def test_eu_device_profile_names_the_published_public_sets() -> None: + path = PROFILES_DIR / "eu-device-gdpr-ai-act.yaml" + assert path.is_file() + profile = validate_profile(path) + assert profile["clauseSets"] == [ + {"authority": "eu", "id": "mdr-2017-745", "version": "2026-07-19"}, + {"authority": "eu-mdcg", "id": "mdcg-2019-16", "version": "rev1"}, + {"authority": "eu", "id": "gdpr-2016-679", "version": "2016-05-04"}, + {"authority": "eu", "id": "ai-act-2024-1689", "version": "2026-07-27"}, + ] + assert "context" not in profile + + def declared_keys(module_dir: pathlib.Path) -> set[tuple[str, str, str]]: """The clause-set keys a module's manifest lists, read from its set files.""" manifest = yaml.safe_load((module_dir / "manifest.yaml").read_text()) or {} @@ -248,7 +285,15 @@ def reference_modules(tmp_path_factory: pytest.TempPathFactory) -> list[pathlib. ) assert result.returncode == 0, result.stderr installed = sorted((home / "filament" / "modules").glob("*")) - return [PACKAGE_ROOT, *(d for d in installed if (d / "manifest.yaml").is_file())] + published_packs = [ + pathlib.Path(importlib.import_module(package).__file__).parent + for package in ("spec_clauses_us_health", "spec_clauses_eu_law") + ] + return [ + PACKAGE_ROOT, + *(d for d in installed if (d / "manifest.yaml").is_file()), + *published_packs, + ] def declaring_module( @@ -291,14 +336,32 @@ def _shipped_keys(path: pathlib.Path) -> list[tuple[str, str, str]]: ] +def assert_profile_keys_declared(path: pathlib.Path, modules: list[pathlib.Path]) -> None: + for key in _shipped_keys(path): + module = declaring_module(key, modules) + assert module is not None, f"{path.stem}: no module declares {key}" + + @pytest.mark.trace("TC-167", "FR-021-AC-2") @pytest.mark.parametrize("path", shipped_profiles(), ids=lambda p: p.stem) def test_every_shipped_key_is_declared_by_a_reference_module( path: pathlib.Path, reference_modules: list[pathlib.Path] ) -> None: - for key in _shipped_keys(path): - module = declaring_module(key, reference_modules) - assert module, f"{path.stem}: no module declares {key}" + assert_profile_keys_declared(path, reference_modules) + + +@pytest.mark.trace("TC-167", "FR-021-AC-2") +def test_a_profile_with_an_unpublished_version_fails_with_its_key( + tmp_path: pathlib.Path, reference_modules: list[pathlib.Path] +) -> None: + source = PROFILES_DIR / "us-device-cybersecurity-hipaa.yaml" + data = validate_profile(source) + data["clauseSets"][0]["version"] = "unpublished-version" + path = tmp_path / source.name + path.write_text(yaml.safe_dump(data, sort_keys=False)) + changed_key = tuple(data["clauseSets"][0][field] for field in ("authority", "id", "version")) + with pytest.raises(AssertionError, match=re.escape(str(changed_key))): + assert_profile_keys_declared(path, reference_modules) @pytest.mark.trace("TC-168", "TC-174", "FR-021-AC-3", "NFR-002-AC-2", "NFR-002-M-2") From db59d2207bad9c837efc7f566a9e67945bfb9776 Mon Sep 17 00:00:00 2001 From: Agent IX Date: Sun, 15 Nov 2026 17:28:34 -0800 Subject: [PATCH 2/4] PLAT-1650: quote profile version dates --- .../profiles/eu-device-gdpr-ai-act.yaml | 6 +++--- .../profiles/us-device-cybersecurity-hipaa.yaml | 6 +++--- tests/test_profiles.py | 14 +++++++++----- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/spec_objects_security/profiles/eu-device-gdpr-ai-act.yaml b/spec_objects_security/profiles/eu-device-gdpr-ai-act.yaml index 2ca6b28..7b19920 100644 --- a/spec_objects_security/profiles/eu-device-gdpr-ai-act.yaml +++ b/spec_objects_security/profiles/eu-device-gdpr-ai-act.yaml @@ -5,13 +5,13 @@ description: EU medical-device, data-protection, and high-risk AI sources. clauseSets: - authority: eu id: mdr-2017-745 - version: 2026-07-19 + version: "2026-07-19" - authority: eu-mdcg id: mdcg-2019-16 version: rev1 - authority: eu id: gdpr-2016-679 - version: 2016-05-04 + version: "2016-05-04" - authority: eu id: ai-act-2024-1689 - version: 2026-07-27 + version: "2026-07-27" diff --git a/spec_objects_security/profiles/us-device-cybersecurity-hipaa.yaml b/spec_objects_security/profiles/us-device-cybersecurity-hipaa.yaml index 40e1d6b..4517e9a 100644 --- a/spec_objects_security/profiles/us-device-cybersecurity-hipaa.yaml +++ b/spec_objects_security/profiles/us-device-cybersecurity-hipaa.yaml @@ -5,10 +5,10 @@ description: US device cybersecurity statute, FDA guidance, and HIPAA Security R clauseSets: - authority: us-congress id: fdca-524b - version: 2026-10-15 + version: "2026-10-15" - authority: us-fda id: premarket-cybersecurity - version: 2026-02-03 + version: "2026-02-03" - authority: us-hhs id: 45-cfr-164-subpart-c - version: 2026-11-12 + version: "2026-11-12" diff --git a/tests/test_profiles.py b/tests/test_profiles.py index 2d4b8cc..f3902ce 100644 --- a/tests/test_profiles.py +++ b/tests/test_profiles.py @@ -202,7 +202,7 @@ def test_shipped_profile_names_are_among_the_three_defaults() -> None: assert names <= ALLOWED_NAMES, sorted(names - ALLOWED_NAMES) -@pytest.mark.trace("TC-206", "FR-021-AC-1", "FR-021-AC-5") +@pytest.mark.trace("TC-166", "FR-021-AC-1") def test_web_app_baseline_profile_is_shipped_with_only_its_public_sets() -> None: path = PROFILES_DIR / "web-app-baseline.yaml" assert path.is_file() @@ -216,7 +216,7 @@ def test_web_app_baseline_profile_is_shipped_with_only_its_public_sets() -> None assert "context" not in profile -@pytest.mark.trace("TC-206", "FR-021-AC-1", "FR-021-AC-2", "FR-021-AC-4") +@pytest.mark.trace("TC-166", "FR-021-AC-1") def test_us_device_profile_names_the_published_public_sets() -> None: path = PROFILES_DIR / "us-device-cybersecurity-hipaa.yaml" assert path.is_file() @@ -237,7 +237,7 @@ def test_us_device_profile_names_the_published_public_sets() -> None: assert "context" not in profile -@pytest.mark.trace("TC-206", "FR-021-AC-1", "FR-021-AC-2", "FR-021-AC-4") +@pytest.mark.trace("TC-166", "FR-021-AC-1") def test_eu_device_profile_names_the_published_public_sets() -> None: path = PROFILES_DIR / "eu-device-gdpr-ai-act.yaml" assert path.is_file() @@ -336,7 +336,9 @@ def _shipped_keys(path: pathlib.Path) -> list[tuple[str, str, str]]: ] -def assert_profile_keys_declared(path: pathlib.Path, modules: list[pathlib.Path]) -> None: +def assert_profile_keys_declared( + path: pathlib.Path, modules: list[pathlib.Path] +) -> None: for key in _shipped_keys(path): module = declaring_module(key, modules) assert module is not None, f"{path.stem}: no module declares {key}" @@ -359,7 +361,9 @@ def test_a_profile_with_an_unpublished_version_fails_with_its_key( data["clauseSets"][0]["version"] = "unpublished-version" path = tmp_path / source.name path.write_text(yaml.safe_dump(data, sort_keys=False)) - changed_key = tuple(data["clauseSets"][0][field] for field in ("authority", "id", "version")) + changed_key = tuple( + data["clauseSets"][0][field] for field in ("authority", "id", "version") + ) with pytest.raises(AssertionError, match=re.escape(str(changed_key))): assert_profile_keys_declared(path, reference_modules) From ffbf8fe7c7dade4d9d61f8af92300b554419eeb1 Mon Sep 17 00:00:00 2001 From: Agent IX Date: Sun, 15 Nov 2026 17:36:19 -0800 Subject: [PATCH 3/4] PLAT-1650: install pack modules from GitHub tags --- pyproject.toml | 2 -- tests/test_profiles.py | 39 +++++++++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 62a6936..8912a92 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,8 +38,6 @@ quire = { version = "^0.61.0", source = "internal-pypi" } # `quality_attribute` field, which spec-artifacts-iso owns. spec-artifacts-iso = { version = "^0.25.0", source = "internal-pypi" } platform-test-kit = {version = "0.5.6", source = "internal-pypi"} -spec-clauses-us-health = { version = "^0.1.0", source = "internal-pypi" } -spec-clauses-eu-law = { version = "^0.1.0", source = "internal-pypi" } [tool.poetry.scripts] build-tools = "scripts.build_tools:main" diff --git a/tests/test_profiles.py b/tests/test_profiles.py index f3902ce..d498671 100644 --- a/tests/test_profiles.py +++ b/tests/test_profiles.py @@ -8,7 +8,6 @@ from __future__ import annotations -import importlib import json import os import pathlib @@ -28,6 +27,10 @@ "eu-device-gdpr-ai-act", "web-app-baseline", } +PUBLISHED_PACK_SOURCES = ( + "github:agent-ix/spec-clauses-us-health//spec_clauses_us_health@v0.1.0", + "github:agent-ix/spec-clauses-eu-law//spec_clauses_eu_law@v0.1.0", +) class ProfileError(ValueError): @@ -268,8 +271,7 @@ def declared_keys(module_dir: pathlib.Path) -> set[tuple[str, str, str]]: @pytest.fixture(scope="session") def reference_modules(tmp_path_factory: pytest.TempPathFactory) -> list[pathlib.Path]: - """The reference module set: the modules `quoin module - ensure-defaults` installs into a fresh home, plus this module. + """The reference module set: Quoin defaults, both published packs, and us. Built from scratch rather than read from an ambient install, so a stale or unpublished local module cannot make a profile pass or fail. It is only @@ -277,22 +279,39 @@ def reference_modules(tmp_path_factory: pytest.TempPathFactory) -> list[pathlib. """ home = tmp_path_factory.mktemp("reference-home") result = subprocess.run( - [engine_tool("quoin"), "module", "ensure-defaults"], - env={**os.environ, "IX_HOME": str(home)}, + [ + engine_tool("quoin"), + "module", + "ensure-defaults", + "--config-root", + str(home), + ], + env=os.environ.copy(), capture_output=True, text=True, check=False, ) assert result.returncode == 0, result.stderr + for source in PUBLISHED_PACK_SOURCES: + result = subprocess.run( + [ + engine_tool("quoin"), + "module", + "install", + source, + "--config-root", + str(home), + ], + env=os.environ.copy(), + capture_output=True, + text=True, + check=False, + ) + assert result.returncode == 0, f"{source}: {result.stderr}" installed = sorted((home / "filament" / "modules").glob("*")) - published_packs = [ - pathlib.Path(importlib.import_module(package).__file__).parent - for package in ("spec_clauses_us_health", "spec_clauses_eu_law") - ] return [ PACKAGE_ROOT, *(d for d in installed if (d / "manifest.yaml").is_file()), - *published_packs, ] From a0bdf48d9b8529a749b47ef16784c6c0d86ac61f Mon Sep 17 00:00:00 2001 From: Agent IX Date: Sun, 15 Nov 2026 18:12:47 -0800 Subject: [PATCH 4/4] docs: add PLAT-1650 review artifacts --- reviews/plat-1650-code-review.md | 27 +++++++++++++++++++++++++++ reviews/plat-1650-gap-analysis.md | 27 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 reviews/plat-1650-code-review.md create mode 100644 reviews/plat-1650-gap-analysis.md diff --git a/reviews/plat-1650-code-review.md b/reviews/plat-1650-code-review.md new file mode 100644 index 0000000..f760693 --- /dev/null +++ b/reviews/plat-1650-code-review.md @@ -0,0 +1,27 @@ +--- +id: SR-1613 +title: "Code review of PLAT-1650 PR #66 default US and EU profiles" +type: SpecReview +analysis: code-review +review_set: subset +scope: "agent-ix/spec-objects-security; spec_objects_security/profiles/eu-device-gdpr-ai-act.yaml, spec_objects_security/profiles/us-device-cybersecurity-hipaa.yaml, tests/test_profiles.py (PR #66 at ffbf8fe7c7dade4d9d61f8af92300b554419eeb1), reviewed against FR-020, FR-021, NFR-002 and PLAT-1650 AC1-7" +--- +# SR-1613: Code review of PLAT-1650 PR #66 default US and EU profiles + +## Summary + +Ticket: PLAT-1650. The change adds the two profile YAML files and extends the profile tests. The exact keys and versions match the released US and EU GitHub module tags. Both profiles omit `context`, so the profile does not bind product-specific dimensions. The tests install those modules through Quoin's supported `github:` source at their release tags, resolve each profile key against installed module manifests, and run `quire publish-check` against each declaring module. No upstream corpus or source module declaration is copied into this repository. + +The focused suite passed: `poetry run pytest -o addopts= tests/test_profiles.py tests/test_clause_sets.py -q` → 45 passed. The repository's default pytest addopts could not run in this environment because pytest-cov and pytest-json-report options were unavailable; clearing those addopts allowed the focused test files to run successfully. + +CLI review used Quoin 0.35.0 with a fresh module config, the released US/EU pack tags, and this PR's module tree. `quoin profile evaluate` exited 0 for web-app-baseline (2 evaluated, 0 unavailable), US (3 evaluated, 0 unavailable), and EU (4 evaluated, 0 unavailable). With the EU module omitted, selecting the EU profile still exited 0 and reported all four EU keys unavailable (0 evaluated, 4 unavailable). Missing product dimensions remain unresolved, as expected. Packaging configuration already includes every `profiles/*.yaml` file in wheel and sdist, and npm's package file list and staging script include `profiles/`; the new files therefore follow the existing package paths. + +## Verdict + +**PASS**: no findings. The profile names are among the three allowed names; keys use only authority, id and version; the US and EU profiles carry no product facts; and the selected public sources match FR-021's intended source table. The PR does not change the module manifest, source-module declarations, publish-check implementation, or packaging scripts. + +## Findings + +| ID | Severity | Summary | Refs | +| --- | --- | --- | --- | +| FND-001 | low | No findings (placeholder) | - | diff --git a/reviews/plat-1650-gap-analysis.md b/reviews/plat-1650-gap-analysis.md new file mode 100644 index 0000000..01d3d1d --- /dev/null +++ b/reviews/plat-1650-gap-analysis.md @@ -0,0 +1,27 @@ +--- +id: SR-1614 +title: "Gap analysis of PLAT-1650 PR #66 default US and EU profiles" +type: SpecReview +analysis: gap-analysis +review_set: subset +scope: "agent-ix/spec-objects-security; spec_objects_security/profiles/eu-device-gdpr-ai-act.yaml, spec_objects_security/profiles/us-device-cybersecurity-hipaa.yaml, tests/test_profiles.py and spec/tests.md (PR #66 at ffbf8fe7c7dade4d9d61f8af92300b554419eeb1), against FR-020, FR-021, NFR-002 and PLAT-1650 AC1-7" +--- +# SR-1614: Gap analysis of PLAT-1650 PR #66 default US and EU profiles + +## Summary + +Ticket: PLAT-1650. Quoin's computed Test Matrix binds the applicable profile tests to FR-020-AC-1..6, FR-021-AC-1..3 and AC-5, and NFR-002-AC-1..2 and M-1..2. The new profile keys have direct assertions, and the fixture test changes a key version to ensure an undeclared key is refused with that key named. FR-021-AC-4, AC-6 and AC-7 are inspection criteria: both new profiles omit context, name only the public sources in the requirement, and list the keys declared by the newly released US/EU pack modules. + +`quoin matrix --repo . --json` shows all applicable Test criteria tagged. The matrix also reports 43 untagged criteria in FR-022, FR-025, FR-026, FR-027 and NFR-005; the same 43 criteria are untagged on `origin/main` at 82ac619, so this PR introduces no matrix gap. + +The ticket's seven acceptance criteria were reviewed: shipped profiles and allowed names (AC1); declared keys and a negative changed-version case (AC2); publish-check for each key (AC3); absent profile context (AC4); CLI evaluation with all packs and with the EU pack omitted (AC5); wheel and npm inclusion through existing glob/list/staging rules (AC6); and public, non-licensed sources (AC7). The focused test files passed, 45 total. CLI evaluation produced 2/2 web, 3/3 US, and 4/4 EU sets evaluated when modules were installed; with the EU module omitted, the EU profile reports 4 unavailable and exits 0. + +## Verdict + +**PASS**: no findings. All changed Test criteria are tagged and have test binders. The remaining untagged rows reproduce unchanged on clean `origin/main` and do not concern this diff. + +## Findings + +| ID | Severity | Summary | Refs | +| --- | --- | --- | --- | +| FND-001 | low | No findings (placeholder) | - |