Skip to content

refactor(tests): use relative imports instead of bare src/ and test/ paths - #170

Open
thedavidmeister wants to merge 9 commits into
mainfrom
issue-99-test-imports
Open

refactor(tests): use relative imports instead of bare src/ and test/ paths#170
thedavidmeister wants to merge 9 commits into
mainfrom
issue-99-test-imports

Conversation

@thedavidmeister

@thedavidmeister thedavidmeister commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

All 14 test files (and one test helper) used bare src/ and test/ root-relative imports that only resolve when compiling from the top-level project. Under soldeer or git-submodule consumption neither root is on the include path, so the files fail to compile. Replaced with ../../..-/../../../../-relative paths so they resolve in any build context.

Files fixed:

  • test/lib/lts/FeedConsumer.sol
  • test/src/concrete/FlareFtsoWords.describedByMeta.t.sol
  • test/src/concrete/FlareFtsoWords.ftsoCurrentPricePair.t.sol
  • test/src/concrete/FlareFtsoWords.ftsoCurrentPriceUsd.t.sol
  • test/src/concrete/FlareFtsoWords.ierc165.t.sol
  • test/src/concrete/FlareFtsoWords.operandDisallowed.t.sol
  • test/src/concrete/FlareFtsoWords.pointers.t.sol
  • test/src/concrete/FlareFtsoWords.sflrCurrentExchangeRate.t.sol
  • test/src/lib/flreth/LibDineroFlrEth.t.sol
  • test/src/lib/lts/LibFtsoV2LTS.t.sol
  • test/src/lib/op/LibOpFtsoCurrentPricePair.t.sol
  • test/src/lib/op/LibOpFtsoCurrentPriceUsd.t.sol
  • test/src/lib/registry/LibFlareContractRegistry.t.sol
  • test/src/lib/sflr/LibSceptreStakedFlare.t.sol

Test plan

  • CI rainix-sol-test passes (same test behavior, import paths only)
  • CI copy-artifacts (git-is-clean) passes

Closes #99

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Updated project references to use corrected relative paths.
    • Preserved existing build scripts, contract behavior, and public interfaces.
  • Tests

    • Updated test references to resolve dependencies from the current project layout.
    • Test logic, assertions, and expected behavior remain unchanged.

…paths

Closes #99

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@thedavidmeister thedavidmeister self-assigned this Jun 23, 2026
@coderabbitai

coderabbitai Bot commented Jun 23, 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: ASSERTIVE

Plan: Pro Plus

Run ID: f9a917b2-805a-45dc-9d09-fba34e903c0e

📥 Commits

Reviewing files that changed from the base of the PR and between b634aad and 87739d2.

📒 Files selected for processing (19)
  • script/Build.sol
  • script/BuildAuthoringMeta.sol
  • test/abstract/FtsoTest.sol
  • test/lib/lts/FeedConsumer.sol
  • test/src/concrete/FlareFtsoWords.describedByMeta.t.sol
  • test/src/concrete/FlareFtsoWords.ftsoCurrentPricePair.t.sol
  • test/src/concrete/FlareFtsoWords.ftsoCurrentPriceUsd.t.sol
  • test/src/concrete/FlareFtsoWords.ierc165.t.sol
  • test/src/concrete/FlareFtsoWords.operandDisallowed.t.sol
  • test/src/concrete/FlareFtsoWords.pointers.t.sol
  • test/src/concrete/FlareFtsoWords.sflrCurrentExchangeRate.t.sol
  • test/src/concrete/FlareFtsoWords.wordOpcodeAlignment.t.sol
  • test/src/lib/flreth/LibDineroFlrEth.t.sol
  • test/src/lib/lts/LibFtsoV2LTS.t.sol
  • test/src/lib/lts/LibFtsoV2LTSFeedIds.t.sol
  • test/src/lib/op/LibOpFtsoCurrentPricePair.t.sol
  • test/src/lib/op/LibOpFtsoCurrentPriceUsd.t.sol
  • test/src/lib/registry/LibFlareContractRegistry.t.sol
  • test/src/lib/sflr/LibSceptreStakedFlare.t.sol

