This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


The following commit(s) were added to refs/heads/sbp by this push:
     new a912cec2 Remove the code to write the unused attestable path files
a912cec2 is described below

commit a912cec2e21d9e9262d262c1633a2938d0f9f516
Author: Sean B. Palmer <[email protected]>
AuthorDate: Tue Mar 17 19:48:18 2026 +0000

    Remove the code to write the unused attestable path files
---
 atr/attestable.py        | 61 ------------------------------------------------
 atr/models/attestable.py |  5 ----
 atr/server.py            |  5 ----
 3 files changed, 71 deletions(-)

diff --git a/atr/attestable.py b/atr/attestable.py
index e27198b0..fc908ad2 100644
--- a/atr/attestable.py
+++ b/atr/attestable.py
@@ -47,12 +47,6 @@ def attestable_path(
     return paths.get_attestable_dir() / str(project_key) / str(version_key) / 
f"{revision_number!s}.json"
 
 
-def attestable_paths_path(
-    project_key: safe.ProjectKey, version_key: safe.VersionKey, 
revision_number: safe.RevisionNumber
-) -> pathlib.Path:
-    return paths.get_attestable_dir() / str(project_key) / str(version_key) / 
f"{revision_number!s}.paths.json"
-
-
 def can_write_file_state_rows(
     previous: models.Attestable | None,
     parent_name: str | None,
@@ -183,58 +177,6 @@ async def load_checks(
     return {}
 
 
-async def load_paths(
-    project_key: safe.ProjectKey,
-    version_key: safe.VersionKey,
-    revision_number: safe.RevisionNumber,
-) -> dict[str, str] | None:
-    file_path = attestable_paths_path(project_key, version_key, 
revision_number)
-    if await aiofiles.os.path.isfile(file_path):
-        try:
-            async with aiofiles.open(file_path, encoding="utf-8") as f:
-                data = json.loads(await f.read())
-            return models.AttestablePathsV1.model_validate(data).paths
-        except (json.JSONDecodeError, pydantic.ValidationError) as e:
-            # log.warning(f"Could not parse {file_path}, trying combined file: 
{e}")
-            log.warning(f"Could not parse {file_path}: {e}")
-    # combined = await load(project_key, version_key, revision_number)
-    # if combined is not None:
-    #     return path_hashes(combined)
-    return None
-
-
-def migrate_to_paths_files() -> int:
-    attestable_dir = paths.get_attestable_dir()
-    if not attestable_dir.is_dir():
-        return 0
-    count = 0
-    for project_dir in sorted(attestable_dir.iterdir()):
-        if not project_dir.is_dir():
-            continue
-        for version_dir in sorted(project_dir.iterdir()):
-            if not version_dir.is_dir():
-                continue
-            for json_file in sorted(version_dir.glob("*.json")):
-                if "." in json_file.stem:
-                    continue
-                target = version_dir / f"{json_file.stem}.paths.json"
-                if target.exists():
-                    continue
-                try:
-                    with open(json_file, encoding="utf-8") as f:
-                        data = json.loads(f.read())
-                    validated = _parse_attestable(data)
-                    paths_result = 
models.AttestablePathsV1(paths=path_hashes(validated))
-                    tmp = target.with_suffix(".tmp")
-                    with open(tmp, "w", encoding="utf-8") as f:
-                        f.write(paths_result.model_dump_json(indent=2))
-                    tmp.replace(target)
-                    count += 1
-                except (json.JSONDecodeError, pydantic.ValidationError):
-                    continue
-    return count
-
-
 def path_classification(attestable: models.Attestable, path_key: str) -> str | 
None:
     if isinstance(attestable, models.AttestableV2):
         entry = attestable.paths.get(path_key)
@@ -317,9 +259,6 @@ async def write_files_data(
     )
     file_path = attestable_path(project_key, version_key, revision_number)
     await util.atomic_write_file(file_path, result.model_dump_json(indent=2))
-    paths_result = models.AttestablePathsV1(paths=path_hashes(result))
-    paths_file_path = attestable_paths_path(project_key, version_key, 
revision_number)
-    await util.atomic_write_file(paths_file_path, 
paths_result.model_dump_json(indent=2))
     checks_file_path = attestable_checks_path(project_key, version_key, 
revision_number)
     if not checks_file_path.exists():
         async with aiofiles.open(checks_file_path, "w", encoding="utf-8") as f:
diff --git a/atr/models/attestable.py b/atr/models/attestable.py
index bf1b5866..510a105c 100644
--- a/atr/models/attestable.py
+++ b/atr/models/attestable.py
@@ -38,11 +38,6 @@ class AttestableChecksV2(schema.Strict):
     checks: dict[str, dict[str, str]] = schema.factory(dict)
 
 
-class AttestablePathsV1(schema.Strict):
-    version: Literal[1] = 1
-    paths: dict[str, str] = schema.factory(dict)
-
-
 class AttestableV1(schema.Strict):
     version: Literal[1] = 1
     paths: dict[str, str] = schema.factory(dict)
diff --git a/atr/server.py b/atr/server.py
index 46da78fd..dd33a115 100644
--- a/atr/server.py
+++ b/atr/server.py
@@ -46,7 +46,6 @@ import quart_wtf
 import werkzeug.routing as routing
 
 import atr
-import atr.attestable as attestable
 import atr.blueprints as blueprints
 import atr.cache as cache
 import atr.config as config
@@ -287,10 +286,6 @@ def _app_setup_lifecycle(app: base.QuartApp, app_config: 
type[config.AppConfig])
 
         await asyncio.to_thread(_set_file_permissions_to_read_only)
 
-        migrated = await asyncio.to_thread(attestable.migrate_to_paths_files)
-        if migrated > 0:
-            log.info(f"Migrated {migrated} attestable files to paths format")
-
         await _backfill_archive_cache()
 
         await cache.admins_startup_load()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to