Skip to content

fix(api): return the user's own submissions from GET /submissions - #110

Open
deep60 wants to merge 2 commits into
mainfrom
fix/list-own-submissions
Open

deep60 wants to merge 2 commits into
mainfrom
fix/list-own-submissions

Conversation

@deep60

@deep60 deep60 commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Submitting a file or URL returned 200 and an id, then the item vanished from the dashboard and marketplace.

Cause: create_file_submission writes to submissions (what a user uploads) but list_submissions delegated to get_submissions, which reads bounty_submissions (an analyst's verdict on a bounty). Two different tables — user uploads were returned by no list endpoint at all.

Verified against the live deployment: after submitting, gateway.submissions held 1 row while GET /submissions returned {"submissions":[]}.

Fix: returns the caller's own submissions, newest first, as a flat camelCase array. Both details match what the client already expects — marketplace.tsx declares useQuery<ApiSubmission[]>, and queryClient.ts does no unwrapping, so the old envelope arrived where an array was required. status and analysisStatus are both emitted since ApiSubmission reads each in different places.

Scoped to the authenticated submitter — the route is in the strict-auth group and returning other users' uploads would leak filenames and descriptions. A public marketplace feed should be a separate endpoint with its own field allowlist.

Compile-verified: build-images.yml run 32370570962, api-gateway job success.

deep60 added 2 commits August 20, 2026 18:16
`create_file_submission` writes to the `submissions` table (what a user
uploads), but `list_submissions` delegated to `get_submissions`, which reads
`bounty_submissions` (an analyst's verdict against a bounty). Two different
tables, two different meanings. The result was that anything a user submitted
was returned by no list endpoint at all: submit a file, get a 200 and an id,
then watch it vanish from the dashboard and marketplace.

Verified against the live deployment - after submitting, gateway.submissions
held 1 row while GET /submissions returned {"submissions":[]} from
bounty_submissions.

Now returns the caller's own submissions, newest first, as a flat camelCase
array. Both details match what the client already expects:
marketplace.tsx declares useQuery<ApiSubmission[]>, and the default fetcher in
queryClient.ts does no unwrapping, so the previous envelope object arrived
where an array was required. `status` and `analysisStatus` are both emitted
because ApiSubmission reads each in different places.

Scoped to the authenticated submitter - the route is in the strict-auth group
and returning other users' uploads would leak filenames and descriptions.

analysisType/bountyAmount/priority/description are lifted out of the row's
metadata JSON, which is where create_file_submission puts them.
Rust CI has failed on main for the last four runs, so every PR inherits a red
`build` check. Both errors are `-D warnings` promotions from a newer clippy and
are unrelated to any recent change:

  api-gateway/src/handlers/websocket.rs:92
    useless conversion to the same type: `String`  (drop `.into()`)

  analysis-engine/src/analyzers/static_analyzer.rs:707
    casting to the same type is unnecessary (`u32` -> `u32`)  (drop the cast)

Fixed here rather than in a separate PR because they block this one from
merging; neither file is otherwise touched by this branch.
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