Skip to content

v0.4.4

@Averyy Averyy tagged this 30 Jul 13:25
A cold anonymous bootstrap that failed was unobservable. All five failure
exits in _reddit_bootstrap_on_client logged at debug with no response
detail, and two of them shared one identical string, so a consumer could
see that the bootstrap ran and produced nothing and nothing else. A
fetchaller deployment hit exactly that: six consecutive CI runs where
every Reddit read came back gated, with no way to tell whether Reddit
served a non-2xx verification page, an unparseable one, or one that set
no cookies.

Each exit now logs one warning carrying the branch, the HTTP status, the
URL actually requested, the body length, and the Set-Cookie names
observed. A failed anonymous setup is not routine, and warning is also
the level Python's lastResort handler emits with no logging configured at
all, so these land in a container log without the consumer shipping
anything. The two branches that shared a string are now three distinct
ones (body over the 32 KiB cap, body not UTF-8, parser found no form),
and the transport branch names the exception type.

The logging respects the rule it was written under: the solved submission
URL never appears, since its query carries the verification token and its
solution. The submission lines log verification.action_url, which the
parser validates to the fixed origin, and cookie names are sorted,
bounded, and token-filtered before reaching a log line. Values, tokens,
and exc_info stay out.

session.reddit_bootstrap_state() exposes the same information
programmatically: attempts, successes, the last inline and browser
outcomes, the status and cookie names behind them, and the seconds the
last browser recovery was granted. Inline and browser outcomes are
separate fields because a single one would be overwritten by the
fallback, losing the inline reason. cookie_names and has_cookie_evidence
are read from the live jar, so a warm cache_dir reports evidence before
any request is made; that was the one question cookie_scope_summary()
could not answer, and the reason a consumer had to monkeypatch
_reddit_bootstrap_on_client and read _cookie_scopes and
_client.cookie_jar to get any of this.

A browser recovery that starts with no budget left is now labeled
no_time_budget rather than counted as a browser that tried and failed,
and the granted budget is reported either way: a recovery given two
seconds cannot load Reddit's root, which is indistinguishable from a
blocked browser without the number. The async path labels an attempt
abandoned by a concurrent client rotation, so an incremented attempt
count can no longer sit next to a stale outcome.

Live-verified against real Reddit on cold anonymous sessions: a listing
read and a search read each detect the gate, bootstrap, and replay to a
200 with inline_solves=1, and a second process on a warm cache serves the
request with no bootstrap at all.
Assets 2
Loading