Skip to content

fix(authz): protect purpose-bound runtime integrity - #65

Draft
seonghobae wants to merge 243 commits into
developfrom
fix/purpose-bound-authorization-runtime-integrity
Draft

fix(authz): protect purpose-bound runtime integrity#65
seonghobae wants to merge 243 commits into
developfrom
fix/purpose-bound-authorization-runtime-integrity

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Scope

Canonical Orgmetra purpose-bound authorization/runtime-integrity lane. Keyverse remains identity/credential/scope authority; Orgmetra remains HR policy/evidence authority. #65 does not copy mutable #63/#64/#141/Assignment source.

Current exact head remains 1caf8f760e81f1cb6954fdf1d0d13a46dbb6c0b1 on protected develop@eb9757f8649aaad026a9865508d9aad50c1a7a4f, open · Draft · mechanically mergeable. Its retained #182#210 authorization hardening and package-root validate_authorization_decision(...) flow remain valid delta.

Current hosted RED and owner RCA

Foundation 33932302769, Repository quality 101213236190, is a real exact-head RED. Checkout, runner, Foundation validation and dependency hygiene passed. All 118 keyverse-adapter tests passed at 100% statement/branch coverage. The first failing consumer was services/job-analysis-api/tests/test_postgres_audit_scalar_time_integrity.py: three tests prove this branch's older shared AuditEvent implementation executes caller-defined timezone utcoffset() behavior during canonical_json() before rejecting invalid durable-audit evidence. The service suite ended 196 passed / 3 failed at 97.70%; PostgreSQL contracts were correctly skipped after the RED.

This is the shared-kernel defect already owned and repaired by #63. #65 must not cherry-pick or copy #63's mutable source. Preserve this RED until #63 reaches protected develop, then non-force adopt protected shared-kernel truth and reacquire exact-head acceptance. No PYTHONPATH workaround, test deletion, callback relaxation, coverage weakening, or mutable-source copy is valid.

Owner prerequisites

#63 shared HRIS-kernel owner remains exact 72070cb4b8d636825ce5b1a326df4c296596ed7e. Foundation 33936088421, Security 33936088403, and SAST 33936088456 are terminal success. CodeQL 33936088409 remains non-passing in the central exact-head dispatch/handoff state, and qualifying approval is absent. #63 therefore remains Draft/unmerged.

#64 generic People/hire owner is exact 4be7f1681959e43d32c8e85a8f2660da36ff6d9c. It preserves #229 result-integrity hardening, #230 direct-PostgreSQL command detachment, #231 pre-authorization command detachment, #232 exact allocation-ratio text, #233 the authoritative (0, 1.0000] parser/OpenAPI contract, #246 idempotent-replay reconciliation, the three wrong-width projection coverage regressions, and later protocol-conformant hostile-test tripwires.

#64 now has terminal exact-head GREEN for Foundation 33981039419, Security Scan 33981039429, and SAST Semgrep 33981039445. Foundation includes People API 239/239 passing tests, 1472 statements / 482 branches at 100.00%, all other owned suites, isolated PostgreSQL contracts, dependency checks and read-only validation. CodeQL PR 33981039424 is terminal failure only in the central compatibility-handoff stage: language detection succeeded; both actions and python compatibility jobs successfully requested current-head scan dispatch and then failed at Release runner or enforce current-head CodeQL verdict, with no terminal codeql-dispatch/<language> status exposed. This remains non-passing, not a source-vulnerability verdict and not a reason for an Orgmetra no-op push.

#64 is still mutable owner source, not protected truth. Formal reviews remain COMMENTED-only with no qualifying APPROVED review, so #64 stays Draft/unmerged despite its deterministic/security GREEN lanes.

#64 and #65 overlap on hire.py, mutations.py, postgres_hire.py, and postgres_mutations.py. After #63 integrates and then #64 integrates normally, #65 must non-force adopt the protected #64 state while preserving #229#233, #246, its acceptance regressions/test contracts, and #65's own detached/revalidated AuthorizationDecision semantics. Do not copy from mutable #64 or retarget onto its head.

#141 retains a valid employing-legal-Organization feature but is Draft on an old owner base and overlaps #64/#65 on People, authorization, and OpenAPI files. It follows #65: after #65 becomes protected truth, #141 must non-force adopt that protected owner state and preserve only its valid legal-employer feature delta. Assignment #163/#165 remain downstream consumers.

