jackwener / jackwener/OpenCLI

[autofix] reddit/hot: EMPTY_RESULT

Open Beginner friendly
#2,485 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
29.3k
Forks
2.9k
Avg merge
15h 36m
Merged PRs (30d)
70

Description

## Summary
OpenCLI autofix repaired this adapter locally, and the retry passed.

## Adapter
- Site: `reddit`
- Command: `hot`
- OpenCLI version: `1.8.7`

## Original failure
- Error code: `EMPTY_RESULT`

~~~
opencli reddit hot --limit 3 -> []
~~~

The command exits 0 and returns an empty array. No error is raised, so
`--trace retain-on-failure` produces no artifact at all: the silent empty
result bypasses the entire diagnostic toolchain.

## Root cause
Reddit now returns an empty Listing (`dist: 0`) for the global frontpage JSON
endpoints. Verified by loading each endpoint directly in a browser tab and
reading the payload:

| endpoint | `dist` | result |
|---|---|---|
| `/hot.json` | 0 | empty |
| `/.json` | 0 | empty |
| `/best.json` | 0 | empty |
| `/r/popular/hot.json` | 3 | OK |
| `/r/all/hot.json` | 3 | OK |
| `/r//hot.json` | 3 | OK |

`clis/reddit/hot.js` used `/hot.json` for the frontpage branch, so the
frontpage path silently returned `[]` while the `--subreddit` path kept working.

## Local fix summary

~~~
Frontpage path changed from '/hot.json' to '/r/popular/hot.json', and explicit
guards added: non-ok HTTP, non-Listing payloads, and empty listings now throw
instead of returning [] (the empty case names dist= and points at
--subreddit/popular).
~~~

## Verification
- `opencli reddit hot --limit 3` -> real posts (rank/title/score/comments/media)
- `opencli reddit hot --subreddit LocalLLaMA --limit 2` -> still OK
- `opencli validate reddit` -> PASS (21 commands, 0 errors, 0 warnings)
- `node scripts/check-silent-column-drop.mjs` -> no new violations

_Issue filed by OpenCLI autofix after a verified local repair._

Contributor guide

Open the contributing guide

Research direction

Start in clis/reddit/hot.js and reproduce the empty frontpage result with `opencli reddit hot --limit 3`; compare the frontpage and subreddit branches with the endpoint behavior documented here. Verify that failures and empty listings no longer pass silently, then run `opencli validate reddit` and `node scripts/check-silent-column-drop.mjs`; done means frontpage and subreddit commands return real results without new validation violations.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.