Skip to content

fix(test): use CARGO_MANIFEST_DIR for test config & stronghold paths - #385

Merged
nanderstabel merged 1 commit into
betafrom
test/relative-paths
Jul 30, 2026
Merged

fix(test): use CARGO_MANIFEST_DIR for test config & stronghold paths#385
nanderstabel merged 1 commit into
betafrom
test/relative-paths

Conversation

@nanderstabel

@nanderstabel nanderstabel commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Description of change

Uses CARGO_MANIFEST_DIR to resolve test.config.yaml and test.stronghold.dat paths at compile time. This fixes test lookup failures when running unit tests from outer workspace roots or nested subcrates where current working directories differ. Also added ADR 0003 documenting test path resolution standards.

Links to any relevant issues

N/A

How the change has been tested

  • Ran unit & integration tests from _core/ssi-agent root (UNICORE__PROFILE=development cargo test --all).
  • Ran unit tests from outer workspace

Definition of Done checklist

Add an x to the boxes that are relevant to your changes.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have successfully tested this change in a docker environment

Summary by CodeRabbit

  • Bug Fixes

    • Improved test reliability by resolving test configuration and secret-storage fixtures from stable project paths rather than the current working directory.
  • Documentation

    • Added guidance for hermetic, thread-safe tests, including in-memory testing, explicit configuration, dependency injection, and avoiding shared disk fixtures.

@nanderstabel nanderstabel self-assigned this Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Test utilities now resolve Stronghold and provisioned configuration fixtures relative to package manifests. ADR 0003 documents hermetic testing practices, including in-memory unit tests and explicit configuration injection.

Changes

Hermetic testing

Layer / File(s) Summary
Manifest-relative test fixtures
agent_secret_manager/src/lib.rs, agent_shared/src/config/provisioned.rs, docs/adr/0003-hermetic-test-architecture-and-config-decoupling.md
Test Stronghold and provisioned configuration paths use compile-time manifest locations, and ADR 0003 documents the associated testing and configuration guidelines.

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

Suggested reviewers: daniel-mader

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: resolving test config and stronghold paths with CARGO_MANIFEST_DIR.
Description check ✅ Passed The description covers the change, motivation, issue reference, testing, and relevant checklist items, matching the template well.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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 test/relative-paths

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.

@nanderstabel
nanderstabel marked this pull request as ready for review July 30, 2026 07:57

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@agent_secret_manager/src/lib.rs`:
- Around line 28-35: Update the test-utils path setup in
agent_secret_manager/src/lib.rs:28-35 to copy the manifest fixture to a unique
per-test temporary Stronghold path or serialize all Stronghold access,
eliminating shared mutable fixture and password collisions. Update
docs/adr/0003-hermetic-test-architecture-and-config-decoupling.md:40-41 to limit
the rationale to CWD-independent lookup and document per-test Stronghold
isolation as a separate requirement.

In `@docs/adr/0003-hermetic-test-architecture-and-config-decoupling.md`:
- Around line 40-41: Update the “Speed & Parallelism” rationale in the ADR to
remove claims that manifest-relative resolution eliminates disk contention or
password collisions. Describe the current change as fixing CWD-relative lookup
failures, and track per-test Stronghold isolation as a separate follow-up while
shared Stronghold storage remains in test_utils.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 49edb37c-f486-40da-9b27-c889c4a6425e

📥 Commits

Reviewing files that changed from the base of the PR and between dbdbc83 and cdb6cb0.

📒 Files selected for processing (3)
  • agent_secret_manager/src/lib.rs
  • agent_shared/src/config/provisioned.rs
  • docs/adr/0003-hermetic-test-architecture-and-config-decoupling.md

Comment thread agent_secret_manager/src/lib.rs
Comment thread docs/adr/0003-hermetic-test-architecture-and-config-decoupling.md
@nanderstabel
nanderstabel merged commit ca6dbb9 into beta Jul 30, 2026
6 of 8 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jul 30, 2026
7 tasks
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.

2 participants