submitPost: preserve native-image submission receipts before hydration and async completion
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 32/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- api, backend-api-design
Hướng nghiên cứu
Start with the public RedditClient reference and the Post implementation in packages/reddit/src/models/Post.ts; trace submitPost through Submit and Info to understand when the receipt is exposed. Then review the media upload documentation for any existing completion contract. Done means the public API defines receipt and pending completion behavior, including created, rejected, unknown, and duplicate-completion outcomes without another Submit.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Could the public SDK expose the original native-image submission receipt independently of Post hydration, and provide a supported completion handle when media creation is asynchronous?
reddit.submitPost() currently returns Promise<Post>. Two paths can reject without exposing a structured post ID or pending handle to the caller:
- Submit returns no ID for an asynchronous image submission;
Post.submitthrows its asynchronous-creation message. - Submit returns an ID, but the SDK's subsequent Info/hydration request fails before the public promise resolves.
For a scheduled publisher, an unknown outcome must not be retried: the post may already exist. This report does not claim every image post fails, or that either mocked response proves Reddit accepted a particular native submission.
Versions and references
- Reproduced locally using the public SDK and RPC mocks from pinned Devvit 0.14.1.
- A separate source-only audit of the published 0.14.8 package found the same async no-ID branch and hydration-before-return behavior. That is not a native reproduction under 0.14.8; no dependency upgrade was performed.
- Public RedditClient reference
- Post implementation
- Published 0.14.1 package, 0.14.8 package
Minimal reproduction: local RPC mocks only
These are direct, supported image-only calls: no application adapter, image/body type suppression, real upload, or live post. Both cases were verified against the pinned SDK using @devvit/test.
import { createDevvitTest } from '@devvit/test/server/vitest';
import { reddit } from '@devvit/web/server';
import { expect, vi } from 'vitest';
const test = createDevvitTest({ subredditName: 'example_dev' });
const options = {
subredditName: 'example_dev',
title: 'SDK receipt reproduction',
kind: 'image' as const,
imageUrls: ['https://i.redd.it/example.png'] as [string],
runAs: 'APP' as const,
};
test('asynchronous no-ID response', async ({ mocks }) => {
const submit = vi.spyOn(mocks.reddit.linksAndComments.plugin, 'Submit')
.mockResolvedValue({ json: { data: {}, errors: [] } });
const info = vi.spyOn(mocks.reddit.linksAndComments.plugin, 'Info');
await expect(reddit.submitPost(options)).rejects.toThrow(
'is being created asynchronously'
);
expect(submit).toHaveBeenCalledTimes(1);
expect(info).not.toHaveBeenCalled();
});
test('Submit ID is not exposed before failed hydration', async ({ mocks }) => {
const submit = vi.spyOn(mocks.reddit.linksAndComments.plugin, 'Submit')
.mockResolvedValue({ json: { data: { id: 'abc123' }, errors: [] } });
const info = vi.spyOn(mocks.reddit.linksAndComments.plugin, 'Info')
.mockRejectedValue(new Error('Mock Info unavailable'));
await expect(reddit.submitPost(options)).rejects.toThrow(
'Mock Info unavailable'
);
expect(submit).toHaveBeenCalledTimes(1);
expect(info).toHaveBeenCalledTimes(1);
});
Separate native observation
A private scheduled image submission was recorded as uncertain without a returned post ID. Later read-only inspection found a candidate with the expected image and separate body. The original raw SDK exception/Submit response was not retained, so its precise failure branch and causal candidate binding are unknown. The occurrence remains protected; it was not retried or manually marked as an automatic pass.
This observation is separate from the deterministic mocked reproductions above.
Requested supported contract
- Return the original structured created-post ID before optional Info hydration, so an app can retain it and verify the post separately.
- If native media is pending without an ID, return a documented token with an authenticated completion operation/event tied to that original submission.
- Define created/pending/rejected/unknown and duplicate-completion behavior without another Submit.
The current media API returns an asset ID/URL and documents upload, not post completion. We found no current public receipt hook or pending-media completion contract. If a supported approach already exists, guidance would be appreciated; parsing exception strings, matching the newest post, internal plugin imports, or a second Submit are not safe substitutes for this use case.
- Ngôn ngữ chính
- TypeScript
- Star
- 217
- Fork
- 89
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của reddit/devvit
-
redis.expireTime() returns relative TTL seconds on live host instead of Unix timestamp secondsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
-
Bound concurrent filesystem reads during asset discovery and source ZIP generationCó thể đã có người làm @CR29-22-2805 đã nhận 138 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Tất cả issue của reddit/devvit
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
amosblomqvist/learnharness#1141 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
ranxianglei/billion-context#8319 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
tencent-connect/dsh-qqbot#148 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
JimLiu/open-artifact#126 ·
-
Claude Code: replace stub has no cut cue, a 6128 B Bash output reads as the one line `END6000`Đang mởbug repro-ready
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
mksglu/context-mode#1454 ·