docs/product-technical-gap-baseline.md remains single-writer-owned by #100; volatile SHAs/run IDs stay in PR/Issue metadata.

Canonical order remains #63 normal protected integration as gates allow → #64 normal integration after terminal required workflows and qualifying review → #65 non-force protected adoption/reconciliation + fresh exact-head acceptance → #141 non-force protected adoption/reconciliation + fresh acceptance → Assignment descendants. The independent #235 Workforce Validation lane may progress from protected develop while these owner gates run. No self-approval, administrator bypass, gate weakening, force-push, destructive rebase, mutable-owner source copy, no-op retrigger, or predecessor-evidence transfer.

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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 marked this pull request as ready for review August 21, 2026 09:38
devin-ai-integration[bot]

This comment was marked as resolved.

@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.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review exact head c35d434adfdee94fa838819bba51bd2449ce940d. Focus on AuthorizationDecision construction-time runtime integrity, allow/deny field invariants, reference namespace binding, compatibility with existing direct decision constructors, and the new adversarial decision-evidence regressions. Do not transfer findings or approval from predecessor heads.

@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '== Exact revision =='
git rev-parse HEAD
git status --short
printf '%s\n' '== Merge base with develop =='
git merge-base HEAD develop
printf '%s\n' '== Changed files =='
git diff --name-status develop...HEAD
printf '%s\n' '== Python structure candidates =='
fd -e py . | xargs -r ast-grep outline --items all --type class,function --match 'AuthorizationDecision|Authorization|Decision' 2>/dev/null || true
printf '%s\n' '== Focused diff =='
git diff --find-renames --unified=80 develop...HEAD -- '*.py'

Length of output: 44422


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '== Authorization module, complete numbered source =='
cat -n packages/keyverse-adapter/src/orgmetra_keyverse_adapter/authorization.py

printf '%s\n' '== Direct constructors and consumer references =='
rg -n -C 8 --glob '*.py' \
  '(AuthorizationDecision\s*\(|\bAuthorizationDecision\b)' \
  packages services

printf '%s\n' '== Existing adapter authorization tests =='
cat -n packages/keyverse-adapter/tests/test_authorization.py

printf '%s\n' '== Persistence-boundary authorization validation =='
sed -n '150,230p' services/people-api/src/orgmetra_people_api/postgres_hire.py
sed -n '1,260p' services/people-api/src/orgmetra_people_api/postgres_mutations.py

printf '%s\n' '== Decision construction test map =='
rg -n -C 5 --glob 'test_*.py' \
  '(AuthorizationDecision\s*\(|_decision\s*\(|allowed=False|authorized_fields)' \
  packages/keyverse-adapter/tests services/people-api/tests services/job-analysis-api/tests

Length of output: 169233


@seonghobae I found one runtime-integrity bypass on exact head c35d434adfdee94fa838819bba51bd2449ce940d.

High: Prevent AuthorizationDecision subclass validation bypass

AuthorizationDecision is still subclassable. A subclass can override __post_init__ and omit super().__post_init__(). The generated dataclass initializer dispatches to that override. The subclass can then contain malformed or executable evidence.

The People persistence boundaries accept the subclass because they use isinstance(authorization, AuthorizationDecision).

  • packages/keyverse-adapter/src/orgmetra_keyverse_adapter/authorization.py, Line 188
  • services/people-api/src/orgmetra_people_api/postgres_hire.py, Line 179
  • services/people-api/src/orgmetra_people_api/postgres_mutations.py, Line 325

This bypass can reintroduce the forged allowed, UUID, string, field-set, and reference values that this change intends to reject.

Make AuthorizationDecision non-subclassable, for example with an __init_subclass__ method that raises TypeError. Add an adversarial regression that defines a subclass which skips __post_init__, then verify that class definition or construction fails. This preserves existing direct construction of the exact AuthorizationDecision class.

I did not transfer predecessor findings or approval. I completed static review only. The sandbox cannot execute the repository test suites.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review exact head edbd07337162f85ac7ab6b74e570b49e53a6d296, focusing on AuthorizationDecision verdict/reason polarity, preservation of extensible denial codes and non-authoritative bounded next_action, and compatibility with direct People persistence/replay fixtures. Do not transfer predecessor findings or GREEN evidence.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review exact head 39b6a3f96534dfecf1d2accbbf852f305a908027 against protected develop@ef1b143368cb6249c9520ca8cae10ebe844a5aa1, scoped to #210. Verify the test-first lineage a0260ae…cb0b999… before production 5660fc6…39b6a3f…; confirm both People and Job Analysis reject an exact built-in Authorization header longer than 8,199 characters before .split()/scheme parsing, preserve the 8,192-character bearer-token maximum, and introduce no unrelated source changes. Do not transfer predecessor review or GREEN evidence.

