feat(workforce-validation): adopt registry into owner persistence - #248
seonghobae wants to merge 18 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks 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 Please review exact head |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
parent='656a0c41c06bc517b2cf7c554e35a6fb4f8c4f4b'
head='3b5ebe8341711e72cf3bacc592af8eddae06c9f5'
echo '== Commit availability =='
git show -s --format='%H%n%P%n%s' "$parent"
git show -s --format='%H%n%P%n%s' "$head"
echo '== Changed files =='
git diff --name-status "$parent" "$head"
echo '== Diff summary =='
git diff --stat "$parent" "$head"
echo '== Diff =='
git diff --find-renames --find-copies --unified=80 "$parent" "$head"
echo '== Candidate source and test file outlines =='
fd -t f -E .git | rg -i '(postgres|validity|registry|migration|workforce|read.*port|contract|test)'Length of output: 46415 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== Registry model outline =='
ast-grep outline services/workforce-validation-api/src/orgmetra_workforce_validation_api/registry.py --items all
echo '== Registry model UUID and record implementation =='
rg -n -A35 -B8 \
'def _store_operational_uuid|def _restore_operational_uuid|class ValidityStudyRecord|def __post_init__' \
services/workforce-validation-api/src/orgmetra_workforce_validation_api/registry.py
echo '== Foundation validity-study DDL, RLS, triggers, grants, and tenant helper =='
rg -n -i -A45 -B12 \
'create table.*validity_study|alter table.*validity_study|create policy|validity_study_bitemporal_guard|current_tenant_record_id|grant .*validity_study|revoke .*validity_study|default privileges' \
database/migrations/0001_foundation_schema.sql
echo '== Owner schema migration and package coverage configuration =='
cat -n services/workforce-validation-api/database/migrations/0001_owner_schema.sql
cat -n services/workforce-validation-api/pyproject.toml
echo '== Existing PostgreSQL adapter transaction patterns =='
ast-grep outline services/job-analysis-api/src/orgmetra_job_analysis_api/postgres.py --items all
rg -n -A25 -B10 \
'SET TRANSACTION READ ONLY|set_config|fetchmany|fetchone|connection_factory' \
services/job-analysis-api/src/orgmetra_job_analysis_api/postgres.py \
services/people-api/src/orgmetra_people_api/postgres.py \
services/people-api/src/orgmetra_people_api/postgres_hire.py
echo '== Coverage workflow and service test selection =='
rg -n -A20 -B10 \
'workforce-validation-api|coverage|branch|test_workforce_validation_owner_schema_postgres' \
.github scripts package.json pyproject.toml 2>/dev/null || trueLength of output: 98825 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== Complete ValidityStudyRecord construction and properties =='
sed -n '190,270p' services/workforce-validation-api/src/orgmetra_workforce_validation_api/registry.py
echo '== All direct SQL references to validity_study, excluding generated artifacts =='
rg -n -i -C3 \
'\b(public\.)?validity_study\b|validity_study_scope_policy|current_tenant_record_id\s*\(' \
-g '!**/.git/**' -g '!**/node_modules/**' .
echo '== Privilege and membership statements for workforce roles =='
rg -n -i -C4 \
'\b(create|alter|grant|revoke|drop)\s+(role|schema|table|function)|workforce_validation_(runtime_)?role' \
database services tests .github
echo '== Exact adapter line map and test assertions =='
nl -ba services/workforce-validation-api/src/orgmetra_workforce_validation_api/postgres_registry.py
nl -ba services/workforce-validation-api/tests/test_postgres_registry.py
echo '== Migration ordering and schema-qualified migration references =='
rg -n -C3 \
'0001_owner_schema|0002_registry_adoption|database/migrations' \
README.md ARCHITECTURE.md TRD.md .github services tests scripts 2>/dev/null || true
echo '== Git diff check for unreviewed changes =='
git diff --check 656a0c41c06bc517b2cf7c554e35a6fb4f8c4f4b 3b5ebe8341711e72cf3bacc592af8eddae06c9f5Length of output: 207696
Static review finding[P1] Update the existing validity-study case trigger function during adoption
Update or replace that function in the adoption migration so that it reads The static review found no additional defects in the requested areas. The migration uses relation identity preservation. The adapter uses a read-only transaction, transaction-local tenant context, schema-qualified parameterized SQL, pre-connection UUID snapshots, bounded fetch, canonical row reconstruction, and target validation. The unit-test structure also makes 100% branch coverage plausible. This review does not infer hosted GREEN, protected-branch approval, or merge eligibility. You are interacting with an AI system. |
|
@coderabbitai review Please review exact child head |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base='656a0c41c06bc517b2cf7c554e35a6fb4f8c4f4b'
head='5d390bc4e86c6db7bcf95a51662cc71500811ad3'
echo '== Exact commits =='
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$base"
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$head"
echo '== Changed files =='
git diff --name-status "$base" "$head"
echo '== Diff check =='
git diff --check "$base" "$head"
echo '== Full review diff =='
git diff --find-renames --find-copies --unified=100 "$base" "$head"
echo '== Candidate files =='
fd -t f -E .git | rg '(postgres_registry|test_postgres_registry|registry\.py|registry_adoption|validity_study_case_integrity|foundation_schema|pyproject\.toml)$'
echo '== Adapter and test outlines =='
ast-grep outline services/workforce-validation-api/src/orgmetra_workforce_validation_api/postgres_registry.py --items all
ast-grep outline services/workforce-validation-api/tests/test_postgres_registry.py --items all
echo '== Complete adapter and contract test sources =='
nl -ba services/workforce-validation-api/src/orgmetra_workforce_validation_api/postgres_registry.py
nl -ba services/workforce-validation-api/tests/test_postgres_registry.py
echo '== Model construction and UUID snapshot/reconstruction contract =='
rg -n -A55 -B12 \
'class ValidityStudyRecord|def __post_init__|def _store_operational_uuid|def _restore_operational_uuid' \
services/workforce-validation-api/src/orgmetra_workforce_validation_api/registry.py
echo '== Adoption and pre-existing trigger SQL =='
nl -ba services/workforce-validation-api/database/migrations/0002_registry_adoption.sql
sed -n '110,175p' database/migrations/0010_validity_study_case_integrity.sql
echo '== Adapter use sites and package exports =='
rg -n -C4 \
'\bPostgresValidityStudyReadPort\b|\bconnection_factory\b|from .*postgres_registry import' \
services/workforce-validation-apiLength of output: 42608
Static review resultThe
The adapter retains the
Unresolved finding[P1] Update the preserved case-integrity trigger function during adoption
Update or replace the function in the adoption migration so it queries I found no additional static defect in the You are interacting with an AI system. |
|
@coderabbitai review Please review exact head |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base='656a0c41c06bc517b2cf7c554e35a6fb4f8c4f4b'
head='b210b6bd201a9b62949da33bc4a9feb92ec6a095'
echo '== Exact commits =='
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$base"
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$head"
echo '== Requested-head ancestry and changes =='
git merge-base --is-ancestor "$base" "$head" && echo 'recorded base is an ancestor'
git diff --check "$base" "$head"
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
git diff --find-renames --find-copies --unified=100 "$base" "$head" -- \
'services/workforce-validation-api/database/migrations' \
'services/workforce-validation-api/tests' \
'database/migrations/0010_validity_study_case_integrity.sql' \
'database/migrations/0001_foundation_schema.sql'
echo '== Candidate file locations =='
fd -t f -E .git | rg '(^|/)(0002_registry_adoption\.sql|0010_validity_study_case_integrity\.sql|0001_foundation_schema\.sql|test_workforce_validation_owner_schema_postgres\.sh|test_postgres_registry\.py)$'
echo '== Adoption migration at exact head =='
git show "$head:services/workforce-validation-api/database/migrations/0002_registry_adoption.sql" | nl -ba
echo '== Protected function definition and relation governance before adoption =='
git show "$head:database/migrations/0010_validity_study_case_integrity.sql" | nl -ba | sed -n '1,280p'
git show "$head:database/migrations/0001_foundation_schema.sql" | nl -ba | \
rg -n -C 20 'validity_study|bitemporal|current_tenant_record_id|CREATE POLICY|FORCE ROW LEVEL SECURITY|GRANT|REVOKE'
echo '== Owner PostgreSQL contract at exact head =='
git show "$head:services/workforce-validation-api/tests/test_workforce_validation_owner_schema_postgres.sh" | nl -ba
echo '== All relevant exact-head SQL references and compatibility-object checks =='
git grep -n -i -E \
'public\.validity_study|workforce_validation\.validity_study|validate_validity_study_case|validity_study_case_record|CREATE( OR REPLACE)? (TABLE|VIEW).*validity_study|ALTER TABLE.*validity_study.*SET SCHEMA|workforce_validation_runtime_role' \
"$head" -- \
'database' 'services/workforce-validation-api' || true
echo '== Current GitHub PR context (metadata only) =='
gh pr view 248 --repo ContextualWisdomLab/Orgmetra \
--json number,state,isDraft,baseRefName,baseRefOid,headRefName,headRefOid,mergeable,reviewDecision,url
gh pr view 235 --repo ContextualWisdomLab/Orgmetra \
--json number,state,isDraft,baseRefName,baseRefOid,headRefName,headRefOid,mergeable,reviewDecision,urlLength of output: 21458 🏁 Script executed: #!/bin/bash
set -euo pipefail
head='b210b6bd201a9b62949da33bc4a9feb92ec6a095'
echo '== Adoption migration at exact head =='
git show "$head:services/workforce-validation-api/database/migrations/0002_registry_adoption.sql" | cat -n
echo '== Protected case-trigger function before adoption =='
git show "$head:database/migrations/0010_validity_study_case_integrity.sql" | cat -n | sed -n '1,300p'
echo '== Validity-study definition, FK, RLS, trigger, and privilege context =='
git show "$head:database/migrations/0001_foundation_schema.sql" | cat -n | \
grep -E -i -C 20 \
'validity_study|validity_study_bitemporal_guard|current_tenant_record_id|CREATE POLICY|FORCE ROW LEVEL SECURITY|GRANT|REVOKE'
echo '== Owner PostgreSQL contract at exact head =='
git show "$head:tests/test_workforce_validation_owner_schema_postgres.sh" | cat -n
echo '== Exact-head relevant SQL references =='
git grep -n -i -E \
'public\.validity_study|workforce_validation\.validity_study|validate_validity_study_case|validity_study_case_record|CREATE( OR REPLACE)? (TABLE|VIEW).*validity_study|ALTER TABLE.*validity_study.*SET SCHEMA|workforce_validation_runtime_role' \
"$head" -- database services/workforce-validation-api tests || true
echo '== Migration inventory and explicit application order in the contract =='
git ls-tree -r --name-only "$head" -- database/migrations services/workforce-validation-api/database/migrations
git show "$head:tests/test_workforce_validation_owner_schema_postgres.sh" | \
grep -n -E -C 4 '0001|0010|0002|psql|migration|validity_study_case_record'
echo '== Current GitHub PR context (metadata only) =='
gh pr view 248 --repo ContextualWisdomLab/Orgmetra \
--json number,state,isDraft,baseRefName,baseRefOid,headRefName,headRefOid,mergeable,reviewDecision,url
gh pr view 235 --repo ContextualWisdomLab/Orgmetra \
--json number,state,isDraft,baseRefName,baseRefOid,headRefName,headRefOid,mergeable,reviewDecision,urlLength of output: 92254 🏁 Script executed: #!/bin/bash
set -euo pipefail
base='656a0c41c06bc517b2cf7c554e35a6fb4f8c4f4b'
parent_head='0ac2255321eaf1d0068978b931990f4d9c9f1c85'
child_head='b210b6bd201a9b62949da33bc4a9feb92ec6a095'
echo '== Current parent availability and delta from child base =='
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$parent_head"
git merge-base --is-ancestor "$base" "$parent_head" && echo 'recorded child base is an ancestor of current parent head'
git diff --name-status "$base" "$parent_head"
git diff --find-renames --find-copies --unified=40 "$base" "$parent_head" -- \
database/migrations tests services/workforce-validation-api || true
echo '== Current parent and exact child references to the registry relation =='
for revision in "$parent_head" "$child_head"; do
echo "-- ${revision} --"
git grep -n -i -E \
'public\.validity_study|workforce_validation\.validity_study|validate_validity_study_case|validity_study_case_record' \
"$revision" -- database services tests || true
done
echo '== Full post-0010 global migrations at current parent head =='
for migration in \
database/migrations/0011_criterion_observation_scope.sql \
database/migrations/0012_people_mutation_idempotency.sql \
database/migrations/0013_job_analysis_snapshot.sql
do
echo "-- ${migration} --"
git show "${parent_head}:${migration}" | cat -n
done
echo '== Replacement-function equivalence except the intended relation qualification =='
git show "$base:database/migrations/0010_validity_study_case_integrity.sql" \
| sed -n '/CREATE FUNCTION public\.validate_validity_study_case()/,/^\$\$;/p' \
| sed 's/public\.validity_study/workforce_validation.validity_study/g' \
> /tmp/protected_function_normalized.sql
git show "$child_head:services/workforce-validation-api/database/migrations/0002_registry_adoption.sql" \
| sed -n '/CREATE OR REPLACE FUNCTION public\.validate_validity_study_case()/,/^\$\$;/p' \
| sed 's/CREATE OR REPLACE FUNCTION/CREATE FUNCTION/' \
> /tmp/adoption_function_normalized.sql
diff -u /tmp/protected_function_normalized.sql /tmp/adoption_function_normalized.sql || trueLength of output: 69642
Static review resultI found no defect in the requested
ALTER TABLE public.validity_study SET SCHEMA workforce_validation;This preserves the table object. The contract verifies the same relation OID before and after adoption. It also verifies the existing inbound foreign-key dependency count, forced RLS flags, and The migration replaces The existing The adoption migration creates no compatibility view or copied registry. It removes the old The current parent head This is independent static evidence only. I did not execute the PostgreSQL contract or hosted workflows. GitHub currently reports You are interacting with an AI system. |
|
Parent handoff refresh: canonical #235 is now exact After #235 integrates normally, non-force adopt the resulting protected truth, preserve this PR's valid migration/adapter/test delta, then add the durable schema-qualified least-privilege implementation of |
|
#407 adoption receipt update — scientific leaf correlation Scientific owner #57 has ordinary-forward strengthened This does not change #248's adoption order. Do not copy or implement against mutable #57/#235 source now. After #235 integrates normally, #248 must non-force adopt protected truth and implement the durable least-privilege resolver so the persisted/released owner evidence corroborates those exact leaf coordinates. Child head/base stay unchanged; no parent/leaf checks or reviews transfer. |
|
Parent handoff update for #407: #235 now has 21 application-owner families at After non-force adoption, durable persistence must add the new validation-result non-verifiability supersession family. The ordinary negative-outcome row's owner-resolved |
|
Parent #235 advanced ordinary-forward to exact Durable adoption after normal parent integration must preserve v1 and v2 as one versioned owner family. V2 must persist/recover the predecessor failed-evidence reference/digest/release instant from canonical released owner evidence, require the successor target result/family/artifact tuple to equal that predecessor exactly, and require successor verification-attempt release at the ordinary predecessor cutover. The failed-artifact tuple must not become a caller-selected lookup coordinate. Mutable current rows, another artifact in the same family, unrelated attempts, or caller timestamps are not correction authority. Keep this PR Draft and source-stale until the parent is normally integrated; then adopt protected truth non-force and reacquire its own exact-head schema/FK/RLS/ACL/PostgreSQL evidence. |
|
Parent handoff update only; no child source restack before normal #235 integration. Current parent owner head is Do not derive authority from a mutable current row, caller timestamp, same-family/different artifact, or adapter-created tuple that bypassed the owner constructors. After normal parent integration, adopt non-force and reacquire exact-head persistence/tests/checks for all 21 owner families. No source change is requested on this stale child head yet. |
|
Parent handoff refresh only; no child source restack before normal #235 integration. Current parent owner head is After normal parent integration, adopt non-force and reacquire exact-head persistence/tests/checks for all 21 owner families. No source change is requested on this stale child head yet. |
|
Parent handoff refresh: #235 is now exact |
seonghobae
left a comment
There was a problem hiding this comment.
Fleet currentness finding on persistence child exact d54d44d795444df572efbb301a667d74ac574d58.
The child is correctly source-stable until normal parent integration, but its Live stack truth — 2026-09-19 section is now materially stale. Fresh parent authority is #235@9ac1a1873b81d0f61b479ff9283f46781136cb2f, not 5512750396ed109eac87b8a77ac2daaa211e1d99. Parent #235 now records 471 ahead / 0 behind and exact-tree local evidence of 1,306/1,306 tests, 4,487/4,487 owned statements, 1,070/1,070 owned branches, Foundation 55/55; hosted/PostgreSQL/wheel/security/independent-review gates remain pending. #248 still describes the parent as 470 ahead and the #419 coverage state as 96.45% RED, which was true for an earlier generation only.
Do not adopt parent source into this child yet. RED is coordination truth: a section labeled Live stack truth must identify the latest parent exact SHA and distinguish historical predecessor evidence from current parent evidence. GREEN is PR-state/coordination-only currentization: record #235@9ac1a187..., move 551275.../96.45% into historical lineage, and preserve the existing rule that none of the parent's local 100% verdict transfers to #248. The child base may remain intentionally stale 656a0c41... until normal protected/released parent integration, exactly as the current adoption policy requires.
After #235 integrates normally, use ordinary/non-force adoption and then reacquire #248's own PostgreSQL/wheel/coverage/security evidence. No source wake/no-op commit is needed for this currentness repair.
|
Stack authority refresh: #426 now owns the post-persistence governed registration/lifecycle increment. This does not change #248 source scope or unblock early restack. Sequence remains #235 normal protected integration → #248 non-force adopt/integrate durable owner schema → #426 idempotent registration + versioned lifecycle transitions → #425 scientific design lineage. #248 should preserve existing status evidence during adoption and must not invent/migrate lifecycle meanings in the adapter or migration before #426’s explicit legacy census/remediation contract. |
Live stack truth — 2026-09-21
Issue #247 owns the FR-007 durability increment. Protected architecture assigns the validity-study registry to
workforce_validation; parent #235 is the canonical application/service owner, while this Draft child owns forward PostgreSQL adoption and least-privilege durable adapters.develop@eb9757f8649aaad026a9865508d9aad50c1a7a4f202d9d87d6a45529497279b881169aab127727f8, open · Draft · mergeable=true01c3da48...neutralizes the lifecycle-governance docstring overclaim;202d9d87...keeps built-wheel acceptance off the repository checkout after predecessor Foundation exposed untracked build artifacts at the read-only gate35507388584, Security35507388575, SAST35507388588, and CodeQL35507388573remain non-terminal at the latest fresh readAPPROVED; visible inline threads are resolvedd54d44d795444df572efbb301a667d74ac574d58656a0c41c06bc517b2cf7c554e35a6fb4f8c4f4b; intentionally stale until parent integration#248 must not copy or prematurely absorb mutable #235/#57 source. #235 integrates normally first; this child then non-force adopts current protected
develop, preserves the valid persistence delta, and reacquires exact-head PostgreSQL/quality/security/review evidence. If #57 has normally integrated by then, its protected delta is inherited as ordinary base truth rather than source-copied.Parent #235 exposes the #407 application-owner families and later owner/provenance/scientific-consistency repairs. #423 rejects material final-weight adjustment codes without governed released owner evidence. #424 requires every admitted governed adjustment to have an exact component binding with contiguous one-based sequence. Durable adapters must preserve those invariants after normal adoption.
Durable adapters must not locally manufacture resolver-issued views/proof results, import/copy runtime seals, invent a generic adjustment receipt family, infer owner-record identity from an evidence digest, persist sparse component bindings, or source-copy mutable parent implementations. They persist and re-resolve canonical owner records and invoke protected application/corroboration contracts after normal adoption. Missing, ambiguous, conflicting, structurally non-canonical, unauthorized, cross-scope, not-yet-released, superseded, unsealed, forged, unresolvable-adjustment or noncontiguous-binding evidence must fail closed.
Predecessor evidence does not transfer to current parent
202d9d87.... Predecessor03bf5040...reached 1,441 tests, 5,186/5,186 statements, 1,116/1,116 branches and isolated PostgreSQL contracts before failing repository cleanliness because wheel acceptance created untracked build artifacts.202d9d87...repairs that causally, but its own exact-head hosted verdict is still non-terminal and no qualifying independent approval exists.Downstream backend/scientific/API order
This persistence child does not own the business lifecycle state machine, scientific design lineage, buyer HTTP transport, or buyer UI.
develop, preserves owner-schema/read-adapter delta, implements durable persistence for the accepted parent owner families and reacquires exact-head evidence.recorded_from/recorded_toremain bitemporal knowledge-time coordinates and must not be overloaded as lifecycle states.UI owner path and corrected #428 relationship
Fresh live review found that the Validation presentation shell already has an executable single-writer owner: #145 on the independent UI stack #53 → #130 → #145. #145 must be preserved; #248 must not import/copy it or create a second dashboard.
That UI stack is itself stale relative to protected
develop: #53 is currently 113 ahead / 3 behind protected truth and non-mergeable, so it must ordinary-forward reconcile protected Foundation/workflow/provenance changes before #130/#145 can adopt normally. #145's focused Validation test currently depends on a historical feature-local workflow; future adoption must first move that acceptance into the then-current canonical Foundation/product-browser path and then retire the leaf workflow without weakening test coverage.Accordingly #428 is commercial convergence only, not step 6 of this branch chain. Source implementation of #428 starts only after both:
Then #428 extends/integrates the protected #145 shell against released #427 into the complete API-backed Validation buyer workspace. It preserves scientific evidence states/provenance, Keyverse-backed auth, design-token/Figma/Storybook contracts, KO/EN/JA/ZH/VI/ES/DE/FR localization, accessibility and current-head browser E2E. It may not bypass #427 through direct SQL or service-internal imports.
A free-form
study_status_code, current row (recorded_to IS NULL), durable read adapter, HTTP 200 or visual dashboard state is not a substitute for governed lifecycle/scientific authority.Issues #407–#428 remain open until their respective completion boundaries are satisfied. No force-push, destructive rebase, self-approval, gate weakening, mutable-source copy, shadow UI ownership or predecessor-evidence transfer is authorized.