arch: establish accounting DDD context map and fitness gate - #41
arch: establish accounting DDD context map and fitness gate#41seonghobae wants to merge 32 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthrough회계 바운디드 컨텍스트, 표준 용어, 단일 primary owner 규칙을 문서화했습니다. ADR 0059에 아키텍처 결정을 기록했습니다. 리스택 증거와 회귀 조건을 추가했습니다. 피트니스 테스트가 문서와 모듈 구조를 검증합니다. Changes회계 DDD 아키텍처
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🟡 Moderate · up to This documentation-and-test change does not alter runtime behavior, but its ownership contract omits an existing reconciliation module. Assign that module exactly one primary owner before merging. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@codex review Review exact head |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@coderabbitai review Review exact head |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
head='afe5742c139231473b48103fafcc5bf5570a1211'
base='a4db2ca98391183037b6b7215caff89decf6f7c5'
echo '== Exact revisions and delta =='
git rev-parse HEAD
git cat-file -t "$head"
git cat-file -t "$base"
git merge-base "$base" "$head"
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
git diff --unified=100 "$base" "$head" -- \
docs/CONTEXT_MAP.md tests/test_ddd_architecture_fitness.py
echo '== Relevant exact-head files =='
for file in docs/CONTEXT_MAP.md tests/test_ddd_architecture_fitness.py; do
echo "----- $file -----"
git show "$head:$file" | nl -ba
done
echo '== Exact production Python inventory =='
git ls-tree -r --name-only "$head" -- src/accounting_information_platform |
grep -E '\.py$' |
sort
echo '== Exact-head absolute imports in production =='
git grep -nE '^[[:space:]]*(from|import)[[:space:]]+[A-Za-z_][A-Za-z0-9_\.]*' \
"$head" -- ':(glob)src/accounting_information_platform/**/*.py' || true
echo '== Ownership and import-rule references =='
git grep -nE 'Physical path|Primary owner|iso20022|__init__|absolute.import|foreign|import.root|most.specific|recursive|deployment_infrastructure' \
"$head" -- docs tests src || true
echo '== Static verification and parser mutation checks =='
tmp_map="$(mktemp)"
tmp_test="$(mktemp)"
git show "$head:docs/CONTEXT_MAP.md" > "$tmp_map"
git show "$head:tests/test_ddd_architecture_fitness.py" > "$tmp_test"
HEAD_SHA="$head" MAP="$tmp_map" TEST="$tmp_test" python3 - <<'PY'
import ast
import os
import re
import subprocess
from pathlib import PurePosixPath
head = os.environ["HEAD_SHA"]
map_text = Path(os.environ["MAP"]).read_text(encoding="utf-8")
test_text = Path(os.environ["TEST"]).read_text(encoding="utf-8")
paths = subprocess.check_output(
["git", "ls-tree", "-r", "--name-only", head, "--", "src/accounting_information_platform"],
text=True,
).splitlines()
production = sorted(p for p in paths if p.endswith(".py"))
print("production files:", len(production))
print("nested files:", [p for p in production if "/" in p.removeprefix("src/accounting_information_platform/")])
# Show all table rows as the actual parser input.
header = "| Physical path | Primary owner | Transitional responsibilities | DDD status | Next correction |"
lines = map_text.splitlines()
start = lines.index(header) + 2
rows = []
for line in lines[start:]:
if not line.startswith("|"):
break
cells = [c.strip() for c in line.strip().strip("|").split("|")]
if len(cells) == 5:
rows.append(cells)
print("ownership rows:")
for cells in rows:
print(" | ".join(cells))
# Parse all production source imports without executing repository source.
allowed_stdlib = set(getattr(__import__("sys"), "stdlib_module_names", ()))
stdlib_fallback = {
"abc", "ast", "collections", "contextlib", "dataclasses", "datetime", "decimal",
"enum", "functools", "hashlib", "hmac", "http", "json", "os", "pathlib",
"re", "sqlite3", "typing", "uuid",
}
allowed_stdlib |= stdlib_fallback
absolute_roots = {}
for path in production:
source = subprocess.check_output(["git", "show", f"{head}:{path}"], text=True)
tree = ast.parse(source, filename=path)
for node in ast.walk(tree):
name = None
if isinstance(node, ast.Import):
name = node.names[0].name.split(".")[0] if node.names else None
elif isinstance(node, ast.ImportFrom) and node.level == 0 and node.module:
name = node.module.split(".")[0]
if name:
absolute_roots.setdefault(name, set()).add(path)
print("absolute import roots:")
for root, importers in sorted(absolute_roots.items()):
print(root, "=>", ", ".join(sorted(importers)))
print("test contains fail-closed terms:",
all(s in test_text for s in (
"ALLOWED_ABSOLUTE_IMPORT_ROOTS",
"assertIn",
"absolute import root",
)))
PY
rm -f "$tmp_map" "$tmp_test"Length of output: 39853 🏁 Script executed: #!/bin/bash
set -euo pipefail
head='afe5742c139231473b48103fafcc5bf5570a1211'
echo '== Relevant files, numbered =='
for file in docs/CONTEXT_MAP.md tests/test_ddd_architecture_fitness.py; do
echo "----- $file -----"
git show "$head:$file" | awk '{printf "%5d %s\n", NR, $0}'
done
echo '== Production Python inventory, including initializers =='
git ls-tree -r --name-only "$head" -- src/accounting_information_platform |
grep -E '\.py$' |
sort
echo '== Parent delta for the two fitness repairs =='
parent="$(git show -s --format='%P' "$head" | awk '{print $1}')"
echo "parent=$parent"
git diff --unified=60 "$parent" "$head" -- docs/CONTEXT_MAP.md tests/test_ddd_architecture_fitness.py
tmp_map="$(mktemp)"
tmp_test="$(mktemp)"
git show "$head:docs/CONTEXT_MAP.md" > "$tmp_map"
git show "$head:tests/test_ddd_architecture_fitness.py" > "$tmp_test"
HEAD_SHA="$head" MAP="$tmp_map" TEST="$tmp_test" python3 - <<'PY'
import ast
import os
import re
import subprocess
import sys
from collections import defaultdict
from pathlib import Path
head = os.environ["HEAD_SHA"]
text = Path(os.environ["MAP"]).read_text(encoding="utf-8")
test = Path(os.environ["TEST"]).read_text(encoding="utf-8")
def blob(path):
return subprocess.check_output(["git", "show", f"{head}:{path}"], text=True)
all_paths = subprocess.check_output(
["git", "ls-tree", "-r", "--name-only", head, "--", "src/accounting_information_platform"],
text=True,
).splitlines()
all_python = sorted(p for p in all_paths if p.endswith(".py"))
production = [p for p in all_python if not p.endswith("/__init__.py") and not p.endswith("accounting_information_platform/__init__.py")]
header = "| Physical path | Primary owner | Transitional responsibilities | DDD status | Next correction |"
lines = text.splitlines()
start = lines.index(header) + 2
rows = []
for line in lines[start:]:
if not line.startswith("|"):
break
cells = [c.strip() for c in line.strip().strip("|").split("|")]
if len(cells) == 5 and cells[0].startswith("`src/accounting_information_platform/"):
rows.append((cells[0].strip("`"), cells[1], cells[2]))
def matches(path, candidate_rows=rows):
candidates = [r for r in candidate_rows if r[0] == path or (r[0].endswith("/") and path.startswith(r[0]))]
if not candidates:
return []
n = max(len(r[0]) for r in candidates)
return [r for r in candidates if len(r[0]) == n]
print("== Actual ownership resolution ==")
for path in production:
found = matches(path)
tokens = re.findall(r"`([^`]+)`", found[0][1]) if len(found) == 1 else []
print(f"{path}: rows={len(found)} owners={tokens}")
print("initializers deliberately excluded:", [p for p in all_python if p not in production])
print("== Actual absolute imports and admission ==")
stdlib = set(sys.stdlib_module_names) | {"__future__", "accounting_information_platform"}
all_roots = defaultdict(set)
for path in all_python:
tree = ast.parse(blob(path), filename=path)
for node in ast.walk(tree):
if isinstance(node, ast.Import):
for alias in node.names:
all_roots[alias.name.split(".", 1)[0]].add(path)
elif isinstance(node, ast.ImportFrom) and node.level == 0 and node.module:
all_roots[node.module.split(".", 1)[0]].add(path)
for root, users in sorted(all_roots.items()):
status = "ADMITTED" if root in stdlib else "REJECTED"
print(f"{root}: {status}: {', '.join(sorted(users))}")
print("== Ownership mutation results ==")
iso = "src/accounting_information_platform/iso20022/parser.py"
iso_row = next(r for r in rows if r[0].endswith("iso20022/"))
file_row = (iso, "`reconciliation_review`", "None")
for name, candidate in {
"directory-only": rows,
"directory-plus-more-specific-file": rows + [file_row],
"duplicate-directory": rows + [iso_row],
"same-specificity-conflict": rows + [file_row, (iso, "`bank_statement_registry`", "None")],
}.items():
found = matches(iso, candidate)
print(name, "=>", len(found), [(r[0], r[1]) for r in found])
print("== Source assertions present ==")
for token in [
'if path.name != "__init__.py"',
'row[0] == relative_path',
'row[0].endswith("/") and relative_path.startswith(row[0])',
'most_specific_length',
'return roots - set(sys.stdlib_module_names)',
'APPROVED_THIRD_PARTY_IMPORT_ROOTS',
]:
print(token, token in test)
PY
rm -f "$tmp_map" "$tmp_test"Length of output: 60013 🏁 Script executed: #!/bin/bash
set -euo pipefail
head='afe5742c139231473b48103fafcc5bf5570a1211'
echo '== Python-version metadata =='
fd -a -t f '^(pyproject\.toml|setup\.cfg|setup\.py|tox\.ini|\.python-version|Pipfile|poetry\.lock|uv\.lock)$' . -x sh -c '
echo "----- $1 -----"
awk "{printf \"%5d %s\\n\", NR, \$0}" "$1"
' sh {} \; || true
echo '== Exact source imports, with context =='
git grep -nE '^[[:space:]]*(from|import)[[:space:]]+[A-Za-z_][A-Za-z0-9_\.]*' \
"$head" -- ':(glob)src/accounting_information_platform/**/*.py' || true
tmp_map="$(mktemp)"
git show "$head:docs/CONTEXT_MAP.md" > "$tmp_map"
HEAD_SHA="$head" MAP="$tmp_map" python3 - <<'PY'
import ast
import os
import re
import subprocess
from collections import defaultdict
from pathlib import Path
head = os.environ["HEAD_SHA"]
text = Path(os.environ["MAP"]).read_text(encoding="utf-8")
# This explicit fallback is only for independent inspection in this sandbox.
# The repository test's direct sys.stdlib_module_names compatibility is checked separately.
stdlib = {
"__future__", "abc", "ast", "base64", "collections", "contextlib", "csv",
"dataclasses", "datetime", "decimal", "enum", "functools", "hashlib",
"hmac", "http", "io", "itertools", "json", "math", "os", "pathlib",
"re", "secrets", "sqlite3", "sys", "typing", "unittest", "urllib", "uuid",
"xml", "zoneinfo", "accounting_information_platform",
}
def blob(path):
return subprocess.check_output(["git", "show", f"{head}:{path}"], text=True)
all_paths = subprocess.check_output(
["git", "ls-tree", "-r", "--name-only", head, "--", "src/accounting_information_platform"],
text=True,
).splitlines()
python_paths = sorted(p for p in all_paths if p.endswith(".py"))
roots = defaultdict(set)
for path in python_paths:
for node in ast.walk(ast.parse(blob(path), filename=path)):
if isinstance(node, ast.Import):
for alias in node.names:
roots[alias.name.split(".", 1)[0]].add(path)
elif isinstance(node, ast.ImportFrom) and node.level == 0 and node.module:
roots[node.module.split(".", 1)[0]].add(path)
print("== Import admission with a version-compatible stdlib fallback ==")
for root, paths in sorted(roots.items()):
print(f"{root}: {'ADMITTED' if root in stdlib else 'REJECTED'}: {', '.join(sorted(paths))}")
header = "| Physical path | Primary owner | Transitional responsibilities | DDD status | Next correction |"
lines = text.splitlines()
rows = []
for line in lines[lines.index(header) + 2:]:
if not line.startswith("|"):
break
cells = [c.strip() for c in line.strip().strip("|").split("|")]
if len(cells) == 5 and cells[0].startswith("`src/accounting_information_platform/"):
rows.append((cells[0].strip("`"), cells[1], cells[2]))
def resolve(path, source):
candidates = [r for r in source if r[0] == path or (r[0].endswith("/") and path.startswith(r[0]))]
return [r for r in candidates if len(r[0]) == max(map(lambda x: len(x[0]), candidates))] if candidates else []
iso = "src/accounting_information_platform/iso20022/future_adapter.py"
directory = next(r for r in rows if r[0].endswith("iso20022/"))
exact = (iso, "`reconciliation_review`", "None")
print("== Most-specific ownership checks ==")
for label, source in (
("directory owner", rows),
("exact owner overrides directory", rows + [exact]),
("duplicate exact owner fails cardinality", rows + [exact, exact]),
):
result = resolve(iso, source)
print(label, "rows=", len(result), "owners=", [r[1] for r in result])
PY
rm -f "$tmp_map"Length of output: 17955
Foundation run You are interacting with an AI system. |
|
#41 single-source-writer lease — exact authority remains Retained behavior artifact
Keep ADR 0059/Context Map/UL Proposed. Shared |
seonghobae
left a comment
There was a problem hiding this comment.
Fresh exact-head composition review on 346df07043cb9bd25595b59eacbc7a5b0cba12e7: this is an ordinary two-parent non-force restack of prior #41 afe5742c139231473b48103fafcc5bf5570a1211 onto current #29 12e1a4bb9d8de5e4b6c72e2893107b07c515416b. The old #41 lineage changes exactly five architecture-owner files, while the current-root delta from their common predecessor does not modify those paths; the composed PR still exposes only those five files and introduces no runtime/migration/API/event/accounting-control delta. That resolves the stale-parent finding without manufacturing documentation churn. This COMMENT is not approval or GREEN: current exact-head Accounting Foundation 34199861702 is newly admitted and must independently prove architecture fitness, repository contracts, complete coverage/package/security evidence. Parent #29 also retains its separate central CodeQL/approval gate.
|
@coderabbitai review Please review exact head |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
head='346df07043cb9bd25595b59eacbc7a5b0cba12e7'
base='12e1a4bb9d8de5e4b6c72e2893107b07c515416b'
echo '== Exact revisions and ancestry =='
git rev-parse HEAD
git cat-file -t "$head"
git cat-file -t "$base"
git merge-base "$base" "$head"
git merge-base --is-ancestor "$base" "$head" && echo 'base-is-ancestor=yes'
echo '== Effective delta =='
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
echo '== Requested DDD owner files at exact head =='
for file in \
docs/CONTEXT_MAP.md \
docs/UBIQUITOUS_LANGUAGE.md \
docs/adr/0059-accounting-bounded-context-map.md \
docs/doctoring/2026-09-02-ddd-context-map-restack.md \
tests/test_ddd_architecture_fitness.py
do
echo "----- $file -----"
git show "$head:$file" | nl -ba
done
echo '== Production Python path inventory =='
git ls-tree -r --name-only "$head" -- src/accounting_information_platform |
grep -E '\.py$' |
sort
echo '== Boundary-related source imports =='
git grep -nE '^[[:space:]]*(from|import)[[:space:]]+' "$head" -- \
':(glob)src/accounting_information_platform/**/*.py' || true
echo '== Context Fabric and authority boundary references =='
git grep -nE 'context-graph-contracts|cwl-context-contracts|Shared Kernel|ACL|anti-corruption|EA Core|enterprise-architecture|foreign.*implementation|cross-service SQL|journal|ledger|provenance|primary.owner|Primary owner' \
"$head" -- docs tests src || trueLength of output: 2618 🏁 Script executed: #!/bin/bash
set -euo pipefail
head='346df07043cb9bd25595b59eacbc7a5b0cba12e7'
print_blob() {
file="$1"
echo "----- $file -----"
git show "$head:$file" | awk '{printf "%5d %s\n", NR, $0}'
}
print_blob 'docs/CONTEXT_MAP.md'
print_blob 'docs/UBIQUITOUS_LANGUAGE.md'
print_blob 'docs/adr/0059-accounting-bounded-context-map.md'
print_blob 'docs/doctoring/2026-09-02-ddd-context-map-restack.md'
print_blob 'tests/test_ddd_architecture_fitness.py'
echo '== Production Python paths =='
git ls-tree -r --name-only "$head" -- src/accounting_information_platform |
grep -E '\.py$' |
sort
echo '== Ownership table rows =='
git show "$head:docs/CONTEXT_MAP.md" |
grep -n 'src/accounting_information_platform/' || true
echo '== Current production absolute imports =='
git grep -nE '^[[:space:]]*(from|import)[[:space:]]+[A-Za-z_][A-Za-z0-9_\.]*' \
"$head" -- ':(glob)src/accounting_information_platform/**/*.py' || true
echo '== Current production SQL-like references =='
git grep -nEi '(select|insert|update|delete|join|from)[[:space:]].*[a-z_][a-z0-9_]*\.[a-z_][a-z0-9_]*' \
"$head" -- ':(glob)src/accounting_information_platform/**/*.py' || trueLength of output: 150092
P1 — Add one primary-owner row for
Assign The requested root is an ancestor of this head. The effective delta contains only the five DDD owner files. The documents keep the ACL, contract-only Shared Kernel, EA evidence-only, foreign-import, and cross-service-SQL constraints intact. I did not use predecessor CI as evidence, and this review is not an approval. ✅ Action performedReview finished.
|
|
/opencode Continue the existing #41 architecture single-writer from exact |
|
/opencode Continue the existing #41 single-source-writer; do not create a second writer or restack. Live head is still |
|
/opencode Resume the existing #41 architecture single-source-writer; do not create another source writer. Fresh live head is still |
|
#41 single-writer handoff: I am taking the existing architecture lease at exact |
|
@codex review Review exact |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@coderabbitai review Fresh exact-head review requested for |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
head='9e2d582ccfea4d54d6609186ceab6dfa009b4035'
base='12e1a4bb9d8de5e4b6c72e2893107b07c515416b'
echo '== Exact revision and effective delta =='
git rev-parse HEAD
git cat-file -t "$head"
git cat-file -t "$base"
git merge-base "$base" "$head"
git merge-base --is-ancestor "$base" "$head" && echo 'base-is-ancestor=yes'
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
echo '== Relevant-file AST outlines =='
ast-grep outline tests/test_ddd_architecture_fitness.py --items all
ast-grep outline src/accounting_information_platform/reconciliation_lifecycle.py --items all
ast-grep outline src/accounting_information_platform/reconciliation_run.py --items all
echo '== `#41-owned` file contents at exact head =='
for file in \
docs/CONTEXT_MAP.md \
docs/UBIQUITOUS_LANGUAGE.md \
docs/adr/0059-accounting-bounded-context-map.md \
docs/doctoring/2026-09-02-ddd-context-map-restack.md \
tests/test_ddd_architecture_fitness.py
do
echo "----- $file -----"
git show "$head:$file" | nl -ba
done
echo '== Exact-head production inventory and imports =='
git ls-tree -r --name-only "$head" -- src/accounting_information_platform | grep -E '\.py$' | sort
git grep -nE '^[[:space:]]*(from|import)[[:space:]]+[A-Za-z_][A-Za-z0-9_\.]*' \
"$head" -- ':(glob)src/accounting_information_platform/**/*.py' || true
echo '== Relevant runtime source only =='
for file in \
src/accounting_information_platform/reconciliation_lifecycle.py \
src/accounting_information_platform/reconciliation_run.py
do
echo "----- $file -----"
git show "$head:$file" | nl -ba
done
echo '== Changed paths outside the allowed five =='
git diff --name-only "$base" "$head" | grep -v -x -E \
'docs/CONTEXT_MAP\.md|docs/UBIQUITOUS_LANGUAGE\.md|docs/adr/0059-accounting-bounded-context-map\.md|docs/doctoring/2026-09-02-ddd-context-map-restack\.md|tests/test_ddd_architecture_fitness\.py' || true
tmp_map="$(mktemp)"
git show "$head:docs/CONTEXT_MAP.md" > "$tmp_map"
HEAD_SHA="$head" MAP="$tmp_map" python3 - <<'PY'
import ast
import os
import re
import subprocess
import sys
from pathlib import Path
head = os.environ["HEAD_SHA"]
text = Path(os.environ["MAP"]).read_text(encoding="utf-8")
header = "| Physical path | Primary owner | Transitional responsibilities | DDD status | Next correction |"
lines = text.splitlines()
start = lines.index(header) + 2
rows = []
for line in lines[start:]:
if not line.startswith("|"):
break
cells = [x.strip() for x in line.strip().strip("|").split("|")]
if len(cells) == 5 and cells[0].startswith("`src/accounting_information_platform/"):
rows.append((cells[0].strip("`"), cells[1], cells[2]))
all_paths = subprocess.check_output(
["git", "ls-tree", "-r", "--name-only", head, "--", "src/accounting_information_platform"],
text=True,
).splitlines()
production = sorted(
p for p in all_paths
if p.endswith(".py") and not p.endswith("/__init__.py")
)
def resolve(path, source=rows):
candidates = [r for r in source if r[0] == path or (r[0].endswith("/") and path.startswith(r[0]))]
if not candidates:
return []
longest = max(len(r[0]) for r in candidates)
return [r for r in candidates if len(r[0]) == longest]
print("== Ownership resolution ==")
for path in production:
found = resolve(path)
owners = re.findall(r"`([^`]+)`", found[0][1]) if len(found) == 1 else []
print(f"{path}: rows={len(found)} owners={owners}")
print("== Ownership mutations for reconciliation_lifecycle.py ==")
target = "src/accounting_information_platform/reconciliation_lifecycle.py"
target_row = next(row for row in rows if row[0] == target)
for label, candidate in {
"baseline": rows,
"missing": [row for row in rows if row != target_row],
"duplicate": rows + [target_row],
"multi-owner": [(p, "`reconciliation_run_control` `reconciliation_review`" if p == target else o, t) for p,o,t in rows],
"undeclared": [(p, "`unknown_context`" if p == target else o, t) for p,o,t in rows],
}.items():
found = resolve(target, candidate)
owners = re.findall(r"`([^`]+)`", found[0][1]) if len(found) == 1 else []
print(f"{label}: rows={len(found)} owners={owners}")
print("== Absolute import roots ==")
roots = set()
for path in sorted(p for p in all_paths if p.endswith(".py")):
source = subprocess.check_output(["git", "show", f"{head}:{path}"], text=True)
for node in ast.walk(ast.parse(source, filename=path)):
if isinstance(node, ast.Import):
roots.update(a.name.split(".", 1)[0] for a in node.names)
elif isinstance(node, ast.ImportFrom) and node.level == 0 and node.module:
roots.add(node.module.split(".", 1)[0])
print(sorted(roots))
print("stdlib contains psycopg:", "psycopg" in sys.stdlib_module_names)
PY
rm -f "$tmp_map"Length of output: 9643 🏁 Script executed: #!/bin/bash
set -euo pipefail
head='9e2d582ccfea4d54d6609186ceab6dfa009b4035'
show_blob() {
file="$1"
echo "----- $file -----"
git show "$head:$file" | awk '{printf "%5d %s\n", NR, $0}'
}
echo '== Exact-head `#41-owned` files =='
for file in \
docs/CONTEXT_MAP.md \
docs/UBIQUITOUS_LANGUAGE.md \
docs/adr/0059-accounting-bounded-context-map.md \
docs/doctoring/2026-09-02-ddd-context-map-restack.md \
tests/test_ddd_architecture_fitness.py
do
show_blob "$file"
done
echo '== Relevant runtime sources =='
show_blob 'src/accounting_information_platform/reconciliation_lifecycle.py'
show_blob 'src/accounting_information_platform/reconciliation_run.py'
echo '== Production inventory and absolute imports =='
git ls-tree -r --name-only "$head" -- src/accounting_information_platform | grep -E '\.py$' | sort
git grep -nE '^[[:space:]]*(from|import)[[:space:]]+[A-Za-z_][A-Za-z0-9_\.]*' \
"$head" -- ':(glob)src/accounting_information_platform/**/*.py' || true
tmp_map="$(mktemp)"
git show "$head:docs/CONTEXT_MAP.md" > "$tmp_map"
HEAD_SHA="$head" MAP="$tmp_map" python3 - <<'PY'
import ast
import os
import re
import subprocess
from pathlib import Path
head = os.environ["HEAD_SHA"]
text = Path(os.environ["MAP"]).read_text(encoding="utf-8")
header = "| Physical path | Primary owner | Transitional responsibilities | DDD status | Next correction |"
lines = text.splitlines()
start = lines.index(header) + 2
rows = []
for line in lines[start:]:
if not line.startswith("|"):
break
cells = [x.strip() for x in line.strip().strip("|").split("|")]
if len(cells) == 5 and cells[0].startswith("`src/accounting_information_platform/"):
rows.append((cells[0].strip("`"), cells[1], cells[2]))
all_paths = subprocess.check_output(
["git", "ls-tree", "-r", "--name-only", head, "--", "src/accounting_information_platform"],
text=True,
).splitlines()
production = sorted(p for p in all_paths if p.endswith(".py") and not p.endswith("/__init__.py"))
def resolve(path, source):
candidates = [r for r in source if r[0] == path or (r[0].endswith("/") and path.startswith(r[0]))]
if not candidates:
return []
longest = max(len(r[0]) for r in candidates)
return [r for r in candidates if len(r[0]) == longest]
print("== Baseline ownership resolution ==")
for path in production:
matches = resolve(path, rows)
owners = re.findall(r"`([^`]+)`", matches[0][1]) if len(matches) == 1 else []
print(f"{path}: matches={len(matches)} owners={owners}")
target = "src/accounting_information_platform/reconciliation_lifecycle.py"
target_row = next(row for row in rows if row[0] == target)
variants = {
"missing": [row for row in rows if row != target_row],
"duplicate": rows + [target_row],
"multi-owner": [(p, "`reconciliation_run_control` `reconciliation_review`" if p == target else owner, trans) for p, owner, trans in rows],
"undeclared-owner": [(p, "`unknown_context`" if p == target else owner, trans) for p, owner, trans in rows],
}
print("== Reconciliation lifecycle mutation results ==")
for name, source in variants.items():
matches = resolve(target, source)
owners = re.findall(r"`([^`]+)`", matches[0][1]) if len(matches) == 1 else []
print(f"{name}: matches={len(matches)} owners={owners}")
print("== AST-derived absolute import roots ==")
roots = {}
for path in sorted(p for p in all_paths if p.endswith(".py")):
source = subprocess.check_output(["git", "show", f"{head}:{path}"], text=True)
for node in ast.walk(ast.parse(source, filename=path)):
if isinstance(node, ast.Import):
for alias in node.names:
roots.setdefault(alias.name.split(".", 1)[0], set()).add(path)
elif isinstance(node, ast.ImportFrom) and node.level == 0 and node.module:
roots.setdefault(node.module.split(".", 1)[0], set()).add(path)
for root, paths in sorted(roots.items()):
print(root, "=>", ", ".join(sorted(paths)))
PY
rm -f "$tmp_map"
echo '== Boundary and status assertions in exact-head documents/tests =='
git grep -nE 'Status: Proposed|proposed architecture|reconciliation_lifecycle|psycopg|PostgreSQL|Shared Kernel|context-graph-contracts|cwl-context-contracts|foreign.*(implementation|application)|cross-service SQL|EA Core|authority|provenance|time' \
"$head" -- docs/CONTEXT_MAP.md docs/UBIQUITOUS_LANGUAGE.md docs/adr/0059-accounting-bounded-context-map.md docs/doctoring/2026-09-02-ddd-context-map-restack.md tests/test_ddd_architecture_fitness.py || trueLength of output: 151024
P2 — Remove or replace the stale The new lifecycle row is correct. It assigns Remove the obsolete row, or restore it only if the module exists on the intended current root. Add a negative fitness check that rejects a file ownership row when the referenced production file is absent. Preserve valid directory-owner rows such as I verified the remaining requested scope:
Foundation You are interacting with an AI system. |
|
@codex review Please review exact head |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review 현재 exact head |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Scope
This architecture slice makes Accounting Information Platform bounded-context ownership machine-checkable without moving runtime accounting behavior. It owns ADR 0059, the Context Map, Ubiquitous Language, the narrow DDD doctoring record, and
tests/test_ddd_architecture_fitness.py. Accounting remains authoritative for journal/posting/period/reconciliation truth; foreign applications cross released contracts and ACLs only.Exact current stack state — 2026-09-09
3bdbeec6cc35e5b111739499c562f988f5fcaa18;fix/reconciliation-multi-match-conservation(fix: allow conserved multi-match reconciliation approvals #29), exact#29@12e1a4bb9d8de5e4b6c72e2893107b07c515416b;CHANGELOG.md,STANDARD_TRACEABILITY, ordocs/product-technical-gap-baseline.mdbytes are copied or rewritten.Review RED → minimal causal repair
Manual exact-head CodeRabbit review of predecessor
9e2d582ccfea4d54d6609186ceab6dfa009b4035found one current P2: the table labeled Current physical ownership still declaredsrc/accounting_information_platform/reconciliation_completion.py, although that production file no longer exists on the current #29-rooted tree. The existing fitness gate checked production-module -> owner completeness, but not the inverse owner-row -> real-path condition. The document could therefore preserve deleted/superseded modules as current architecture indefinitely.The finding remained source-valid and was repaired test-first:
b2fd20fb7ea102902f28e163e53cf6923f9be0aa— RED fitness contracttest_every_physical_ownership_row_references_an_existing_path; the predecessor table fails on the obsolete completion-module row while real directory-owner rows such assrc/accounting_information_platform/iso20022/remain valid.5e8f8a0607aabe98cbc7351cd79f9149a60356bd— minimal Context Map repair removes only the stalereconciliation_completion.pyrow. It does not invent a replacement module or move authority; the livereconciliation_lifecycle.pyrow remains assigned exactly once toreconciliation_run_control.3bdbeec6cc35e5b111739499c562f988f5fcaa18— arch: establish accounting DDD context map and fitness gate #41-owned doctoring distinguishes the historical restack wherereconciliation_completion.pyexisted from current architecture truth and extends the regression contract so every ownership file/directory row must reference an existing path.No runtime/migration authority, accounting invariant, Shared Kernel scope or external dependency implementation changed.
Exact-head GREEN evidence
Accounting Foundation
34239818457is terminal GREEN on unchanged exact3bdbeec6cc35e5b111739499c562f988f5fcaa18.102106807702: behavior/repository tests GREEN; complete production branch coverage GREEN; strict denominator enforcement GREEN; repository contracts, compile/import, reproducible wheel/evidence and package stages GREEN.102106807452: GREEN.102106807652: GREEN.102106807711: GREEN.102110720459: skipped because this stacked architecture head is not yet protected integration evidence; the skip is not promoted to GREEN.Retained exact-head artifacts:
10061809339,sha256:90f4b2cbf402f413135cd6c6b568931b66a15f6aee74ad46762752156a5573cc;10061915751,sha256:0775fd1c2637406d6fdb37f7410f6098eca1e3a67dfd49e352c465725bb46995;10061921252,sha256:377fe47e0bc90905b33a19c7389e9dba3c4e44d034c76eb3cee322a31e43d0a6;10061846663,sha256:4433ebe9488dfab651e79f493f5f6ff7c58ff8f45a74ffd19a2d0c70fd575d2d.Predecessor GREEN is not used as current evidence; these artifacts and jobs are bound to
3bdbeec....Governance handoff and authority boundary
The ADR 0059 shared-record review finding is now resolved on #41 as an explicit canonical-owner transfer, not as a claim that the shared records are already updated.
CHANGELOG.mdanddocs/doctoring/STANDARD_TRACEABILITY.mdare PR #37's single-writer surfaces. Current#37@bdf076466b1cde0e7ae6247f44309fac153ae4c4records the exact acceptance that, after #41 reaches protected integration, #37 must non-destructively rebuild on that protected tree and record ADR 0059 / Context Map / UL provenance, including the no-stale-owner-row and one-most-specific-primary-owner constraints, before #37 itself can merge. This removes the circular #41-thread dependency without introducing a second documentation writer or prematurely marking ADR 0059 Accepted.ADR 0059, the Context Map and Ubiquitous Language remain
Proposeduntil protected integration. Every production module must have one explicit most-specific bounded-context owner.proposal_intakeremains the operational/commercial ACL;journal_postingandjournal_reversalalone create authoritative journal facts;close_controlowns period state;bank_statement_registryterminates provider/bank models;reconciliation_run_controlowns reconciliation scope/lifecycle evidence;reconciliation_reviewowns matching/review evidence.psycopgis only a PostgreSQL infrastructure adapter exception and cannot own accounting decisions.Review / merge boundary
Ready admits fresh exact-head review; it is not approval, merge, protected-integration evidence, or release evidence. All current #41 review threads are resolved, including the shared-record finding by documented transfer to canonical owner #37. No qualifying independent current-head
APPROVEDreview is established, so #41 is not normally mergeable by policy even though its repository-owned evidence is GREEN.Do not self-approve, bypass, force-push, destructively rebase, synthesize status, duplicate #37-owned shared docs, merge from predecessor evidence, tag, version or release.