chore: migrate GRACE-Poly anchors to hierarchical dotted naming
Systematic rename of all semantic anchors (#region, [DEF], @RELATION) across 1400+ files — backend Python, frontend Svelte/TS, specs, docs: - Flat anchors become Namespace.Module.Entity - @RELATION references updated to match new anchor paths - Zero business logic changes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# #region TestAPIKeyModel [C:2] [TYPE Module] [SEMANTICS test, api_key, model]
|
||||
# #region Test.ApiKeyModel.TestAPIKeyModel [C:2] [TYPE Module] [SEMANTICS test, api_key, model]
|
||||
# @BRIEF Contract tests for the APIKey SQLAlchemy model — creation, hash storage, and field constraints.
|
||||
# @RELATION BINDS_TO -> [APIKeyModel]
|
||||
# @RELATION BINDS_TO -> [Models.ApiKey.APIKeyModel]
|
||||
# @TEST_CONTRACT: APIKey model stores SHA-256 hash and prefix; raw key never persisted.
|
||||
# @TEST_EDGE: key_hash is unique and indexed
|
||||
# @TEST_EDGE: prefix is exactly 11 chars ("ssk_" + 7)
|
||||
@@ -8,7 +8,7 @@
|
||||
import pytest
|
||||
|
||||
|
||||
# #region clean_db [C:1] [TYPE Fixture]
|
||||
# #region Test.ApiKeyModel.CleanDb [C:1] [TYPE Fixture]
|
||||
# @BRIEF In-memory SQLite fixture for APIKey model tests.
|
||||
@pytest.fixture
|
||||
def clean_db():
|
||||
@@ -28,13 +28,13 @@ def clean_db():
|
||||
session = Session()
|
||||
yield session
|
||||
session.close()
|
||||
# #endregion clean_db
|
||||
# #endregion Test.ApiKeyModel.CleanDb
|
||||
|
||||
|
||||
class TestAPIKeyModel:
|
||||
"""Verify APIKey model fields and constraints."""
|
||||
|
||||
# #region test_create_api_key [C:2] [TYPE Function]
|
||||
# #region Test.ApiKeyModel.TestCreateApiKey [C:2] [TYPE Function]
|
||||
# @BRIEF Create APIKey with required fields and verify defaults.
|
||||
def test_create_api_key(self, clean_db):
|
||||
from src.models.api_key import APIKey
|
||||
@@ -59,9 +59,9 @@ class TestAPIKeyModel:
|
||||
assert api_key.environment_id is None
|
||||
assert api_key.expires_at is None
|
||||
assert api_key.last_used_at is None
|
||||
# #endregion test_create_api_key
|
||||
# #endregion Test.ApiKeyModel.TestCreateApiKey
|
||||
|
||||
# #region test_key_hash_unique [C:2] [TYPE Function]
|
||||
# #region Test.ApiKeyModel.TestKeyHashUnique [C:2] [TYPE Function]
|
||||
# @BRIEF key_hash is unique — duplicate raises IntegrityError.
|
||||
def test_key_hash_unique(self, clean_db):
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
@@ -84,9 +84,9 @@ class TestAPIKeyModel:
|
||||
permissions=["maintenance:end"],
|
||||
))
|
||||
clean_db.commit()
|
||||
# #endregion test_key_hash_unique
|
||||
# #endregion Test.ApiKeyModel.TestKeyHashUnique
|
||||
|
||||
# #region test_prefix_length [C:2] [TYPE Function]
|
||||
# #region Test.ApiKeyModel.TestPrefixLength [C:2] [TYPE Function]
|
||||
# @BRIEF prefix is exactly 11 characters.
|
||||
def test_prefix_length(self, clean_db):
|
||||
from src.models.api_key import APIKey
|
||||
@@ -102,9 +102,9 @@ class TestAPIKeyModel:
|
||||
# The DB allows any prefix length; the app layer enforces 11 chars
|
||||
# via generate_api_key. Model just stores what it's given.
|
||||
assert len(api_key.prefix) <= 11
|
||||
# #endregion test_prefix_length
|
||||
# #endregion Test.ApiKeyModel.TestPrefixLength
|
||||
|
||||
# #region test_active_default_true [C:2] [TYPE Function]
|
||||
# #region Test.ApiKeyModel.TestActiveDefaultTrue [C:2] [TYPE Function]
|
||||
# @BRIEF active column defaults to True.
|
||||
def test_active_default_true(self, clean_db):
|
||||
from src.models.api_key import APIKey
|
||||
@@ -119,5 +119,5 @@ class TestAPIKeyModel:
|
||||
clean_db.commit()
|
||||
|
||||
assert api_key.active is True
|
||||
# #endregion test_active_default_true
|
||||
# #endregion TestAPIKeyModel
|
||||
# #endregion Test.ApiKeyModel.TestActiveDefaultTrue
|
||||
# #endregion Test.ApiKeyModel.TestAPIKeyModel
|
||||
|
||||
Reference in New Issue
Block a user