@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

head='39b6a3f96534dfecf1d2accbbf852f305a908027'
base='ef1b143368cb6249c9520ca8cae10ebe844a5aa1'
red_prefix='a0260ae'
test_successor_prefix='cb0b999'
prod_prefix='5660fc6'

printf '%s\n' '== Exact revision, base, and worktree =='
printf 'HEAD='; git rev-parse HEAD
printf 'MERGE_BASE='; git merge-base HEAD develop
git status --short
test "$(git rev-parse HEAD)" = "$head"
test "$(git merge-base HEAD develop)" = "$base"

printf '%s\n' '== Resolve stated commits and verify sequence =='
red="$(git rev-parse "$red_prefix")"
test_successor="$(git rev-parse "$test_successor_prefix")"
production="$(git rev-parse "$prod_prefix")"
printf 'RED=%s\nTEST_SUCCESSOR=%s\nPRODUCTION=%s\n' "$red" "$test_successor" "$production"
git merge-base --is-ancestor "$red" "$test_successor"
git merge-base --is-ancestor "$test_successor" "$production"
git merge-base --is-ancestor "$production" "$head"
git log --reverse --format='%H %P %s' --ancestry-path "$red..$head"
printf 'TEST_SUCCESSOR_PARENT='; git rev-parse "${test_successor}^"
printf 'PRODUCTION_PARENT='; git rev-parse "${production}^"
printf 'HEAD_PARENT='; git rev-parse "${head}^"

printf '%s\n' '== Changed files and exact commit deltas =='
git diff --name-status "$base...$head"
for commit in "$red" "$test_successor" "$production" "$head"; do
  printf '\n== %s ==\n' "$commit"
  git show --no-patch --format='%H%nParents: %P%nSubject: %s%n%b' "$commit"
  git show --format= --name-status "$commit"
done
printf '%s\n' '== Net delta from first production commit to head =='
git diff --name-status "$production...$head"
git diff --check "$red...$head"

printf '%s\n' '== Find Authorization parsing sources and tests =='
fd -e py . packages services | while IFS= read -r file; do
  if rg -q '(Authorization|authorization|Bearer|bearer|split\s*\()' "$file"; then
    printf '%s\n' "$file"
  fi
done

printf '%s\n' '== Authorization header length gates and parsing order =='
rg -n -A80 -B20 --glob '*.py' \
  '(authorization.{0,20}(header|Header)|Authorization|Bearer|bearer|\.split\s*\(|8192|8199|8200|header.*length|length.*header)' \
  packages services

printf '%s\n' '== Focused source/test changes in stated sequence =='
git diff --find-renames --unified=100 "$red^" "$head" -- '*.py'

printf '%s\n' '== Dedicated `#210` tests and token-length compatibility assertions =='
rg -n -A120 -B20 --glob 'test_*.py' \
  '(8192|8199|8200|Authorization|authorization.*header|Bearer|bearer|too long|header.*length|token.*length)' \
  packages services

printf '%s\n' '== Static parser statement order in candidate production files =='
python3 - <<'PY'
from pathlib import Path
import ast

for path in Path(".").glob("**/*.py"):
    text = path.read_text(encoding="utf-8")
    if not any(term in text for term in ("Authorization", "authorization", "Bearer", "bearer")):
        continue
    try:
        tree = ast.parse(text, filename=str(path))
    except SyntaxError:
        continue
    matches = []
    for node in ast.walk(tree):
        if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
            source = ast.get_source_segment(text, node) or ""
            if ("split(" in source and
                any(term in source for term in ("Authorization", "authorization", "Bearer", "bearer"))):
                matches.append(node)
    if matches:
        print(f"\n== {path} ==")
        for fn in matches:
            print(f"{fn.name}: Lines {fn.lineno}-{fn.end_lineno}")
            for stmt in fn.body:
                rendered = ast.unparse(stmt).splitlines()[0]
                if any(term in rendered for term in ("split(", "len(", "8192", "8199", "8200", "authorization", "Authorization", "Bearer", "bearer")):
                    print(f"  Line {stmt.lineno}: {rendered}")
