cctally 1.83.0 → 1.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,30 @@ def source_root_key(canonical_root: str) -> str:
25
25
  return digest.hexdigest()[:32]
26
26
 
27
27
 
28
+ def codex_file_key(root_key: str, canonical_physical_path: str) -> str:
29
+ """Return the durable identity of one Codex rollout file (#416 spec §3.2).
30
+
31
+ Keyed on ``(source_root_key, canonical physical path)`` — deliberately NOT
32
+ on the configured walk spelling, because Codex discovery deduplicates on the
33
+ canonical physical path but persists the FIRST configured candidate
34
+ spelling, so reordering ``$CODEX_HOME`` roots or respelling a symlink makes
35
+ the same physical file miss a path-keyed map.
36
+
37
+ Scoping by ``root_key`` is what makes a root requalification safe for free:
38
+ the same physical file reached under a different provider root is a
39
+ different identity, so it carries no prior attribution decision and takes a
40
+ fresh one. Non-reversible and fixed-width like ``source_root_key``, so the
41
+ durable key never embeds an operator path.
42
+ """
43
+ root = _required_string(root_key, "root_key")
44
+ path = _required_string(canonical_physical_path, "canonical_physical_path")
45
+ digest = hashlib.sha256(
46
+ b"cctally-codex-file-v1\0" + root.encode("utf-8")
47
+ + b"\0" + path.encode("utf-8")
48
+ )
49
+ return digest.hexdigest()[:32]
50
+
51
+
28
52
  def canonical_identity(
29
53
  source: str,
30
54
  resource_kind: str,