Files
civitai__civitai/scripts
Zachary Lowden a75fb42290 fix(blocks): an unreadable post subject is no longer reported as "posting from apps is not enabled" (#4976)
`authorizeBlockPostRequest` passed an unhydratable session subject straight
into `isAppBlocksPostCreationEnabled({ user: subjectUser ?? undefined })` --
the no-entity arm. A segment-scoped rollout cannot match a no-entity eval, so
it answers false, and a failed identity read was rendered to the viewer as
"posting from apps is not enabled". Two different facts, one message, and only
one of them is about permission.

Refuse an unhydratable subject on its own terms before the flag is consulted,
matching the two sibling guards in this router family. The flag denial keeps
its message unchanged, so the two stay separable.

This does NOT widen who may post: an unreadable subject is still refused, and
a dedicated case pins that it is still refused under a base-enabled flag. It
also does not assert a mechanism for any particular production refusal -- a
subject carrying a stale isModerator and a transient flag-evaluation failure
produce the identical observable and neither is excluded.

- BlockPostRequestAuth.subjectUser is now non-nullable, so widening it back is
  a type error rather than a silent re-conflation.
- New counter civitai_app_block_post_subject_refusals_total{surface}, following
  the existing emitters in app-block-runtime.metrics.ts. A log line would not
  have worked: application-container logs are not collected for this
  deployment, which is why the original refusal was unattributable.
- Watchlisted as post-subject-refusal -- losing the branch to a bundler falls
  back to the no-entity arm, which returns the flag's BASE value.

Regression matrix (5 of 6 new cases): red at 85a3786116, green at HEAD.
The sixth, the flag-denial positive control, passes on both trees and is an
invariant guard, not regression coverage.
2026-09-19 11:33:40 -05:00
..
2026-06-04 15:58:33 -06:00