PY

Length of output: 204266


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head='39b6a3f96534dfecf1d2accbbf852f305a908027'
red="$(git rev-parse a0260ae)"
test_successor="$(git rev-parse cb0b999)"
production="$(git rev-parse 5660fc6)"
people_auth='services/people-api/src/orgmetra_people_api/auth.py'
job_auth='services/job-analysis-api/src/orgmetra_job_analysis_api/auth.py'
people_test='services/people-api/tests/test_bearer_header_budget.py'
job_test='services/job-analysis-api/tests/test_bearer_header_budget.py'

test "$(git rev-parse HEAD)" = "$head"

printf '%s\n' '== Direct parent relationships =='
for commit in "$red" "$test_successor" "$production" "$head"; do
  printf '\nCOMMIT='; git rev-parse "$commit"
  printf 'PARENT='; git rev-parse "${commit}^"
  git show --no-patch --format='SUBJECT=%s%nFILES:' "$commit"
  git diff-tree --no-commit-id --name-status -r "$commit"
done

printf '%s\n' '== Exact source for both parsers =='
for file in "$people_auth" "$job_auth"; do
  printf '\n== %s ==\n' "$file"
  rg -n -A45 -B10 --glob '*.py' \
    '^_MAX_(AUTHORIZATION_HEADER_LENGTH|BEARER_TOKEN_LENGTH)\s*=|^def extract_bearer_token\s*\(' \
    "$file"
done

printf '%s\n' '== Exact `#210` regression files =='
for file in "$people_test" "$job_test"; do
  printf '\n== %s ==\n' "$file"
  cat -n "$file"
done

printf '%s\n' '== Test-first and production patches =='
for commit in "$red" "$test_successor" "$production" "$head"; do
  printf '\n== PATCH %s ==\n' "$commit"
  git show --format='%H %s' --find-renames --unified=80 "$commit" -- \
    "$people_auth" "$job_auth" "$people_test" "$job_test"
done

printf '%s\n' '== Net source changes after first production commit =='
git diff --name-status "$production...$head"
git diff --find-renames --unified=80 "$production...$head" -- \
  "$people_auth" "$job_auth" "$people_test" "$job_test"

printf '%s\n' '== Changed non-test files against protected base =='
git diff --name-only "$(git merge-base HEAD develop)...HEAD" |
while IFS= read -r file; do
  case "$file" in
    */tests/*|*/test_*.py) ;;
    *) printf '%s\n' "$file" ;;
  esac
done

printf '%s\n' '== Static Python syntax check for reviewed files =='
python3 - <<'PY'
from pathlib import Path
import ast

for filename in (
    "services/people-api/src/orgmetra_people_api/auth.py",
    "services/job-analysis-api/src/orgmetra_job_analysis_api/auth.py",
    "services/people-api/tests/test_bearer_header_budget.py",
    "services/job-analysis-api/tests/test_bearer_header_budget.py",
):
    ast.parse(Path(filename).read_text(encoding="utf-8"), filename=filename)
    print(f"ast_parse=ok {filename}")
PY

Length of output: 48328


@seonghobae I reviewed exact head 39b6a3f96534dfecf1d2accbbf852f305a908027 against develop@ef1b143368cb6249c9520ca8cae10ebe844a5aa1.

I found no static issue in the requested #210 scope.

The test-first sequence is direct:

  1. a0260aeaad44b8b12a6e11b7007ea338593eb985 adds the Job Analysis regression.
  2. cb0b999efb002fe8677a93d2e674ba192e2dcc05 adds the matching People regression.
  3. 5660fc6e00d38510ac5538bcef9da2e89b52a1a5 adds the Job Analysis production change.
  4. 39b6a3f96534dfecf1d2accbbf852f305a908027 adds the matching People production change.

Both services define:

_MAX_BEARER_TOKEN_LENGTH = 8192
_MAX_AUTHORIZATION_HEADER_LENGTH = 8199

Both extract_bearer_token(...) functions apply the checks in this order:

  1. Require an exact built-in str.
  2. Reject a header longer than 8,199 characters.
  3. Call .split(" ", 1).
  4. Validate the Bearer scheme.
  5. Reject a token longer than 8,192 characters.

