Hub view counts fail for unknown entity IDs
- Dominant language
- Scala
- Stars
- 314
- Forks
- 187
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 214
Description
### Feature Summary
The public hub counts GET endpoint inserts a zero row when an entity has no stored view count. For an unknown workflow or dataset ID, that read-side insert violates the view-count foreign key and returns 500. Other missing counts already return zero without writing.
Before: unknown ID view count -> insert zero row -> foreign-key failure -> 500
After: unknown ID view count -> return zero without writing -> 200
Reproduction evidence:
1. Run the current main branch locally.
2. Request hub counts for workflow ID 2147483647 with action type view.
3. Observe HTTP 500 and a workflow view-count foreign-key violation.
4. Repeat with action type like and observe HTTP 200 with a zero count.
5. The same view request for an unknown dataset ID also returns 500.
Version and commit evidence:
1.3.0-incubating-SNAPSHOT (main)
**Commit Hash**
98588bf2ab49aac65ebf002496eb057670e6fc07
**Relevant log output**
insert into workflow_view_count (wid, view_count) values (?, ?)
ERROR: insert or update on table workflow_view_count violates foreign key constraint workflow_view_count_wid_fkey
Detail: Key (wid)=(2147483647) is not present in table workflow.
### Proposed Solution or Design
After: unknown ID view count -> return zero without writing -> 200
### Affected Area
Workflow Engine (Amber)
Contributor guide
Assessment
This issue has not been assessed yet.