Walkthrough

Build scripts and Solidity tests replace bare src/ and test/ imports with relative paths. No contract APIs, test logic, assertions, or build behavior changed.

Changes

Import path wiring

Layer / File(s) Summary
Build script import paths
script/Build.sol, script/BuildAuthoringMeta.sol
Build-related imports now reference parent-relative source paths.
Concrete test import paths
test/src/concrete/FlareFtsoWords.*.t.sol
FlareFtsoWords tests now use relative source and helper imports without changing test logic.
Library test import paths
test/abstract/FtsoTest.sol, test/lib/lts/FeedConsumer.sol, test/src/lib/*
Library, helper, registry, and abstract test imports now use deeper relative paths.
Estimated code review effort: 1 (Trivial) ~5 minutes

Possibly related issues

  • rainlanguage/rain.solmem#94 — Addresses the same replacement of bare Solidity src/ and test/ imports with relative paths.

Possibly related PRs

  • rainlanguage/rain.flare#165 — Performs the same mechanical import-path updates across overlapping scripts and tests.
  • rainlanguage/rain.flare#130 — Also modifies FlareFtsoWords.pointers.t.sol, though its changes concern authoring-meta assertions rather than imports.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: converting test imports from bare source-root paths to relative imports.
Linked Issues check ✅ Passed The PR updates the reported test files and related scripts to relative paths, matching issue #99's goal of removing bare src/test imports.
Out of Scope Changes check ✅ Passed The changes are limited to import-path rewrites and formatting, with no unrelated logic or public API changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-99-test-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.

thedavidmeister and others added 2 commits June 23, 2026 10:13
…l [3b-attempt]

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Keep this branch's relative-import style while adopting main's expanded symbol lists in both conflicted test files, and convert the two bare imports main added since (test/abstract/FtsoTest.sol, test/src/lib/lts/LibFtsoV2LTSFeedIds.t.sol) so the whole test tree uses relative imports per #99.

Co-Authored-By: Claude <noreply@anthropic.com>
@thedavidmeister

Copy link
Copy Markdown
Collaborator Author

🤖 ai:producer
Producer note: PR close-candidate — queued for human close review. Duplicate #99 carrier: sibling PR #165 is now merge-updated against current main and covers the ENTIRE category (all bare src/-and-test/ imports in the test tree converted, including test/abstract/FtsoTest.sol and test/src/lib/lts/LibFtsoV2LTSFeedIds.t.sol which previously only this PR covered). This PR also has a prior [merge-update] and re-conflicted. Superseded by #165.

@thedavidmeister thedavidmeister added the ai:ready AI vetter: passes review, ready for human decision label Jul 6, 2026
@thedavidmeister

thedavidmeister commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

🤖 ai:vetter
Reviewed 265caac: ready — Merge-main re-vet: diff still purely converts bare src/ and test/ root paths to relative paths acros
cost 115 — mechanical path refactor, CI-proven

@thedavidmeister thedavidmeister added human:needs-work Human reviewer: needs rework and removed ai:ready AI vetter: passes review, ready for human decision labels Jul 7, 2026
@thedavidmeister

Copy link
Copy Markdown
Collaborator Author

Rework note (human): the bare-import fix must cover script/ too, not just test/. The same convention applies — bare src/ imports break under soldeer/submodule consumption for any first-party .sol, and script/ is first-party. This PR leaves 4 bare imports unfixed, so the Closes #99 coverage is incomplete for the category (the fix should be all first-party .sol, not only tests):

  • script/BuildAuthoringMeta.sol:6import {LibFlareFtsoSubParser} from "src/lib/parse/LibFlareFtsoSubParser.sol";
  • script/BuildPointers.sol:7import {FlareFtsoWords} from "src/concrete/FlareFtsoWords.sol";
  • script/BuildPointers.sol:10import {PARSE_META_BUILD_DEPTH} from "src/abstract/FlareFtsoSubParser.sol";
  • script/BuildPointers.sol:11import {LibFlareFtsoSubParser} from "src/lib/parse/LibFlareFtsoSubParser.sol";

Fix these the same way (relative paths from script/ to src/, e.g. ../src/…), then it fully covers the category.

@thedavidmeister

Copy link
Copy Markdown
Collaborator Author

🤖 ai:producer
Producer note: reworked per rework note — converted the 4 remaining bare src/ imports in script/BuildAuthoringMeta.sol and script/BuildPointers.sol to relative ../src/ paths; grep confirms zero bare src/-style imports remain repo-wide and forge build is green.

thedavidmeister and others added 4 commits July 10, 2026 09:23
BuildPointers.sol keeps main's PARSE_META_BUILD_DEPTH source (the
generated pointers file) in this branch's relative-path style; the
registry test keeps main's expanded import set, relative. Converts the
two bare src/ imports main introduced in
FlareFtsoWords.wordOpcodeAlignment.t.sol so the category (no bare
first-party imports) stays complete.

Co-Authored-By: Claude <noreply@anthropic.com>
Import-block conflicts in LibDineroFlrEth.t.sol and
LibSceptreStakedFlare.t.sol: kept the branch's relative import style
applied to main's superset of imports (new zero-rate guard test
symbols from main preserved).

Co-Authored-By: Claude <noreply@anthropic.com>
# Conflicts:
#	test/src/lib/flreth/LibDineroFlrEth.t.sol
#	test/src/lib/lts/LibFtsoV2LTS.t.sol
#	test/src/lib/registry/LibFlareContractRegistry.t.sol
#	test/src/lib/sflr/LibSceptreStakedFlare.t.sol
@thedavidmeister thedavidmeister added ai:ready AI vetter: passes review, ready for human decision and removed human:needs-work Human reviewer: needs rework labels Jul 16, 2026
@thedavidmeister

Copy link
Copy Markdown
Collaborator Author

🤖 ai:vetter
Reviewed bd4cc3d: ready — closes #99 — human-directed rework executed: script/ bare imports converted (correct ../src/ depth); grep verifies zero bare src//test//script/ imports repo-wide, category fully covered per the human carrier-pick note
cost 127 — mechanical import conversion, grep-verified

@thedavidmeister

Copy link
Copy Markdown
Collaborator Author

🤖 ai:vetter
Reviewed 87739d2: ready — re-vet at 87739d2 after merge-update: closes #99 — grep confirms zero bare src//test//script/ imports repo-wide, all relative depths resolve to existing files (test/fork/* verified), diff is import-lines only, category fully covered per the human carrier-pick rework note
cost 120 — mechanical import conversion, grep-verified

@thedavidmeister thedavidmeister added ai:blocked-on AI producer: blocked on a dependency PR and removed ai:ready AI vetter: passes review, ready for human decision labels Jul 28, 2026
@thedavidmeister

Copy link
Copy Markdown
Collaborator Author

🤖 ai:producer
Blocked-on: Blocked on rainlanguage/rainix#289 (fork-RPC failover preflight), which is now ai:design pending a human ruling. This diff only rewrites test imports from bare src/ and test/ paths to relative ones, so it cannot change fork behaviour. 82 of 85 tests pass; the 3 failures are all upstream RPC faults: EVM error; database error: failed to get storage for 0xdBF71d7840934EB82FA10173103D4e9fd4054dd1 with HTTP error 500, Temporary internal error. Please retry, code 19 (testFtsoV2LTSGetFeed, testFtsoV2LTSGetFeedTimeoutZeroExactNotStale, testFtsoRegistryGetFtsoBySymbolMajors). The archive-aware, 3-consecutive-pass preflight in rainix#289 is what routes around an unhealthy endpoint. Goes green once that lands on rainix main.

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

Labels

ai:blocked-on AI producer: blocked on a dependency PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[F48] [LOW] Tests use bare src/ and test/ root-relative imports that break under git-submodule consumption

1 participant