Skip to content

fix(services): make governed service tests runnable from any working directory - #122

Draft
seonghobae wants to merge 2 commits into
developfrom
fix/central-sandbox-sibling-imports
Draft

fix(services): make governed service tests runnable from any working directory#122
seonghobae wants to merge 2 commits into
developfrom
fix/central-sandbox-sibling-imports

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Buyer-visible / control-plane gap

The central review coverage sandbox executes project-local Python tests from each project directory. Two Orgmetra service suites had target-owned portability defects under that execution model: they imported sibling workspace packages without a workspace install, and several repository-file contract tests resolved paths from process CWD. Those defects could make plain service-directory pytest collection fail before product evidence was measured.

This PR repairs only that Orgmetra-owned boundary. It does not claim to repair the entire central OpenCode coverage-evidence pipeline.

Root-cause repair

  • services/job-analysis-api/conftest.py and services/people-api/conftest.py add the repository's packages/*/src and services/*/src trees to sys.path only for pytest collection, so sibling Orgmetra workspace packages are importable without changing production runtime behavior.
  • Repository-file tests in the two services anchor paths from Path(__file__) instead of process CWD, making evidence reads location-independent by construction.
  • Fresh Devin review on predecessor 60ad07a02c766b54673d7cbbdd7e7bdcd08d129e confirmed the injected workspace package names do not collide. That predecessor evidence remains causal history, not current-head acceptance.

Protected-parent adoption

Current exact head: 18f1d3ee98bc88850bda56eff7c781182cd134d1
Protected base: develop@eb9757f8649aaad026a9865508d9aad50c1a7a4f
Live state: open · Draft · mergeable.

18f1d3ee... is an ordinary non-force two-parent adoption of prior feature head 60ad07a... and protected develop@eb9757f.... Protected #161 repository-workflow consolidation is preserved rather than resurrected or overwritten. No force push, destructive rebase, gate weakening, or foreign-owner source copy was used.

Historical evidence on 60ad07a...—69 job-analysis API tests, 146 People API tests and exact 100% statement/branch coverage for both service suites—does not transfer to the adopted head.

Current exact-head acceptance

Current hosted results on exact 18f1d3ee... are terminal:

  • Foundation 34005815981: SUCCESS. Exact checkout, explicit ubuntu-24.04 runner contract, foundation-pack validation, dependency hygiene, reviewed toolchain installation, all owned unit/service contracts, isolated PostgreSQL contracts and read-only validation completed.
  • SAST Semgrep 34005816117: SUCCESS.
  • Security Scan 34005816066: SUCCESS.
  • CodeQL PR 34005816039: FAILURE, but both Python and Actions compatibility jobs successfully requested current-head CodeQL dispatch and failed only at Release runner or enforce current-head CodeQL verdict. This is the central verdict-production/authorization boundary, not a demonstrated Orgmetra source/SARIF finding.

Combined reviewer statuses currently show Devin Review and CodeRabbit success, and the only formal reviews are COMMENTED; there is no qualifying APPROVED review. The one existing review thread is resolved. Therefore the PR remains Draft.

Central owner boundary remains

Orgmetra #40 continues to exercise a distinct central-owned coverage-wrapper failure: its project already configures pytest-cov, while the trusted fallback wraps that project in an outer python3 -m coverage run -m pytest tests, creating a nested-coverage collision and No data to report class failure after the target suite itself completes at 100%. That owner path remains ContextualWisdomLab/.github#624; removing target-owned pytest-cov from Orgmetra would be a leaf workaround.

Do not turn the current CodeQL handoff failure into leaf churn, a synthetic verdict, a no-op retrigger or a weakened security gate. No .github source, setting, workflow or PR state is mutated from this lane.

Acceptance and merge governance

Keep this PR Draft until a valid exact-head CodeQL verdict exists, every current central reviewer workflow is terminal passing, all required conversations are resolved and the live independent-review policy is satisfied. Do not self-approve, use routine administrator bypass, weaken coverage/docstring gates, transfer predecessor evidence, force-push/destructively rebase, or mutate a dedicated-writer dependency.

…directory

The central coverage sandbox runs plain 'pytest tests' inside each
project directory without a workspace install, so service tests that
import sibling workspace packages failed collection with
ModuleNotFoundError, and tests reading repository files relative to the
process CWD failed with FileNotFoundError. Root-cause repairs:

