Skip to content

Commit e610ae1

Browse files
committed
rename regulatory mapper and genericize compliance framework references
- Rename free_ai_mapper.py to regulatory_mapper.py - Rename FreeAIMapper class to RegulatoryMapper - Replace SUTRAS with PRINCIPLES throughout - Replace free_ai_mapping field with regulatory_mapping - Remove region-specific framework references from comments - Re-number recommendations to generic rec_01..rec_10 - 853 tests passing
1 parent 7bf43c2 commit e610ae1

8 files changed

Lines changed: 73 additions & 73 deletions

File tree

airlock/compliance/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from __future__ import annotations
22

3-
"""RBI FREE-AI compliance module for the Airlock Protocol."""
3+
"""Compliance module for the Airlock Protocol."""
44

55
from airlock.compliance.bias_detector import BiasDetector
6-
from airlock.compliance.free_ai_mapper import FreeAIMapper
6+
from airlock.compliance.regulatory_mapper import RegulatoryMapper
77
from airlock.compliance.incident import IncidentStore
88
from airlock.compliance.inventory import AgentInventory
99
from airlock.compliance.report_generator import ComplianceReportGenerator
@@ -22,7 +22,7 @@
2222
"BiasDetector",
2323
"ComplianceReport",
2424
"ComplianceReportGenerator",
25-
"FreeAIMapper",
25+
"RegulatoryMapper",
2626
"IncidentReport",
2727
"IncidentStore",
2828
"RiskClassification",
Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
"""Maps Airlock Protocol features to RBI FREE-AI Framework sutras and recommendations."""
3+
"""Maps Airlock Protocol features to regulatory compliance framework principles."""
44

55
import logging
66
from typing import Any
@@ -10,93 +10,93 @@
1010

1111
logger = logging.getLogger(__name__)
1212

