Skip to content

fix(core): protect canonical evidence runtime types - #63

Draft
seonghobae wants to merge 54 commits into
developfrom
fix/job-analysis-temporal-evidence-types
Draft

fix(core): protect canonical evidence runtime types#63
seonghobae wants to merge 54 commits into
developfrom
fix/job-analysis-temporal-evidence-types

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Scope

Canonical shared HRIS-kernel audit/runtime evidence lane for Orgmetra. It owns shared audit/job-analysis value integrity; consumer lanes do not copy mutable #63 source.

Protected workflow adoption

Repository workflow owner #161 integrated normally as protected develop@eb9757f8649aaad026a9865508d9aad50c1a7a4f. #63 adopted that protected truth without force/rebase through ordinary successors. Current exact head is 72070cb4b8d636825ce5b1a326df4c296596ed7e, open · Draft · mechanically mergeable over protected develop.

#211#213 retained structural repair

#211 moved canonical timestamp validation ahead of snapshot equality so caller-defined timezone behavior cannot execute during low-level comparison. #212 repaired the then-current single-use audit issuance identity. #213 subsequently removed process-local mutable issuance authority entirely and made AuditOutboxEvent an exact-type, slotless tuple value object whose construction validates fields and detaches time evidence; export revalidates contained evidence. Low-level tuple construction is treated only as adversarial interpreter-level test input and must fail closed at export, not as a supported issuance path.

#214 timezone-provider boundary

At predecessor e29d180…, _freeze_timestamp(...) still invoked utcoffset() on arbitrary caller-supplied tzinfo after only outer-datetime validation. Ordinary successors 1d24cef77d8b843f694c5982c5e4ceaf786eb8647216153d55e2767716357d3171030d4aa8a64586c9bbbef9740f6349930ff5ab79d39d0902f8a10248af3c30dcf35724c719bac7c5f6202b3c2b4a0c16dce30fea69991277c558688da704554c08b0e8 established the exact standard-library provider contract: exact built-in datetime, then exact datetime.timezone or zoneinfo.ZoneInfo, before offset resolution; custom/executable timezone providers fail before callbacks. The manifest reseal covered only manifest-owned changed artifacts.

Focused predecessor extraction had 39 manifest-owned audit tests passing and a direct ZoneInfo("Asia/Seoul")/callback-tripwire probe. That local evidence remains causal only.

Hosted RED RCA and minimal causal fix

Foundation CI 33904960273 eventually acquired GitHub-hosted runner 1001672934 on the intended ubuntu-24.04 image and checked out exact predecessor 16dce30fea69991277c558688da704554c08b0e8. Foundation validation, runner contract, dependency hygiene, and all 218 HRIS-kernel tests passed, but the non-negotiable 100% coverage gate failed: audit.py reported 116 statements / 3 misses, 60 branches / 3 partial, 97% file coverage; repository HRIS-kernel total was 99.43%. The exact uncovered rejection lines were 71, 192, and 239. PostgreSQL contracts were skipped only because that earlier step failed.

The three uncovered branches are legitimate structural rejection paths rather than dead code: _canonical_timestamp(...) rejects a low-level exact tuple carrying non-canonical time; AuditOutboxEvent.__new__() rejects subclass construction; and to_cloudevent() rejects a low-level tuple subclass before export. Lowering coverage or deleting these protections would weaken the contract.

Ordinary test-only successor 72070cb4b8d636825ce5b1a326df4c296596ed7e adds exactly three regressions in packages/hris-kernel/tests/test_audit_runtime_type_integrity.py for those hosted misses. It makes no production or manifest-owned-file change.

Current exact-head evidence

Exact Foundation CI 33936088421 completed successfully on current head 72070cb4b8d636825ce5b1a326df4c296596ed7e. Repository-quality job 101224196516 checked out the exact candidate on GitHub-hosted ubuntu-24.04; compile, foundation validation, dependency hygiene, owned unit/service-contract coverage, isolated PostgreSQL contracts, and read-only validation all completed successfully. The earlier 99.43% coverage RED is therefore repaired without weakening the 100% gate.