- services/{job-analysis-api,people-api}/conftest.py add every workspace
  src tree to sys.path for sessions rooted under the service, keeping
  production runtime behavior untouched.
- Repository-file reads in job-analysis-api and people-api test modules
  now anchor at Path(__file__) instead of the process CWD.

Both suites pass fully from their own directories (69+72 subtests and
146+235 subtests), which is also how hosted exact-head quality workflows
and the central review coverage sandbox invoke them.
@coderabbitai

coderabbitai Bot commented Aug 25, 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: Pro Plus

Run ID: 594cfd7e-8aeb-4e8d-8357-88b09cd138de

📥 Commits

Reviewing files that changed from the base of the PR and between 9e3e484 and 60ad07a.

📒 Files selected for processing (9)
  • services/job-analysis-api/conftest.py
  • services/job-analysis-api/tests/test_http_content_type.py
  • services/job-analysis-api/tests/test_http_error_contract.py
  • services/job-analysis-api/tests/test_openapi_route_contract.py
  • services/job-analysis-api/tests/test_openapi_snapshot_schema.py
  • services/job-analysis-api/tests/test_postgres_contract_script.py
  • services/job-analysis-api/tests/test_workflow_contract.py
  • services/people-api/conftest.py
  • services/people-api/tests/test_workflow_contract.py

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


📝 Walkthrough

Walkthrough

테스트 초기화 코드가 워크스페이스 소스 경로를 sys.path에 추가합니다. 계약 테스트는 현재 작업 디렉터리 대신 테스트 파일 기준의 저장소 루트에서 스키마, 스크립트, 워크플로 파일을 읽습니다.

Changes

테스트 경로 안정화

Layer / File(s) Summary
워크스페이스 테스트 import 경로
services/job-analysis-api/conftest.py, services/people-api/conftest.py
두 서비스의 테스트 초기화 코드가 packages/*/srcservices/*/src 디렉터리를 검색하고, 유효한 중복 경로를 sys.path 앞에 추가합니다.
저장소 기준 계약 파일 경로
services/job-analysis-api/tests/test_http_content_type.py, services/job-analysis-api/tests/test_http_error_contract.py, services/job-analysis-api/tests/test_openapi_route_contract.py, services/job-analysis-api/tests/test_openapi_snapshot_schema.py, services/job-analysis-api/tests/test_postgres_contract_script.py, services/job-analysis-api/tests/test_workflow_contract.py, services/people-api/tests/test_workflow_contract.py
계약 테스트가 OpenAPI 스키마, PostgreSQL 스크립트, 워크플로 파일을 테스트 파일 위치 기준의 저장소 루트에서 읽습니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 60ad0

This PR makes governed service tests independent of the working directory without changing production behavior, so no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 9 files.
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 제목은 서비스 테스트가 모든 작업 디렉터리에서 실행되도록 수정한 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/central-sandbox-sibling-imports

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.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

Comment thread services/job-analysis-api/conftest.py
seonghobae added a commit that referenced this pull request Aug 31, 2026
Fresh 2026-08-31 exact-head sweep of the non-draft queue confirms the
dominant merge blocker is the central required-review set, not leaf
defects: opencode-review / noema-review fail closed with no current-head
verdict from the .github dispatch agent; dependency-review fails closed on
an intermittent GitHub dependency-graph HTTP 403; strix is terminal
FAILURE on most non-draft PRs. #122 is the only non-draft PR with the
whole central set GREEN, held only by REVIEW_REQUIRED.

Also: gitignore the local .codegraph/ index; note removal of stranded
PR #119 podman test-isolation wrappers and empty agent-registry files.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FQWfxSuCi8U16WDJ9VyGjm
@seonghobae
seonghobae marked this pull request as draft September 6, 2026 00:10
Preserve the complete governed test-portability delta from 60ad07a while adopting protected develop@eb9757f8649aaad026a9865508d9aad50c1a7a4f using GitHub's conflict-free exact merge tree. Preserve #161 repository-workflow consolidation and require fresh exact-head acceptance.

No force-push, gate weakening, foreign-owner source copy, or release claim.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant