feat(people): add PostgreSQL Employment-history read adapter - #156
seonghobae wants to merge 60 commits into
Conversation
📝 WalkthroughWalkthrough
ChangesEmployment 이력 읽기
Priority: ⬇️ Low Estimated code review effort: 4 (Complex) | ~45 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant Caller
participant PostgresEmploymentHistoryReadPort
participant PostgreSQL
Caller->>PostgresEmploymentHistoryReadPort: tenant, person, known_at 전달
PostgresEmploymentHistoryReadPort->>PostgreSQL: READ COMMITTED, READ ONLY 트랜잭션 시작
PostgresEmploymentHistoryReadPort->>PostgreSQL: tenant context 및 Employment 쿼리 실행
PostgreSQL-->>PostgresEmploymentHistoryReadPort: Employment history rows 반환
PostgresEmploymentHistoryReadPort-->>Caller: 검증된 EmploymentHistoryRecord tuple 반환
Merge Risk: 🟡 Moderate · up to Some valid connection configurations can bypass the adapter’s promised read-only tenant transaction. Enforce an explicit transaction contract before merging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 38.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 50 functions across 5 files. (8 skipped: 8 unsupported.)
✨ Finishing Touches 💡 1📝 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 |
|
@coderabbitai review 현재 exact head |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- HEAD ---'
git rev-parse HEAD
printf '%s\n' '--- candidate files ---'
fd -t f . | rg -i 'employment.*history|history.*employment|postgres.*people|people.*postgres'
printf '%s\n' '--- PostgresEmploymentHistoryReadPort references ---'
rg -n -C 5 '\bPostgresEmploymentHistoryReadPort\b' .
printf '%s\n' '--- connection_factory references in employment-history candidates ---'
rg -n -C 5 '\bconnection_factory\b' . -g '*employment*' -g '*Employment*' -g '*postgres*' -g '*Postgres*' || trueLength of output: 76093 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- adapter outline ---'
ast-grep outline people/src/people/infrastructure/employment_history/postgres_read_port.py --items all
printf '%s\n' '--- focused test outline ---'
ast-grep outline people/tests/test_postgres_employment_history_read_port.py --items all
printf '%s\n' '--- adapter source ---'
cat -n people/src/people/infrastructure/employment_history/postgres_read_port.py
printf '%s\n' '--- focused test source ---'
cat -n people/tests/test_postgres_employment_history_read_port.py
printf '%s\n' '--- changed files at reviewed head relative to parent ---'
git diff --name-status 8d7871bd41b98c1f09bade8c17260d8e1b297daf..0c397a1f313739a258237109228d27338070a6dfLength of output: 1462 🏁 Script executed: #!/bin/bash
set -euo pipefail
adapter='services/people-api/src/orgmetra_people_api/postgres_employment_history.py'
test_file='services/people-api/tests/test_postgres_employment_history_capability_integrity.py'
printf '%s\n' '--- adapter outline ---'
ast-grep outline "$adapter" --items all
printf '%s\n' '--- focused-test outline ---'
ast-grep outline "$test_file" --items all
printf '%s\n' '--- adapter: PostgresEmploymentHistoryReadPort ---'
sed -n '116,190p' "$adapter" | cat -n
printf '%s\n' '--- focused regression ---'
cat -n "$test_file"
printf '%s\n' '--- all factory/property accesses in adapter ---'
rg -n -C 3 '\b(connection_factory|_factory_payload|__getitem__)\b' "$adapter"
printf '%s\n' '--- focused regression diff ---'
git diff --unified=80 8d7871bd41b98c1f09bade8c17260d8e1b297daf..HEAD -- "$test_file" "$adapter"Length of output: 22189
Focused regression은 필요한 경계를 검증합니다.
이 확인은 소스와 테스트 구조를 기준으로 수행했습니다. 이 환경에서는 저장소 테스트를 실행하지 않았습니다. PR은 Draft 상태이며 exact-head hosted Foundation 증거와 독립 승인이 아직 없으므로 승인 또는 병합 권한을 주장하지 않습니다. You are interacting with an AI system. |
Buyer-visible scope
Adds
PostgresEmploymentHistoryReadPortbehind the governed Person-scoped Employment-history application port. The adapter detaches tenant/Person identity before connection acquisition, structurally binds one PostgreSQL capability, requires a proven non-autocommit connection before cursor acquisition, executes a short read-only tenant-context-bound transaction, reconstructs bitemporal Employment history at the requested knowledge cutoff, and rejects malformed/scope-escaping/visibility-invalid rows. It does not authorize fields itself, mutate HR truth, or make an employment decision.Current stack authority
Current direct base: #155
4b8fa8e1bd29d941f5889f346014133aaa1c02e9Current exact head:
a701cbdd66699bdf504909077413500b4af0ea51Protected truth beneath the stack:
develop@eb9757f8649aaad026a9865508d9aad50c1a7a4fThe current exact head ordinary-forward adopts #341 through #155/#149/#55. Only canonical parent-owned
hire_http.pyand the focused dependency-binding regression were adopted; #156-owned PostgreSQL source/tests/SQL contracts remain unchanged. Earlier #333–#337 transport/read hardening is preserved. ADR 0156 remains Proposed.Historical feature-local HTTP/PostgreSQL workflows remain removed; canonical repository acceptance belongs to Foundation.
tests/test_bitemporal_postgres.shexecutes production Employment-history SQL against seeded PostgreSQL and covers pre/post-correction cutoffs, half-open recorded boundaries, non-UTC session timezone, foreign-tenant exclusion, and read-only write rejection. Tuple-backed immutableconnection_factory, detached exact UUID scalar authority, exactconnection.autocommit is Falsebefore cursor acquisition, short transaction scope, and post-read scope/cutoff verification remain intact.No parent/predecessor check or review transfers. After #55/#65/#149/#155 and prerequisites reach protected
develop, #156 must ordinary-forward onto then-current protected truth, retarget todevelop, and reacquire Foundation—including real PostgreSQL and full People statement/branch coverage—plus Security/SAST/CodeQL/model review and qualifying independent approval.Keep Draft. No force-push, destructive rebase, self/model approval, routine administrator bypass, gate weakening, mutable-owner source copy, no-op retrigger, predecessor-evidence transfer, synthetic status, feature-local workflow resurrection, or simple Close is authorized.