Therefore, an exact built-in header of 8,200 characters raises AuthenticationFailed("authorization header length is invalid") before scheme parsing. The pre-existing exact-type check also occurs before len() and .split().

The 8,199-character header limit preserves the 8,192-character bearer-token limit because "Bearer " contains seven characters. Both new regression files verify:

  • Rejection of "X" * 8200.
  • Acceptance of f"Bearer {'x' * 8192}".

The #210 production commits modify only these files:

  • services/job-analysis-api/src/orgmetra_job_analysis_api/auth.py
  • services/people-api/src/orgmetra_people_api/auth.py

The focused source and regression files pass static Python parsing. I found no unrelated source change in the #210 commit sequence.

I did not run repository tests or hosted workflows. I do not transfer predecessor findings, approval, or GREEN evidence.

You are interacting with an AI system.

Adopt protected develop@eb9757f after #161 integrated, preserving the purpose-bound authorization/runtime-integrity branch as first parent and the protected workflow consolidation as second parent. Workflow-owned paths use protected truth; service auth/runtime source remains on the canonical #65 writer branch.

This merge intentionally leaves the foundation manifest to be resealed against the combined tree by the repository validation lane rather than copying stale per-workflow evidence.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review exact current head 50fd31581ccc5b0310cfb1c7b5a2f878f30c1183 against protected develop@eb9757f8649aaad026a9865508d9aad50c1a7a4f. Re-evaluate the #182#210 authorization/runtime-integrity delta after the non-force #161 workflow restack, including CHANGELOG delta preservation and manifest reseal. Do not transfer the predecessor 39b6a3f… review result.

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Oops, something went wrong! Please try again later. 🐰 💔

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review exact head 47059d82011973855d7a540788500533859cc96a only. Focus on the #211 downstream acceptance test: it must preserve #63 as the shared-kernel owner, perform no consumer-side source copy, and fail closed before hostile timezone/text callbacks once protected #63 truth is adopted. Do not transfer predecessor review evidence.

@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

head='47059d82011973855d7a540788500533859cc96a'
base='eb9757f8649aaad026a9865508d9aad50c1a7a4f'

printf '%s\n' '== Exact revision and protected base =='
printf 'HEAD='; git rev-parse HEAD
printf 'MERGE_BASE='; git merge-base HEAD develop
git status --short
test "$(git rev-parse HEAD)" = "$head"
test "$(git merge-base HEAD develop)" = "$base"

printf '%s\n' '== Ancestry and files changed against protected develop =='
git log --reverse --format='%H %P %s' --ancestry-path "$base..$head"
git diff --name-status "$base...$head"

printf '%s\n' '== Current head and parent delta =='
parent="$(git rev-parse "${head}^")"
printf 'PARENT=%s\n' "$parent"
git show --no-patch --format='HEAD=%H%nPARENTS=%P%nSUBJECT=%s%n%B' "$head"
git diff --name-status "$parent" "$head"
git diff --check "$parent" "$head"
git diff --find-renames --unified=100 "$parent" "$head" -- '*.py' '*.toml' '*.md'

printf '%s\n' '== `#211` candidates in history and source/tests =='
git log --all --format='%H %P %s' --grep='`#211`\|211' -i
rg -n -A80 -B20 --glob '*.py' --glob '*.md' --glob '*.toml' \
  '(`#211`|downstream acceptance|shared.kernel|shared_kernel|hostile.*(timezone|text)|ZoneInfo|tzinfo|timezone|AuthorizationDecision)' \
  .

printf '%s\n' '== Changed Python structure =='
git diff --name-only "$parent" "$head" -- '*.py' |
while IFS= read -r file; do
  printf '\n== %s ==\n' "$file"
  ast-grep outline "$file" --items all --type class,function \
    --match 'accept|shared|kernel|timezone|text|snapshot|authorization|integrity' || true
done

printf '%s\n' '== Relevant shared-kernel and consumer package inventory =='
fd -e py . packages services | while IFS= read -r file; do
  if rg -q '(ZoneInfo|tzinfo|timezone|hostile|runtime.integrity|snapshot_from_document|AuthorizationDecision)' "$file"; then
    printf '%s\n' "$file"
  fi
done

Length of output: 202385


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head='47059d82011973855d7a540788500533859cc96a'
parent="$(git rev-parse "${head}^")"
test_file='services/job-analysis-api/tests/test_postgres_audit_scalar_time_integrity.py'

test "$(git rev-parse HEAD)" = "$head"

