chore: add test coverage for GitHub image ingestion on task import - #7313
Open
superplanehq-integration[bot] wants to merge 2 commits into
Open
superplanehq-integration[bot] wants to merge 2 commits into
superplanehq-integration[bot] wants to merge 2 commits into
Conversation
Tasks: Store files on workspace (issue #7108) was already implemented and merged in #7234: the editor supports attaching files, and ImportFactoryIntakeItem copies GitHub-hosted image bytes into workspace storage via storedfiles.IngestRemoteImages so private-repo images keep rendering. That specific behavior had no coverage: the existing intake tests use a stub source that doesn't implement the optional RemoteFetch interface, so the image-copy branch in ImportFactoryIntakeItem was never exercised. Add a stub that implements RemoteFetch and a test asserting that a GitHub-hosted image URL in an imported issue body is replaced with a stored sp-file:// reference backed by a real file record. Verified this test fails (0 files copied, original URL still present) when the ingestion branch is disabled, confirming it actually exercises the behavior it documents. Signed-off-by: SuperPlane Agent <superplaneagent@superplane.com> Co-authored-by: Pedro Foresti Leão <pedro@superplane.com>
Contributor
Author
|
👋 Commands for maintainers:
|
Contributor
Author
|
Maintainers: comment |
Signed-off-by: SuperPlane Agent <superplaneagent@superplane.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUPER-82
Summary
This change adds a missing test for a feature that is already live on
main. Issue #7108, "Tasks: Store files on workspace," was already implemented and merged in PR #7234. Task descriptions can already hold uploaded files and images, and the GitHub task import already copies image bytes into workspace storage so private-repo images keep rendering. This PR does not change that behavior. It adds a test that proves the GitHub import path works, because that path had no direct test coverage.Why this is needed
ImportFactoryIntakeItemcopies image bytes from a GitHub issue body into workspace storage throughstoredfiles.IngestRemoteImages, using the intake source's optionalRemoteFetchmethod. The existing intake tests use a stub source that does not implementRemoteFetch, so that code path never ran in a test. A regression in this logic would not show up in the test suite.API (tests only)
Added a new test case,
Test__ImportFactoryIntakeItem/copies_GitHub-hosted_images_into_workspace_storage, inpkg/grpc/actions/factories/search_factory_intake_items_test.go. The test builds a stub intake source that implementsRemoteFetchand returns a fake PNG image, imports a GitHub issue whose body links to auser-images.githubusercontent.comimage, and asserts that the saved task: no longer contains the original external image URL, has one file record with content typeimage/pngand a working download URL, and has its description rewritten to reference the stored file (sp-file://<id>).I confirmed this test is effective by temporarily disabling the image-copy branch in
ImportFactoryIntakeItemand re-running the test: it failed as expected. I then restored the code and confirmed the test passes.Testing
Ran
make test PKG_TEST_PACKAGES="./pkg/grpc/actions/factories",make lint, andgofmt -lon the changed file. No production code changed; only the test file was updated.Created via SuperPlane.
The PR appears safe to merge.