feat(web): say what a pack was abandoned for
A pack that hard-failed at import blacklisted its release, put every episode back to missing and left the season reading 0/10, with nothing on screen joining the two. Every fact was already recorded. The blacklist now carries its reason out of the database: deck rows read `blacklisted · size` instead of a bare `blacklisted`, and say whether the policy turned the file down — relaxable for this title — or the release itself failed, which a retry only repeats. A season whose pack was abandoned says so on its row and above its deck, with the release name, when it failed, and what it failed on. A row the blacklist no longer answers for keeps rendering and claims no reason. Two defects from the integration review of #211 sit in the same code and are fixed here: a waived row threw away the rule it now carries and read a bare `below policy`, and the empty-eligible count called every waived row force-grabbable, since #211 gave those rows the rule `overridable` reads. Verified against a real browser: series detail, both season decks and their buckets, at 1280 and 390 px. Refs #227, #211
This commit is contained in:
+117
-13
@@ -34,6 +34,9 @@ import {
|
||||
} from "./queues";
|
||||
import {
|
||||
type ActionOutcome,
|
||||
blacklistAdvice,
|
||||
blacklistClass,
|
||||
blacklistReasonLabel,
|
||||
bucketOf,
|
||||
type FilesOutcome,
|
||||
formatAudio,
|
||||
@@ -46,12 +49,14 @@ import {
|
||||
formatSource,
|
||||
formatSweepAge,
|
||||
grabRelease,
|
||||
type ImportFailure,
|
||||
libraryFolder,
|
||||
type MovieRelease,
|
||||
movieFiles,
|
||||
movieReleases,
|
||||
movieSearchState,
|
||||
overridable,
|
||||
type PackStateOutcome,
|
||||
probedAttributeTags,
|
||||
queueSearch,
|
||||
removeMovie,
|
||||
@@ -2237,7 +2242,14 @@ function paintBuckets(dom: BucketsDom, releases: MovieRelease[], actions: Releas
|
||||
// §9.3: over-strict filters must be visible, not silently absent — and
|
||||
// where a rule can be waived, the count says so rather than leaving the
|
||||
// way out folded inside a collapsed bucket.
|
||||
const forceable = releases.filter(overridable).length;
|
||||
//
|
||||
// Only a rejected row needs forcing. A row below policy is offered
|
||||
// already, one click, whatever its rule — and since #211 gave it a rule
|
||||
// at all, counting every overridable row here claimed the whole
|
||||
// collapsed deck had to be forced.
|
||||
const forceable = releases.filter(
|
||||
(release) => bucketOf(release) === "rejected" && overridable(release),
|
||||
).length;
|
||||
const none = document.createElement("li");
|
||||
none.className = "rel rel-none readout dim";
|
||||
none.textContent =
|
||||
@@ -2379,20 +2391,36 @@ function releaseRow(
|
||||
}),
|
||||
);
|
||||
}
|
||||
// #227: a blacklisted release was grabbed, downloaded and condemned at
|
||||
// import. Which of the two things happened decides what the operator does
|
||||
// next, and `blacklisted` alone reads the same for both.
|
||||
const blacklisted =
|
||||
bucket === "rejected" && release.rejected_rule === "blacklisted"
|
||||
? blacklistClass(release.blacklist_reason)
|
||||
: null;
|
||||
if (bucket !== "eligible") {
|
||||
// A rejected row always names its rule; a waived one cannot — the
|
||||
// `releases` CHECK allows `rejected_rule` only on a rejection. So a
|
||||
// waived row says the plainer thing the operator can act on, "below
|
||||
// policy", rather than the name the record keeps for it.
|
||||
// §9.3: every row that is not eligible names the rule behind it, waived
|
||||
// and rejected alike — three waivers for three different reasons read
|
||||
// identically otherwise, and reading release names to tell them apart is
|
||||
// the Radarr defect this view exists to fix. #211 gave a waived row the
|
||||
// rule it relaxed; a row written before it still has none, and says the
|
||||
// plainer thing alone.
|
||||
const verdict =
|
||||
bucket === "waived"
|
||||
? "below policy"
|
||||
: release.rejected_rule
|
||||
? `rejected · ${ruleLabel(release.rejected_rule)}`
|
||||
: "rejected";
|
||||
? release.rejected_rule
|
||||
? `below policy · ${ruleLabel(release.rejected_rule)}`
|
||||
: "below policy"
|
||||
: blacklisted
|
||||
? `blacklisted · ${blacklistReasonLabel(release.blacklist_reason)}`
|
||||
: release.rejected_rule
|
||||
? `rejected · ${ruleLabel(release.rejected_rule)}`
|
||||
: "rejected";
|
||||
line.append(
|
||||
chip(verdict, (span) => {
|
||||
span.dataset.verdict = bucket;
|
||||
if (blacklisted) {
|
||||
span.dataset.blacklist = blacklisted;
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -2401,6 +2429,13 @@ function releaseRow(
|
||||
name.className = "rel-name readout";
|
||||
name.textContent = release.name;
|
||||
line.append(name);
|
||||
if (blacklisted) {
|
||||
const why = document.createElement("span");
|
||||
why.className = "rel-why readout";
|
||||
why.dataset.blacklist = blacklisted;
|
||||
why.textContent = blacklistAdvice(release.blacklist_reason);
|
||||
line.append(why);
|
||||
}
|
||||
item.append(line);
|
||||
|
||||
const note = document.createElement("span");
|
||||
@@ -2884,6 +2919,10 @@ function tvReleasesMain(): TvReleasesView {
|
||||
const sub = must<HTMLElement>("#tv-releases-sub");
|
||||
const sweep = must<HTMLButtonElement>("#tv-releases-sweep");
|
||||
const statusEl = must<HTMLElement>("#tv-releases-status");
|
||||
const failureEl = must<HTMLElement>("#tv-releases-failure");
|
||||
const failureRelease = must<HTMLElement>("#tv-failure-release");
|
||||
const failureWhat = must<HTMLElement>("#tv-failure-what");
|
||||
const failureNext = must<HTMLElement>("#tv-failure-next");
|
||||
const dom = buildBucketDom(must<HTMLElement>("#tv-buckets"));
|
||||
|
||||
let request: TvDeckRequest | null = null;
|
||||
@@ -2926,6 +2965,36 @@ function tvReleasesMain(): TvReleasesView {
|
||||
statusEl.dataset.action = "";
|
||||
}
|
||||
|
||||
/**
|
||||
* #227: the season's own history, above the candidates. A pack that
|
||||
* downloaded in full and was condemned at import (§5.7) blacklists the
|
||||
* release and puts every episode back to `missing`, which leaves the season
|
||||
* reading `0/10` as though nothing had ever been tried. It sits outside the
|
||||
* status line because it is a fact about the season, not about the request
|
||||
* in flight, and it has to survive a sweep that repaints the status.
|
||||
*/
|
||||
function paintFailure(failure: ImportFailure | null) {
|
||||
if (failure === null) {
|
||||
failureEl.hidden = true;
|
||||
return;
|
||||
}
|
||||
failureEl.dataset.blacklist = blacklistClass(failure.reason);
|
||||
failureEl.hidden = false;
|
||||
failureRelease.textContent =
|
||||
failure.failed_at === null
|
||||
? failure.release
|
||||
: `${failure.release} · ${formatSweepAge(failure.failed_at)}`;
|
||||
// A rule name reads as a preposition — "condemned on size"; a reason
|
||||
// written as a sentence has to be quoted, not conjugated.
|
||||
const on =
|
||||
blacklistClass(failure.reason) === "policy"
|
||||
? ` on ${blacklistReasonLabel(failure.reason)}`
|
||||
: "";
|
||||
const said = blacklistClass(failure.reason) === "release" ? `${failure.reason}. ` : "";
|
||||
failureWhat.textContent = `downloaded in full, then condemned at import${on} — ${said}every episode went back to missing and the release is blacklisted.`;
|
||||
failureNext.textContent = `${blacklistAdvice(failure.reason)}.`;
|
||||
}
|
||||
|
||||
const actions: ReleaseActions = {
|
||||
reload: () => load(),
|
||||
notify: (text, tone) => setStatus(text, tone),
|
||||
@@ -2969,9 +3038,17 @@ function tvReleasesMain(): TvReleasesView {
|
||||
setStatus(`releases unavailable — ${outcome.detail}`, "fault");
|
||||
return;
|
||||
}
|
||||
if (!paintBuckets(dom, outcome.releases, actions)) {
|
||||
const painted = paintBuckets(dom, outcome.releases, actions);
|
||||
// One read of the season's state, shared by the notice and the empty
|
||||
// verdict below — they answer two questions from the same row.
|
||||
const pack = await current.target.packState?.();
|
||||
if (ticket !== sequence || request !== current) {
|
||||
return;
|
||||
}
|
||||
paintFailure(pack?.kind === "state" ? pack.state.import_failure : null);
|
||||
if (!painted) {
|
||||
clearBuckets(dom);
|
||||
await emptyVerdict(current, ticket, sweepIfEmpty);
|
||||
await emptyVerdict(current, ticket, sweepIfEmpty, pack);
|
||||
return;
|
||||
}
|
||||
setStatus(null);
|
||||
@@ -2985,8 +3062,13 @@ function tvReleasesMain(): TvReleasesView {
|
||||
* answers the third; `last_pack_search_at` separates the first two, the
|
||||
* same way a movie's `last_searched_at` does (#177).
|
||||
*/
|
||||
async function emptyVerdict(current: TvDeckRequest, ticket: number, sweepIfEmpty: boolean) {
|
||||
const outcome = await current.target.packState?.();
|
||||
async function emptyVerdict(
|
||||
current: TvDeckRequest,
|
||||
ticket: number,
|
||||
sweepIfEmpty: boolean,
|
||||
known?: PackStateOutcome,
|
||||
) {
|
||||
const outcome = known ?? (await current.target.packState?.());
|
||||
if (ticket !== sequence || request !== current) {
|
||||
return;
|
||||
}
|
||||
@@ -3078,6 +3160,9 @@ function tvReleasesMain(): TvReleasesView {
|
||||
if (ticket !== sequence || request !== current) {
|
||||
return;
|
||||
}
|
||||
if (state?.kind === "state") {
|
||||
paintFailure(state.state.import_failure);
|
||||
}
|
||||
if (state?.kind === "state" && state.state.last_pack_search_at !== baseline) {
|
||||
sweep.disabled = false;
|
||||
await emptyVerdict(current, ticket, false);
|
||||
@@ -3150,6 +3235,7 @@ function tvReleasesMain(): TvReleasesView {
|
||||
next.returnTo.hidden = true;
|
||||
view.hidden = false;
|
||||
clearBuckets(dom);
|
||||
paintFailure(null);
|
||||
sweep.disabled = false;
|
||||
back.focus();
|
||||
void load(true);
|
||||
@@ -3554,6 +3640,24 @@ function seriesMain(tvDeck: TvReleasesView, views: HideableView[]): SeriesView {
|
||||
});
|
||||
|
||||
line.append(disclose, name, track, seasonCountsChip(season));
|
||||
// #227: the season the operator's report is about read `0/10` with
|
||||
// nothing saying a pack had been grabbed, downloaded in full and thrown
|
||||
// out at import. The counts chip beside this one is exactly the number
|
||||
// that looked like nothing was ever tried.
|
||||
const failure = season.import_failure;
|
||||
if (failure) {
|
||||
const kind = blacklistClass(failure.reason);
|
||||
const when = failure.failed_at === null ? "" : ` ${formatSweepAge(failure.failed_at)}`;
|
||||
const told = `a pack for this season downloaded in full and failed at import${when} — ${failure.release} · ${blacklistAdvice(failure.reason)}`;
|
||||
line.append(
|
||||
chip(`import failed · ${blacklistReasonLabel(failure.reason)}`, (span) => {
|
||||
span.dataset.flag = "import-failed";
|
||||
span.dataset.blacklist = kind;
|
||||
span.title = told;
|
||||
span.setAttribute("aria-label", told);
|
||||
}),
|
||||
);
|
||||
}
|
||||
// The season-level twin of the episode flag above: gone upstream while
|
||||
// files under it remained.
|
||||
if (season.vanished) {
|
||||
|
||||
Reference in New Issue
Block a user