Skip to content

Replace symlinked VERSION.txt with pytest fixture in test config#347

Merged
jordanpadams merged 3 commits intomainfrom
fix/remove-symlinked-version-txt
Mar 26, 2026
Merged

Replace symlinked VERSION.txt with pytest fixture in test config#347
jordanpadams merged 3 commits intomainfrom
fix/remove-symlinked-version-txt

Conversation

@jordanpadams
Copy link
Copy Markdown
Member

@jordanpadams jordanpadams commented Mar 18, 2026

🗒️ Summary

Removes the double-hop symlink tests/pds/ingress/service/config/VERSION.txt and replaces it with a session-scoped pytest fixture that copies the canonical src/pds/ingress/VERSION.txt into the test config directory at test-session start.

The symlink was confusing roundup-action's TextFileDetective.locate_file(), which uses os.walk with a break that only exits the inner loop — so the last VERSION.txt found (the symlink) was being passed to commit(), causing git to stage the symlink path instead of the real file. See NASA-PDS/roundup-action#166 for the companion fix in roundup-action itself.

🤖 AI Assistance Disclosure

  • No AI assistance used
  • AI used for light assistance (e.g., suggestions, refactoring, documentation help, minor edits)
  • AI used for moderate content generation (AI generated some code or logic, but the developer authored or heavily revised the majority)
  • AI generated substantial portions of this code

Estimated % of code influenced by AI: 60%

⚙️ Test Data and/or Report

All 32 unit tests pass with the fixture in place:

pytest
...
tests/pds/ingress/service/test_pds_ingress_app.py ......   [ 18%]
tests/pds/ingress/service/test_pds_status_app.py ...       [ 28%]
tests/pds/ingress/util/test_auth_util.py ..                [ 34%]
tests/pds/ingress/util/test_backoff_util.py ..             [ 40%]
tests/pds/ingress/util/test_config_util.py ........        [ 65%]
tests/pds/ingress/util/test_log_util.py ...                [ 75%]
tests/pds/ingress/util/test_path_util.py .....             [ 90%]
tests/pds/ingress/util/test_report_util.py ...             [100%]

32 passed in 31.07s

test_get_dum_version continues to assert that the version read from config/VERSION.txt matches __version__, confirming the fixture keeps them in sync.

♻️ Related Issues

Fixes NASA-PDS/roundup-action#166

🤓 Reviewer Checklist

Reviewers: Please verify the following before approving this pull request.

Documentation and PR Content

  • Documentation: README, Wiki, or inline documentation (Sphinx, Javadoc, Docstrings) have been updated to reflect these changes.
  • Issue Traceability: The PR is linked to a valid GitHub Issue
  • PR Title: The PR title is "user-friendly" clearly identifying what is being fixed or the new feature being added, that if you saw it in the Release Notes for a tool, you would be able to get the gist of what was done.

Security & Quality

  • SonarCloud: Confirmed no new High or Critical security findings.
  • Secrets Detection: Verified that the Secrets Detection scan passed and no sensitive information (keys, tokens, PII) is exposed.
  • Code Quality: Code follows organization style guidelines and best practices for the specific language (e.g., PEP 8, Google Java Style).

Testing & Validation

  • Test Accuracy: Verified that test data is accurate, representative of real-world PDS4 scenarios, and sufficient for the logic being tested.
  • Coverage: Automated tests cover new logic and edge cases.
  • Local Verification: (If applicable) Successfully built and ran the changes in a local or staging environment.

Maintenance

  • Backward Compatibility: Confirmed that these changes do not break existing downstream dependencies or API contracts (or that breaking changes are clearly documented).

The symlinked tests/pds/ingress/service/config/VERSION.txt was confusing
roundup-action's TextFileDetective, which walks src/ for VERSION.txt files
but only breaks the inner loop -- causing the last found path (a symlink)
to be committed instead of the canonical file.

Replace the symlink with a conftest.py fixture that copies the real
src/pds/ingress/VERSION.txt into the test config dir at session start,
keeping the version always in sync without introducing symlinks.

Fixes: NASA-PDS/roundup-action#166

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jordanpadams jordanpadams requested a review from a team as a code owner March 18, 2026 20:12
Copy link
Copy Markdown
Member

@nutjob4life nutjob4life left a comment

Choose a reason for hiding this comment

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

Delta: ✓
Tox: ✓
Approval: ✅
Tox details:

  py313: OK (34.00=setup[1.26]+cmd[32.75] seconds)
  docs: OK (1.16=setup[0.49]+cmd[0.67] seconds)
  lint: OK (2.65=setup[0.01]+cmd[2.65] seconds)
  congratulations :) (37.88 seconds)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes a confusing symlinked VERSION.txt from the test configuration and replaces it with a pytest session fixture that syncs the test config’s VERSION.txt from the canonical package version file, reducing the chance that tooling (e.g., roundup-action) interacts with symlink paths.

Changes:

  • Added a session-scoped, autouse pytest fixture to copy src/pds/ingress/VERSION.txt into the test config directory.
  • Replaced the symlinked tests/.../config/VERSION.txt with a regular text file.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/pds/ingress/service/conftest.py Adds a session autouse fixture to copy the canonical VERSION file into the test config directory.
tests/pds/ingress/service/config/VERSION.txt Replaces a symlink with a real version file content.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

jordanpadams and others added 2 commits March 26, 2026 15:49
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@jordanpadams jordanpadams merged commit bd60ef4 into main Mar 26, 2026
2 checks passed
@jordanpadams jordanpadams deleted the fix/remove-symlinked-version-txt branch March 26, 2026 23:30
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.

TextFileDetective does not skip symlinked VERSION.txt files, causing incorrect version file to be committed

3 participants