fix(services): make governed service tests runnable from any working directory - #122
fix(services): make governed service tests runnable from any working directory#122seonghobae wants to merge 2 commits into
Conversation
…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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthrough테스트 초기화 코드가 워크스페이스 소스 경로를 Changes테스트 경로 안정화
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to 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)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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
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.
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-evidencepipeline.Root-cause repair
services/job-analysis-api/conftest.pyandservices/people-api/conftest.pyadd the repository'spackages/*/srcandservices/*/srctrees tosys.pathonly for pytest collection, so sibling Orgmetra workspace packages are importable without changing production runtime behavior.Path(__file__)instead of process CWD, making evidence reads location-independent by construction.60ad07a02c766b54673d7cbbdd7e7bdcd08d129econfirmed the injected workspace package names do not collide. That predecessor evidence remains causal history, not current-head acceptance.Protected-parent adoption
Current exact head:
18f1d3ee98bc88850bda56eff7c781182cd134d1Protected base:
develop@eb9757f8649aaad026a9865508d9aad50c1a7a4fLive state: open · Draft · mergeable.
18f1d3ee...is an ordinary non-force two-parent adoption of prior feature head60ad07a...and protecteddevelop@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:34005815981: SUCCESS. Exact checkout, explicitubuntu-24.04runner contract, foundation-pack validation, dependency hygiene, reviewed toolchain installation, all owned unit/service contracts, isolated PostgreSQL contracts and read-only validation completed.34005816117: SUCCESS.34005816066: SUCCESS.34005816039: FAILURE, but both Python and Actions compatibility jobs successfully requested current-head CodeQL dispatch and failed only atRelease 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
APPROVEDreview. 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 andNo data to reportclass failure after the target suite itself completes at 100%. That owner path remainsContextualWisdomLab/.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
.githubsource, 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.