printf '%s\n' '== Focused commit scope =='
git show --no-patch --format='HEAD=%H%nPARENTS=%P%nSUBJECT=%s%n%B' "$head"
git diff-tree --no-commit-id --name-status -r "$head"
git diff --find-renames --unified=140 "$parent" "$head" -- "$test_file"
git diff --name-only "$parent" "$head" -- 'packages/hris-kernel/**' 'services/job-analysis-api/src/**'

printf '%s\n' '== Complete `#211` downstream acceptance test =='
cat -n "$test_file"

printf '%s\n' '== Focused imports and referenced symbols =='
rg -n -C 8 --glob '*.py' \
  '(AuditOutboxEvent|_validate.*audit|audit.*scalar|occurred_at|content_digest|to_cloudevent|timezone|tzinfo)' \
  services/job-analysis-api/src services/job-analysis-api/tests/test_postgres_audit_scalar_time_integrity.py \
  packages/hris-kernel/src/orgmetra_hris_kernel/audit.py

printf '%s\n' '== Consumer package dependency declaration =='
for file in \
  services/job-analysis-api/pyproject.toml \
  packages/hris-kernel/pyproject.toml
do
  printf '\n== %s ==\n' "$file"
  cat -n "$file"
done

printf '%s\n' '== Shared-kernel audit API surface and static boundary order =='
ast-grep outline packages/hris-kernel/src/orgmetra_hris_kernel/audit.py \
  --items all --type class,function --match 'AuditOutboxEvent|audit|validate|time|text'
rg -n -A150 -B20 --glob '*.py' \
  '^(class AuditOutboxEvent|def _.*(?:time|text|validate)|    def (to_cloudevent|canonical_json|content_digest))\b|type\s*\(|tzinfo|utcoffset|astimezone|isoformat|strip\(|split\(|encode\(' \
  packages/hris-kernel/src/orgmetra_hris_kernel/audit.py \
  services/job-analysis-api/src/orgmetra_job_analysis_api/postgres.py

printf '%s\n' '== Static test assertions for callback non-dispatch =='
rg -n -A50 -B12 --glob '*.py' \
  '(test_durable_audit_rejects_executable_occurred_at_timezone_before_callback|callback|calls|AssertionError|Executable|Hostile|tzinfo|text)' \
  "$test_file"

Length of output: 191040


@seonghobae I reviewed exact head 47059d82011973855d7a540788500533859cc96a only.

I found no static issue in the #211 downstream acceptance-test scope.

The commit changes only services/job-analysis-api/tests/test_postgres_audit_scalar_time_integrity.py. It does not change packages/hris-kernel or Job Analysis production source. It does not copy shared-kernel validation into the consumer.

The test imports the public AuditOutboxEvent from orgmetra_hris_kernel. It exercises PostgresJobAnalysisPort.persist_snapshot(...) through the normal consumer boundary.

The test preserves #63 as the shared-kernel owner. It requires the adopted shared-kernel contract to reject:

  • A low-level-mutated occurred_at value with a hostile tzinfo.
  • A non-boolean high_impact value.
  • A confirmation_reference text subtype with executable equality methods.

Each case supplies _never_connect. This requires rejection before database acquisition. Each case also checks tripwire.calls == 0. This requires rejection before the hostile timezone callback.

The current checked-out shared-kernel source is not yet the protected #63 truth that this test specifies. Its AuditOutboxEvent implementation still uses permissive runtime checks and can call time or text operations after low-level mutation. Therefore, this downstream acceptance test is expected to remain RED until #63 integrates into protected develop and #65 adopts that protected source normally.

I did not transfer predecessor findings, approval, or GREEN evidence. I did not execute repository or hosted tests.

You are interacting with an AI system.

type(self).calls += 1
raise AssertionError("durable integer comparison executed before exact validation")

def __le__(self, other: object) -> bool:
type(self).calls += 1
raise AssertionError("durable integer comparison executed before exact validation")

def __lt__(self, other: object) -> bool:
type(self).calls += 1
raise AssertionError("durable integer comparison executed before exact validation")

def __gt__(self, other: object) -> bool:
class _ExecutableRowCollection(list[object]):
"""Fail if database collection hooks run before the durable boundary."""

def __bool__(self) -> bool:
def __len__(self) -> int:
raise AssertionError("row collection length executed")

def __getitem__(self, index: object) -> object:
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