admin docs: hide phantom prepared-filing PDF for non-form services

The dot-compliance-remediation pipeline seeds filing_status.pdf_minio_path on
every order in a batch, but only MCS-150-producing slugs (mcs150-update,
dot-registration, usdot-reactivation, dot-full-compliance) ever generate it.
For admin-assisted services like UCR it was a phantom 'Prepared filing PDF /
not generated yet' row. Gate the prepared-filing artifacts on FORM_PRODUCING_SLUGS
(mirrors the worker's MCS150_FORM_SLUGS) and give the empty state a clearer
explanation.
This commit is contained in:
justin 2026-06-16 02:35:29 -05:00
parent d18de006d8
commit c8e0065729
2 changed files with 24 additions and 4 deletions

View file

@ -611,6 +611,18 @@ router.post("/api/v1/admin/compliance-orders/:order_number/rearm-intake", requir
const WORKER_URL_ADMIN = process.env.WORKER_URL || "http://workers:8090";
// Slugs that actually generate an MCS-150 PDF (mirrors MCS150_FORM_SLUGS in
// scripts/workers/services/mcs150_update.py). Other admin-assisted DOT services
// routed to the same handler (UCR, MC authority, audit prep, ETA, etc.) never
// produce that form, even though the shared filing_status carries a phantom
// pdf_minio_path.
const FORM_PRODUCING_SLUGS = new Set<string>([
"mcs150-update",
"dot-registration",
"usdot-reactivation",
"dot-full-compliance",
]);
/** Ask the worker for a presigned (internal minio:9000) GET URL. */
async function presignInternal(key: string): Promise<string | null> {
if (!key) return null;
@ -641,16 +653,24 @@ async function collectOrderDocuments(orderNumber: string): Promise<Array<{ label
// 1. Order row: intake_data filing artifacts + per-order document columns.
const ord = await pool.query(
`SELECT intake_data, engagement_letter_minio_key, rmd_packet_minio_paths
`SELECT service_slug, intake_data, engagement_letter_minio_key, rmd_packet_minio_paths
FROM compliance_orders WHERE order_number = $1`,
[orderNumber],
);
if (ord.rows.length) {
const o = ord.rows[0];
const slug = (o.service_slug as string) || "";
const intake = (o.intake_data && typeof o.intake_data === "object" ? o.intake_data : {}) as Record<string, any>;
const fs = (intake.filing_status && typeof intake.filing_status === "object" ? intake.filing_status : {}) as Record<string, any>;
add("Prepared filing PDF", fs.pdf_minio_path);
add("Attested PDF (faxed)", fs.attested_pdf);
// The shared dot-compliance-remediation pipeline seeds a filing_status with a
// template pdf_minio_path on EVERY order in a batch, but only services that
// actually produce an MCS-150 form ever generate that PDF. For admin-assisted
// services (UCR, MC authority, audit prep, etc.) it's a phantom that never
// exists, so only surface the prepared-filing artifacts for form producers.
if (FORM_PRODUCING_SLUGS.has(slug)) {
add("Prepared filing PDF", fs.pdf_minio_path);
add("Attested PDF (faxed)", fs.attested_pdf);
}
add("Confirmation screenshot", fs.screenshot_path);
if (fs.evidence && typeof fs.evidence === "object") {
for (const [k, v] of Object.entries(fs.evidence as Record<string, any>)) {