13-
# RBI FREE-AI Framework: 7 Sutras
14-
SUTRAS: dict[str, str] = {
15-
"sutra_1": "Governance & Oversight",
16-
"sutra_2": "Risk Management",
17-
"sutra_3": "Data Governance",
18-
"sutra_4": "Model Development & Validation",
19-
"sutra_5": "Fairness & Bias",
20-
"sutra_6": "Transparency & Explainability",
21-
"sutra_7": "Accountability & Audit",
13+
# Compliance framework: 7 core principles
14+
PRINCIPLES: dict[str, str] = {
15+
"principle_1": "Governance & Oversight",
16+
"principle_2": "Risk Management",
17+
"principle_3": "Data Governance",
18+
"principle_4": "Model Development & Validation",
19+
"principle_5": "Fairness & Bias",
20+
"principle_6": "Transparency & Explainability",
21+
"principle_7": "Accountability & Audit",
2222
}
2323

24-
# Selected RBI FREE-AI recommendations mapped to Airlock features
24+
# Regulatory recommendations mapped to Airlock features
2525
RECOMMENDATION_MAP: dict[str, dict[str, str]] = {
26-
"rec_14": {
26+
"rec_01": {
2727
"title": "AI Model Inventory",
2828
"airlock_feature": "agent_inventory",
29-
"sutra": "sutra_1",
29+
"principle": "principle_1",
3030
},
31-
"rec_15": {
31+
"rec_02": {
3232
"title": "Risk Classification",
3333
"airlock_feature": "risk_classifier",
34-
"sutra": "sutra_2",
34+
"principle": "principle_2",
3535
},
36-
"rec_16": {
36+
"rec_03": {
3737
"title": "Incident Reporting",
3838
"airlock_feature": "incident_store",
39-
"sutra": "sutra_2",
39+
"principle": "principle_2",
4040
},
41-
"rec_17": {
41+
"rec_04": {
4242
"title": "Audit Trail",
4343
"airlock_feature": "audit_trail",
44-
"sutra": "sutra_7",
44+
"principle": "principle_7",
4545
},
46-
"rec_18": {
46+
"rec_05": {
4747
"title": "Bias Detection",
4848
"airlock_feature": "bias_detector",
49-
"sutra": "sutra_5",
49+
"principle": "principle_5",
5050
},
51-
"rec_19": {
51+
"rec_06": {
5252
"title": "Trust Scoring Transparency",
5353
"airlock_feature": "trust_scoring",
54-
"sutra": "sutra_6",
54+
"principle": "principle_6",
5555
},
56-
"rec_20": {
56+
"rec_07": {
5757
"title": "Identity Verification",
5858
"airlock_feature": "did_verification",
59-
"sutra": "sutra_1",
59+
"principle": "principle_1",
6060
},
61-
"rec_21": {
61+
"rec_08": {
6262
"title": "Capability Assessment",
6363
"airlock_feature": "vc_capability",
64-
"sutra": "sutra_4",
64+
"principle": "principle_4",
6565
},
66-
"rec_22": {
66+
"rec_09": {
6767
"title": "Data Privacy Controls",
6868
"airlock_feature": "privacy_mode",
69-
"sutra": "sutra_3",
69+
"principle": "principle_3",
7070
},
71-
"rec_23": {
71+
"rec_10": {
7272
"title": "Compliance Reporting",
7373
"airlock_feature": "compliance_reports",
74-
"sutra": "sutra_7",
74+
"principle": "principle_7",
7575
},
7676
}
7777

7878

79-
class FreeAIMapper:
80-
"""Maps Airlock compliance status to RBI FREE-AI framework."""
79+
class RegulatoryMapper:
80+
"""Maps Airlock compliance status to regulatory framework principles."""
8181

8282
def map_compliance_status(
8383
self,
8484
inventory: AgentInventory,
8585
incident_store: IncidentStore,
8686
) -> dict[str, Any]:
87-
"""Map current compliance state to FREE-AI sutras and recommendations."""
87+
"""Map current compliance state to framework principles and recommendations."""
8888
agents = inventory.list_all()
8989
incidents = incident_store.list_all()
9090

91-
sutra_status: dict[str, dict[str, Any]] = {}
92-
for sutra_id, sutra_name in SUTRAS.items():
91+
principle_status: dict[str, dict[str, Any]] = {}
92+
for principle_id, principle_name in PRINCIPLES.items():
9393
mapped_recs = [
9494
rec_id
9595
for rec_id, rec_data in RECOMMENDATION_MAP.items()
96-
if rec_data["sutra"] == sutra_id
96+
if rec_data["principle"] == principle_id
9797
]
98-
sutra_status[sutra_id] = {
99-
"name": sutra_name,
98+
principle_status[principle_id] = {
99+
"name": principle_name,
100100
"recommendation_count": len(mapped_recs),
101101
"recommendations": mapped_recs,
102102
"status": "active" if agents else "pending",
@@ -111,8 +111,8 @@ def map_compliance_status(
111111
)
112112

113113
return {
114-
"framework": "RBI FREE-AI",
115-
"sutras": sutra_status,
114+
"framework": "airlock-compliance",
115+
"principles": principle_status,
116116
"recommendations": recommendation_status,
117117
"total_agents_tracked": len(agents),
118118
"total_incidents": len(incidents),
@@ -130,7 +130,7 @@ def get_recommendation_status(
130130
return {"error": f"Unknown recommendation: {rec_id}"}
131131

132132
feature = rec_data["airlock_feature"]
133-
implemented = True # All mapped features exist in the codebase
133+
implemented = True
134134
active = False
135135

136136
if feature == "agent_inventory" and inventory is not None:
@@ -147,12 +147,12 @@ def get_recommendation_status(
147147
"audit_trail",
148148
"compliance_reports",
149149
):
150-
active = True # Core features are always active
150+
active = True
151151

152152
return {
153153
"rec_id": rec_id,
154154
"title": rec_data["title"],
155-
"sutra": rec_data["sutra"],
155+
"principle": rec_data["principle"],
156156
"airlock_feature": feature,
157157
"implemented": implemented,
158158
"active": active,

airlock/compliance/report_generator.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from __future__ import annotations
22

3-
"""Compliance report generation for RBI FREE-AI."""
3+
"""Compliance report generation."""
44

55
import logging
66
import uuid
77
from datetime import UTC, datetime
88

9-
from airlock.compliance.free_ai_mapper import FreeAIMapper
9+
from airlock.compliance.regulatory_mapper import RegulatoryMapper
1010
from airlock.compliance.incident import IncidentStore
1111
from airlock.compliance.inventory import AgentInventory
1212
from airlock.compliance.schemas import ComplianceReport
@@ -24,7 +24,7 @@ def __init__(
2424
) -> None:
2525
self._inventory = inventory
2626
self._incident_store = incident_store
27-
self._mapper = FreeAIMapper()
27+
self._mapper = RegulatoryMapper()
2828

2929
def generate(
3030
self,
@@ -52,7 +52,7 @@ def generate(
5252
incidents_by_severity=incidents_by_severity,
5353
)
5454

55-
free_ai_mapping = self._mapper.map_compliance_status(
55+
regulatory_mapping = self._mapper.map_compliance_status(
5656
self._inventory,
5757
self._incident_store,
5858
)
@@ -72,7 +72,7 @@ def generate(
7272
total_incidents=len(period_incidents),
7373
incidents_by_severity=incidents_by_severity,
7474
compliance_score=compliance_score,
75-
free_ai_mapping=free_ai_mapping,
75+
regulatory_mapping=regulatory_mapping,
7676
recommendations=recommendations,
7777
audit_summary=self.generate_audit_summary(),
7878
)
@@ -118,7 +118,7 @@ def generate_for_agent(
118118
total_incidents=len(period_incidents),
119119
incidents_by_severity=incidents_by_severity,
120120
compliance_score=compliance_score,
121-
free_ai_mapping={},
121+
regulatory_mapping={},
122122
recommendations=[],
123123
audit_summary={},
124124
)

airlock/compliance/schemas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
"""Pydantic models for the RBI FREE-AI compliance module."""
3+
"""Pydantic models for the compliance module."""
44

55
import logging
66
from datetime import UTC, datetime
@@ -77,6 +77,6 @@ class ComplianceReport(BaseModel):
7777
total_incidents: int = 0
7878
incidents_by_severity: dict[str, int] = Field(default_factory=dict)
7979
compliance_score: float = 0.0
80-
free_ai_mapping: dict[str, object] = Field(default_factory=dict)
80+
regulatory_mapping: dict[str, object] = Field(default_factory=dict)
8181
recommendations: list[str] = Field(default_factory=list)
8282
audit_summary: dict[str, object] = Field(default_factory=dict)

airlock/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class AirlockConfig(BaseSettings):
218218
oauth_dynamic_registration: bool = True
219219

220220
# -----------------------------------------------------------------------
221-
# Compliance (RBI FREE-AI)
221+
# Compliance
222222
# -----------------------------------------------------------------------
223223
compliance_enabled: bool = True
224224
compliance_risk_auto_classify: bool = True

airlock/gateway/compliance_routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
"""FastAPI routes for the RBI FREE-AI compliance module."""
3+
"""FastAPI routes for the compliance module."""
44

55
import logging
66
from datetime import UTC, datetime

tests/test_compliance_reports.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from __future__ import annotations
22

3-
"""Tests for compliance report generation and FREE-AI mapping."""
3+
"""Tests for compliance report generation and regulatory mapping."""
44

55
from datetime import UTC, datetime
66

77
import pytest
88
from asgi_lifespan import LifespanManager
99
from httpx import ASGITransport, AsyncClient
1010

11-
from airlock.compliance.free_ai_mapper import RECOMMENDATION_MAP, SUTRAS, FreeAIMapper
11+
from airlock.compliance.regulatory_mapper import RECOMMENDATION_MAP, PRINCIPLES, RegulatoryMapper
1212
from airlock.compliance.incident import IncidentStore
1313
from airlock.compliance.inventory import AgentInventory
1414
from airlock.compliance.report_generator import ComplianceReportGenerator
@@ -130,51 +130,51 @@ def test_recommendations_with_critical_agents(self) -> None:
130130

131131

132132
# ---------------------------------------------------------------------------
133-
# FREE-AI Mapper tests
133+
# Regulatory Mapper tests
134134
# ---------------------------------------------------------------------------
135135

136136

137-
class TestFreeAIMapper:
138-
def test_sutras_defined(self) -> None:
139-
assert len(SUTRAS) == 7
140-
assert "sutra_1" in SUTRAS
137+
class TestRegulatoryMapper:
138+
def test_principles_defined(self) -> None:
139+
assert len(PRINCIPLES) == 7
140+
assert "principle_1" in PRINCIPLES
141141

142142
def test_recommendation_map_has_entries(self) -> None:
143143
assert len(RECOMMENDATION_MAP) > 0
144144
for rec_id, rec_data in RECOMMENDATION_MAP.items():
145145
assert "title" in rec_data
146146
assert "airlock_feature" in rec_data
147-
assert "sutra" in rec_data
147+
assert "principle" in rec_data
148148

149149
def test_map_compliance_status(self) -> None:
150150
inv = _populated_inventory()
151151
store = _populated_incident_store()
152-
mapper = FreeAIMapper()
152+
mapper = RegulatoryMapper()
153153

154154
result = mapper.map_compliance_status(inv, store)
155-
assert result["framework"] == "RBI FREE-AI"
156-
assert "sutras" in result
155+
assert result["framework"] == "airlock-compliance"
156+
assert "principles" in result
157157
assert "recommendations" in result
158158
assert result["total_agents_tracked"] == 3
159159

160160
def test_map_compliance_status_empty(self) -> None:
161161
inv = AgentInventory()
162162
store = IncidentStore()
163-
mapper = FreeAIMapper()
163+
mapper = RegulatoryMapper()
164164

165165
result = mapper.map_compliance_status(inv, store)
166166
assert result["total_agents_tracked"] == 0
167167

168168
def test_get_recommendation_status(self) -> None:
169-
mapper = FreeAIMapper()
169+
mapper = RegulatoryMapper()
170170
inv = _populated_inventory()
171171

172-
status = mapper.get_recommendation_status("rec_14", inventory=inv)
172+
status = mapper.get_recommendation_status("rec_01", inventory=inv)
173173
assert status["implemented"] is True
174174
assert status["active"] is True
175175

176176
def test_get_recommendation_status_unknown(self) -> None:
177-
mapper = FreeAIMapper()
177+
mapper = RegulatoryMapper()
178178
status = mapper.get_recommendation_status("rec_999")
179179
assert "error" in status
180180

tests/test_vc_capability.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def test_extract_capabilities_happy_path() -> None:
206206
"id": "did:key:z6MkTest",
207207
"capabilities": [
208208
{"name": "crypto_security", "version": "1.0", "description": "Ed25519 signing"},
209-
{"name": "payments", "version": "2.1", "description": "NPCI UPI processing"},
209+
{"name": "payments", "version": "2.1", "description": "Payment processing"},
210210
],
211211
}
212212
result = extract_capabilities([subject])

0 commit comments

Comments
 (0)