Fresh exact-head security evidence has also completed: Security Scan 33936088403 is success and SAST Semgrep 33936088456 is success. CodeQL PR 33936088409 is completed failure, but current job/log RCA does not show a SARIF/code vulnerability verdict. CodeQL compatibility analysis (actions) job 101250523794 and the Python shard entered the central exact-head handoff with no authenticated codeql-dispatch/<language> status, successfully requested their one-language repository_dispatch, recorded verdict=pending, then intentionally failed the required shard to release its runner. The job log states that the central dispatch workflow will publish the terminal verdict and rerun that exact failed job. Current commit statuses still have no terminal codeql-dispatch/actions or codeql-dispatch/python verdict, so CodeQL remains non-passing; this failure is not converted into GREEN evidence.

The canonical central owner already contains the dispatch/wake mechanics: ContextualWisdomLab/.github #1865 merged the exact failed-job wake design, and #1888 subsequently merged per-language dispatch concurrency so sibling language shards do not cancel each other. Current central codeql-scan-dispatch.yml validates live PR/base/head/run/job/language identity, executes the native CodeQL scan and SARIF Medium+ gate, publishes codeql-dispatch/<language>, then wakes only the matching failed required job. Fresh organization repository-dispatch evidence remains queued, so no no-op push or new competing leaf workaround is justified while the protected central owner is still executing its intended handoff.

All visible review threads are resolved. Submitted reviews remain COMMENTED; there is no ruleset-qualifying current-head APPROVED review. #63 therefore remains Draft and is not merge-authorized despite Foundation/Security/SAST GREEN.

A prior CodeRabbit suggestion to add Job Analysis files to manifest.json was verified against repository manifest equality rules and rejected/resolved rather than weakening the manifest contract.

Owner dependencies

#64 remains the canonical generic People mutation writer. #65 owns purpose-bound authorization/Job Analysis consumer semantics and may consume shared-kernel truth only after #63 reaches protected develop; fresh #64/#65 compare also requires #65 to preserve #64's protected consumer hardening before #65 integration. #163/#165 remain downstream of normally integrated protected owner truth. docs/product-technical-gap-baseline.md remains single-writer-owned by #100.

No self-approval, administrator bypass, gate weakening, force-push, destructive rebase, no-op retrigger, predecessor-check transfer, mutable-owner dependency, or source copy.

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 6368a167-7c3f-41b2-bb67-09a477ed7c65

📥 Commits

Reviewing files that changed from the base of the PR and between eb9757f and 423cf66.

📒 Files selected for processing (8)
  • CHANGELOG.md
  • manifest.json
  • packages/hris-kernel/src/orgmetra_hris_kernel/audit.py
  • packages/hris-kernel/src/orgmetra_hris_kernel/job_analysis.py
  • packages/hris-kernel/tests/test_audit_creation_identity_integrity.py
  • packages/hris-kernel/tests/test_audit_outbox.py
  • packages/hris-kernel/tests/test_audit_runtime_type_integrity.py
  • packages/hris-kernel/tests/test_job_analysis_temporal_type_integrity.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

감사 이벤트와 작업 분석 증거의 런타임 타입 검증을 강화했습니다. 내장 타입 서브클래스를 거부하고, 허용된 타임스탬프를 UTC로 고정합니다. 생성 후 변조와 변환 예외에 대한 회귀 테스트를 추가했습니다.

Changes

런타임 타입 무결성

Layer / File(s) Summary
감사 이벤트 검증 및 canonical export
packages/hris-kernel/src/orgmetra_hris_kernel/audit.py, packages/hris-kernel/tests/test_audit_runtime_type_integrity.py, packages/hris-kernel/tests/test_audit_creation_identity_integrity.py, packages/hris-kernel/tests/test_audit_outbox.py, CHANGELOG.md, manifest.json
AuditOutboxEvent가 정확한 UUID, 문자열 및 datetime 타입만 허용합니다. occurred_at을 UTC datetime으로 분리합니다. to_cloudevent()가 현재 값과 생성 시점 증거를 재검증합니다. 생성 후 변조, 변경 가능한 tzinfo, 예외 및 오프셋 오버플로를 테스트합니다.
작업 분석 증거 검증 및 정규화
packages/hris-kernel/src/orgmetra_hris_kernel/job_analysis.py, packages/hris-kernel/tests/test_job_analysis_temporal_type_integrity.py
작업 분석 모델이 정확한 UUID, 문자열, 숫자, 날짜, datetime 및 중첩 모델 타입만 허용합니다. retrieved_at, recorded_at, reviewed_at을 UTC datetime으로 분리합니다. 서브클래스, 변경 가능한 tzinfo, 변환 예외 및 오프셋 오버플로를 테스트합니다.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 423cf

