Skip to content

chore: add test coverage for GitHub image ingestion on task import - #7313

Open
superplanehq-integration[bot] wants to merge 2 commits into
mainfrom
feat/task-file-workspace-import-test
Open

superplanehq-integration[bot] wants to merge 2 commits into
mainfrom
feat/task-file-workspace-import-test

Conversation

@superplanehq-integration

@superplanehq-integration superplanehq-integration Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

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

ImportFactoryIntakeItem copies image bytes from a GitHub issue body into workspace storage through storedfiles.IngestRemoteImages, using the intake source's optional RemoteFetch method. The existing intake tests use a stub source that does not implement RemoteFetch, 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, in pkg/grpc/actions/factories/search_factory_intake_items_test.go. The test builds a stub intake source that implements RemoteFetch and returns a fake PNG image, imports a GitHub issue whose body links to a user-images.githubusercontent.com image, and asserts that the saved task: no longer contains the original external image URL, has one file record with content type image/png and 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 ImportFactoryIntakeItem and 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, and gofmt -l on the changed file. No production code changed; only the test file was updated.


Created via SuperPlane.

RetriggerView in Greptile

The PR appears safe to merge.

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>
@superplanehq-integration

Copy link
Copy Markdown
Contributor Author

👋 Commands for maintainers:

  • /sp start - Start an ephemeral machine (takes ~30s)
  • /sp stop - Stop a running machine (auto-executed on pr close)

@superplanehq-integration

Copy link
Copy Markdown
Contributor Author

Maintainers: comment /deploy-storybook to get a Storybook link for this PR.

Comment thread pkg/grpc/actions/factories/search_factory_intake_items_test.go
Signed-off-by: SuperPlane Agent <superplaneagent@superplane.com>
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.

1 participant