The runtime-type and timestamp hardening changes have focused regression coverage, and no current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 97.80% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 91 functions across 6 files. (2 skipped: 2 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 감사 및 직무 분석 증거의 canonical runtime type 보호라는 PR의 주요 변경을 명확하고 간결하게 설명합니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/job-analysis-temporal-evidence-types

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae seonghobae changed the title fix(job-analysis): protect canonical temporal evidence types fix(core): protect canonical evidence runtime types Aug 21, 2026
@seonghobae
seonghobae marked this pull request as ready for review August 21, 2026 12:08
devin-ai-integration[bot]

This comment was marked as resolved.

github-code-quality[bot]

This comment was marked as resolved.

@seonghobae
seonghobae marked this pull request as draft August 22, 2026 02:05
devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae
seonghobae marked this pull request as ready for review August 22, 2026 02:08
@seonghobae

Copy link
Copy Markdown
Contributor Author

@opencode-agent Please review the current unchanged head against protected develop. Local exact-head verification: all owned package suites pass at 100% statement/branch coverage.

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review exact head f2229342d7c3fb538020c53e9752b8179e7e7269 against protected develop@ef1b143368cb6249c9520ca8cae10ebe844a5aa1. Focus on canonical HRIS-kernel runtime integrity after the non-force restack: exact datetime rejection/detachment/canonicalization in AuditOutboxEvent, hostile runtime-type regressions, temporal evidence invariants in Job Analysis, and whether the protected-base merge introduced any semantic or compatibility regression. #197 is routed here as the canonical owner; do not transfer predecessor-head review, approval, or GREEN evidence.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review exact current head for #213 only. Focus on whether module import still exposes mutable creation/live issuance backing storage, whether the closure-private claim/record/lookup API can reset or overwrite an already-issued live identity, whether stale-finalizer identity protection remains intact, and whether #211/#212 canonicalization/re-entry semantics were preserved. Do not transfer predecessor-head findings or checks.

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== exact HEAD and status ==='
git rev-parse HEAD
git status --short
git branch --show-current

echo '=== recent commits ==='
git log --oneline -12

echo '=== diff from previous reviewed successor ==='
git diff --stat 31fabb5764f4fc6e09884da83348eb0fb50ea5c5..HEAD
git diff --find-renames --unified=80 31fabb5764f4fc6e09884da83348eb0fb50ea5c5..HEAD -- \
  packages/hris-kernel/src/orgmetra_hris_kernel/audit.py \
  packages/hris-kernel/tests \
  manifest.json \
  CHANGELOG.md

echo '=== audit module structure ==='
ast-grep outline packages/hris-kernel/src/orgmetra_hris_kernel/audit.py --items all

echo '=== focused source ==='
cat -n packages/hris-kernel/src/orgmetra_hris_kernel/audit.py

echo '=== audit-related test definitions and focused content ==='
rg -n --type py -C 3 \
  '(_AUDIT_CREATION_SNAPSHOTS|_AUDIT_LIVE_ISSUANCES|_claim|_record|_lookup|_cleanup|finaliz|__post_init__|to_cloudevent|canonical_timestamp|creation.snapshot|re.?entr)' \
  packages/hris-kernel/tests

echo '=== package exports and direct registry imports ==='
fd -a '__init__.py' packages/hris-kernel/src -x sh -c 'echo === $1; cat -n "$1"' sh {}
rg -n --type py -C 3 \
  '(from\s+orgmetra_hris_kernel\.audit\s+import|import\s+orgmetra_hris_kernel\.audit|_AUDIT_CREATION_SNAPSHOTS|_AUDIT_LIVE_ISSUANCES)' \
  packages/hris-kernel

echo '=== manifest rule and current entries ==='
rg -n -C 4 '(REQUIRED|_validate_manifest|audit\.py|test_audit_outbox\.py)' tests/validate_repository.py manifest.json

Length of output: 201723


@seonghobae I found one blocking issue in exact head 48bfaf7558c8623b70d3c08a736c6d2953f563b5.

Blocking — closure cells still expose mutable issuance storage.
packages/hris-kernel/src/orgmetra_hris_kernel/audit.py Line 253 exports _claim_audit_issuance, _record_audit_creation_snapshot, and _lookup_audit_creation_snapshot as module attributes. Each function exposes its closed-over cells through Python’s __closure__. A module consumer can recover the live_issuances and creation_snapshots dictionaries from these cells and mutate them.

After a consumer removes the live issuance for an existing event, it can mutate event fields with object.__setattr__() and invoke AuditOutboxEvent.__post_init__(). The new call can claim the same identity and record a replacement snapshot. This bypasses the creation-time binding that #212 requires.

The new test checks only that _AUDIT_LIVE_ISSUANCES and _AUDIT_CREATION_SNAPSHOTS are absent. It does not check the exposed closure-backed mutation path.

The normal paths preserve the requested semantics:

  • Line 359 canonicalizes occurred_at before Line 375 retrieves and compares the creation snapshot.
  • Lines 51-53 retain identity-matched stale-finalizer cleanup.

However, these properties do not prevent the closure-state reset and reissue path.

You are interacting with an AI system.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review exact head 72070cb4b8d636825ce5b1a326df4c296596ed7e against protected develop@eb9757f8649aaad026a9865508d9aad50c1a7a4f. Focus on the test-only hosted-coverage repair for the three structural audit rejection branches (previous Foundation miss lines 71, 192, 239), and verify that no production/manifest contract was weakened.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="eb9757f8649aaad026a9865508d9aad50c1a7a4f"
head="72070cb4b8d636825ce5b1a326df4c296596ed7e"

echo "=== exact revision ==="
git rev-parse HEAD
git status --short
git merge-base "$base" "$head"
git diff --stat "$base..$head"
git diff --name-status "$base..$head"

echo "=== final successor delta ==="
git log --oneline --decorate -12
parent="$(git rev-parse "${head}^")"
git diff --stat "$parent..$head"
git diff --name-status "$parent..$head"
git diff --find-renames --unified=60 "$parent..$head"

echo "=== audit module outline ==="
ast-grep outline packages/hris-kernel/src/orgmetra_hris_kernel/audit.py --items all

echo "=== audit branch neighborhoods ==="
nl -ba packages/hris-kernel/src/orgmetra_hris_kernel/audit.py | sed -n '55,82p;175,205p;222,250p'

echo "=== test definitions and changed test content ==="
ast-grep outline packages/hris-kernel/tests --items all --type function --match 'audit|Audit'
git diff --find-renames --unified=80 "$parent..$head" -- packages/hris-kernel/tests
rg -n --type py -C 5 \
  '(Line 71|Line 192|Line 239|structural|reject|_validate_event_snapshot|AuditOutboxEvent|to_cloudevent)' \
  packages/hris-kernel/tests

echo "=== production and manifest contract changes at exact head ==="
git diff --find-renames --unified=40 "$parent..$head" -- \
  packages/hris-kernel/src/orgmetra_hris_kernel/audit.py \
  manifest.json \
  tests/validate_repository.py \
  CHANGELOG.md
rg -n -C 5 '(REQUIRED|_validate_manifest|audit\.py|test_audit_outbox\.py)' \
  tests/validate_repository.py manifest.json

Length of output: 13352


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="eb9757f8649aaad026a9865508d9aad50c1a7a4f"
head="72070cb4b8d636825ce5b1a326df4c296596ed7e"
parent="$(git rev-parse "${head}^")"

echo "=== requested branch neighborhoods, current source ==="
sed -n '45,90p;145,255p' packages/hris-kernel/src/orgmetra_hris_kernel/audit.py

echo "=== full canonical export path, current source ==="
sed -n '250,390p' packages/hris-kernel/src/orgmetra_hris_kernel/audit.py

echo "=== exact final test file ==="
cat packages/hris-kernel/tests/test_audit_runtime_type_integrity.py

echo "=== prior test file at final parent ==="
git show "${parent}:packages/hris-kernel/tests/test_audit_runtime_type_integrity.py"

echo "=== source and manifest-rule changes from protected base ==="
git diff --find-renames --unified=25 "$base..$head" -- \
  packages/hris-kernel/src/orgmetra_hris_kernel/audit.py \
  tests/validate_repository.py \
  manifest.json

echo "=== manifest validation contract and relevant final entries ==="
sed -n '/REQUIRED/,/^[^[:space:]]/p' tests/validate_repository.py
rg -n -C 4 '"(CHANGELOG\.md|packages/hris-kernel/src/orgmetra_hris_kernel/audit\.py|packages/hris-kernel/tests/test_audit_outbox\.py)"' manifest.json

echo "=== static test imports and collection names ==="
rg -n --type py -C 2 \
  '^(class _ForgedAuditOutboxEvent|def test_audit_event_rejects_(subclass_construction|low_level_subclass|low_level_non_utc_datetime)|from orgmetra_hris_kernel\.audit import AuditOutboxEvent)' \
  packages/hris-kernel/tests/test_audit_runtime_type_integrity.py

echo "=== final commit metadata ==="
git show --format=fuller --no-ext-diff --no-renames --stat "$head"

Length of output: 53109


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== exact source line mapping ==="
awk 'NR >= 64 && NR <= 78 { printf "%d:%s\n", NR, $0 }
     NR >= 184 && NR <= 198 { printf "%d:%s\n", NR, $0 }
     NR >= 232 && NR <= 246 { printf "%d:%s\n", NR, $0 }' \
  packages/hris-kernel/src/orgmetra_hris_kernel/audit.py

echo "=== manifest validator entry-set enforcement ==="
rg -n -A45 -B8 \
  'def _manifest_entries|def _validate_manifest|unexpected|extra|set\(REQUIRED\)|manifest.*entries' \
  tests/validate_repository.py

echo "=== manifest metadata versus checked-in required artifacts ==="
for file in \
  CHANGELOG.md \
  packages/hris-kernel/src/orgmetra_hris_kernel/audit.py \
  packages/hris-kernel/tests/test_audit_outbox.py
do
  printf '%s\t' "$file"
  sha256sum "$file" | awk '{printf "sha256=%s ", $1}'
  bytes=$(wc -c < "$file")
  lines=$(awk 'END { print NR }' "$file")
  printf 'bytes=%s lines=%s\n' "$bytes" "$lines"
done

echo "=== final commit does not modify production or manifest paths ==="
git diff-tree --no-commit-id --name-status -r 72070cb4b8d636825ce5b1a326df4c296596ed7e
git diff --quiet 72070cb4b8d636825ce5b1a326df4c296596ed7e^ 72070cb4b8d636825ce5b1a326df4c296596ed7e -- \
  packages/hris-kernel/src/orgmetra_hris_kernel/audit.py manifest.json tests/validate_repository.py
printf 'production_and_manifest_paths_unchanged_in_final_commit=%s\n' "$?"

Length of output: 13724


@seonghobae No findings for exact head 72070cb4b8d636825ce5b1a326df4c296596ed7e.

The final commit changes only packages/hris-kernel/tests/test_audit_runtime_type_integrity.py.

The three new regressions cover the specified structural rejection branches in packages/hris-kernel/src/orgmetra_hris_kernel/audit.py:

  • Line 192 rejects subclass construction before event validation.
  • Line 239 rejects a low-level AuditOutboxEvent subtype before CloudEvent export.
  • Line 71 rejects a low-level forged naive timestamp before timestamp rendering.

The final commit does not modify production code, manifest.json, or tests/validate_repository.py.

I used the existing manifest-contract guidance. The validator still compares the manifest path set with the exact REQUIRED set and rejects both missing and extra entries. test_audit_runtime_type_integrity.py remains outside that intentional manifest subset.

The current manifest metadata matches the checked-in required artifacts, including audit.py at 12,593 bytes and 307 lines. Static inspection confirms that no production or manifest contract was weakened.


🧠 Learnings used
Learnt from: seonghobae
Repo: ContextualWisdomLab/Orgmetra PR: 63
File: manifest.json:344-352
Timestamp: 2026-09-04T14:35:53.442Z
Learning: In Orgmetra, `tests/validate_repository.py` builds the canonical `manifest.json` inventory from the exact `REQUIRED` path set and `_validate_manifest()` rejects both missing and extra entries. `packages/hris-kernel/src/orgmetra_hris_kernel/job_analysis.py` and `packages/hris-kernel/tests/test_job_analysis_temporal_type_integrity.py` are intentionally outside this foundation manifest subset; do not request manifest entries for them unless a separate change updates the `REQUIRED` contract with its required rationale and tests.

You are interacting with an AI system.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review exact current head 72070cb4b8d636825ce5b1a326df4c296596ed7e against protected develop@eb9757f8649aaad026a9865508d9aad50c1a7a4f. Focus on the hosted-RED repair: predecessor Foundation ran 218 HRIS-kernel tests but missed three legitimate audit rejection branches; current head adds only the three regression cases needed to execute those branches. Verify no production or manifest-owned artifact was weakened, all prior review findings remain resolved/current, and do not infer merge readiness from the separate central CodeQL dispatch handoff.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="eb9757f8649aaad026a9865508d9aad50c1a7a4f"
head="72070cb4b8d636825ce5b1a326df4c296596ed7e"

echo "=== revision identity ==="
printf 'HEAD='
git rev-parse HEAD
printf 'requested_head=%s\n' "$head"
printf 'merge_base='
git merge-base "$base" "$head"
git status --short

echo "=== final successor paths and diff ==="
parent="$(git rev-parse "${head}^")"
git diff-tree --no-commit-id --name-status -r "$head"
git diff --check "$parent..$head"
git diff --find-renames --unified=80 "$parent..$head" -- \
  packages/hris-kernel/tests/test_audit_runtime_type_integrity.py \
  packages/hris-kernel/src/orgmetra_hris_kernel/audit.py \
  manifest.json \
  tests/validate_repository.py \
  CHANGELOG.md

echo "=== final test structure ==="
ast-grep outline packages/hris-kernel/tests/test_audit_runtime_type_integrity.py --items all --type function,class
nl -ba packages/hris-kernel/tests/test_audit_runtime_type_integrity.py | sed -n '1,280p'

echo "=== corresponding audit branches and export path ==="
ast-grep outline packages/hris-kernel/src/orgmetra_hris_kernel/audit.py --items all
nl -ba packages/hris-kernel/src/orgmetra_hris_kernel/audit.py | sed -n '55,80p;180,200p;230,248p;250,390p'

echo "=== protected-base changes for production and manifest-owned paths ==="
git diff --find-renames --unified=25 "$base..$head" -- \
  packages/hris-kernel/src/orgmetra_hris_kernel/audit.py \
  manifest.json \
  tests/validate_repository.py \
  CHANGELOG.md

echo "=== manifest contract and current required artifact metadata ==="
rg -n -A55 -B8 \
  'REQUIRED|def _validate_manifest|unexpected|extra|set\(REQUIRED\)' \
  tests/validate_repository.py
rg -n -C 4 \
  '"(CHANGELOG\.md|packages/hris-kernel/src/orgmetra_hris_kernel/audit\.py|packages/hris-kernel/tests/test_audit_outbox\.py)"' \
  manifest.json
for file in \
  CHANGELOG.md \
  packages/hris-kernel/src/orgmetra_hris_kernel/audit.py \
  packages/hris-kernel/tests/test_audit_outbox.py
do
  printf '%s\t' "$file"
  sha256sum "$file" | awk '{printf "sha256=%s ", $1}'
  printf 'bytes=%s lines=%s\n' "$(wc -c < "$file")" "$(awk 'END {print NR}' "$file")"
done

echo "=== direct module-state exposure scan ==="
rg -n --type py -C 3 \
  '(_AUDIT_CREATION_SNAPSHOTS|_AUDIT_LIVE_ISSUANCES|__closure__|_claim_audit_issuance|_record_audit_creation_snapshot|_lookup_audit_creation_snapshot)' \
  packages/hris-kernel/src/orgmetra_hris_kernel/audit.py \
  packages/hris-kernel/tests

Length of output: 12502


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="eb9757f8649aaad026a9865508d9aad50c1a7a4f"
head="72070cb4b8d636825ce5b1a326df4c296596ed7e"

show_lines() {
  local file="$1"
  local ranges="$2"
  awk -v ranges="$ranges" '
    BEGIN {
      count = split(ranges, parts, ";")
      for (i = 1; i <= count; i++) {
        split(parts[i], bounds, "-")
        start[i] = bounds[1]
        stop[i] = bounds[2]
      }
    }
    {
      for (i = 1; i <= count; i++) {
        if (NR >= start[i] && NR <= stop[i]) {
          printf "%d:%s\n", NR, $0
          break
        }
      }
    }
  ' "$file"
}

echo "=== source branch neighborhoods ==="
show_lines packages/hris-kernel/src/orgmetra_hris_kernel/audit.py "55-80;180-200;230-248;250-390"

echo "=== final test lines ==="
show_lines packages/hris-kernel/tests/test_audit_runtime_type_integrity.py "160-205"

echo "=== base-to-head production and manifest changes ==="
git diff --name-status "$base..$head" -- \
  packages/hris-kernel/src/orgmetra_hris_kernel/audit.py \
  manifest.json \
  tests/validate_repository.py \
  CHANGELOG.md
git diff --find-renames --unified=30 "$base..$head" -- \
  packages/hris-kernel/src/orgmetra_hris_kernel/audit.py \
  manifest.json \
  tests/validate_repository.py \
  CHANGELOG.md

echo "=== manifest validator contract ==="
rg -n -A55 -B8 \
  'REQUIRED|def _validate_manifest|unexpected|extra|set\(REQUIRED\)' \
  tests/validate_repository.py

echo "=== current manifest entries ==="
rg -n -C 4 \
  '"(CHANGELOG\.md|packages/hris-kernel/src/orgmetra_hris_kernel/audit\.py|packages/hris-kernel/tests/test_audit_outbox\.py)"' \
  manifest.json

echo "=== metadata compared with worktree ==="
for file in \
  CHANGELOG.md \
  packages/hris-kernel/src/orgmetra_hris_kernel/audit.py \
  packages/hris-kernel/tests/test_audit_outbox.py
do
  printf '%s\t' "$file"
  sha256sum "$file" | awk '{printf "sha256=%s ", $1}'
  printf 'bytes=%s lines=%s\n' "$(wc -c < "$file")" "$(awk 'END {print NR}' "$file")"
done

echo "=== audit module state exposure and lifecycle implementation ==="
rg -n --type py -C 5 \
  '(_AUDIT_CREATION_SNAPSHOTS|_AUDIT_LIVE_ISSUANCES|__closure__|_claim_audit_issuance|_record_audit_creation_snapshot|_lookup_audit_creation_snapshot|finalize|cleanup)' \
  packages/hris-kernel/src/orgmetra_hris_kernel/audit.py \
  packages/hris-kernel/tests

echo "=== worktree test and final commit status ==="
git status --short
git diff --check "${head}^..$head"

Length of output: 61026


@seonghobae No findings for exact head 72070cb4b8d636825ce5b1a326df4c296596ed7e.

The checked-out HEAD matches the requested revision. Its merge base matches protected develop@eb9757f8649aaad026a9865508d9aad50c1a7a4f.

The final commit changes only packages/hris-kernel/tests/test_audit_runtime_type_integrity.py. It adds exactly three regressions:

  • It executes the exact-type rejection in AuditOutboxEvent.__new__ at Line 192.
  • It executes the low-level subtype rejection in AuditOutboxEvent.to_cloudevent() at Line 239.
  • It executes the non-canonical timestamp rejection in _canonical_timestamp() at Line 71.

The tests target the rejection branches before untrusted subtype behavior or non-UTC timestamp rendering can proceed.

No production file or manifest-owned artifact changes in the final successor. The current manifest.json metadata matches CHANGELOG.md, packages/hris-kernel/src/orgmetra_hris_kernel/audit.py, and packages/hris-kernel/tests/test_audit_outbox.py. The manifest validator still rejects both missing and extra entries. I used the existing manifest-contract guidance: test_audit_runtime_type_integrity.py remains intentionally outside the REQUIRED manifest path set.

The previous mutable issuance-registry concern remains resolved on this head. audit.py has no exposed issuance registries or closure-backed issuance mutators. The module-state tests verify that those module attributes are absent.

This review does not determine hosted Foundation status or merge readiness from the separate central CodeQL dispatch handoff.


🧠 Learnings used
Learnt from: seonghobae
Repo: ContextualWisdomLab/Orgmetra PR: 63
File: manifest.json:344-352
Timestamp: 2026-09-04T14:35:53.442Z
Learning: In Orgmetra, `tests/validate_repository.py` builds the canonical `manifest.json` inventory from the exact `REQUIRED` path set and `_validate_manifest()` rejects both missing and extra entries. `packages/hris-kernel/src/orgmetra_hris_kernel/job_analysis.py` and `packages/hris-kernel/tests/test_job_analysis_temporal_type_integrity.py` are intentionally outside this foundation manifest subset; do not request manifest entries for them unless a separate change updates the `REQUIRED` contract with its required rationale and tests.

You are interacting with an AI system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant