From 4ef21c5c0d78c243392a0a62116ba196f457495a Mon Sep 17 00:00:00 2001 From: Robert Douglas <57234112+realrobertdouglas@users.noreply.github.com> Date: Wed, 2 Dec 2026 13:10:41 -0600 Subject: [PATCH 01/21] =?UTF-8?q?v2.9190=20=E2=80=94=20Lien=20desk:=20the?= =?UTF-8?q?=20county's=20stamp=20goes=20on=20the=20lien=20you=20pressed=20?= =?UTF-8?q?(findings=20808=20and=20813,=20punch=20list=20#479=20step=201)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every door to the Release of record tab carried the job, not the lien. The Payoffs row and the day's run now hand the lien's id, the tab opens on it, and the tab holds the lien it stands on after Recorded on is kept. Co-Authored-By: Claude Fable 5.2 --- docs/LIEN_DESK_ARCHITECTURE.md | 4 ++ docs/recent-features/v2.9190.md | 31 +++++++++++++++ .../LienFilingTabs.release.render.test.tsx | 39 +++++++++++++++++++ src/components/jobs/LienFilingTabs.tsx | 14 ++++++- src/components/jobs/LienInstrumentsModal.tsx | 4 ++ .../jobs/LienPayoffs.render.test.tsx | 3 +- src/components/jobs/LienPayoffs.tsx | 14 ++++--- .../jobs/LienRunReleases.render.test.tsx | 2 +- src/components/jobs/LienRunReleases.tsx | 4 +- .../release-a-filed-lien-after-it-is-paid.md | 2 +- src/content/releaseNotes/v2.9190.ts | 15 +++++++ src/lib/jobs/lienReleaseOfRecord.test.ts | 15 +++++++ src/lib/jobs/lienReleaseOfRecord.ts | 14 +++++-- src/pages/LienDeskPage.tsx | 7 ++-- 14 files changed, 150 insertions(+), 18 deletions(-) create mode 100644 docs/recent-features/v2.9190.md create mode 100644 src/content/releaseNotes/v2.9190.ts diff --git a/docs/LIEN_DESK_ARCHITECTURE.md b/docs/LIEN_DESK_ARCHITECTURE.md index 88ec9dfc1d..ec997827d7 100644 --- a/docs/LIEN_DESK_ARCHITECTURE.md +++ b/docs/LIEN_DESK_ARCHITECTURE.md @@ -727,6 +727,10 @@ last_updated: 2026-12-01 > The stamp is two `ChangeableValue`s, and each Keep is one update of the release row through `keepReleaseStamp`. > A saved release prints from its own saved fields, and a lien with a release draws no save press. > The tab's six render tests are `LienFilingTabs.release.render.test.tsx`. +> **v2.9190 (a door names its lien, findings 808 and 813):** `pickReleaseTarget` takes a third value, the lien the door named, read after the lien the tab holds and before the rule. +> The doors are a lien's row in Payoffs and a release's line on the day's run: each `onOpenRelease` hands the job and its `affidavitId`, `LienDeskPage` keeps it as `releaseLienId` on the window it opens, and `LienInstrumentsModal` hands it to `LienFilingTabs`. +> The tab holds the lien it stands on: an effect writes the picked lien's id into `releaseTargetId`, so a release the county has just recorded no longer hands the tab to the job's other lien. +> A door that names no lien (the Accounts Receivable chip, a deep link, the head's step) leaves the rule to pick, as before. > **v2.8510 (one check over many bills, piece 3):** `PayoffsWindow` holds `checkKey`, and a place whose liened jobs still have an open bill hands `PlaceCard` an `onCheck`, the press *One check for this place ›*. > [`LienPayoffCheck`](../src/components/jobs/LienPayoffCheck.tsx) then stands in for the list, with three inputs for the check, a `ChangeableValue` for what each bill gets, three totals, the sentence and the batch press. > Its rule is [`lienPayoffCheck.ts`](../src/lib/jobs/lienPayoffCheck.ts), whose `checkBills`, `spreadCheck` and `checkPlan` are held by 14 tests. diff --git a/docs/recent-features/v2.9190.md b/docs/recent-features/v2.9190.md new file mode 100644 index 0000000000..58673ec0b5 --- /dev/null +++ b/docs/recent-features/v2.9190.md @@ -0,0 +1,31 @@ +# v2.9190 — Lien desk: the county’s stamp goes on the lien you pressed (2026-12-02) + +Findings 808 and 813 of run 17, step 1 of punch list #479 (the release road's faults). Client only. No migration, no function change, nothing owed on prod. Both faults were read in the code and never seen in a browser: no job on prod has two filed liens with a release each today. + +## What was wrong + +- **808.** Every door to the Lien window's **Release of record** tab carried the job and not the lien. On a job with two filed liens that each have a saved release, **Record the county’s stamp ›** on the second lien's Payoffs row opened the tab on the first lien. The day and the number were then kept on the wrong release. +- **813.** The tab chose its lien again on every draw: the lien picked under **Which lien**, else the first whose release the county has not recorded, else the first. With nothing picked by hand, keeping **Recorded on** made that release a recorded one, and the rule handed the tab to the job's other lien before **Instrument number** was typed. + +## What changed + +- [`lienReleaseOfRecord.ts`](../../src/lib/jobs/lienReleaseOfRecord.ts): `pickReleaseTarget` takes a third value, the lien the door named. The order is the lien the tab holds, then the door's lien, then the rule as before. +- [`LienPayoffs.tsx`](../../src/components/jobs/LienPayoffs.tsx) and [`LienRunReleases.tsx`](../../src/components/jobs/LienRunReleases.tsx): `onOpenRelease` hands the job and the row's `affidavitId`. Both rows already held it. +- [`LienDeskPage.tsx`](../../src/pages/LienDeskPage.tsx) keeps it as `releaseLienId` on the window it opens, [`LienInstrumentsModal.tsx`](../../src/components/jobs/LienInstrumentsModal.tsx) hands it on, and [`LienFilingTabs.tsx`](../../src/components/jobs/LienFilingTabs.tsx) reads it in the pick. +- `LienFilingTabs.tsx` holds the lien it stands on: an effect writes the picked lien's id into `releaseTargetId`. A lien picked under **Which lien** still wins, and a lien that is voided or belongs to another job falls back to the door and then the rule. +- The guide [release a filed lien after it is paid](../../src/content/help/release-a-filed-lien-after-it-is-paid.md) says the press opens the tab on that lien. + +## Not in this change + +- A door that names no lien is left to the rule: the Accounts Receivable chip, a deep link, the Legal desk's **Record the release…** and the head's **Go to the release of record ›**. +- The window's head still reads one release for the whole job. That is finding 809, step 2 of the card. + +## Tests + +- `lienReleaseOfRecord.test.ts`: the door's lien, the held lien over the door, a door that names no lien of the job, and the held lien after its release is recorded. +- `LienFilingTabs.release.render.test.tsx`: the stamp's number is written to the release of the lien the door named. The door's lien is taken once the job's filings are read. The tab stays on its lien when the county's day arrives. +- `LienPayoffs.render.test.tsx` and `LienRunReleases.render.test.tsx`: each press hands the job and the lien. + +## Looks owed + +- None on a real lien: no job on prod has two filed liens. On the ZZ Test job, with the live-write slot: two filed liens with a saved release each, **Record the county’s stamp ›** on the second row, and the tab reads *Releasing: instrument #* with the second lien's number. Every row is voided after, each release before its affidavit. diff --git a/src/components/jobs/LienFilingTabs.release.render.test.tsx b/src/components/jobs/LienFilingTabs.release.render.test.tsx index 01ea39d39a..e1251b7fd7 100644 --- a/src/components/jobs/LienFilingTabs.release.render.test.tsx +++ b/src/components/jobs/LienFilingTabs.release.render.test.tsx @@ -338,6 +338,45 @@ describe('Release of record: a job with two filed liens', () => { }) }) +describe('Release of record: the tab opens on the lien its door named, and stays on it (findings 808 and 813)', () => { + const second = lien({ id: 'a2', recording_number: '2026-0500001', filed_at: '2026-11-16' }) + const releasing = () => [...document.querySelectorAll('div')].find((d) => d.children.length === 1 && d.firstElementChild?.textContent === 'Releasing:')?.textContent ?? '' + const ui = (over: Partial) => ( + {}} {...over} /> + ) + + it('keeps the county’s stamp on the release of the lien whose row was pressed', async () => { + // Both liens have a saved release. Left to pick, the tab takes the first: the second lien's stamp went onto the first's release. + draw({ job: paid(), releaseLienId: 'a2', filings: [lien() as never, second as never, release() as never, release({ id: 'r2', fields: { releasesFilingId: 'a2' } }) as never] }) + expect(releasing()).toContain('instrument #2026-0500001') + fireEvent.click(screen.getByRole('button', { name: /the release’s instrument number/ })) + fireEvent.change(screen.getByLabelText(/the release’s instrument number/), { target: { value: '2026-0431955' } }) + fireEvent.click(screen.getByRole('button', { name: 'Keep' })) + await waitFor(() => expect(writes.updates).toHaveLength(1)) + expect(writes.updates[0]).toMatchObject({ id: 'r2' }) + }) + + it('takes the door’s lien once the filings are read, and a lien picked on the tab after it', () => { + const rows = [lien() as never, second as never, release() as never, release({ id: 'r2', fields: { releasesFilingId: 'a2' } }) as never] + const view = renderWithProviders(ui({ releaseLienId: 'a2', filings: [lien({ id: 'old', job_id: 'job-9', recording_number: '2026-0300000' }) as never] })) + view.rerender(ui({ releaseLienId: 'a2', filings: rows })) + expect(releasing()).toContain('instrument #2026-0500001') + fireEvent.click(document.querySelectorAll('[data-lien-release-which] input[type="radio"]')[0]!) + expect(releasing()).toContain('instrument #2026-0412207') + }) + + it('stays on its lien when the county’s day is kept, with the instrument number still to type', () => { + // The first lien is released. The tab opens on the second, whose release is saved and not recorded. + const first = release({ filed_at: '2026-11-23' }) + const view = renderWithProviders(ui({ filings: [lien() as never, second as never, first as never, release({ id: 'r2', fields: { releasesFilingId: 'a2' } }) as never] })) + expect(releasing()).toContain('instrument #2026-0500001') + // Recorded on is kept on the second: every release is now recorded, and the rule alone went back to the first lien. + view.rerender(ui({ filings: [lien() as never, second as never, first as never, release({ id: 'r2', filed_at: '2026-11-24', fields: { releasesFilingId: 'a2' } }) as never] })) + expect(releasing()).toContain('instrument #2026-0500001') + expect(document.querySelector('[data-lien-release-saved]')!.textContent).toBe('Released. The county recorded it Nov 24.') + }) +}) + describe('Release of record: the head’s release step lands on the tab’s own work (finding 804)', () => { const lit = () => [...document.querySelectorAll('[data-landed]')].map((el) => Object.keys(el.dataset).filter((k) => k.startsWith('lienRelease'))) diff --git a/src/components/jobs/LienFilingTabs.tsx b/src/components/jobs/LienFilingTabs.tsx index e39dfba650..cfabea12e9 100644 --- a/src/components/jobs/LienFilingTabs.tsx +++ b/src/components/jobs/LienFilingTabs.tsx @@ -152,6 +152,7 @@ export default function LienFilingTabs({ onOpenDeskNotice, land = null, landRelease = null, + releaseLienId = null, headSlotRef, onServePrinted, onClose, @@ -182,6 +183,8 @@ export default function LienFilingTabs({ land?: (LienMailProofLanding & { at: number }) | null /** The head's release step was pressed (finding 804): land on the Release of record tab's own work, once for each press. `at` tells one press from the next. */ landRelease?: { at: number } | null + /** The filed lien the opener's press was made on (finding 808): the Release of record tab opens on that lien, not on the job's first. Absent, the tab picks. */ + releaseLienId?: string | null /** The Lien window's slot at the top of each paper's pane (Way 2 of finding 803): on a computer the window draws its steps' band and the papers' bar there, inside the paper's own scroll. */ headSlotRef?: (el: HTMLElement | null) => void /** The filed lien's copies went to the printer from this window's press. */ @@ -265,7 +268,16 @@ export default function LienFilingTabs({ ), [live], ) - const releaseTarget = pickReleaseTarget(releaseTargetList, releaseTargetId) + const releaseTarget = pickReleaseTarget(releaseTargetList, releaseTargetId, releaseLienId) + // The tab holds the lien it stands on (finding 813): a release the county has just recorded must not hand the tab to the job's other lien. + const releaseOnId = releaseTarget?.affidavit.id ?? null + // A door pressed on another lien while the tab is drawn moves it to that lien. + useEffect(() => { + if (releaseLienId) setReleaseTargetId(releaseLienId) + }, [releaseLienId]) + useEffect(() => { + if (releaseOnId && releaseOnId !== releaseTargetId) setReleaseTargetId(releaseOnId) + }, [releaseOnId, releaseTargetId]) /** Open the service step on what the filing already holds, so a day recorded alone can take its receipts later. */ const openServiceStep = () => { if (!filedAffidavit) return diff --git a/src/components/jobs/LienInstrumentsModal.tsx b/src/components/jobs/LienInstrumentsModal.tsx index 7b9d5cfb5e..a1bc2f988a 100644 --- a/src/components/jobs/LienInstrumentsModal.tsx +++ b/src/components/jobs/LienInstrumentsModal.tsx @@ -160,6 +160,7 @@ export default function LienInstrumentsModal({ onRecorded, initialTab, land: landOnOpen = null, + releaseLienId = null, noticeMonths, onOpenLienDesk, onOpenRelease, @@ -183,6 +184,8 @@ export default function LienInstrumentsModal({ initialTab?: 'demand' | 'notice' | 'affidavit' | 'release_record' /** Open landed on one copy of one filing (`lienMailProofDoor.ts`): the press on a stop window's card on the Lien desk. The opener sets `initialTab` to the paper's tab. */ land?: LienMailProofLanding | null + /** The filed lien a release's door was pressed on (finding 808): the Release of record tab opens on that lien. Absent, the tab picks. */ + releaseLienId?: string | null /** The Lien desk's months for the § 53.056 notice (v2.3405) — recorded as months_covered instead of the last work month alone. */ noticeMonths?: string[] | null /** The next step's door to the Lien desk on this job (punch list #82): notices and retainage are drafted, approved and sent there. Absent, the card has no desk button. */ @@ -2082,6 +2085,7 @@ export default function LienInstrumentsModal({ noticeMonths={noticeMonths ?? null} land={land} landRelease={landRelease} + releaseLienId={releaseLienId} headSlotRef={setHeadSlot} // The copies went to the printer here: this window's card reads the next stage at once, and the opener reads again once the print is filed. onServePrinted={(id) => { diff --git a/src/components/jobs/LienPayoffs.render.test.tsx b/src/components/jobs/LienPayoffs.render.test.tsx index c90096d0c1..fd4ab06cb3 100644 --- a/src/components/jobs/LienPayoffs.render.test.tsx +++ b/src/components/jobs/LienPayoffs.render.test.tsx @@ -98,7 +98,8 @@ describe('LienPayoffs', () => { expect(paid.querySelector('[data-lien-payoff-warn]')).toBeNull() expect([...paid.querySelectorAll('[data-lien-payoff-steps] [data-step]')].map((s) => s.dataset.state)).toEqual(['done', 'now', 'later']) fireEvent.click(paid.querySelector('[data-lien-payoff-press="release"]')!) - expect(onOpenRelease).toHaveBeenCalledWith('j1') + // The door names the row's own lien (finding 808), so the tab opens on it and not on the job's first. + expect(onOpenRelease).toHaveBeenCalledWith('j1', 'a1') const owes = rowOf('a2') expect(owes.querySelector('[data-lien-payoff-say]')!.textContent).toBe('$5,160.50 is still open on this job’s bills.') diff --git a/src/components/jobs/LienPayoffs.tsx b/src/components/jobs/LienPayoffs.tsx index 42ebbfe037..7697b7aa80 100644 --- a/src/components/jobs/LienPayoffs.tsx +++ b/src/components/jobs/LienPayoffs.tsx @@ -61,7 +61,8 @@ type Props = { /** The job's Bill tab, where a payment is recorded. */ onOpenBill: (jobId: string) => void /** The job's Lien window on its Release of record tab. */ - onOpenRelease: (jobId: string) => void + /** The Lien window's Release of record tab for this job, on the lien whose row was pressed (finding 808). */ + onOpenRelease: (jobId: string, affidavitId?: string) => void isMobile?: boolean /** Told once the check pane recorded a payment, so the desk reads again. */ onChanged?: () => void @@ -267,7 +268,7 @@ function StepRounds({ row }: { row: LienPayoffRow }) { ) } -function LienRow({ row, isMobile, onDoor }: { row: LienPayoffRow; isMobile: boolean; onDoor: (door: LienPayoffDoor, jobId: string) => void }) { +function LienRow({ row, isMobile, onDoor }: { row: LienPayoffRow; isMobile: boolean; onDoor: (door: LienPayoffDoor, jobId: string, affidavitId?: string) => void }) { const done = row.step.step === 'done' return (
@@ -295,7 +296,7 @@ function LienRow({ row, isMobile, onDoor }: { row: LienPayoffRow; isMobile: bool ) : null}
{row.step.press ? ( - ) : done ? ( @@ -312,7 +313,7 @@ function LienRow({ row, isMobile, onDoor }: { row: LienPayoffRow; isMobile: bool ) } -function PlaceCard({ place, isMobile, onDoor, onCheck, card }: { place: LienPayoffPlace; isMobile: boolean; onDoor: (door: LienPayoffDoor, jobId: string) => void; onCheck?: () => void; card?: ReactNode }) { +function PlaceCard({ place, isMobile, onDoor, onCheck, card }: { place: LienPayoffPlace; isMobile: boolean; onDoor: (door: LienPayoffDoor, jobId: string, affidavitId?: string) => void; onCheck?: () => void; card?: ReactNode }) { const other = lienPayoffOtherLine(place.other) return (
@@ -351,7 +352,7 @@ function PlaceCard({ place, isMobile, onDoor, onCheck, card }: { place: LienPayo ) } -function PayoffsWindow({ places, billsByJob, bankChecks, todayYmd, failure, loading, isMobile, onRetry, onClose, onDoor, onRecorded, record, keep, keepRelease, role, who }: { places: LienPayoffPlace[]; billsByJob: Readonly>>; bankChecks?: ReadonlyArray; todayYmd: string; failure: string | null; loading: boolean; isMobile: boolean; onRetry: () => void; onClose: () => void; onDoor: (door: LienPayoffDoor, jobId: string) => void; onRecorded: () => void; record?: Parameters[0]['record']; keep: typeof keepPayoffFields; keepRelease: typeof keepReleaseFacts; role: UserRole | null; who: PayoffWho | null }) { +function PayoffsWindow({ places, billsByJob, bankChecks, todayYmd, failure, loading, isMobile, onRetry, onClose, onDoor, onRecorded, record, keep, keepRelease, role, who }: { places: LienPayoffPlace[]; billsByJob: Readonly>>; bankChecks?: ReadonlyArray; todayYmd: string; failure: string | null; loading: boolean; isMobile: boolean; onRetry: () => void; onClose: () => void; onDoor: (door: LienPayoffDoor, jobId: string, affidavitId?: string) => void; onRecorded: () => void; record?: Parameters[0]['record']; keep: typeof keepPayoffFields; keepRelease: typeof keepReleaseFacts; role: UserRole | null; who: PayoffWho | null }) { useModalStackEntry() const closeRef = useRef(onClose) closeRef.current = onClose @@ -476,7 +477,8 @@ export default function LienPayoffs({ todayYmd, refreshKey, onOpenBill, onOpenRe const places = useMemo(() => (facts ? lienPayoffPlaces(facts) : []), [facts]) const words = useMemo(() => lienPayoffStrip(places), [places]) - const onDoor = useCallback((door: LienPayoffDoor, jobId: string) => (door === 'bill' ? onOpenBill(jobId) : onOpenRelease(jobId)), [onOpenBill, onOpenRelease]) + // A release's door carries the row's own lien (finding 808): on a job with two filed liens the tab opened on the first one found. + const onDoor = useCallback((door: LienPayoffDoor, jobId: string, affidavitId?: string) => (door === 'bill' ? onOpenBill(jobId) : onOpenRelease(jobId, affidavitId)), [onOpenBill, onOpenRelease]) const stripNode = words.say || failure ? ( diff --git a/src/components/jobs/LienRunReleases.render.test.tsx b/src/components/jobs/LienRunReleases.render.test.tsx index 75627342f2..1d4e373bbd 100644 --- a/src/components/jobs/LienRunReleases.render.test.tsx +++ b/src/components/jobs/LienRunReleases.render.test.tsx @@ -156,7 +156,7 @@ describe('LienRunReleases', () => { const county = await found('[data-lien-run-releases="county"] [data-lien-run-release-open]') expect(county.textContent).toBe('Record the county’s stamp ›') fireEvent.click(county) - expect(onOpenRelease).toHaveBeenCalledWith('j1') + expect(onOpenRelease).toHaveBeenCalledWith('j1', 'a1') fireEvent.click(screen.getByRole('button', { name: /the day the stamped copies were sent/ })) fireEvent.change(screen.getByLabelText(/the day the stamped copies were sent/), { target: { value: '2026-12-01' } }) fireEvent.click(screen.getByRole('button', { name: 'Keep' })) diff --git a/src/components/jobs/LienRunReleases.tsx b/src/components/jobs/LienRunReleases.tsx index c833b61cbf..e1b54516f5 100644 --- a/src/components/jobs/LienRunReleases.tsx +++ b/src/components/jobs/LienRunReleases.tsx @@ -25,7 +25,7 @@ export type LienRunReleasesProps = { /** Who is signed in, kept with each press. Null, or a viewer outside the lien office, sees the list with no press. */ who: { id: string; name: string } | null /** The job's Lien window on its Release of record tab, where the county's stamp is typed. */ - onOpenRelease?: (jobId: string) => void + onOpenRelease?: (jobId: string, affidavitId?: string) => void /** A release changed: the desk reads again. */ onChanged?: () => void read?: typeof readLienPayoffFacts @@ -178,7 +178,7 @@ export default function LienRunReleases({ todayYmd, refreshKey, isMobile, issuer ) : null} {onOpenRelease && (l.stage === 'county' || l.held) ? (
-
diff --git a/src/content/help/release-a-filed-lien-after-it-is-paid.md b/src/content/help/release-a-filed-lien-after-it-is-paid.md index 1f8f4c60f8..2cb142cfa4 100644 --- a/src/content/help/release-a-filed-lien-after-it-is-paid.md +++ b/src/content/help/release-a-filed-lien-after-it-is-paid.md @@ -97,7 +97,7 @@ The leader signs the paper before a notary. You can print the release with the day's other releases. Read [Print the releases in the run](#print-the-releases-in-the-run) below. -A job with two filed liens asks **Which lien** first. Pick the one that was paid. +A job with two filed liens asks **Which lien** first. Pick the one that was paid. A press on a lien's own row in **Payoffs** opens the tab on that lien. The tab stays on it while you keep the county's day and number. ## Release a lien with money still open diff --git a/src/content/releaseNotes/v2.9190.ts b/src/content/releaseNotes/v2.9190.ts new file mode 100644 index 0000000000..b0785a0c1b --- /dev/null +++ b/src/content/releaseNotes/v2.9190.ts @@ -0,0 +1,15 @@ +import type { ReleaseNote } from '../../lib/releaseNotes' + +const note: ReleaseNote = { + version: 'v2.9190', + date: '2026-12-02', + title: 'Lien desk: the county’s stamp goes on the lien you pressed', + kind: 'fix', + highlights: [ + 'On a job with two filed liens, Record the county’s stamp on the second lien’s row could open the Release of record tab on the first lien.', + 'The press now opens the tab on the lien whose row you pressed, in Payoffs and on the day’s run of releases.', + 'The tab stays on that lien after you keep Recorded on, so the instrument number goes on the same release.', + ], +} + +export default note diff --git a/src/lib/jobs/lienReleaseOfRecord.test.ts b/src/lib/jobs/lienReleaseOfRecord.test.ts index 6dbcbdd133..6ea61066b6 100644 --- a/src/lib/jobs/lienReleaseOfRecord.test.ts +++ b/src/lib/jobs/lienReleaseOfRecord.test.ts @@ -36,6 +36,21 @@ describe('releaseTargets and the pick', () => { expect(pickReleaseTarget(releaseTargets([aff()], [rel({ filed_at: '2026-12-03' })]), null)?.affidavit.id).toBe('a1') expect(pickReleaseTarget([], null)).toBeNull() }) + + it('opens on the lien the door named, and stays on the lien the tab holds (findings 808 and 813)', () => { + const second = aff({ id: 'a2', recording_number: '2026-0500001', filed_at: '2026-11-16' }) + // Both liens have a saved release: the stamp's door on the second lien's row opens the second. + const both = releaseTargets([aff(), second], [rel({ fields: { releasesFilingId: 'a1' } }), rel({ id: 'r2', fields: { releasesFilingId: 'a2' } })]) + expect(pickReleaseTarget(both, null)?.affidavit.id).toBe('a1') + expect(pickReleaseTarget(both, null, 'a2')?.affidavit.id).toBe('a2') + // A lien picked on the tab wins over the door, and a door that names no lien of the job changes nothing. + expect(pickReleaseTarget(both, 'a1', 'a2')?.affidavit.id).toBe('a1') + expect(pickReleaseTarget(both, null, 'gone')?.affidavit.id).toBe('a1') + // The second lien's release is recorded while the tab is on it: the tab holds it, where the rule alone goes back to the first. + const kept = releaseTargets([aff(), second], [rel({ fields: { releasesFilingId: 'a1' } }), rel({ id: 'r2', fields: { releasesFilingId: 'a2' }, filed_at: '2026-12-03' })]) + expect(pickReleaseTarget(kept, null)?.affidavit.id).toBe('a1') + expect(pickReleaseTarget(kept, 'a2')?.affidavit.id).toBe('a2') + }) }) describe('releaseMoneyGate', () => { diff --git a/src/lib/jobs/lienReleaseOfRecord.ts b/src/lib/jobs/lienReleaseOfRecord.ts index fff4bf5af7..47e1bbc0b6 100644 --- a/src/lib/jobs/lienReleaseOfRecord.ts +++ b/src/lib/jobs/lienReleaseOfRecord.ts @@ -84,9 +84,17 @@ export function releaseTargets(targets: ReadonlyArray, pickedId: string | null): T | null { - return targets.find((t) => t.affidavit.id === pickedId) ?? targets.find((t) => t.state !== 'recorded') ?? targets[0] ?? null +/** + * The lien the tab is on. First the one the tab holds: the one picked under *Which lien*, or the one it already + * stands on. Then the one the door named (`doorId`): a press on a lien's own row in Payoffs or on the day's run + * opens the tab on that lien. Then the first whose release the county has not recorded, else the first. + * + * The tab holds the lien it stands on (v2.9190), so a kept **Recorded on** no longer moves it. The last rule alone + * chose before, and a release the county had just recorded handed the tab to the job's other lien, where the + * instrument number was then typed onto the wrong release. + */ +export function pickReleaseTarget(targets: ReadonlyArray, pickedId: string | null, doorId: string | null = null): T | null { + return targets.find((t) => t.affidavit.id === pickedId) ?? (doorId ? targets.find((t) => t.affidavit.id === doorId) : undefined) ?? targets.find((t) => t.state !== 'recorded') ?? targets[0] ?? null } /** The payment date the paper starts on: the day of the last payment, or today when the job has none. */ diff --git a/src/pages/LienDeskPage.tsx b/src/pages/LienDeskPage.tsx index 2531b98cbc..9ffc6c210a 100644 --- a/src/pages/LienDeskPage.tsx +++ b/src/pages/LienDeskPage.tsx @@ -69,7 +69,7 @@ const DESK_USER_ROLES = ['assistant', 'controller', 'master_technician', 'subcon const BACK_DOOR: CSSProperties = { display: 'inline-flex', alignItems: 'center', gap: 6, height: 30, padding: '0 10px', borderWidth: 1, borderStyle: 'solid', borderColor: 'var(--border-strong)', borderRadius: 8, background: 'var(--surface)', color: 'var(--text-700)', font: 'inherit', fontSize: '0.8rem', fontWeight: 600, cursor: 'pointer', whiteSpace: 'nowrap', flex: 'none', marginRight: 8 } -type LienWindow = { job: JobWithDetails; initialTab?: 'demand' | 'notice' | 'affidavit' | 'release_record'; noticeMonths?: string[] | null; openLastWork?: boolean; /** The copy to land on, from a stop window's card. */ land?: LienMailProofLanding | null } +type LienWindow = { job: JobWithDetails; initialTab?: 'demand' | 'notice' | 'affidavit' | 'release_record'; noticeMonths?: string[] | null; openLastWork?: boolean; /** The copy to land on, from a stop window's card. */ land?: LienMailProofLanding | null; /** The filed lien a release's door was pressed on (finding 808): the Release of record tab opens on it. */ releaseLienId?: string | null } export default function LienDeskPage() { const { user, role, loading: authLoading, profileName } = useAuth() @@ -370,7 +370,7 @@ export default function LienDeskPage() { initiallyOpen={searchParams.get('payoffs') === '1'} onOpenBill={(jobId) => openEditJob(jobId, 'bill')} onChanged={refetch} - onOpenRelease={(jobId) => withJob(jobId, (job) => setLienWindow({ job, initialTab: 'release_record' }))} + onOpenRelease={(jobId, affidavitId) => withJob(jobId, (job) => setLienWindow({ job, initialTab: 'release_record', releaseLienId: affidavitId ?? null }))} /> withJob(jobId, (job) => setLienWindow({ job, initialTab: 'release_record' }))} + onOpenRelease={(jobId, affidavitId) => withJob(jobId, (job) => setLienWindow({ job, initialTab: 'release_record', releaseLienId: affidavitId ?? null }))} onChanged={refetch} /> } @@ -454,6 +454,7 @@ export default function LienDeskPage() { invoice={null} initialTab={lienWindow?.initialTab} land={lienWindow?.land ?? null} + releaseLienId={lienWindow?.releaseLienId ?? null} noticeMonths={lienWindow?.noticeMonths ?? null} // v2.7077: the window's header names the step the desk's row names. deskNotice={lienWindowDeskNotice(lienWindow ? data?.queue.entries.find((e) => e.jobId === lienWindow.job.id) : null)} From 70b501e7c92c870482cc462b190d29fe8a354885 Mon Sep 17 00:00:00 2001 From: Robert Douglas <57234112+realrobertdouglas@users.noreply.github.com> Date: Wed, 2 Dec 2026 13:17:30 -0600 Subject: [PATCH 02/21] =?UTF-8?q?docs(to-dos):=20card=20#479=20brought=20c?= =?UTF-8?q?urrent=20=E2=80=94=20step=201=20built,=20the=20five=20neighbour?= =?UTF-8?q?ing=20mends=20on=20main?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5.2 --- to-dos/lien-release-road-faults/README.md | 56 ++++++++++++----------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/to-dos/lien-release-road-faults/README.md b/to-dos/lien-release-road-faults/README.md index a3a8e8db91..eae1025b0e 100644 --- a/to-dos/lien-release-road-faults/README.md +++ b/to-dos/lien-release-road-faults/README.md @@ -2,7 +2,7 @@ name: "The release road: every fault found on the way to releasing a paid lien, and the ones left to mend" number: 479 group: ready -status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · five mends are in open PRs, none on main yet · fourteen steps are left, none started +status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · thirteen steps are left summary: > The owner asked for help releasing a paid lien and printing its release, and for every bug on the way. One thread read the road in the code and found fourteen faults, findings 808 to 821. @@ -12,11 +12,11 @@ summary: > the most serious first. Two can mislead on a real lien today. On a job with two liens the county's stamp can land on the wrong release. And a release that is only saved already reads Released. -next: Step 1, findings 808 and 813. Every door to the Release of record tab names the lien, so the county's stamp lands on the release it was pressed for. +next: Step 2, finding 809. A release that is only saved stops reading Released, and one reading says where a release stands. ask: owner · decide · Three picks are on the card. May a saved release be corrected before the county's day is kept? -size: L as a train of fourteen (M · M · S · S · S · S · M · M · S · S · XS · S · S · S); left: all fourteen -blocker: Steps 1, 2, 5, 6 and 10 to 14 have none. Step 3 waits on PR #10639. Steps 4 and 7 wait on the owner's picks. Step 8 owes a migration. Step 9 is built after card #477. -opinion: build — steps 1 and 2 first. They are the two that can mislead on a real lien, and a release cannot be taken back once the county records it. +size: L as a train of fourteen (M · M · S · S · S · S · M · M · S · S · XS · S · S · S); left: steps 2 to 14 +blocker: Steps 2, 5, 6 and 10 to 14 have none. Step 3 is clear for the payment's own day, and its day before the lien was filed waits on call 3. Steps 4 and 7 wait on the owner's picks. Step 8 owes a migration. Step 9 is built after card #477. +opinion: build — step 2 next. With step 1 it is the pair that can mislead on a real lien, and a release cannot be taken back once the county records it. mockup: not required — each step mends a press, a line or a guard on a screen that is already drawn. A step that redraws a screen draws it then. --- @@ -50,16 +50,16 @@ same lien through its stops, and the Board and To do show where it stands. ## The fourteen faults of the read -State is as read on GitHub on 2026-12-02 at 14:34 UTC. +State is as read on GitHub and on `main` on 2026-12-02 at 19:17 UTC. | # | What a person sees | Sure | State | | --- | --- | --- | --- | -| 808 | A job has two filed liens, each with a saved release. **Record the county's stamp ›** on the second lien's Payoffs row opens the tab on the first lien. The day and the number are kept on the wrong release. | read | Not started. Step 1. | +| 808 | A job has two filed liens, each with a saved release. **Record the county's stamp ›** on the second lien's Payoffs row opens the tab on the first lien. The day and the number are kept on the wrong release. | read | Built in step 1, v2.9190. Every door from a lien's own row names that lien. | | 809 | A release that is only saved reads *Released* in five places. They are the window's head, its suit stop, the stop's window, the desk's path and the Accounts Receivable chip. The day its row was made stands in for the county's day. The tab, Payoffs and the Board still say it waits for the county. The chip also shows the lien's own number as the release's. On a job with two liens, one release makes the whole job read released. | seen | Not started. Step 2. | | 810 | A job has nothing open and no payment. It reads *The bills read paid. The release is owed.* A filed lien whose bill goes back to draft is one such job. The tab then prints a paper that swears payment as of today. | seen | Decided on card #477, call 2. Not built. Not a step here. | -| 811 | **Payment / satisfaction date** is not checked. Cleared, the paper prints *as of —*. A day still to come is taken. A day before the lien was filed is taken. The date is set once, from the window's kept copy of the job. So it can show today while the money line shows the real day. | read | Mended in part by PR #10639, open and held behind #10636. It stops an empty day and a day still to come. The rest is step 3. | +| 811 | **Payment / satisfaction date** is not checked. Cleared, the paper prints *as of —*. A day still to come is taken. A day before the lien was filed is taken. The date is set once, from the window's kept copy of the job. So it can show today while the money line shows the real day. | read | Mended in part by v2.9179 (PR #10639), on `main`. It stops an empty day and a day still to come. The rest is step 3. | | 812 | A saved release cannot be corrected, and nothing says so. The only way is **Void**, **Confirm void** and making it again. Print needs no save, so a paper printed and signed can differ from the one saved after it. | read | Not started. Step 4. | -| 813 | A job has two liens. Keeping **Recorded on** throws the tab onto the other lien before **Instrument number** is typed. | read | Not started. Step 1, with 808. | +| 813 | A job has two liens. Keeping **Recorded on** throws the tab onto the other lien before **Instrument number** is typed. | read | Built in step 1, v2.9190. The tab holds the lien it stands on. | | 814 | A release is saved and the county has not recorded it. The job's bills owe again. The tab still says *Sign it before a notary. Then record it at the county.* Its print is live. Payoffs and the day's run hold the same release. | read | Not started. Step 5. | | 815 | **Download PDF** files no copy. Neither press marks the release as printed for the notary. When a check then comes back, the app says no release has left the office. The day's run prints it again. | read | Not started. Step 6. | | 816 | Voiding a filed affidavit that has a release leaves the release with no lien. Payoffs, the Board and the tab offer a second release, and the head still says released. Under **Filings on this job** a release's line names no lien, number or day, so two cannot be told apart. A release the county recorded voids with the same two presses and no words. | read, its line seen | Not started. Step 7. | @@ -73,12 +73,12 @@ State is as read on GitHub on 2026-12-02 at 14:34 UTC. | # | What a person sees | Sure | State | | --- | --- | --- | --- | -| 776 | On the Board, a chip's card names a suit day in another year with no year. | seen | PR #10641, in the merge queue. | -| 803 | In the Lien window, scrolling the paper folds the steps and the paper leaps. | seen | PR #10637, open. Its looks passed. It is held behind #10636. | -| 804 | **Go to the release of record ›** only picks the tab, and a second press changes nothing. **Save release record** sat cut off at the window's bottom edge. | seen | PR #10636, in the merge queue. | -| 824 | The bin *Paid awaiting release* counts liens. Its press leaves no To do row for a paid lien that owes its release. | seen | PR #10623, open and held behind two others. It is step 6 of card #472. | +| 776 | On the Board, a chip's card names a suit day in another year with no year. | seen | Mended, v2.9180 (PR #10641), on `main`. | +| 803 | In the Lien window, scrolling the paper folds the steps and the paper leaps. | seen | Mended, v2.9177 (PR #10637), on `main`. Its look on the live site is owed. | +| 804 | **Go to the release of record ›** only picks the tab, and a second press changes nothing. **Save release record** sat cut off at the window's bottom edge. | seen | Mended, v2.9175 (PR #10636), on `main`. Its look on the live site is owed. | +| 824 | The bin *Paid awaiting release* counts liens. Its press leaves no To do row for a paid lien that owes its release. | seen | Mended, v2.9163 (PR #10623), on `main`. It is step 6 of card #472. | | 825 | On a job with no property facts, the paper's owner and property description are blank lines. The tab says nothing before **Save release record** takes it. | seen | Not started. Step 13. | -| 826 | A lien was filed and then released. It never had a To do row, while the Board and Payoffs showed it. | seen | PR #10623 adds the rows. Check this case on the live site once it lands. | +| 826 | A lien was filed and then released. It never had a To do row, while the Board and Payoffs showed it. | seen | v2.9163 (PR #10623) added the rows, on `main`. This case is still to check on the live site. | | 827 | A link that opens the Lien window on a job took about nine seconds to draw the window. | seen | Not started. Step 14. | Findings 822 and 823 are faults of the desk's Board and To do, not of the road. They are in the @@ -86,9 +86,10 @@ Lien desk lane's note of run 17 and are not on this card. ## What other cards already hold -- **Card #477**, *Lien release: what opens it once a payment is in* (PR #10644, in the merge - queue). It holds what opens the three presses, the wait on a check, the override and its - prompt. It also holds 810's mend: a job with no payment stops reading paid. +- **Card #477**, [*Lien release: what opens it once a payment is in*](../lien-release-opens-when-funds-land/README.md). + It holds what opens the three presses, the wait on a check, the override and its prompt. It + also holds 810's mend: a job with no payment stops reading paid. Nothing of it is built: the + override prompt's mock-up waits for the owner's look. - **Card #472**, [*Lien desk Board: the flow after a lien is filed*](../lien-desk-board-flow-after-filing/README.md). Its step 6 is the two To do rows of 824 and 826. Its steps 7 and 8 are the lapsed lien's answer and the counsel row. @@ -103,14 +104,16 @@ Lien desk lane's note of run 17 and are not on this card. ## The steps left, one PR each -1. **Every door to the tab names the lien (M). 808 and 813.** A press made on one lien opens the - tab on that lien. The tab stays on it after **Recorded on** is kept. The doors are in Payoffs, - the day's run, the desk's page and the tabs themselves. +1. **Built, v2.9190. Every door to the tab names the lien (M). 808 and 813.** A press made on + one lien opens the tab on that lien. The tab stays on it after **Recorded on** is kept. The + doors are a lien's row in Payoffs and a release's line on the day's run. A door that names no + lien is left to the tab's own rule: the Accounts Receivable chip, a deep link and the head's + step. 2. **Saved is not released (M). 809.** One reading says where a release stands: saved, or recorded with the county's day. The five places read it. The chip shows the release's own number. On a job with two liens each lien reads for itself. -3. **The rest of the payment date (S). 811.** After #10639 is on `main`. The date follows the - payment's own day, not the window's kept copy. A day before the lien was filed waits on call 3. +3. **The rest of the payment date (S). 811.** The date follows the payment's own day, not the + window's kept copy. A day before the lien was filed waits on call 3. 4. **A saved release, and the paper that was printed (S). 812.** Waits on call 1. At the least, the tab says before the save that a saved release cannot be changed. It also says when the facts on the screen differ from the last printed copy. @@ -144,7 +147,7 @@ Lien desk lane's note of run 17 and are not on this card. ## Where each lives Files and lines are `main`'s at `c7cdafa95c`. Read them again before a step: five PRs on these -files land first. +files have landed since, and the lines have moved. | # | Where | | --- | --- | @@ -176,6 +179,7 @@ files land first. ## Where it stands -Written on 2026-12-02 (UTC). Of the fourteen faults of the read, one is mended in part by an open -PR and one is decided on card #477. Of the seven neighbours, five are in four open PRs. None of -those PRs is on `main` yet. Nothing on this card is started. +Written on 2026-12-02 (UTC), brought current at 19:17 UTC the same day. Of the fourteen faults +of the read, two are built in step 1 (808 and 813, v2.9190), one is mended in part on `main` (811) +and one is decided on card #477 (810). Of the seven neighbours, five are mended on `main` by four +PRs, and their looks on the live site are owed. Thirteen steps are left. Step 2 is next. From 0076f9d9880fa84f4cf2473a37f145ebb7761e46 Mon Sep 17 00:00:00 2001 From: Robert Douglas <57234112+realrobertdouglas@users.noreply.github.com> Date: Wed, 2 Dec 2026 13:21:04 -0600 Subject: [PATCH 03/21] docs(to-dos): card #479, the owner's answers to its three calls, in their words Co-Authored-By: Claude Fable 5.2 --- to-dos/lien-release-road-faults/README.md | 41 ++++++++++++++--------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/to-dos/lien-release-road-faults/README.md b/to-dos/lien-release-road-faults/README.md index eae1025b0e..571b96564d 100644 --- a/to-dos/lien-release-road-faults/README.md +++ b/to-dos/lien-release-road-faults/README.md @@ -2,7 +2,7 @@ name: "The release road: every fault found on the way to releasing a paid lien, and the ones left to mend" number: 479 group: ready -status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · thirteen steps are left +status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · the owner answered the three calls on 2026-12-02 · thirteen steps are left summary: > The owner asked for help releasing a paid lien and printing its release, and for every bug on the way. One thread read the road in the code and found fourteen faults, findings 808 to 821. @@ -13,9 +13,9 @@ summary: > county's stamp can land on the wrong release. And a release that is only saved already reads Released. next: Step 2, finding 809. A release that is only saved stops reading Released, and one reading says where a release stands. -ask: owner · decide · Three picks are on the card. May a saved release be corrected before the county's day is kept? +ask: owner · decide · A look at one drawing, still to be made. The window that refuses the void of an affidavit with a live release, and where its Take me there press lands. size: L as a train of fourteen (M · M · S · S · S · S · M · M · S · S · XS · S · S · S); left: steps 2 to 14 -blocker: Steps 2, 5, 6 and 10 to 14 have none. Step 3 is clear for the payment's own day, and its day before the lien was filed waits on call 3. Steps 4 and 7 wait on the owner's picks. Step 8 owes a migration. Step 9 is built after card #477. +blocker: Steps 2 to 6 and 10 to 14 have none. Step 7 waits on the owner's look at its drawing. Step 8 owes a migration. Step 9 is built after card #477. opinion: build — step 2 next. With step 1 it is the pair that can mislead on a real lien, and a release cannot be taken back once the county records it. mockup: not required — each step mends a press, a line or a guard on a screen that is already drawn. A step that redraws a screen draws it then. --- @@ -113,17 +113,20 @@ Lien desk lane's note of run 17 and are not on this card. recorded with the county's day. The five places read it. The chip shows the release's own number. On a job with two liens each lien reads for itself. 3. **The rest of the payment date (S). 811.** The date follows the payment's own day, not the - window's kept copy. A day before the lien was filed waits on call 3. -4. **A saved release, and the paper that was printed (S). 812.** Waits on call 1. At the least, - the tab says before the save that a saved release cannot be changed. It also says when the - facts on the screen differ from the last printed copy. + window's kept copy. A day before the lien was filed is asked about once and then taken (call 3). +4. **A saved release, and the paper that was printed (S). 812.** A saved release is corrected in + place until the county's day is kept (call 1). After that the tab says it is the county's + record. The tab also says when the facts on the screen differ from the last printed copy. 5. **Bills that owe again hold the print (S). 814.** The tab reads the same hold as Payoffs and the run, and says why. 6. **A download is a copy, and a print is marked (S). 815.** **Download PDF** files a copy as the print does. Either press marks the release as out for the notary. -7. **Voids that leave nothing behind (M). 816.** Waits on call 2. A release's line under - **Filings on this job** names its lien, its number and its day. Voiding a release the county - recorded takes words. +7. **Voids that leave nothing behind (M). 816.** The void of an affidavit with a live release + is refused by a window with a **Take me there** press, which brings the person to the release + and shows where to press (call 2). The window and its flow are drawn first, and the owner + looks at the drawing before this half is built. The other half does not wait: a release's line + under **Filings on this job** names its lien, its number and its day, and voiding a release + the county recorded takes words. 8. **One release a lien (M). 817.** The save is guarded in the client. A rule in the database ties one live release to one lien. This step is a migration and owes a push. 9. **The desk's path knows the wait, and one chip a lien (S). 818.** Built after card #477, since @@ -136,13 +139,19 @@ Lien desk lane's note of run 17 and are not on this card. 14. **The slow link (S). 827.** Measure what the nine seconds are first. Then mend what the measure shows. -## The calls left open +## The calls, each answered -| # | Question | Your pick | The other way | -| --- | --- | --- | --- | -| 1 | May a saved release be corrected in place? | **Yes, until the county's day is kept.** After that it is the county's record. | Never. Keep void and make again, and say so on the tab. | -| 2 | What happens when a person voids an affidavit that has a live release? | **The void is refused, with words that say to void the release first.** | Both are voided in one press, the release first. | -| 3 | A payment day before the day the lien was filed: refused, or asked about? | **Asked once, then taken.** The app counts days and does not judge the law. | Refused, with the reason under the date. | +The owner answered on 2026-12-02 (UTC), relayed by the managing session of run 18. Their words: + +> d. yes to all except "Refused, with words to void the release first" should make it easy to bring +> a user to where they need to do that and show them where to click. we'll need to come up with a +> modal and then a flow if they click "take me there" on the modal + +| # | Question | The answer | +| --- | --- | --- | +| 1 | May a saved release be corrected in place? | **Yes, until the county's day is kept.** After that it is the county's record. | +| 2 | What happens when a person voids an affidavit that has a live release? | **The void is refused, by a window with a Take me there press.** The press brings the person to the release and shows where to press. The window and its flow are to be drawn and looked at before they are built. | +| 3 | A payment day before the day the lien was filed: refused, or asked about? | **Asked once, then taken.** The app counts days and does not judge the law. | ## Where each lives From 8b106d40a9bf7693964a80fec996538b5e1cb260 Mon Sep 17 00:00:00 2001 From: Robert Douglas <57234112+realrobertdouglas@users.noreply.github.com> Date: Wed, 2 Dec 2026 13:40:52 -0600 Subject: [PATCH 04/21] docs: the release tab's render-test count after the merge with main Co-Authored-By: Claude Fable 5.2 --- docs/LIEN_DESK_ARCHITECTURE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/LIEN_DESK_ARCHITECTURE.md b/docs/LIEN_DESK_ARCHITECTURE.md index 03cfb7eac8..bcb0bbbdc7 100644 --- a/docs/LIEN_DESK_ARCHITECTURE.md +++ b/docs/LIEN_DESK_ARCHITECTURE.md @@ -731,7 +731,7 @@ last_updated: 2026-12-02 > The stamp is two `ChangeableValue`s, and each Keep is one update of the release row through `keepReleaseStamp`. > A saved release prints from its own saved fields, and a lien with a release draws no save press. > Since v2.9179 `releasePaymentDayCheck` in `lienReleaseOfRecord.ts` holds the three presses of a release not yet saved while the payment date is cleared or still to come (`payDayMissing`, `payDayFuture`), with the reason under the date (`data-lien-release-day-why`), and a saved release's two presses are left alone. -> The tab's render tests are `LienFilingTabs.release.render.test.tsx`, six at v2.8508 and 22 since v2.9179. +> The tab's render tests are `LienFilingTabs.release.render.test.tsx`, six at v2.8508, 22 since v2.9179 and 25 since v2.9190. > **v2.9190 (a door names its lien, findings 808 and 813):** `pickReleaseTarget` takes a third value, the lien the door named, read after the lien the tab holds and before the rule. > The doors are a lien's row in Payoffs and a release's line on the day's run: each `onOpenRelease` hands the job and its `affidavitId`, `LienDeskPage` keeps it as `releaseLienId` on the window it opens, and `LienInstrumentsModal` hands it to `LienFilingTabs`. > The tab holds the lien it stands on: an effect writes the picked lien's id into `releaseTargetId`, so a release the county has just recorded no longer hands the tab to the job's other lien. From b6f4918aae92d8c653e71ea6e93584e6025ac9c4 Mon Sep 17 00:00:00 2001 From: Robert Douglas <57234112+realrobertdouglas@users.noreply.github.com> Date: Wed, 2 Dec 2026 14:19:47 -0600 Subject: [PATCH 05/21] =?UTF-8?q?v2.9216=20=E2=80=94=20Release=20of=20reco?= =?UTF-8?q?rd:=20the=20payment=20date=20follows=20the=20payment=20(finding?= =?UTF-8?q?=20811,=20punch=20list=20#479=20step=203)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tab's date reads the job as it stands until a person types a day. A date before the lien's filed day is asked about once (Keep this date), and the print, the download and the save wait for the answer. Co-Authored-By: Claude Fable 5.2 --- docs/LIEN_DESK_ARCHITECTURE.md | 2 ++ docs/recent-features/v2.9216.md | 27 ++++++++++++++ .../LienFilingTabs.release.render.test.tsx | 35 +++++++++++++++++++ src/components/jobs/LienFilingTabs.tsx | 34 +++++++++++++++--- .../release-a-filed-lien-after-it-is-paid.md | 2 +- src/content/releaseNotes/v2.9216.ts | 15 ++++++++ src/lib/jobs/lienReleaseOfRecord.test.ts | 33 +++++++++++++++-- src/lib/jobs/lienReleaseOfRecord.ts | 34 ++++++++++++++++++ to-dos/lien-release-road-faults/README.md | 10 +++--- 9 files changed, 180 insertions(+), 12 deletions(-) create mode 100644 docs/recent-features/v2.9216.md create mode 100644 src/content/releaseNotes/v2.9216.ts diff --git a/docs/LIEN_DESK_ARCHITECTURE.md b/docs/LIEN_DESK_ARCHITECTURE.md index bcb0bbbdc7..6a70dc833c 100644 --- a/docs/LIEN_DESK_ARCHITECTURE.md +++ b/docs/LIEN_DESK_ARCHITECTURE.md @@ -732,6 +732,8 @@ last_updated: 2026-12-02 > A saved release prints from its own saved fields, and a lien with a release draws no save press. > Since v2.9179 `releasePaymentDayCheck` in `lienReleaseOfRecord.ts` holds the three presses of a release not yet saved while the payment date is cleared or still to come (`payDayMissing`, `payDayFuture`), with the reason under the date (`data-lien-release-day-why`), and a saved release's two presses are left alone. > The tab's render tests are `LienFilingTabs.release.render.test.tsx`, six at v2.8508, 22 since v2.9179 and 25 since v2.9190. +> **v2.9216 (the rest of the payment date, finding 811):** the tab's date is `releasePaymentDateShown`, the day a person typed or else the last payment's own day read from the job as it stands, so a payment recorded with the window up moves it. +> `releasePaymentDayAsk` asks once about a date before the lien's filed day, and the three presses and the save wait for **Keep this date** (`data-lien-release-day-ask`, `data-lien-release-day-kept`); the answer is held for one lien and one day by `releasePaymentDayKey` and is not saved on the row. > **v2.9190 (a door names its lien, findings 808 and 813):** `pickReleaseTarget` takes a third value, the lien the door named, read after the lien the tab holds and before the rule. > The doors are a lien's row in Payoffs and a release's line on the day's run: each `onOpenRelease` hands the job and its `affidavitId`, `LienDeskPage` keeps it as `releaseLienId` on the window it opens, and `LienInstrumentsModal` hands it to `LienFilingTabs`. > The tab holds the lien it stands on: an effect writes the picked lien's id into `releaseTargetId`, so a release the county has just recorded no longer hands the tab to the job's other lien. diff --git a/docs/recent-features/v2.9216.md b/docs/recent-features/v2.9216.md new file mode 100644 index 0000000000..6f5113a34c --- /dev/null +++ b/docs/recent-features/v2.9216.md @@ -0,0 +1,27 @@ +# v2.9216 — Release of record: the payment date follows the payment (2026-12-02) + +Step 3 of punch list #479 (the release road's faults), the rest of finding 811. Client only. No migration, no function change, nothing owed on prod. Stacked on v2.9190 (step 1), which changes the same tab. + +## What was wrong + +- The tab's **Payment / satisfaction date** was set once, when the window opened, from the window's kept copy of the job. A payment recorded with the window up left the date on today, while the money line beside it named the payment's real day. +- A date before the day the lien was filed was taken with no word. v2.9179 held an empty date and a day still to come, and left this one alone. + +## What changed + +- [`lienReleaseOfRecord.ts`](../../src/lib/jobs/lienReleaseOfRecord.ts): + - `releasePaymentDateShown` is the date the tab shows: the day a person typed, or else the last payment's own day read from the job as it stands. A cleared field is a typed answer too, so the check holds it and the payment's day does not come back by itself. + - `releasePaymentDayAsk` answers the question a date before the lien's filed day owes, or null. A date the older check refuses asks nothing. + - `releasePaymentDayKey` holds an answer for one lien and one day, so another day, or the job's other lien, is asked again. +- [`LienFilingTabs.tsx`](../../src/components/jobs/LienFilingTabs.tsx): the question stands under the date in amber with one press, **Keep this date**. Until it is pressed, **Print for notarization**, **Download PDF** and **Save release record** are dead and the save writes nothing. After it, a quiet line says the date is kept. A saved release is left alone: its paper is what was saved. +- The answer is not saved on the row. The owner's words of 2026-12-02 on the call: asked once, then taken. The app counts days and does not judge the law. +- The guide [release a filed lien after it is paid](../../src/content/help/release-a-filed-lien-after-it-is-paid.md) says the date asks once. + +## Tests + +- `lienReleaseOfRecord.test.ts`: the date follows the job until one is typed; the question for a day before the lien, none on the filed day or after, none on a refused date, none once kept; the key is per lien and day. +- `LienFilingTabs.release.render.test.tsx`: a payment recorded with the tab up moves the date, and a typed day stays; a day before the lien holds the three presses and writes nothing until **Keep this date**, another such day asks again, and the save carries the kept day. + +## Look owed + +- On the ZZ Test job with the live-write slot, or read only on a real lien with nothing pressed past the date field: type a date before the lien's filed day and read the question and the dead presses. Press **Keep this date** only on the ZZ Test lien. Changing the date field writes nothing by itself. diff --git a/src/components/jobs/LienFilingTabs.release.render.test.tsx b/src/components/jobs/LienFilingTabs.release.render.test.tsx index e1251b7fd7..e622f0a60d 100644 --- a/src/components/jobs/LienFilingTabs.release.render.test.tsx +++ b/src/components/jobs/LienFilingTabs.release.render.test.tsx @@ -427,6 +427,41 @@ describe('Release of record: the payment date is held before the print and the s expect(actions().every((b) => !b.disabled)).toBe(true) }) + it('follows a payment recorded while the tab is up, until a person types a day (v2.9216)', () => { + const props = (job: ReturnType) => ({ job, jobNumber: '2041', activeTab: 'release_record' as const, issuer: null, signerNameFallback: 'R. Castellan, Master Plumber', linkedAddress: address as never, jobOwnerRow: null, filings: [lien() as never], clock: { workMonth: '2026-08', noticeDeadline: '2026-11-16', filingDeadline: '2026-12-15' }, isSub: false, originalContractorName: '', ownerEmail: '', originalContractorEmail: '', onChanged: vi.fn() }) + const view = renderWithProviders() + const date = () => (screen.getByLabelText('Payment / satisfaction date') as HTMLInputElement).value + expect(date()).toBe('2026-11-20') + const later = paid() + later.payments = [...(later.payments ?? []), { ...(later.payments ?? [])[0]!, id: 'p2', paid_on: '2026-11-22' }] + view.rerender() + expect(date()).toBe('2026-11-22') + fireEvent.change(screen.getByLabelText('Payment / satisfaction date'), { target: { value: '2026-11-21' } }) + view.rerender() + expect(date()).toBe('2026-11-21') + }) + + it('asks once about a day before the lien was filed, holds the presses until it is kept, then takes it (v2.9216)', async () => { + draw({ job: paid() }) + fireEvent.change(screen.getByLabelText('Payment / satisfaction date'), { target: { value: '2026-11-05' } }) + const ask = document.querySelector('[data-lien-release-day-ask]')! + expect(ask.textContent).toContain('This date is before the lien was filed, Nov 9. Keep it if it is right.') + expect(actions().every((b) => b.disabled)).toBe(true) + fireEvent.click(actions()[2]!) + expect(writes.inserts).toEqual([]) + fireEvent.click(screen.getByRole('button', { name: 'Keep this date' })) + expect(document.querySelector('[data-lien-release-day-ask]')).toBeNull() + expect(document.querySelector('[data-lien-release-day-kept]')!.textContent).toBe('Kept. This date is before the lien was filed.') + expect(actions().every((b) => !b.disabled)).toBe(true) + // Another day before the lien is another question. + fireEvent.change(screen.getByLabelText('Payment / satisfaction date'), { target: { value: '2026-11-04' } }) + expect(document.querySelector('[data-lien-release-day-ask]')).not.toBeNull() + fireEvent.click(screen.getByRole('button', { name: 'Keep this date' })) + fireEvent.click(screen.getByRole('button', { name: 'Save release record' })) + await waitFor(() => expect(writes.inserts).toHaveLength(1)) + expect(writes.inserts[0]!.fields).toMatchObject({ releasesFilingId: 'a1', paymentDate: '2026-11-04' }) + }) + it('leaves a saved release’s print alone', () => { draw({ job: paid(), filings: [lien() as never, release({ fields: { releasesFilingId: 'a1', paymentDate: '' } }) as never] }) expect(document.querySelector('[data-lien-release-day-why]')).toBeNull() diff --git a/src/components/jobs/LienFilingTabs.tsx b/src/components/jobs/LienFilingTabs.tsx index cfabea12e9..8cf140d722 100644 --- a/src/components/jobs/LienFilingTabs.tsx +++ b/src/components/jobs/LienFilingTabs.tsx @@ -87,7 +87,7 @@ import type { JobWorkMonths } from '../../lib/jobs/forecastWorkMonths' import { lienTradeWords } from '../../lib/jobs/lienTradeWords' import { MoneyText } from '../Money' import { ChangeableValue, ValueLine, ValueLines, ValueSentence } from '../valuesInPlace/ValuesInPlace' -import { RELEASE_OF_RECORD_WORDS, canReleaseAnyway, pickReleaseTarget, releaseMoneyBackWords, releaseMoneyGate, releaseNeedsBank, releasePaymentDay, releaseRecordedSentence, releaseSaveFields, releaseStampDayCheck, releaseStampPatch, releaseTargets, releasePaymentDayCheck } from '../../lib/jobs/lienReleaseOfRecord' +import { RELEASE_OF_RECORD_WORDS, canReleaseAnyway, pickReleaseTarget, releaseMoneyBackWords, releaseMoneyGate, releaseNeedsBank, releasePaymentDateShown, releasePaymentDayAsk, releasePaymentDayBeforeLien, releasePaymentDayKey, releaseRecordedSentence, releaseSaveFields, releaseStampDayCheck, releaseStampPatch, releaseTargets, releasePaymentDayCheck } from '../../lib/jobs/lienReleaseOfRecord' import { payoffNote } from '../../lib/jobs/lienPayoffFields' import { releaseFacts } from '../../lib/jobs/lienReleaseFacts' @@ -236,7 +236,12 @@ export default function LienFilingTabs({ const [ownerProof, setOwnerProof] = useState({ ...EMPTY_SERVICE_COPY }) const [ocProof, setOcProof] = useState({ ...EMPTY_SERVICE_COPY }) // The release of record (punch list #435, piece 2): its payment date starts on the last payment's day, not on today. - const [releasePaymentDate, setReleasePaymentDate] = useState(() => releasePaymentDay(job.payments ?? [], todayYmd())) + // Since v2.9216 (finding 811's rest) it follows the job as it stands now until a person types a day: set once at the + // open, it stayed on today when a payment was recorded with the window up, while the money line named the real day. + const [releasePaymentTyped, setReleasePaymentTyped] = useState(null) + const releasePaymentDate = releasePaymentDateShown(releasePaymentTyped, job.payments ?? [], todayYmd()) + /** The lien and day a person kept a payment date for, though it is before the lien was filed: asked once, then taken. */ + const [releaseDayKept, setReleaseDayKept] = useState(null) /** The filed lien the release tab is on, when the job holds more than one and one was picked. */ const [releaseTargetId, setReleaseTargetId] = useState(null) /** The reason a release goes out with money still open: null while the box is shut. */ @@ -938,6 +943,8 @@ export default function LienFilingTabs({ /** Save the release of the lien the tab is on. It names its affidavit, and a lien that has a release takes no second one. */ const recordRelease = () => { if (!releaseTarget || releaseTarget.release || releaseGate.hold || releasePaymentDayCheck(releasePaymentDate, todayYmd())) return + // A date before the lien was filed waits for its one answer (v2.9216). + if (releasePaymentDayAsk(releasePaymentDate, releaseTarget.affidavit.filed_at, releaseDayKept === releasePaymentDayKey(releaseTarget.affidavit.id, releasePaymentDate))) return return insertFiling( { kind: 'release_of_record', @@ -1732,7 +1739,11 @@ export default function LienFilingTabs({ const releaseMoneyBack = savedRelease ? releaseMoneyBackWords({ recorded: Boolean(savedRelease.filed_at), payments: job.payments ?? [], bank: bankChecks, todayYmd: todayYmd(), mark: releaseFacts(savedRelease.fields).moneyBack, open: claim.openBalance }) : null // The paper's payment date, held before the print and the save (v2.9179): a saved release cannot be corrected. const releaseDayWhy = savedRelease ? null : releasePaymentDayCheck(releasePaymentDate, todayYmd()) - const releaseDead = releaseGate.hold || Boolean(releaseDayWhy) + // A day before the lien was filed is asked about once, then taken (v2.9216, the owner's answer of 2026-12-02). + const releaseDayIsKept = Boolean(releaseTarget) && releaseDayKept === releasePaymentDayKey(releaseTarget?.affidavit.id ?? '', releasePaymentDate) + const releaseDayAsk = savedRelease || releaseDayWhy ? null : releasePaymentDayAsk(releasePaymentDate, releaseTarget?.affidavit.filed_at, releaseDayIsKept) + const releaseDayKeptNote = !savedRelease && !releaseDayWhy && releaseDayIsKept && releasePaymentDayBeforeLien(releasePaymentDate, releaseTarget?.affidavit.filed_at) + const releaseDead = releaseGate.hold || Boolean(releaseDayWhy) || Boolean(releaseDayAsk) const releaseHeld: CSSProperties = releaseDead ? { background: DEAD_PRESS_FILL, color: DEAD_PRESS_TEXT, border: '1px solid transparent', cursor: 'default' } : {} const releaseTone = { red: 'var(--text-red-700)', amber: 'var(--text-amber-800)', green: 'var(--text-green-700)' }[releaseGate.tone] const releaseOutline: CSSProperties = { padding: '0.45rem 0.9rem', fontSize: '0.8125rem', background: 'var(--surface)', border: '1px solid #2563eb', color: 'var(--text-link)', borderRadius: 4, cursor: 'pointer', ...releasePhoneButton } @@ -1840,13 +1851,28 @@ export default function LienFilingTabs({ {/* Nothing opens here, so there is no sheet: on a phone (v2.4423) the same fields are full width in place and the three buttons are a grid. */} {releaseDayWhy ? (

{releaseDayWhy}

) : null} + {releaseDayAsk ? ( +

+ + + + +

+ ) : null} + {releaseDayKeptNote ? ( +

+ {RELEASE_OF_RECORD_WORDS.payDayKept} +

+ ) : null} {isMobile ?
{sheetSavedCopy}
: savedCopyRow}
- -
+ {/* Why the two presses are dead (v2.9222): the hold Payoffs' row and the day's run keep on the same release. */} + {releaseSavedHeld ? ( +

+ +

+ ) : null} ) : ( <> diff --git a/src/content/help/release-a-filed-lien-after-it-is-paid.md b/src/content/help/release-a-filed-lien-after-it-is-paid.md index 2443518f32..2d9a439e41 100644 --- a/src/content/help/release-a-filed-lien-after-it-is-paid.md +++ b/src/content/help/release-a-filed-lien-after-it-is-paid.md @@ -133,7 +133,7 @@ The card lists each saved release under what it needs next. The four heads are * Press the blue button under **Print for the notary**. The button reads like {{button:blue|Print 3 releases for the notary}}. One print opens, with a release on each sheet. The leader signs each before a notary. -Some releases may be held. The button then reads like {{button:blue|Print 2 releases for the notary · 1 is short ▸}}. The ready ones print. The held one stays with its reason in red. *Short* means the job's bills owe money again. A release is also held when its check came back. +Some releases may be held. The button then reads like {{button:blue|Print 2 releases for the notary · 1 is short ▸}}. The ready ones print. The held one stays with its reason in red. *Short* means the job's bills owe money again. A release is also held when its check came back. The **Release of record** tab holds the same release. Its two print buttons wait, and the reason stands under them. ## Record the notary and the copies in the run diff --git a/src/content/releaseNotes/v2.9222.ts b/src/content/releaseNotes/v2.9222.ts new file mode 100644 index 0000000000..7021d7cc91 --- /dev/null +++ b/src/content/releaseNotes/v2.9222.ts @@ -0,0 +1,15 @@ +import type { ReleaseNote } from '../../lib/releaseNotes' + +const note: ReleaseNote = { + version: 'v2.9222', + date: '2026-12-02', + title: 'Release of record: a held release holds its print', + kind: 'fix', + highlights: [ + 'A saved release whose job owed money again was held on Payoffs and on the day’s run. The Release of record tab still let it print.', + 'The tab now holds the same release. Its two print buttons wait, and the reason stands under them in red.', + 'A release whose check came back is held the same way. A release the county already recorded is not held.', + ], +} + +export default note diff --git a/src/lib/jobs/lienReleaseOfRecord.test.ts b/src/lib/jobs/lienReleaseOfRecord.test.ts index 638e29dcba..0ec74fdfe6 100644 --- a/src/lib/jobs/lienReleaseOfRecord.test.ts +++ b/src/lib/jobs/lienReleaseOfRecord.test.ts @@ -3,7 +3,7 @@ import { plainWordsFailures } from '../plainWords' import { plainSentence, val } from '../valuesInPlace' import type { LienPayoffAffidavit, LienPayoffPayment, LienPayoffRelease } from './lienPayoff' import type { BankCheck } from './checkCleared' -import { RELEASE_OF_RECORD_WORDS, canReleaseAnyway, pickReleaseTarget, releaseMoneyBackWords, releaseMoneyGate, releaseNeedsBank, releaseCorrectable, releasePaymentDatePatch, releasePaymentDateShown, releasePaymentDay, releaseSavedPaymentDay, releasePaymentDayAsk, releasePaymentDayBeforeLien, releasePaymentDayCheck, releasePaymentDayKey, releaseRecordedSentence, releaseSaveFields, releaseStampDayCheck, releaseStampPatch, releaseTargets, releaseWaitsOnCheck } from './lienReleaseOfRecord' +import { RELEASE_OF_RECORD_WORDS, canReleaseAnyway, pickReleaseTarget, releaseMoneyBackWords, releaseMoneyGate, releaseNeedsBank, releaseCorrectable, releasePaymentDatePatch, releasePaymentDateShown, releasePaymentDay, releaseSavedPaymentDay, releasePaymentDayAsk, releasePaymentDayBeforeLien, releasePaymentDayCheck, releasePaymentDayKey, releaseRecordedSentence, releaseSaveFields, releaseSavedHold, releaseStampDayCheck, releaseStampPatch, releaseTargets, releaseWaitsOnCheck } from './lienReleaseOfRecord' // Every job, instrument and amount here is made up. const TODAY = '2026-11-24' @@ -355,6 +355,22 @@ describe('a saved release is corrected in place until the county records it (v2. }) }) +describe('releaseSavedHold: a saved release reads the hold Payoffs and the run keep (v2.9222)', () => { + const fields = { releasesFilingId: 'a1', paymentDate: '2026-11-20' } + it('holds while the bills owe again, and says how much', () => { + expect(releaseSavedHold({ recorded: false, open: 1200, fields, cameBack: false })).toEqual({ kind: 'short', why: `Held. ${val('money', '$1,200.00')} is open on this job’s bills again. Record the payment first.` }) + }) + it('holds on a check that came back, before the money is read', () => { + expect(releaseSavedHold({ recorded: false, open: 0, fields, cameBack: true })).toEqual({ kind: 'came_back', why: 'Held. The check behind it came back.' }) + expect(releaseSavedHold({ recorded: false, open: 1200, fields, cameBack: true })?.kind).toBe('came_back') + }) + it('does not hold a paid release, one let go with money open on a reason, or one the county recorded', () => { + expect(releaseSavedHold({ recorded: false, open: 0, fields, cameBack: false })).toBeNull() + expect(releaseSavedHold({ recorded: false, open: 1200, fields: { ...fields, releasedUnpaidReason: 'settled for less' }, cameBack: false })).toBeNull() + expect(releaseSavedHold({ recorded: true, open: 1200, fields, cameBack: true })).toBeNull() + }) +}) + describe('releasePaymentDayCheck (v2.9179)', () => { it('lets a day up to today go on the paper', () => { expect(releasePaymentDayCheck('2026-11-20', '2026-11-24')).toBeNull() diff --git a/src/lib/jobs/lienReleaseOfRecord.ts b/src/lib/jobs/lienReleaseOfRecord.ts index 4e1e85bfc6..eac9d2b43d 100644 --- a/src/lib/jobs/lienReleaseOfRecord.ts +++ b/src/lib/jobs/lienReleaseOfRecord.ts @@ -80,6 +80,10 @@ export const RELEASE_OF_RECORD_WORDS = { countyRecordTag: 'the county’s record', countyRecord: 'The county recorded this release. Its paper stays as it was saved.', releaseGone: 'This release is no longer open to a change. Close the window and read the job again.', + /** A saved release that is held (v2.9222, finding 814): the line above its dead presses, in place of *Sign it before a notary*. */ + savedHeld: 'This release is saved and held. Do not sign it or record it yet.', + heldCameBack: 'Held. The check behind it came back.', + heldShortNext: 'Record the payment first.', } as const export type ReleaseState = 'none' | 'made' | 'recorded' @@ -217,6 +221,21 @@ export function releaseMoneyBackWords(input: { recorded: boolean; payments: Read return input.recorded ? `${said} The county’s record stands. Ask counsel.` : `Do not record this release. ${said}` } +/** + * Why a saved release's print is held, or null (v2.9222, finding 814). It is the hold Payoffs' row and the day's run + * already keep (`lienReleaseRun.ts`), which the tab did not read: its print stayed live and its line still said to + * sign and record. A check that came back holds it, and so do bills that owe again, unless the release went out with + * money open on a reason. The county's record stands whatever the money does, so a recorded release is never held. + */ +export function releaseSavedHold(input: { recorded: boolean; open: number; fields: unknown; cameBack: boolean }): { kind: 'came_back' | 'short'; why: string } | null { + if (input.recorded) return null + if (input.cameBack) return { kind: 'came_back', why: RELEASE_OF_RECORD_WORDS.heldCameBack } + const f = input.fields && typeof input.fields === 'object' && !Array.isArray(input.fields) ? (input.fields as Record) : {} + const anyway = typeof f.releasedUnpaidReason === 'string' && f.releasedUnpaidReason.trim() !== '' + if (input.open > 0.004 && !anyway) return { kind: 'short', why: `Held. ${val('money', moneyWords(input.open))} is open on this job’s bills again. ${RELEASE_OF_RECORD_WORDS.heldShortNext}` } + return null +} + /** * The fields a release saves: the paper's own, the affidavit it releases, and the reason it went out anyway. The * reason is `releasedUnpaidReason` when money was still open, and `releasedBeforeClearedReason` when the bills read diff --git a/to-dos/lien-release-road-faults/README.md b/to-dos/lien-release-road-faults/README.md index 9276ca2af6..7cede66e67 100644 --- a/to-dos/lien-release-road-faults/README.md +++ b/to-dos/lien-release-road-faults/README.md @@ -2,7 +2,7 @@ name: "The release road: every fault found on the way to releasing a paid lien, and the ones left to mend" number: 479 group: ready -status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 3 is built (v2.9216) · the first half of step 4 is built (v2.9219) · the owner answered the three calls on 2026-12-02 · twelve steps are left +status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 3 is built (v2.9216) · the first half of step 4 is built (v2.9219) · step 5 is built (v2.9222) · the owner answered the three calls on 2026-12-02 · twelve steps are left summary: > The owner asked for help releasing a paid lien and printing its release, and for every bug on the way. One thread read the road in the code and found fourteen faults, findings 808 to 821. @@ -60,7 +60,7 @@ State is as read on GitHub and on `main` on 2026-12-02 at 19:17 UTC. | 811 | **Payment / satisfaction date** is not checked. Cleared, the paper prints *as of —*. A day still to come is taken. A day before the lien was filed is taken. The date is set once, from the window's kept copy of the job. So it can show today while the money line shows the real day. | read | Mended in part by v2.9179 (PR #10639), on `main`. It stops an empty day and a day still to come. The rest is mended by v2.9216, step 3: the date follows the job as it stands, and a day before the lien was filed is asked about once. | | 812 | A saved release cannot be corrected, and nothing says so. The only way is **Void**, **Confirm void** and making it again. Print needs no save, so a paper printed and signed can differ from the one saved after it. | read | Mended in part by v2.9219, step 4's first half: a saved release's payment date is corrected in place until the county's day is kept. Left: the facts drawn from the records, and the printed copy. | | 813 | A job has two liens. Keeping **Recorded on** throws the tab onto the other lien before **Instrument number** is typed. | read | Built in step 1, v2.9190. The tab holds the lien it stands on. | -| 814 | A release is saved and the county has not recorded it. The job's bills owe again. The tab still says *Sign it before a notary. Then record it at the county.* Its print is live. Payoffs and the day's run hold the same release. | read | Not started. Step 5. | +| 814 | A release is saved and the county has not recorded it. The job's bills owe again. The tab still says *Sign it before a notary. Then record it at the county.* Its print is live. Payoffs and the day's run hold the same release. | read | Mended by v2.9222, step 5: the tab reads the same hold, its two presses wait and the reason stands under them. | | 815 | **Download PDF** files no copy. Neither press marks the release as printed for the notary. When a check then comes back, the app says no release has left the office. The day's run prints it again. | read | Not started. Step 6. | | 816 | Voiding a filed affidavit that has a release leaves the release with no lien. Payoffs, the Board and the tab offer a second release, and the head still says released. Under **Filings on this job** a release's line names no lien, number or day, so two cannot be told apart. A release the county recorded voids with the same two presses and no words. | read, its line seen | Not started. Step 7. | | 817 | Around the reload after **Save release record** a second release row can be written. Nothing in the database ties one release to one lien. A reload that fails draws *No recorded lien on this job*. | plausible | Not started. Step 8. | @@ -121,7 +121,7 @@ Lien desk lane's note of run 17 and are not on this card. and is locked once the county's day is kept. Left, as a second PR: a press that reads the facts drawn from the records again (the owner, the legal description, the county), and the line that says the screen differs from the last printed copy. -5. **Bills that owe again hold the print (S). 814.** The tab reads the same hold as Payoffs and +5. **Built, v2.9222. Bills that owe again hold the print (S). 814.** The tab reads the same hold as Payoffs and the run, and says why. 6. **A download is a copy, and a print is marked (S). 815.** **Download PDF** files a copy as the print does. Either press marks the release as out for the notary. From 281dc042ec5e481c5211816fb3088cecff9f7815 Mon Sep 17 00:00:00 2001 From: Robert Douglas <57234112+realrobertdouglas@users.noreply.github.com> Date: Wed, 2 Dec 2026 14:33:44 -0600 Subject: [PATCH 09/21] =?UTF-8?q?v2.9224=20=E2=80=94=20Release=20of=20reco?= =?UTF-8?q?rd:=20a=20download=20is=20a=20copy,=20and=20a=20print=20is=20ma?= =?UTF-8?q?rked=20(finding=20815,=20punch=20list=20#479=20step=206)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Download PDF of a release files a sent copy as the print does. A saved release printed or downloaded from its tab keeps printedForNotary on its row, read fresh first, as the day's run does. Co-Authored-By: Claude Fable 5.2 --- docs/LIEN_DESK_ARCHITECTURE.md | 2 + docs/recent-features/v2.9224.md | 27 ++++++++++++ .../LienFilingTabs.release.render.test.tsx | 42 +++++++++++++++++++ src/components/jobs/LienFilingTabs.tsx | 35 +++++++++++++--- .../release-a-filed-lien-after-it-is-paid.md | 2 +- src/content/releaseNotes/v2.9224.ts | 15 +++++++ src/lib/jobs/lienReleaseOfRecord.ts | 2 + to-dos/lien-release-road-faults/README.md | 6 +-- 8 files changed, 122 insertions(+), 9 deletions(-) create mode 100644 docs/recent-features/v2.9224.md create mode 100644 src/content/releaseNotes/v2.9224.ts diff --git a/docs/LIEN_DESK_ARCHITECTURE.md b/docs/LIEN_DESK_ARCHITECTURE.md index 3295eda4e2..9ee37a85a7 100644 --- a/docs/LIEN_DESK_ARCHITECTURE.md +++ b/docs/LIEN_DESK_ARCHITECTURE.md @@ -741,6 +741,8 @@ last_updated: 2026-12-02 > **v2.9222 (a saved release reads the run's hold, finding 814):** `releaseSavedHold` in `lienReleaseOfRecord.ts` answers why a saved release's print waits, a check that came back or bills that owe again with no release-anyway reason, the hold `lienReleaseRun.ts` and Payoffs' row keep. > While it holds, the tab's **Print for notarization** and **Download PDF** are dead, the reason stands under them (`data-lien-release-saved-held`) and the saved line reads `savedHeld`. > A recorded release is never held. +> **v2.9224 (a download is a copy, and a print is marked, finding 815):** the tab's **Download PDF** of a release files a sent copy with `how: 'download'` under the kind the print files, `lien_release_of_record`. +> A saved release's print or download from the tab keeps `printedForNotary` on its row through `markReleaseOut`, read fresh first, as the day's run does, so the run stops offering it to print. > **v2.9190 (a door names its lien, findings 808 and 813):** `pickReleaseTarget` takes a third value, the lien the door named, read after the lien the tab holds and before the rule. > The doors are a lien's row in Payoffs and a release's line on the day's run: each `onOpenRelease` hands the job and its `affidavitId`, `LienDeskPage` keeps it as `releaseLienId` on the window it opens, and `LienInstrumentsModal` hands it to `LienFilingTabs`. > The tab holds the lien it stands on: an effect writes the picked lien's id into `releaseTargetId`, so a release the county has just recorded no longer hands the tab to the job's other lien. diff --git a/docs/recent-features/v2.9224.md b/docs/recent-features/v2.9224.md new file mode 100644 index 0000000000..266e9236a8 --- /dev/null +++ b/docs/recent-features/v2.9224.md @@ -0,0 +1,27 @@ +# v2.9224 — Release of record: a download is a copy, and a print is marked (2026-12-02) + +Step 6 of punch list #479 (the release road's faults), finding 815. Client only. No migration, no function change, nothing owed on prod. Stacked on v2.9222 (step 5), which changes the same tab. + +## What was wrong + +- **Download PDF** on the **Release of record** tab filed no copy on the job. **Print for notarization** did. +- Neither press marked a saved release as printed for the notary. Only the day's run kept that mark (`printedForNotary`). +- So a release printed from its tab was offered to print again on the day's run. And when a check came back, Accounts Receivable read that no release had left the office. + +## What changed + +- [`LienFilingTabs.tsx`](../../src/components/jobs/LienFilingTabs.tsx): + - `downloadPdf` files a sent copy of a release with `how: 'download'`, under the kind the print files (`lien_release_of_record`). Other papers' downloads are as before. + - `markReleaseOut` keeps `printedForNotary` on a saved release after its print or its download from the tab. It reads the row fresh and writes the mark over the row's facts as they stand. A release already marked, recorded or voided is left alone. A blocked print window marks nothing. + - `printDoc` answers whether the paper went to the printer. +- If the mark does not take, the tab says *The paper went out. The release did not take its printed mark.* +- A release printed before it is saved has no row to mark. That stays with step 4's second half. + +## Tests + +- `LienFilingTabs.release.render.test.tsx`: a saved release printed from the tab takes the mark over the row as it is now; a blocked print window and an already marked release write nothing. +- The download's copy is held by the type check and read in the look below: a PDF is not built in a render test. + +## Look owed + +- On the ZZ Test job with the live-write slot: save a release, press **Download PDF**, read the copy under the job's sent copies and the release at *notary* on the day's run. Void the release after. On a real lien a walker presses neither button: each now writes. diff --git a/src/components/jobs/LienFilingTabs.release.render.test.tsx b/src/components/jobs/LienFilingTabs.release.render.test.tsx index 2422ed66d0..cee50b7038 100644 --- a/src/components/jobs/LienFilingTabs.release.render.test.tsx +++ b/src/components/jobs/LienFilingTabs.release.render.test.tsx @@ -24,6 +24,17 @@ const writes = vi.hoisted(() => ({ inserts: [] as Array> /** The release row as the database holds it now, for the fresh read a correction makes first (v2.9219). */ const reads = vi.hoisted(() => ({ fresh: null as Record | null })) +/** The printer (v2.9224): whether the print window opened, and every paper sent to it. Nothing prints in a test. */ +const printer = vi.hoisted(() => ({ opens: true, papers: [] as Array> })) +vi.mock('../../lib/sent/sentCopiesIo', async (orig) => ({ + ...(await orig()), + printAndFile: (_html: string, filing: Record) => { + if (printer.opens) printer.papers.push(filing) + return printer.opens + }, + fileSentCopy: async () => true, +})) + /** Who is on the tab. The office's assistant unless a test says otherwise. */ const auth = vi.hoisted(() => ({ role: 'assistant' })) @@ -69,6 +80,8 @@ afterEach(() => { writes.inserts.length = 0 writes.updates.length = 0 reads.fresh = null + printer.opens = true + printer.papers.length = 0 bank.checks = [] bank.asked.length = 0 }) @@ -536,6 +549,35 @@ describe('Release of record: the payment date is held before the print and the s expect(actions().every((b) => !b.disabled)).toBe(true) }) + it('marks a saved release as printed for the notary when the tab prints it, over the row as it is now (v2.9224)', async () => { + reads.fresh = { filed_at: null, voided_at: null, fields: { releasesFilingId: 'a1', paymentDate: '2026-11-20', notarizedYmd: '2026-11-22' } } + const { onChanged } = draw({ job: paid(), filings: [lien() as never, release() as never] }) + fireEvent.click(screen.getByRole('button', { name: 'Print for notarization' })) + expect(printer.papers).toHaveLength(1) + expect(printer.papers[0]).toMatchObject({ kind: 'lien_release_of_record', jobIds: ['job-2041'] }) + await waitFor(() => expect(writes.updates).toHaveLength(1)) + const kept = writes.updates[0]!.patch.fields as Record + expect(kept).toMatchObject({ releasesFilingId: 'a1', paymentDate: '2026-11-20', notarizedYmd: '2026-11-22' }) + expect(kept.printedForNotary).toMatchObject({ by: expect.any(String), at: expect.any(String) }) + await waitFor(() => expect(onChanged).toHaveBeenCalled()) + }) + + it('writes no mark when the print window is blocked, or when the release is already marked', async () => { + reads.fresh = { filed_at: null, voided_at: null, fields: { releasesFilingId: 'a1', paymentDate: '2026-11-20' } } + printer.opens = false + draw({ job: paid(), filings: [lien() as never, release() as never] }) + fireEvent.click(screen.getByRole('button', { name: 'Print for notarization' })) + await Promise.resolve() + expect(writes.updates).toEqual([]) + cleanup() + printer.opens = true + draw({ job: paid(), filings: [lien() as never, release({ fields: { releasesFilingId: 'a1', paymentDate: '2026-11-20', printedForNotary: { by: 'u1', name: 'A. Clerk', at: '2026-11-21T15:00:00Z' } } }) as never] }) + fireEvent.click(screen.getByRole('button', { name: 'Print for notarization' })) + expect(printer.papers).toHaveLength(1) + await Promise.resolve() + expect(writes.updates).toEqual([]) + }) + it('leaves a saved release’s print alone', () => { draw({ job: paid(), filings: [lien() as never, release({ fields: { releasesFilingId: 'a1', paymentDate: '' } }) as never] }) expect(document.querySelector('[data-lien-release-day-why]')).toBeNull() diff --git a/src/components/jobs/LienFilingTabs.tsx b/src/components/jobs/LienFilingTabs.tsx index 4f4299d83e..9edcd920ee 100644 --- a/src/components/jobs/LienFilingTabs.tsx +++ b/src/components/jobs/LienFilingTabs.tsx @@ -90,7 +90,7 @@ import { ChangeableValue, ValueLine, ValueLines, ValueSentence } from '../values import { plainSentence } from '../../lib/valuesInPlace' import { RELEASE_OF_RECORD_WORDS, canReleaseAnyway, pickReleaseTarget, releaseMoneyBackWords, releaseMoneyGate, releaseNeedsBank, releaseCorrectable, releasePaymentDatePatch, releasePaymentDateShown, releasePaymentDayAsk, releasePaymentDayBeforeLien, releasePaymentDayKey, releaseSavedHold, releaseSavedPaymentDay, releaseRecordedSentence, releaseSaveFields, releaseStampDayCheck, releaseStampPatch, releaseTargets, releasePaymentDayCheck } from '../../lib/jobs/lienReleaseOfRecord' import { payoffNote } from '../../lib/jobs/lienPayoffFields' -import { releaseFacts } from '../../lib/jobs/lienReleaseFacts' +import { releaseByNow, releaseFacts, releaseFactsPatch } from '../../lib/jobs/lienReleaseFacts' /** * The statutory filing tabs of the Lien instruments modal (v2.2645, phase 3): @@ -215,7 +215,7 @@ export default function LienFilingTabs({ }) { // On a phone the record steps are sheets over the window's card (v2.4422); a computer keeps the boxes in the tab. const isMobile = useIsMobile() - const { user: authUser, role: authRole } = useAuth() + const { user: authUser, role: authRole, profileName } = useAuth() const { showToast } = useToastContext() const [pdfBusy, setPdfBusy] = useState(false) const [encloseInvoice, setEncloseInvoice] = useState(true) @@ -772,6 +772,8 @@ export default function LienFilingTabs({ // A print counts as a send (docs/SENT_COPIES.md): the paper is filed on the job as it printed. const ok = printAndFile(paperHtml, filing) if (!ok) showToast('Popup blocked — allow popups to print.', 'error') + // True when the paper went to the printer: a saved release is then marked as out for the notary (v2.9224). + return ok }, [currentDoc, noticeEnclosureHtml, showToast, job.id, jobNumber, docExtras.letterhead, printOptions, affidavitFields, helpSheetOn, helpPaper, noticeRecordOn, noticeRecord, printNoticeEnvelopes]) // A guide copy (punch list #314): the paper with a mark beside each blank and the notes down the side. It is a copy to learn from, never signed or filed, so nothing is filed on the job. @@ -794,12 +796,16 @@ export default function LienFilingTabs({ a.click() a.remove() URL.revokeObjectURL(url) + // A downloaded release is a copy that left the office, as a printed one is (v2.9224, finding 815): until then + // it filed nothing, so a check that came back read as if no release had gone out. + if (currentDoc.kind === 'release_of_record') void fileSentCopy({ kind: `lien_${currentDoc.kind}`, title: currentDoc.title, jobIds: [job.id], how: 'download' }, { blob, fileName: filingPdfFilename(currentDoc.kind, jobNumber), contentType: 'application/pdf' }) + return true } catch { showToast('Could not build the PDF.', 'error') } finally { setPdfBusy(false) } - }, [currentDoc, jobNumber, pdfBusy, showToast, withNoticeEnclosure]) + }, [currentDoc, jobNumber, pdfBusy, showToast, withNoticeEnclosure, job.id]) const insertFiling = useCallback( async (payload: Record, successMsg: string) => { @@ -982,6 +988,25 @@ export default function LienFilingTabs({ showToast(RELEASE_OF_RECORD_WORDS.paperCorrected, 'success') onChanged() } + /** + * Mark a saved release as out for the notary (v2.9224, finding 815), as the day's run does when it prints one. The + * tab's own print and download left no mark, so the run offered the same release to print again. The row is read + * fresh and the mark goes over its facts as they stand. A release already marked, recorded or voided is left alone. + */ + const markReleaseOut = async () => { + const release = releaseTarget?.release + if (!release || !authUser?.id || release.filed_at || releaseFacts(release.fields).printed) return + try { + const read = await withSupabaseRetry(() => supabase.from('job_lien_filings').select('id, filed_at, voided_at, fields').eq('id', release.id).maybeSingle(), 'mark the release as printed: read it first') + const row = read as { filed_at: string | null; voided_at: string | null; fields: unknown } | null + if (!row || !releaseCorrectable(row) || releaseFacts(row.fields).printed) return + const printed = releaseByNow({ id: authUser.id, name: profileName ?? '' }, new Date().toISOString()) + await withSupabaseRetry(() => supabase.from('job_lien_filings').update({ fields: releaseFactsPatch(row.fields, { printed }) } as never).eq('id', release.id), 'mark the release as printed for the notary') + onChanged() + } catch (e) { + showToast(formatErrorMessage(e, RELEASE_OF_RECORD_WORDS.markFailed), 'error') + } + } /** A corrected date before the lien was filed is asked about once: the first Keep says so, the second takes it. */ const releaseCorrectAsked = useRef(null) const checkReleaseCorrection = (draft: string): string | null => { @@ -1860,10 +1885,10 @@ export default function LienFilingTabs({

{releaseCorrectable(savedRelease) ? RELEASE_OF_RECORD_WORDS.paperHint : RELEASE_OF_RECORD_WORDS.countyRecord}

- -
diff --git a/src/content/help/release-a-filed-lien-after-it-is-paid.md b/src/content/help/release-a-filed-lien-after-it-is-paid.md index 2d9a439e41..b737021b39 100644 --- a/src/content/help/release-a-filed-lien-after-it-is-paid.md +++ b/src/content/help/release-a-filed-lien-after-it-is-paid.md @@ -133,7 +133,7 @@ The card lists each saved release under what it needs next. The four heads are * Press the blue button under **Print for the notary**. The button reads like {{button:blue|Print 3 releases for the notary}}. One print opens, with a release on each sheet. The leader signs each before a notary. -Some releases may be held. The button then reads like {{button:blue|Print 2 releases for the notary · 1 is short ▸}}. The ready ones print. The held one stays with its reason in red. *Short* means the job's bills owe money again. A release is also held when its check came back. The **Release of record** tab holds the same release. Its two print buttons wait, and the reason stands under them. +Some releases may be held. The button then reads like {{button:blue|Print 2 releases for the notary · 1 is short ▸}}. The ready ones print. The held one stays with its reason in red. *Short* means the job's bills owe money again. A release is also held when its check came back. The **Release of record** tab holds the same release. Its two print buttons wait, and the reason stands under them. A release printed or downloaded from that tab counts as printed here too. ## Record the notary and the copies in the run diff --git a/src/content/releaseNotes/v2.9224.ts b/src/content/releaseNotes/v2.9224.ts new file mode 100644 index 0000000000..25a8d3abf9 --- /dev/null +++ b/src/content/releaseNotes/v2.9224.ts @@ -0,0 +1,15 @@ +import type { ReleaseNote } from '../../lib/releaseNotes' + +const note: ReleaseNote = { + version: 'v2.9224', + date: '2026-12-02', + title: 'Release of record: a download is a copy, and a print is marked', + kind: 'fix', + highlights: [ + 'Download PDF on a release filed no copy on the job. It now files one, as Print for notarization does.', + 'A saved release printed or downloaded from its tab is now marked as printed for the notary.', + 'So the day’s run no longer offers the same release to print again, and a check that comes back finds the release that went out.', + ], +} + +export default note diff --git a/src/lib/jobs/lienReleaseOfRecord.ts b/src/lib/jobs/lienReleaseOfRecord.ts index eac9d2b43d..ba2b434f49 100644 --- a/src/lib/jobs/lienReleaseOfRecord.ts +++ b/src/lib/jobs/lienReleaseOfRecord.ts @@ -84,6 +84,8 @@ export const RELEASE_OF_RECORD_WORDS = { savedHeld: 'This release is saved and held. Do not sign it or record it yet.', heldCameBack: 'Held. The check behind it came back.', heldShortNext: 'Record the payment first.', + /** The paper went out and its mark did not take (v2.9224): the run would offer the same release to print again. */ + markFailed: 'The paper went out. The release did not take its printed mark.', } as const export type ReleaseState = 'none' | 'made' | 'recorded' diff --git a/to-dos/lien-release-road-faults/README.md b/to-dos/lien-release-road-faults/README.md index 7cede66e67..3e00cbac1e 100644 --- a/to-dos/lien-release-road-faults/README.md +++ b/to-dos/lien-release-road-faults/README.md @@ -2,7 +2,7 @@ name: "The release road: every fault found on the way to releasing a paid lien, and the ones left to mend" number: 479 group: ready -status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 3 is built (v2.9216) · the first half of step 4 is built (v2.9219) · step 5 is built (v2.9222) · the owner answered the three calls on 2026-12-02 · twelve steps are left +status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 3 is built (v2.9216) · the first half of step 4 is built (v2.9219) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · the owner answered the three calls on 2026-12-02 · twelve steps are left summary: > The owner asked for help releasing a paid lien and printing its release, and for every bug on the way. One thread read the road in the code and found fourteen faults, findings 808 to 821. @@ -61,7 +61,7 @@ State is as read on GitHub and on `main` on 2026-12-02 at 19:17 UTC. | 812 | A saved release cannot be corrected, and nothing says so. The only way is **Void**, **Confirm void** and making it again. Print needs no save, so a paper printed and signed can differ from the one saved after it. | read | Mended in part by v2.9219, step 4's first half: a saved release's payment date is corrected in place until the county's day is kept. Left: the facts drawn from the records, and the printed copy. | | 813 | A job has two liens. Keeping **Recorded on** throws the tab onto the other lien before **Instrument number** is typed. | read | Built in step 1, v2.9190. The tab holds the lien it stands on. | | 814 | A release is saved and the county has not recorded it. The job's bills owe again. The tab still says *Sign it before a notary. Then record it at the county.* Its print is live. Payoffs and the day's run hold the same release. | read | Mended by v2.9222, step 5: the tab reads the same hold, its two presses wait and the reason stands under them. | -| 815 | **Download PDF** files no copy. Neither press marks the release as printed for the notary. When a check then comes back, the app says no release has left the office. The day's run prints it again. | read | Not started. Step 6. | +| 815 | **Download PDF** files no copy. Neither press marks the release as printed for the notary. When a check then comes back, the app says no release has left the office. The day's run prints it again. | read | Mended by v2.9224, step 6: a download files a copy, and the tab's print or download marks a saved release as printed for the notary. | | 816 | Voiding a filed affidavit that has a release leaves the release with no lien. Payoffs, the Board and the tab offer a second release, and the head still says released. Under **Filings on this job** a release's line names no lien, number or day, so two cannot be told apart. A release the county recorded voids with the same two presses and no words. | read, its line seen | Not started. Step 7. | | 817 | Around the reload after **Save release record** a second release row can be written. Nothing in the database ties one release to one lien. A reload that fails draws *No recorded lien on this job*. | plausible | Not started. Step 8. | | 818 | The desk's path is never told that a release waits on a check. It says *Paid — file the release of record.* with **File the release ›** while the tab's presses are dead. The Board keeps one chip a job in a bin. So on a job with two liens **Make N release ›** can leave one out. | read | Not started. Step 9. | @@ -123,7 +123,7 @@ Lien desk lane's note of run 17 and are not on this card. line that says the screen differs from the last printed copy. 5. **Built, v2.9222. Bills that owe again hold the print (S). 814.** The tab reads the same hold as Payoffs and the run, and says why. -6. **A download is a copy, and a print is marked (S). 815.** **Download PDF** files a copy as the +6. **Built, v2.9224. A download is a copy, and a print is marked (S). 815.** **Download PDF** files a copy as the print does. Either press marks the release as out for the notary. 7. **Voids that leave nothing behind (M). 816.** The void of an affidavit with a live release is refused by a window with a **Take me there** press, which brings the person to the release From ebdcf1af697aa110fb93827932dd92eb031572b7 Mon Sep 17 00:00:00 2001 From: Robert Douglas <57234112+realrobertdouglas@users.noreply.github.com> Date: Wed, 2 Dec 2026 14:37:51 -0600 Subject: [PATCH 10/21] =?UTF-8?q?v2.9229=20=E2=80=94=20Release=20of=20reco?= =?UTF-8?q?rd:=20the=20county's=20stamp=20no=20longer=20overwrites=20other?= =?UTF-8?q?=20facts=20(finding=20819,=20punch=20list=20#479=20step=2010)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit keepReleaseStamp reads the release's row fresh and patches its facts as they stand. A row voided since takes no stamp. Co-Authored-By: Claude Fable 5.2 --- docs/LIEN_DESK_ARCHITECTURE.md | 1 + docs/recent-features/v2.9229.md | 25 +++++++++++++++++ .../LienFilingTabs.release.render.test.tsx | 28 +++++++++++++++++-- src/components/jobs/LienFilingTabs.tsx | 8 +++++- src/content/releaseNotes/v2.9229.ts | 15 ++++++++++ to-dos/lien-release-road-faults/README.md | 6 ++-- 6 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 docs/recent-features/v2.9229.md create mode 100644 src/content/releaseNotes/v2.9229.ts diff --git a/docs/LIEN_DESK_ARCHITECTURE.md b/docs/LIEN_DESK_ARCHITECTURE.md index 9ee37a85a7..a360c85c2a 100644 --- a/docs/LIEN_DESK_ARCHITECTURE.md +++ b/docs/LIEN_DESK_ARCHITECTURE.md @@ -743,6 +743,7 @@ last_updated: 2026-12-02 > A recorded release is never held. > **v2.9224 (a download is a copy, and a print is marked, finding 815):** the tab's **Download PDF** of a release files a sent copy with `how: 'download'` under the kind the print files, `lien_release_of_record`. > A saved release's print or download from the tab keeps `printedForNotary` on its row through `markReleaseOut`, read fresh first, as the day's run does, so the run stops offering it to print. +> **v2.9229 (keeping one fact writes one fact, finding 819):** `keepReleaseStamp` reads the release's row fresh and builds `releaseStampPatch` on its facts as they stand, and refuses a row voided since (`releaseGone`). > **v2.9190 (a door names its lien, findings 808 and 813):** `pickReleaseTarget` takes a third value, the lien the door named, read after the lien the tab holds and before the rule. > The doors are a lien's row in Payoffs and a release's line on the day's run: each `onOpenRelease` hands the job and its `affidavitId`, `LienDeskPage` keeps it as `releaseLienId` on the window it opens, and `LienInstrumentsModal` hands it to `LienFilingTabs`. > The tab holds the lien it stands on: an effect writes the picked lien's id into `releaseTargetId`, so a release the county has just recorded no longer hands the tab to the job's other lien. diff --git a/docs/recent-features/v2.9229.md b/docs/recent-features/v2.9229.md new file mode 100644 index 0000000000..9c49ef5853 --- /dev/null +++ b/docs/recent-features/v2.9229.md @@ -0,0 +1,25 @@ +# v2.9229 — Release of record: the county's stamp no longer overwrites other facts (2026-12-02) + +Step 10 of punch list #479 (the release road's faults), finding 819, in the tab. Client only. No migration, no function change, nothing owed on prod. Stacked on v2.9224 (step 6), which changes the same tab. + +## What was wrong + +- A release keeps its facts in one JSON column, `fields`: the paper's own, the release's instrument number, the notary's day, the copies' day, the mark of a check that came back. +- Keeping the instrument number built the new `fields` on the window's copy of the row and wrote the whole of it. A fact another screen had kept after the window opened was written over with the old copy. + +## What changed + +- [`LienFilingTabs.tsx`](../../src/components/jobs/LienFilingTabs.tsx): `keepReleaseStamp` reads the release's row first and hands `releaseStampPatch` its facts as they stand. A row voided in the meantime takes no stamp and the field says so (`releaseGone`). +- The same read is behind the two writes this train added to the tab: the payment date's correction (v2.9219) and the printed mark (v2.9224). + +## Not in this change + +- The day's run and Payoffs write a release's facts through `keepReleaseFacts` from the rows they read (`lienReleaseRunIo.ts`). They read just before they draw, so the window is short, and each is its own screen. A merge inside the database would close it for every writer and owes a migration and a push. It stays on the card under step 10. + +## Tests + +- `LienFilingTabs.release.render.test.tsx`: the stamp keeps a notary's day another screen wrote in the meantime; a release voided in the meantime takes no stamp and says so. The test's database now holds each filing the tab is drawn on. + +## Look owed + +- None of its own. It rides with the ZZ Test looks of the same train: a stamp kept on a ZZ Test release keeps its other facts. diff --git a/src/components/jobs/LienFilingTabs.release.render.test.tsx b/src/components/jobs/LienFilingTabs.release.render.test.tsx index cee50b7038..8581121f6d 100644 --- a/src/components/jobs/LienFilingTabs.release.render.test.tsx +++ b/src/components/jobs/LienFilingTabs.release.render.test.tsx @@ -22,7 +22,7 @@ vi.mock('../../hooks/useBankChecks', () => ({ const writes = vi.hoisted(() => ({ inserts: [] as Array>, updates: [] as Array<{ patch: Record; id: string }> })) /** The release row as the database holds it now, for the fresh read a correction makes first (v2.9219). */ -const reads = vi.hoisted(() => ({ fresh: null as Record | null })) +const reads = vi.hoisted(() => ({ fresh: null as Record | null, rows: {} as Record> })) /** The printer (v2.9224): whether the print window opened, and every paper sent to it. Nothing prints in a test. */ const printer = vi.hoisted(() => ({ opens: true, papers: [] as Array> })) @@ -56,7 +56,7 @@ vi.mock('../../lib/supabase', async () => { if (table !== 'job_lien_filings') return from(table) return { ...(from(table) as object), - select: (cols: string) => (cols === 'id, filed_at, voided_at, fields' ? { eq: () => ({ maybeSingle: () => Promise.resolve({ data: reads.fresh, error: null }) }) } : (from(table) as { select: (c: string) => unknown }).select(cols)), + select: (cols: string) => (cols === 'id, filed_at, voided_at, fields' ? { eq: (_col: string, id: string) => ({ maybeSingle: () => Promise.resolve({ data: reads.fresh ?? reads.rows[id] ?? null, error: null }) }) } : (from(table) as { select: (c: string) => unknown }).select(cols)), insert: (row: Record) => { writes.inserts.push(row) return { select: () => ({ single: () => Promise.resolve({ data: { id: 'new-release' }, error: null }) }) } @@ -80,6 +80,7 @@ afterEach(() => { writes.inserts.length = 0 writes.updates.length = 0 reads.fresh = null + reads.rows = {} printer.opens = true printer.papers.length = 0 bank.checks = [] @@ -97,6 +98,8 @@ const paid = () => type Props = Parameters[0] const draw = (over: Partial) => { const onChanged = vi.fn() + // The database holds each filing the tab is drawn on, for a write that reads its row fresh first (v2.9229). + for (const f of (over.filings ?? []) as unknown as Array>) reads.rows[String(f.id)] = f renderWithProviders( { + // Another screen kept the notary's day after this window read the release. + reads.fresh = { filed_at: null, voided_at: null, fields: { releasesFilingId: 'a1', paymentDate: '2026-11-20', notarizedYmd: '2026-11-22' } } + draw({ job: paid(), filings: [lien() as never, release() as never] }) + fireEvent.click(screen.getByRole('button', { name: /the release’s instrument number/ })) + fireEvent.change(screen.getByLabelText(/the release’s instrument number/), { target: { value: '2026-0431955' } }) + fireEvent.click(screen.getByRole('button', { name: 'Keep' })) + await waitFor(() => expect(writes.updates).toHaveLength(1)) + expect(writes.updates[0]).toEqual({ id: 'r1', patch: { fields: { releasesFilingId: 'a1', paymentDate: '2026-11-20', notarizedYmd: '2026-11-22', releaseInstrument: '2026-0431955' } } }) + }) + + it('keeps no stamp on a release voided in the meantime, and says so', async () => { + reads.fresh = { filed_at: null, voided_at: '2026-11-23T10:00:00Z', fields: { releasesFilingId: 'a1', paymentDate: '2026-11-20' } } + draw({ job: paid(), filings: [lien() as never, release() as never] }) + fireEvent.click(screen.getByRole('button', { name: /the release’s instrument number/ })) + fireEvent.change(screen.getByLabelText(/the release’s instrument number/), { target: { value: '2026-0431955' } }) + fireEvent.click(screen.getByRole('button', { name: 'Keep' })) + expect(await screen.findByText('This release is no longer open to a change. Close the window and read the job again.')).toBeTruthy() + expect(writes.updates).toEqual([]) + }) + it('leaves a saved release’s print alone', () => { draw({ job: paid(), filings: [lien() as never, release({ fields: { releasesFilingId: 'a1', paymentDate: '' } }) as never] }) expect(document.querySelector('[data-lien-release-day-why]')).toBeNull() diff --git a/src/components/jobs/LienFilingTabs.tsx b/src/components/jobs/LienFilingTabs.tsx index 9edcd920ee..83cae39a8a 100644 --- a/src/components/jobs/LienFilingTabs.tsx +++ b/src/components/jobs/LienFilingTabs.tsx @@ -968,7 +968,13 @@ export default function LienFilingTabs({ const keepReleaseStamp = async (change: { instrument?: string; day?: string }) => { const release = releaseTarget?.release if (!release) return - await withSupabaseRetry(() => supabase.from('job_lien_filings').update(releaseStampPatch(release, change) as never).eq('id', release.id), 'record the release’s stamp') + // The row is read fresh (finding 819): the patch was built on the window's copy of the facts, so keeping the + // instrument number wrote that whole copy back and lost a fact another screen had kept in the meantime, the + // notary's day, the copies' day or the mark of a check that came back. + const read = await withSupabaseRetry(() => supabase.from('job_lien_filings').select('id, filed_at, voided_at, fields').eq('id', release.id).maybeSingle(), 'record the release’s stamp: read it first') + const row = read as { filed_at: string | null; voided_at: string | null; fields: unknown } | null + if (!row || row.voided_at) throw new Error(RELEASE_OF_RECORD_WORDS.releaseGone) + await withSupabaseRetry(() => supabase.from('job_lien_filings').update(releaseStampPatch({ fields: row.fields }, change) as never).eq('id', release.id), 'record the release’s stamp') showToast(RELEASE_OF_RECORD_WORDS.stampKept, 'success') onChanged() } diff --git a/src/content/releaseNotes/v2.9229.ts b/src/content/releaseNotes/v2.9229.ts new file mode 100644 index 0000000000..a8e353cb50 --- /dev/null +++ b/src/content/releaseNotes/v2.9229.ts @@ -0,0 +1,15 @@ +import type { ReleaseNote } from '../../lib/releaseNotes' + +const note: ReleaseNote = { + version: 'v2.9229', + date: '2026-12-02', + title: 'Release of record: the county’s stamp no longer overwrites other facts', + kind: 'fix', + highlights: [ + 'Keeping a release’s instrument number wrote back every fact the window had read when it opened.', + 'A fact kept on another screen in the meantime could be lost: the notary’s day, the day the copies went out, or the mark of a check that came back.', + 'The stamp now reads the release fresh and changes its own value alone.', + ], +} + +export default note diff --git a/to-dos/lien-release-road-faults/README.md b/to-dos/lien-release-road-faults/README.md index 3e00cbac1e..3f0d94849e 100644 --- a/to-dos/lien-release-road-faults/README.md +++ b/to-dos/lien-release-road-faults/README.md @@ -2,7 +2,7 @@ name: "The release road: every fault found on the way to releasing a paid lien, and the ones left to mend" number: 479 group: ready -status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 3 is built (v2.9216) · the first half of step 4 is built (v2.9219) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · the owner answered the three calls on 2026-12-02 · twelve steps are left +status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 3 is built (v2.9216) · the first half of step 4 is built (v2.9219) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · step 10 is built in the tab (v2.9229) · the owner answered the three calls on 2026-12-02 · twelve steps are left summary: > The owner asked for help releasing a paid lien and printing its release, and for every bug on the way. One thread read the road in the code and found fourteen faults, findings 808 to 821. @@ -65,7 +65,7 @@ State is as read on GitHub and on `main` on 2026-12-02 at 19:17 UTC. | 816 | Voiding a filed affidavit that has a release leaves the release with no lien. Payoffs, the Board and the tab offer a second release, and the head still says released. Under **Filings on this job** a release's line names no lien, number or day, so two cannot be told apart. A release the county recorded voids with the same two presses and no words. | read, its line seen | Not started. Step 7. | | 817 | Around the reload after **Save release record** a second release row can be written. Nothing in the database ties one release to one lien. A reload that fails draws *No recorded lien on this job*. | plausible | Not started. Step 8. | | 818 | The desk's path is never told that a release waits on a check. It says *Paid — file the release of record.* with **File the release ›** while the tab's presses are dead. The Board keeps one chip a job in a bin. So on a job with two liens **Make N release ›** can leave one out. | read | Not started. Step 9. | -| 819 | Keeping the instrument number writes every kept fact of the release back from the window's copy. A fact another screen wrote in the meantime is lost. That can be the notary's day, the copies' day or the mark of a check that came back. | plausible | Not started. Step 10. | +| 819 | Keeping the instrument number writes every kept fact of the release back from the window's copy. A fact another screen wrote in the meantime is lost. That can be the notary's day, the copies' day or the mark of a check that came back. | plausible | Mended in the tab by v2.9229, step 10: the stamp's write reads the row fresh. The day's run and Payoffs still write from their own copy (`keepReleaseFacts`). | | 820 | **Go to the affidavit ›** does nothing a person can see when the **Lien affidavit** tab is already picked. It is the same dead press as 804. | read | Not started. Step 11. | | 821 | The stamp box says the stamped copy is saved on the release's line. That line takes a typed Drive link only. The scan press is drawn for a filed affidavit alone. | read | Not started. Step 12. | @@ -135,7 +135,7 @@ Lien desk lane's note of run 17 and are not on this card. ties one live release to one lien. This step is a migration and owes a push. 9. **The desk's path knows the wait, and one chip a lien (S). 818.** Built after card #477, since that card changes what opens the presses. -10. **Keeping one fact writes one fact (S). 819.** The write reads the row fresh, or merges in the +10. **Built in the tab, v2.9229. Keeping one fact writes one fact (S). 819.** The write reads the row fresh, or merges in the database. If it merges in the database it owes a push. 11. **Go to the affidavit › lands on the work (XS). 820.** The pattern of #10636. 12. **The release's line takes a scan (S). 821.** Or the stamp box's words say a link. From 8f6d8d38082ff5817a34487db3c788cacdabb5f9 Mon Sep 17 00:00:00 2001 From: Robert Douglas <57234112+realrobertdouglas@users.noreply.github.com> Date: Wed, 2 Dec 2026 14:49:14 -0600 Subject: [PATCH 11/21] =?UTF-8?q?v2.9232=20=E2=80=94=20Release=20of=20reco?= =?UTF-8?q?rd:=20the=20stamped=20release=20goes=20on=20its=20line=20as=20a?= =?UTF-8?q?=20scan=20(finding=20821,=20punch=20list=20#479=20step=2012)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The county's stamp box sends the office to the release's line under Filings on this job, and that line took a typed Drive link only. The saved copy's editor on a release's line now draws Upload the scanned PDF. The scan is named as a release in the job's folder and its link is written on the release, the two copy columns alone. Co-Authored-By: Claude Fable 5.2 --- docs/LIEN_DESK_ARCHITECTURE.md | 1 + docs/recent-features/v2.9232.md | 30 ++++++++++++ src/components/jobs/LienFiledScanPress.tsx | 16 +++++-- .../LienFilingTabs.release.render.test.tsx | 46 +++++++++++++++++++ src/components/jobs/LienFilingTabs.tsx | 22 +++++++-- .../release-a-filed-lien-after-it-is-paid.md | 2 +- src/content/releaseNotes/v2.9232.ts | 15 ++++++ src/lib/jobs/lienScanFile.test.ts | 24 +++++++++- src/lib/jobs/lienScanFile.ts | 25 +++++++++- to-dos/lien-release-road-faults/README.md | 7 +-- 10 files changed, 171 insertions(+), 17 deletions(-) create mode 100644 docs/recent-features/v2.9232.md create mode 100644 src/content/releaseNotes/v2.9232.ts diff --git a/docs/LIEN_DESK_ARCHITECTURE.md b/docs/LIEN_DESK_ARCHITECTURE.md index a360c85c2a..e70f1a9571 100644 --- a/docs/LIEN_DESK_ARCHITECTURE.md +++ b/docs/LIEN_DESK_ARCHITECTURE.md @@ -744,6 +744,7 @@ last_updated: 2026-12-02 > **v2.9224 (a download is a copy, and a print is marked, finding 815):** the tab's **Download PDF** of a release files a sent copy with `how: 'download'` under the kind the print files, `lien_release_of_record`. > A saved release's print or download from the tab keeps `printedForNotary` on its row through `markReleaseOut`, read fresh first, as the day's run does, so the run stops offering it to print. > **v2.9229 (keeping one fact writes one fact, finding 819):** `keepReleaseStamp` reads the release's row fresh and builds `releaseStampPatch` on its facts as they stand, and refuses a row voided since (`releaseGone`). +> **v2.9232 (the release's line takes a scan, finding 821):** the saved copy's editor on a `release_of_record` row under *Filings on this job* draws `LienFiledScanPress` with `paper="release"`, which names the file with `lienReleaseScanName` and writes the link under `LIEN_RELEASE_SCAN_NOTE` through `saveFilingScan`, the two copy columns alone. > **v2.9190 (a door names its lien, findings 808 and 813):** `pickReleaseTarget` takes a third value, the lien the door named, read after the lien the tab holds and before the rule. > The doors are a lien's row in Payoffs and a release's line on the day's run: each `onOpenRelease` hands the job and its `affidavitId`, `LienDeskPage` keeps it as `releaseLienId` on the window it opens, and `LienInstrumentsModal` hands it to `LienFilingTabs`. > The tab holds the lien it stands on: an effect writes the picked lien's id into `releaseTargetId`, so a release the county has just recorded no longer hands the tab to the job's other lien. diff --git a/docs/recent-features/v2.9232.md b/docs/recent-features/v2.9232.md new file mode 100644 index 0000000000..e1af5f2424 --- /dev/null +++ b/docs/recent-features/v2.9232.md @@ -0,0 +1,30 @@ +# v2.9232 — Release of record: the stamped release goes on its line as a scan (2026-12-02) + +Step 12 of punch list #479 (the release road's faults), finding 821. Client only. No migration, no function change, nothing owed on prod. Stacked on v2.9229 (step 10), which changes the same tab. + +## What was wrong + +- The county's stamp box on the Release of record tab says *The stamped copy is saved on the release's line, under Filings on this job.* +- That line's editor took a typed Drive link and a note. **Upload the scanned PDF** was drawn for a filed affidavit alone, so the office had to put the scan in Drive by hand and paste its link. + +## What changed + +- [`lienScanFile.ts`](../../src/lib/jobs/lienScanFile.ts): `lienReleaseScanName` (*Lien release, Job 2291, the county's stamped release, scanned, 2026-12-01.pdf*, with no day while the county's day is not typed), the note `LIEN_RELEASE_SCAN_NOTE`, the words `LIEN_RELEASE_SCAN_WORDS`, and `lienScanProblem` names a release as the paper to scan alone. +- [`LienFiledScanPress.tsx`](../../src/components/jobs/LienFiledScanPress.tsx): a `paper` prop, `affidavit` unless told. A release's press takes the release's name and words. The affidavit's press is unchanged, and `data-lien-filed-scan` now carries the paper. +- [`LienFilingTabs.tsx`](../../src/components/jobs/LienFilingTabs.tsx): the saved copy's editor on a release's line draws the press. `saveFilingScan` writes the link under the release's note. It writes `document_url` and `document_note` alone, so the release's other facts stand (finding 819). +- The help guide *release a filed lien after it is paid* says how. + +## Not in this change + +- The press is on the line, where the stamp box sends the office. The stamp box itself is unchanged. +- The Lien desk's batch of scans (*Choose the stamped liens*) still takes affidavits alone. + +## Tests + +- `lienScanFile.test.ts`: the release's name with and without a day, its own note, its words, the too-big sentence. +- `LienFilingTabs.release.render.test.tsx`: the press on the release's line and the affidavit's as before; a picked file lands in the folder under the release's name and its link is written on the release, the two copy columns alone; a scan before the county's day has no day in its name. + +## Look owed + +- A ZZ Test look, with the live-write slot: on the ZZ Test job's saved release, press *link the saved copy* on its line under **Filings on this job**, press **Upload the scanned PDF**, pick a small made-up PDF, and see the line read *Saved copy* with the scan's note. Then clear the link and take the file out of the ZZ Test job's folder. +- On a real lien a walker reads the line only. The press writes a file and a link. diff --git a/src/components/jobs/LienFiledScanPress.tsx b/src/components/jobs/LienFiledScanPress.tsx index a0ddf028f6..b75563b819 100644 --- a/src/components/jobs/LienFiledScanPress.tsx +++ b/src/components/jobs/LienFiledScanPress.tsx @@ -1,6 +1,6 @@ import { useRef, useState, type CSSProperties } from 'react' import { putJobFolderFile } from '../../lib/jobs/jobFolderAddFileIo' -import { LIEN_FILED_SCAN_WORDS, LIEN_SCAN_ACCEPT, lienFiledScanName, lienScanProblem } from '../../lib/jobs/lienScanFile' +import { LIEN_FILED_SCAN_WORDS, LIEN_RELEASE_SCAN_WORDS, LIEN_SCAN_ACCEPT, lienFiledScanName, lienReleaseScanName, lienScanProblem } from '../../lib/jobs/lienScanFile' import { formatErrorMessage } from '../../utils/errorHandling' import { useToastContext } from '../../contexts/ToastContext' @@ -13,6 +13,9 @@ import { useToastContext } from '../../contexts/ToastContext' * Team only, Sent by us, the moment it is picked, so a failure shows here and not after the record is saved. The link * comes back through `onSaved` and the form keeps it as the filing's saved copy until its own press writes the record. * A file the folder cannot take is refused with what to do about it. + * + * `paper="release"` is the same press on a release's line (finding 821, v2.9232): the county's stamped release, named + * as a release in the folder. */ export function LienFiledScanPress({ jobId, @@ -21,6 +24,7 @@ export function LienFiledScanPress({ url, onSaved, compact, + paper = 'affidavit', put = putJobFolderFile, }: { jobId: string @@ -32,15 +36,17 @@ export function LienFiledScanPress({ onSaved: (url: string) => void /** The computer's record box draws small presses; the phone's sheet draws them 44 px tall. */ compact?: boolean + /** Which stamped paper the scan is. A release's scan takes a release's name and words. */ + paper?: 'affidavit' | 'release' put?: typeof putJobFolderFile }) { const { showToast } = useToastContext() const input = useRef(null) const [busy, setBusy] = useState(false) - const words = LIEN_FILED_SCAN_WORDS + const words = paper === 'release' ? LIEN_RELEASE_SCAN_WORDS : LIEN_FILED_SCAN_WORDS const take = async (file: File) => { - const problem = lienScanProblem(file, 'affidavit') + const problem = lienScanProblem(file, paper) if (problem) { showToast(problem, 'error') if (input.current) input.current.value = '' @@ -48,7 +54,7 @@ export function LienFiledScanPress({ } setBusy(true) try { - const named = new File([file], lienFiledScanName(jobNumber, day, file), { type: file.type || 'application/pdf' }) + const named = new File([file], paper === 'release' ? lienReleaseScanName(jobNumber, day, file) : lienFiledScanName(jobNumber, day, file), { type: file.type || 'application/pdf' }) const added = await put(jobId, 'sent', named) onSaved(added.url) } catch (e) { @@ -64,7 +70,7 @@ export function LienFiledScanPress({ : { minHeight: 44, padding: '0 0.9rem', fontSize: '0.875rem', fontWeight: 600, background: 'var(--surface)', color: 'inherit', border: '1px solid var(--border-strong)', borderRadius: 8, cursor: busy ? 'wait' : 'pointer' } return ( - + ({ })) /** Who is on the tab. The office's assistant unless a test says otherwise. */ +/** The job's Drive folder (finding 821): each file a scan press puts there, and the link it answers. */ +const folder = vi.hoisted(() => ({ puts: [] as Array<{ jobId: string; where: string; name: string }> })) +vi.mock('../../lib/jobs/jobFolderAddFileIo', () => ({ + putJobFolderFile: (jobId: string, where: string, file: File) => { + folder.puts.push({ jobId, where, name: file.name }) + return Promise.resolve({ url: 'https://drive.google.com/file/d/zz-scan/view' }) + }, +})) + const auth = vi.hoisted(() => ({ role: 'assistant' })) vi.mock('../../hooks/useAuth', async () => { @@ -83,6 +92,7 @@ afterEach(() => { reads.rows = {} printer.opens = true printer.papers.length = 0 + folder.puts.length = 0 bank.checks = [] bank.asked.length = 0 }) @@ -608,3 +618,39 @@ describe('Release of record: the payment date is held before the print and the s expect(actions().every((b) => !b.disabled)).toBe(true) }) }) + +describe('Release of record: the release’s line takes the county’s stamped copy as a scan (finding 821, v2.9232)', () => { + const row = (id: string) => document.querySelector(`[data-lien-filing-row="${id}"]`)! + const openCopy = (id: string) => fireEvent.click([...row(id).querySelectorAll('button')].find((b) => b.textContent === 'link the saved copy')!) + + it('draws the scan press on the release’s line, named for a release, and the affidavit’s as before', () => { + draw({ job: paid(), filings: [lien() as never, release() as never] }) + expect(document.querySelector('[data-lien-filed-scan]')).toBeNull() + openCopy('r1') + const press = row('r1').querySelector('[data-lien-filed-scan="release"]')! + expect(press.querySelector('button')!.textContent).toBe('Upload the scanned PDF') + expect(press.querySelector('button')!.title).toContain('the stamped release') + openCopy('a1') + expect(row('a1').querySelector('[data-lien-filed-scan="affidavit"]')).toBeTruthy() + }) + + it('puts the scan in the job’s folder under a release’s name and keeps its link on the release, the two copy columns alone', async () => { + const { onChanged } = draw({ job: paid(), filings: [lien() as never, release({ filed_at: '2026-11-24' }) as never] }) + openCopy('r1') + const file = new File(['%PDF-1.4 zz'], 'SCAN0007.PDF', { type: 'application/pdf' }) + fireEvent.change(row('r1').querySelector('[data-lien-filed-scan="release"] input[type="file"]')!, { target: { files: [file] } }) + await waitFor(() => expect(writes.updates).toHaveLength(1)) + expect(folder.puts).toEqual([{ jobId: 'job-2041', where: 'sent', name: 'Lien release, Job 2041, the county’s stamped release, scanned, 2026-11-24.pdf' }]) + expect(writes.updates[0]).toEqual({ id: 'r1', patch: { document_url: 'https://drive.google.com/file/d/zz-scan/view', document_note: 'the county’s stamped release, scanned' } }) + expect(await screen.findByText('Scan saved as the release’s saved copy.')).toBeTruthy() + expect(onChanged).toHaveBeenCalled() + }) + + it('takes a scan before the county’s day is typed, with no day in the name', async () => { + draw({ job: paid(), filings: [lien() as never, release() as never] }) + openCopy('r1') + fireEvent.change(row('r1').querySelector('[data-lien-filed-scan="release"] input[type="file"]')!, { target: { files: [new File(['zz'], 'page.png', { type: 'image/png' })] } }) + await waitFor(() => expect(folder.puts).toHaveLength(1)) + expect(folder.puts[0]?.name).toBe('Lien release, Job 2041, the county’s stamped release, scanned.png') + }) +}) diff --git a/src/components/jobs/LienFilingTabs.tsx b/src/components/jobs/LienFilingTabs.tsx index 83cae39a8a..cec024a030 100644 --- a/src/components/jobs/LienFilingTabs.tsx +++ b/src/components/jobs/LienFilingTabs.tsx @@ -17,7 +17,7 @@ import { lienVoidPaperStuck, lienVoidPaperWords } from '../../lib/jobs/lienFilin import { voidLienFiling } from '../../lib/jobs/lienFilingVoidIo' import LienRecordSheet from './LienRecordSheet' import { LienFiledScanPress } from './LienFiledScanPress' -import { LIEN_CLERK_SCAN_NOTE } from '../../lib/jobs/lienScanFile' +import { LIEN_CLERK_SCAN_NOTE, LIEN_RELEASE_SCAN_NOTE, LIEN_RELEASE_SCAN_WORDS } from '../../lib/jobs/lienScanFile' import { LIEN_SCANS_DOOR_FROM_FILING } from '../../lib/jobs/lienScanBatch' import { lienDeskHref } from '../../lib/lien/lienDeskRoute' import { recordSheetField, recordSheetLabel } from './lienRecordSheetStyles' @@ -1033,18 +1033,24 @@ export default function LienFilingTabs({ setDocNote(e.target.value)} placeholder="note (optional)" aria-label="Saved copy — note" style={{ width: '100%', padding: '0.3rem 0.4rem', fontSize: '0.78rem', border: '1px solid var(--border-strong)', borderRadius: 4, background: 'var(--surface)', color: 'inherit' }} /> ) - /** A scan uploaded on a filing already recorded (punch list #366) is its saved copy at once: the file is in Drive, so the link is written with no second press. */ + /** + * A scan uploaded on a filing already recorded (punch list #366) is its saved copy at once: the file is in Drive, so + * the link is written with no second press. A release's stamped copy goes the same way under its own note (finding + * 821, v2.9232). The write names the two copy columns alone, so it leaves the release's other facts as they stand. + */ const saveFilingScan = async (f: JobLienFilingRow, url: string) => { + const release = f.kind === 'release_of_record' try { + const copy = release ? filingDocumentPayload({ url, note: LIEN_RELEASE_SCAN_NOTE }, { clear: true }) : filingDocumentPayload({ url, note: LIEN_CLERK_SCAN_NOTE }, { clear: true }) await withSupabaseRetry( - () => supabase.from('job_lien_filings').update(filingDocumentPayload({ url, note: LIEN_CLERK_SCAN_NOTE }, { clear: true }) as never).eq('id', f.id), + () => supabase.from('job_lien_filings').update(copy as never).eq('id', f.id), 'save lien filing scan', ) - showToast('Scan saved as the filing’s saved copy.', 'success') + showToast(release ? LIEN_RELEASE_SCAN_WORDS.kept : 'Scan saved as the filing’s saved copy.', 'success') setDocEditId(null) onChanged() } catch (e) { - showToast(formatErrorMessage(e, 'The scan is in the job’s Drive folder, but its link was not saved on the filing.'), 'error') + showToast(formatErrorMessage(e, release ? LIEN_RELEASE_SCAN_WORDS.linkFailed : 'The scan is in the job’s Drive folder, but its link was not saved on the filing.'), 'error') } } /** Add or change the saved copy on a recorded filing (v2.3763) — the run's link is often typed later, once the scan is in Drive. */ @@ -1216,6 +1222,12 @@ export default function LienFilingTabs({ void saveFilingScan(f, url)} /> ) : null} + {/* A release's stamped copy from this computer too (finding 821, v2.9232): the stamp box sends the office to this line. */} + {f.kind === 'release_of_record' ? ( + + void saveFilingScan(f, url)} /> + + ) : null} ) } diff --git a/src/content/help/release-a-filed-lien-after-it-is-paid.md b/src/content/help/release-a-filed-lien-after-it-is-paid.md index b737021b39..aef1b337f5 100644 --- a/src/content/help/release-a-filed-lien-after-it-is-paid.md +++ b/src/content/help/release-a-filed-lien-after-it-is-paid.md @@ -123,7 +123,7 @@ Take the notarized release to the county clerk. The clerk records it and stamps Back on the Lien desk, press {{button:blue|Record the county’s stamp ›}} on the row. The tab shows **The county's stamp**. Press the value beside **Recorded on**, set the day and press **Keep**. Do the same beside **Instrument number**. The row then reads *Released*. -The stamped copy goes on the release's line under **Filings on this job**. Press *link the saved copy* there and paste its Drive link. +The stamped copy goes on the release's line under **Filings on this job**. Press *link the saved copy* there. Then press {{button:outline|Upload the scanned PDF}} and pick the scan from this computer. The scan goes in the job's Drive folder and its link is kept on the line. A Drive link can be pasted there too. ## Print the releases in the run diff --git a/src/content/releaseNotes/v2.9232.ts b/src/content/releaseNotes/v2.9232.ts new file mode 100644 index 0000000000..2940e5205a --- /dev/null +++ b/src/content/releaseNotes/v2.9232.ts @@ -0,0 +1,15 @@ +import type { ReleaseNote } from '../../lib/releaseNotes' + +const note: ReleaseNote = { + version: 'v2.9232', + date: '2026-12-02', + title: 'Release of record: the stamped release goes on its line as a scan', + kind: 'fix', + highlights: [ + 'The county’s stamp box says the stamped copy is saved on the release’s line. That line took a pasted Drive link only.', + 'The line now has Upload the scanned PDF, as a filed lien’s line has. Press link the saved copy first.', + 'The scan goes in the job’s Drive folder, named as a release, and its link is kept on the line.', + ], +} + +export default note diff --git a/src/lib/jobs/lienScanFile.test.ts b/src/lib/jobs/lienScanFile.test.ts index d039107b2c..55388f4ebc 100644 --- a/src/lib/jobs/lienScanFile.test.ts +++ b/src/lib/jobs/lienScanFile.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' import { LIEN_CLERK_PAGE_NOTE } from './lienServiceProof' -import { LIEN_CLERK_SCAN_NOTE, LIEN_SCAN_ACCEPT, lienFiledScanName, lienScanExtension, lienScanIsPdf, lienScanProblem } from './lienScanFile' +import { LIEN_CLERK_SCAN_NOTE, LIEN_FILED_SCAN_WORDS, LIEN_RELEASE_SCAN_NOTE, LIEN_RELEASE_SCAN_WORDS, LIEN_SCAN_ACCEPT, lienFiledScanName, lienReleaseScanName, lienScanExtension, lienScanIsPdf, lienScanProblem } from './lienScanFile' describe('lienScanProblem', () => { it('takes a PDF, a picture, and a scanner’s file with no type but a PDF name', () => { @@ -34,3 +34,25 @@ describe('the scan’s name in Drive', () => { expect(LIEN_CLERK_SCAN_NOTE).not.toBe(LIEN_CLERK_PAGE_NOTE) }) }) + +describe('a release’s stamped copy, scanned (finding 821, v2.9232)', () => { + it('is named as a release, by its job and the day the county recorded it', () => { + expect(lienReleaseScanName('2291', '2026-12-01', { type: 'application/pdf', name: 'SCAN0009.PDF' })).toBe('Lien release, Job 2291, the county’s stamped release, scanned, 2026-12-01.pdf') + expect(lienReleaseScanName('2291', '', { type: 'image/png', name: 'shot' })).toBe('Lien release, Job 2291, the county’s stamped release, scanned.png') + }) + + it('has a note of its own, so the lien’s scan and the release’s are told apart in the folder and on the line', () => { + expect(LIEN_RELEASE_SCAN_NOTE).not.toBe(LIEN_CLERK_SCAN_NOTE) + expect(lienReleaseScanName('1', '', { type: '', name: 'a.pdf' })).not.toBe(lienFiledScanName('1', '', { type: '', name: 'a.pdf' })) + }) + + it('keeps the press’s words and names the release where the affidavit was named', () => { + expect(LIEN_RELEASE_SCAN_WORDS.press).toBe(LIEN_FILED_SCAN_WORDS.press) + expect(LIEN_RELEASE_SCAN_WORDS.title).toContain('stamped release') + expect(LIEN_RELEASE_SCAN_WORDS.title).not.toContain('affidavit') + }) + + it('says to scan the release alone when the file is too big', () => { + expect(lienScanProblem({ size: 14 * 1024 * 1024, type: 'application/pdf', name: 'stack.pdf' }, 'release')).toContain('Scan this release alone') + }) +}) diff --git a/src/lib/jobs/lienScanFile.ts b/src/lib/jobs/lienScanFile.ts index a44dfa1ff2..0f024558d4 100644 --- a/src/lib/jobs/lienScanFile.ts +++ b/src/lib/jobs/lienScanFile.ts @@ -22,8 +22,8 @@ export function lienScanIsPdf(file: Pick): bo return file.type === 'application/pdf' || /\.pdf$/i.test(file.name) } -/** Why a file cannot be added, in sentences, or null when it can. `paper` is the one to scan alone: *notice*, *affidavit*. */ -export function lienScanProblem(file: LienScanFileLike, paper: 'notice' | 'affidavit'): string | null { +/** Why a file cannot be added, in sentences, or null when it can. `paper` is the one to scan alone: *notice*, *affidavit*, *release*. */ +export function lienScanProblem(file: LienScanFileLike, paper: 'notice' | 'affidavit' | 'release'): string | null { if (!lienScanIsPdf(file) && !file.type.startsWith('image/')) return 'That file is not a scan or a photo. Add a PDF or a picture.' if (file.size <= 0) return 'That file is empty. Scan the papers again.' if (addFileTooBig(file.size)) return `That file is ${addFileSizeWords(file.size)}. The most a file can be is ${addFileSizeWords(ADD_FILE_MAX_BYTES)}. Scan this ${paper} alone, or at a lower quality.` @@ -53,6 +53,19 @@ export function lienFiledScanName(jobNumber: string, ymd: string, file: Pick): string { + const job = jobNumber.trim() ? `Job ${jobNumber.trim()}, ` : '' + const day = ymd.trim() ? `, ${ymd.trim()}` : '' + return `Lien release, ${job}${LIEN_RELEASE_SCAN_NOTE}${day}.${lienScanExtension(file)}` +} + /** The press's words. Each sentence is one idea, as a first-timer reads it. */ export const LIEN_FILED_SCAN_WORDS = { press: 'Upload the scanned PDF', @@ -62,3 +75,11 @@ export const LIEN_FILED_SCAN_WORDS = { title: 'Pick the scan of the stamped affidavit from this computer. It goes in the job’s Drive folder, under Sent by us.', failed: 'The file was not added. Nothing was saved.', } as const + +/** The same press on a release's line (finding 821, v2.9232): only the paper it names differs. */ +export const LIEN_RELEASE_SCAN_WORDS = { + ...LIEN_FILED_SCAN_WORDS, + title: 'Pick the scan of the stamped release from this computer. It goes in the job’s Drive folder, under Sent by us.', + kept: 'Scan saved as the release’s saved copy.', + linkFailed: 'The scan is in the job’s Drive folder, but its link was not saved on the release.', +} as const diff --git a/to-dos/lien-release-road-faults/README.md b/to-dos/lien-release-road-faults/README.md index 3f0d94849e..f4f8597586 100644 --- a/to-dos/lien-release-road-faults/README.md +++ b/to-dos/lien-release-road-faults/README.md @@ -2,7 +2,7 @@ name: "The release road: every fault found on the way to releasing a paid lien, and the ones left to mend" number: 479 group: ready -status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 3 is built (v2.9216) · the first half of step 4 is built (v2.9219) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · step 10 is built in the tab (v2.9229) · the owner answered the three calls on 2026-12-02 · twelve steps are left +status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 3 is built (v2.9216) · the first half of step 4 is built (v2.9219) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · step 10 is built in the tab (v2.9229) · step 12 is built (v2.9232) · the owner answered the three calls on 2026-12-02 · steps 2, 7, 8, 9, 11, 13 and 14 are left, with the second halves of steps 4 and 10 summary: > The owner asked for help releasing a paid lien and printing its release, and for every bug on the way. One thread read the road in the code and found fourteen faults, findings 808 to 821. @@ -67,7 +67,7 @@ State is as read on GitHub and on `main` on 2026-12-02 at 19:17 UTC. | 818 | The desk's path is never told that a release waits on a check. It says *Paid — file the release of record.* with **File the release ›** while the tab's presses are dead. The Board keeps one chip a job in a bin. So on a job with two liens **Make N release ›** can leave one out. | read | Not started. Step 9. | | 819 | Keeping the instrument number writes every kept fact of the release back from the window's copy. A fact another screen wrote in the meantime is lost. That can be the notary's day, the copies' day or the mark of a check that came back. | plausible | Mended in the tab by v2.9229, step 10: the stamp's write reads the row fresh. The day's run and Payoffs still write from their own copy (`keepReleaseFacts`). | | 820 | **Go to the affidavit ›** does nothing a person can see when the **Lien affidavit** tab is already picked. It is the same dead press as 804. | read | Not started. Step 11. | -| 821 | The stamp box says the stamped copy is saved on the release's line. That line takes a typed Drive link only. The scan press is drawn for a filed affidavit alone. | read | Not started. Step 12. | +| 821 | The stamp box says the stamped copy is saved on the release's line. That line takes a typed Drive link only. The scan press is drawn for a filed affidavit alone. | read | Built, v2.9232. The release's line draws **Upload the scanned PDF**. Step 12. | ## Found on the same road @@ -138,7 +138,8 @@ Lien desk lane's note of run 17 and are not on this card. 10. **Built in the tab, v2.9229. Keeping one fact writes one fact (S). 819.** The write reads the row fresh, or merges in the database. If it merges in the database it owes a push. 11. **Go to the affidavit › lands on the work (XS). 820.** The pattern of #10636. -12. **The release's line takes a scan (S). 821.** Or the stamp box's words say a link. +12. **Built, v2.9232. The release's line takes a scan (S). 821.** The saved copy's editor on a release's line has + **Upload the scanned PDF**. The scan is named as a release in the job's folder. 13. **Missing property facts are named before the save (S). 825.** 14. **The slow link (S). 827.** Measure what the nine seconds are first. Then mend what the measure shows. From bedea573ad9756d1e94a1096a040562d40047eb4 Mon Sep 17 00:00:00 2001 From: Robert Douglas <57234112+realrobertdouglas@users.noreply.github.com> Date: Wed, 2 Dec 2026 14:53:47 -0600 Subject: [PATCH 12/21] =?UTF-8?q?v2.9234=20=E2=80=94=20Release=20of=20reco?= =?UTF-8?q?rd:=20a=20blank=20line=20on=20the=20paper=20is=20named=20before?= =?UTF-8?q?=20the=20save=20(finding=20825,=20punch=20list=20#479=20step=20?= =?UTF-8?q?13)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On a job with no property facts the release printed a blank line for the owner and the legal description, and the tab said nothing before the save. A line above the presses of a release still to save now names each fact the paper would print blank and where it is fixed. It names and does not hold. Co-Authored-By: Claude Fable 5.2 --- docs/LIEN_DESK_ARCHITECTURE.md | 1 + docs/recent-features/v2.9234.md | 29 ++++++++++++++++ .../LienFilingTabs.release.render.test.tsx | 21 ++++++++++++ src/components/jobs/LienFilingTabs.tsx | 11 +++++- .../release-a-filed-lien-after-it-is-paid.md | 2 ++ src/content/releaseNotes/v2.9234.ts | 15 ++++++++ src/lib/jobs/lienReleaseOfRecord.test.ts | 30 +++++++++++++++- src/lib/jobs/lienReleaseOfRecord.ts | 34 +++++++++++++++++++ to-dos/lien-release-road-faults/README.md | 7 ++-- 9 files changed, 145 insertions(+), 5 deletions(-) create mode 100644 docs/recent-features/v2.9234.md create mode 100644 src/content/releaseNotes/v2.9234.ts diff --git a/docs/LIEN_DESK_ARCHITECTURE.md b/docs/LIEN_DESK_ARCHITECTURE.md index e70f1a9571..265338ac05 100644 --- a/docs/LIEN_DESK_ARCHITECTURE.md +++ b/docs/LIEN_DESK_ARCHITECTURE.md @@ -745,6 +745,7 @@ last_updated: 2026-12-02 > A saved release's print or download from the tab keeps `printedForNotary` on its row through `markReleaseOut`, read fresh first, as the day's run does, so the run stops offering it to print. > **v2.9229 (keeping one fact writes one fact, finding 819):** `keepReleaseStamp` reads the release's row fresh and builds `releaseStampPatch` on its facts as they stand, and refuses a row voided since (`releaseGone`). > **v2.9232 (the release's line takes a scan, finding 821):** the saved copy's editor on a `release_of_record` row under *Filings on this job* draws `LienFiledScanPress` with `paper="release"`, which names the file with `lienReleaseScanName` and writes the link under `LIEN_RELEASE_SCAN_NOTE` through `saveFilingScan`, the two copy columns alone. +> **v2.9234 (blank facts are named before the save, finding 825):** `releasePaperBlanks` reads the release's drawn fields for a blank county, owner, legal description or property address, and `releasePaperBlanksWords` names them above the presses of a release still to save (`data-lien-release-blanks`), where it names and does not hold. > **v2.9190 (a door names its lien, findings 808 and 813):** `pickReleaseTarget` takes a third value, the lien the door named, read after the lien the tab holds and before the rule. > The doors are a lien's row in Payoffs and a release's line on the day's run: each `onOpenRelease` hands the job and its `affidavitId`, `LienDeskPage` keeps it as `releaseLienId` on the window it opens, and `LienInstrumentsModal` hands it to `LienFilingTabs`. > The tab holds the lien it stands on: an effect writes the picked lien's id into `releaseTargetId`, so a release the county has just recorded no longer hands the tab to the job's other lien. diff --git a/docs/recent-features/v2.9234.md b/docs/recent-features/v2.9234.md new file mode 100644 index 0000000000..1094f3f7c7 --- /dev/null +++ b/docs/recent-features/v2.9234.md @@ -0,0 +1,29 @@ +# v2.9234 — Release of record: a blank line on the paper is named before the save (2026-12-02) + +Step 13 of punch list #479 (the release road's faults), finding 825. Client only. No migration, no function change, nothing owed on prod. Stacked on v2.9232 (step 12), which changes the same tab. + +## What was wrong + +- The release's paper names the county, the owner of record, the legal description and the property address. A fact its record does not hold prints as a blank line. +- On a job with no property facts the walker saw the owner and the description blank on the paper. The tab said nothing before **Save release record** took it, and a saved release prints as it was saved. + +## What changed + +- [`lienReleaseOfRecord.ts`](../../src/lib/jobs/lienReleaseOfRecord.ts): `releasePaperBlanks` reads the paper's fields for a blank county, owner, legal description or property address, in the paper's order. `releasePaperBlanksWords` names them and says where each is fixed: property facts in the customer's address book, the address on the job. +- [`LienFilingTabs.tsx`](../../src/components/jobs/LienFilingTabs.tsx): the line stands above the three presses of a release still to save (`data-lien-release-blanks`). +- It names and does not hold. The lien's instrument number is what the county releases against, and a release that is owed must not wait on an address book. +- The help guide *release a filed lien after it is paid* says so. + +## Not in this change + +- A release already saved with a blank line. Its paper is its saved fields. Reading the record's facts again on a saved release is the second half of step 4 on the card. +- The lien's own instrument number and the claimant's name. The run already refuses to print a release without them (`releaseRunPaper`). + +## Tests + +- `lienReleaseOfRecord.test.ts`: no blanks, each blank in order, the sentence for one and for several, the address's own door, plain words. +- `LienFilingTabs.release.render.test.tsx`: nothing on a whole record, the owner and the description named with the presses live on a job with no property record, nothing on a saved release. + +## Look owed + +- Read only, no slot: on the ZZ Test job with no property record, open the Lien window on the Release of record tab with no release saved and read the amber line above the presses. Press nothing. diff --git a/src/components/jobs/LienFilingTabs.release.render.test.tsx b/src/components/jobs/LienFilingTabs.release.render.test.tsx index 6af1fd7367..5adbb25f6c 100644 --- a/src/components/jobs/LienFilingTabs.release.render.test.tsx +++ b/src/components/jobs/LienFilingTabs.release.render.test.tsx @@ -654,3 +654,24 @@ describe('Release of record: the release’s line takes the county’s stamped c expect(folder.puts[0]?.name).toBe('Lien release, Job 2041, the county’s stamped release, scanned.png') }) }) + +describe('Release of record: the facts the paper would print blank are named before the save (finding 825, v2.9234)', () => { + const blanks = () => document.querySelector('[data-lien-release-blanks]') + + it('says nothing on a job whose property facts are whole', () => { + draw({ job: paid() }) + expect(blanks()).toBeNull() + }) + + it('names the owner and the legal description on a job with no property record, and leaves the presses live', () => { + draw({ job: paid(), linkedAddress: null }) + expect(blanks()!.dataset.lienReleaseBlanks).toBe('owner legal') + expect(blanks()!.textContent).toBe('The paper has a blank line for the owner of record and the legal description. Property facts are fixed in the customer’s address book. Fix them before you print, or the release prints with the lines blank.') + expect(actions().every((b) => !b.disabled)).toBe(true) + }) + + it('is not asked of a saved release, which prints as it was saved', () => { + draw({ job: paid(), linkedAddress: null, filings: [lien() as never, release() as never] }) + expect(blanks()).toBeNull() + }) +}) diff --git a/src/components/jobs/LienFilingTabs.tsx b/src/components/jobs/LienFilingTabs.tsx index cec024a030..61cc502b94 100644 --- a/src/components/jobs/LienFilingTabs.tsx +++ b/src/components/jobs/LienFilingTabs.tsx @@ -88,7 +88,7 @@ import { lienTradeWords } from '../../lib/jobs/lienTradeWords' import { MoneyText } from '../Money' import { ChangeableValue, ValueLine, ValueLines, ValueSentence } from '../valuesInPlace/ValuesInPlace' import { plainSentence } from '../../lib/valuesInPlace' -import { RELEASE_OF_RECORD_WORDS, canReleaseAnyway, pickReleaseTarget, releaseMoneyBackWords, releaseMoneyGate, releaseNeedsBank, releaseCorrectable, releasePaymentDatePatch, releasePaymentDateShown, releasePaymentDayAsk, releasePaymentDayBeforeLien, releasePaymentDayKey, releaseSavedHold, releaseSavedPaymentDay, releaseRecordedSentence, releaseSaveFields, releaseStampDayCheck, releaseStampPatch, releaseTargets, releasePaymentDayCheck } from '../../lib/jobs/lienReleaseOfRecord' +import { RELEASE_OF_RECORD_WORDS, canReleaseAnyway, pickReleaseTarget, releaseMoneyBackWords, releaseMoneyGate, releaseNeedsBank, releasePaperBlanks, releasePaperBlanksWords, releaseCorrectable, releasePaymentDatePatch, releasePaymentDateShown, releasePaymentDayAsk, releasePaymentDayBeforeLien, releasePaymentDayKey, releaseSavedHold, releaseSavedPaymentDay, releaseRecordedSentence, releaseSaveFields, releaseStampDayCheck, releaseStampPatch, releaseTargets, releasePaymentDayCheck } from '../../lib/jobs/lienReleaseOfRecord' import { payoffNote } from '../../lib/jobs/lienPayoffFields' import { releaseByNow, releaseFacts, releaseFactsPatch } from '../../lib/jobs/lienReleaseFacts' @@ -1818,6 +1818,9 @@ export default function LienFilingTabs({ const releaseDayAsk = savedRelease || releaseDayWhy ? null : releasePaymentDayAsk(releasePaymentDate, releaseTarget?.affidavit.filed_at, releaseDayIsKept) const releaseDayKeptNote = !savedRelease && !releaseDayWhy && releaseDayIsKept && releasePaymentDayBeforeLien(releasePaymentDate, releaseTarget?.affidavit.filed_at) const releaseDead = releaseGate.hold || Boolean(releaseDayWhy) || Boolean(releaseDayAsk) + // The property facts the paper would print blank, asked of a release still to save (finding 825, v2.9234). + const releaseBlanks = savedRelease ? [] : releasePaperBlanks(releaseFields) + const releaseBlanksWords = releasePaperBlanksWords(releaseBlanks) const releaseHeld: CSSProperties = releaseDead ? { background: DEAD_PRESS_FILL, color: DEAD_PRESS_TEXT, border: '1px solid transparent', cursor: 'default' } : {} const releaseTone = { red: 'var(--text-red-700)', amber: 'var(--text-amber-800)', green: 'var(--text-green-700)' }[releaseGate.tone] const releaseOutline: CSSProperties = { padding: '0.45rem 0.9rem', fontSize: '0.8125rem', background: 'var(--surface)', border: '1px solid #2563eb', color: 'var(--text-link)', borderRadius: 4, cursor: 'pointer', ...releasePhoneButton } @@ -1973,6 +1976,12 @@ export default function LienFilingTabs({

) : null} {isMobile ?
{sheetSavedCopy}
: savedCopyRow} + {/* The facts the paper would print as blank lines, named before the save (finding 825, v2.9234). It names and does not hold. */} + {releaseBlanksWords ? ( +

+ {releaseBlanksWords} +

+ ) : null}
+ ) : null} + {releaseReprint ? ( +

+ +

+ ) : null}

{releaseCorrectable(savedRelease) ? RELEASE_OF_RECORD_WORDS.paperHint : RELEASE_OF_RECORD_WORDS.countyRecord}

diff --git a/src/content/help/release-a-filed-lien-after-it-is-paid.md b/src/content/help/release-a-filed-lien-after-it-is-paid.md index 3e0ac67db5..14be2b6b3d 100644 --- a/src/content/help/release-a-filed-lien-after-it-is-paid.md +++ b/src/content/help/release-a-filed-lien-after-it-is-paid.md @@ -95,6 +95,10 @@ The payment date is already the day of the last payment. It prints on the paper, The paper names the county, the owner, the legal description and the property address. A line above the buttons says when the paper has a blank line for one of them. It reads like *The paper has a blank line for the owner of record.* Property facts are fixed in the customer's address book. Fix them before you print. The buttons do not wait on it. +A saved release keeps the facts it was saved with. Was the owner or the legal description fixed after the save? **The paper** then lists each fact with what the record says now. Press the counted press under them, like {{button:outline|Use 2 facts from the record}}. The paper takes them. A fact the record does not hold is left as the paper has it. + +Did the paper change after it was printed? A line under **The paper** says what changed and the day of the print. It reads like *The payment date changed after this release was printed Dec 2.* Print it again, so the notary signs the paper the app holds. The line goes away after the print. + The leader signs the paper before a notary. You can print the release with the day's other releases. Read [Print the releases in the run](#print-the-releases-in-the-run) below. diff --git a/src/content/releaseNotes/v2.9238.ts b/src/content/releaseNotes/v2.9238.ts new file mode 100644 index 0000000000..dac80cce40 --- /dev/null +++ b/src/content/releaseNotes/v2.9238.ts @@ -0,0 +1,16 @@ +import type { ReleaseNote } from '../../lib/releaseNotes' + +const note: ReleaseNote = { + version: 'v2.9238', + date: '2026-12-02', + title: 'Release of record: a saved release takes the record’s facts, and says when to print again', + kind: 'fix', + highlights: [ + 'A saved release kept the owner and the legal description it was saved with, even after they were fixed.', + 'The paper now lists each fact the record gives differently. One press, like Use 2 facts from the record, takes them.', + 'A line says when the paper changed after it was printed, and to print it again before the notary signs.', + 'Both stop once the county records the release.', + ], +} + +export default note diff --git a/src/lib/jobs/lienReleaseFacts.test.ts b/src/lib/jobs/lienReleaseFacts.test.ts index e069a32ad5..d1d67bbda6 100644 --- a/src/lib/jobs/lienReleaseFacts.test.ts +++ b/src/lib/jobs/lienReleaseFacts.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { RELEASE_FACT_KEYS, releaseByNow, releaseByYmd, releaseFacts, releaseFactsPatch } from './lienReleaseFacts' +import { RELEASE_FACT_KEYS, RELEASE_PAPER_KEYS, releaseByNow, releaseByYmd, releaseFacts, releaseFactsPatch, releasePaperChangedSincePrint, releasePrintedPaper } from './lienReleaseFacts' // Every name here is made up. const WHO = { by: 'u1', name: 'Alex Rivera', at: '2026-11-27T03:30:00Z' } @@ -23,7 +23,7 @@ describe('releaseFactsPatch', () => { it('adds a fact and keeps the paper’s own fields', () => { expect(releaseFactsPatch(paper, { notarizedYmd: '2026-12-01' })).toEqual({ ...paper, notarizedYmd: '2026-12-01' }) - expect(releaseFactsPatch(paper, { printed: WHO })).toEqual({ ...paper, printedForNotary: WHO }) + expect(releaseFactsPatch(paper, { printed: WHO })).toMatchObject({ ...paper, printedForNotary: WHO }) expect(releaseFactsPatch(paper, { copies: { ...WHO, ymd: '2026-12-05' } })).toEqual({ ...paper, copiesSent: { ymd: '2026-12-05', by: 'u1', name: 'Alex Rivera', at: WHO.at } }) }) @@ -65,3 +65,39 @@ describe('who pressed', () => { expect(releaseByYmd(WHO)).toBe('2026-11-26') }) }) + +describe('the paper as it stood at its last print (finding 812, v2.9238)', () => { + const saved = { releasesFilingId: 'a1', county: 'Travis', ownerName: 'Marisol Okafor', legalDescription: 'LOT 1 BLK 2', paymentDate: '2026-11-20', recordingNumber: '2026-0412207' } + + it('is kept with the print’s mark, the nine facts the paper draws and nothing else', () => { + const marked = releaseFactsPatch(saved, { printed: WHO }) + const kept = releasePrintedPaper(marked)! + expect(Object.keys(kept).sort()).toEqual([...RELEASE_PAPER_KEYS].sort()) + expect(kept).toMatchObject({ county: 'Travis', ownerName: 'Marisol Okafor', paymentDate: '2026-11-20', propertyAddress: '' }) + expect(releasePaperChangedSincePrint(marked)).toEqual([]) + }) + + it('names what changed after the print, in the paper’s order', () => { + const marked = releaseFactsPatch(saved, { printed: WHO }) + expect(releasePaperChangedSincePrint({ ...marked, paymentDate: '2026-11-21', ownerName: 'Marisol Okafor-Reyes' })).toEqual(['ownerName', 'paymentDate']) + }) + + it('says nothing of a release never printed, or of a print marked before the copy was kept', () => { + expect(releasePrintedPaper(saved)).toBeNull() + expect(releasePaperChangedSincePrint(saved)).toEqual([]) + expect(releasePaperChangedSincePrint({ ...saved, printedForNotary: WHO })).toEqual([]) + }) + + it('goes with the mark when the print is taken off, and a second print keeps the paper as it stands then', () => { + const marked = releaseFactsPatch(saved, { printed: WHO }) + expect(releaseFactsPatch(marked, { printed: null })).toEqual(saved) + const again = releaseFactsPatch({ ...marked, paymentDate: '2026-11-21' }, { printed: { ...WHO, at: '2026-11-28T15:00:00Z' } }) + expect(releasePrintedPaper(again)!.paymentDate).toBe('2026-11-21') + expect(releasePaperChangedSincePrint(again)).toEqual([]) + }) + + it('is left alone by the other facts’ changes', () => { + const marked = releaseFactsPatch(saved, { printed: WHO }) + expect(releasePrintedPaper(releaseFactsPatch(marked, { notarizedYmd: '2026-12-01' }))).toEqual(releasePrintedPaper(marked)) + }) +}) diff --git a/src/lib/jobs/lienReleaseFacts.ts b/src/lib/jobs/lienReleaseFacts.ts index 87f415fe09..46b0f97d93 100644 --- a/src/lib/jobs/lienReleaseFacts.ts +++ b/src/lib/jobs/lienReleaseFacts.ts @@ -44,6 +44,32 @@ function readBy(raw: unknown): ReleaseBy | null { return at ? { by: text(r.by), name: text(r.name), at } : null } +/** The paper's own facts on a release row: the nine its print draws. */ +export const RELEASE_PAPER_KEYS = ['county', 'claimantCompany', 'claimantPersonName', 'recordingNumber', 'filedDate', 'legalDescription', 'propertyAddress', 'ownerName', 'paymentDate'] as const +export type ReleasePaperKey = (typeof RELEASE_PAPER_KEYS)[number] + +/** Where a row keeps its paper as it stood at its last print (finding 812, v2.9238). */ +export const RELEASE_PRINTED_PAPER_KEY = 'printedPaper' + +const paperOf = (f: Record): Record => Object.fromEntries(RELEASE_PAPER_KEYS.map((k) => [k, text(f[k])])) as Record + +/** The paper as it stood at its last print, or null when the row keeps none: no print, or a print marked before v2.9238. */ +export function releasePrintedPaper(fields: unknown): Record | null { + const kept = asObject(fields)[RELEASE_PRINTED_PAPER_KEY] + return kept && typeof kept === 'object' && !Array.isArray(kept) ? paperOf(kept as Record) : null +} + +/** + * The paper's facts that changed since its last print, in the paper's order. Empty when it was not printed, when the + * row keeps no copy of the print, or when nothing changed. A paper signed before a notary must be the one on the row. + */ +export function releasePaperChangedSincePrint(fields: unknown): ReleasePaperKey[] { + const printed = releasePrintedPaper(fields) + if (!printed) return [] + const now = paperOf(asObject(fields)) + return RELEASE_PAPER_KEYS.filter((k) => now[k] !== printed[k]) +} + /** The three facts off a release row's `fields`. A broken one reads as not there. */ export function releaseFacts(fields: unknown): ReleaseFacts { const f = asObject(fields) @@ -79,8 +105,14 @@ export type ReleaseFactsChange = { export function releaseFactsPatch(fields: unknown, change: ReleaseFactsChange): Record { const out = asObject(fields) if (change.printed !== undefined) { - if (change.printed) out[RELEASE_FACT_KEYS.printed] = { by: change.printed.by, name: change.printed.name, at: change.printed.at } - else delete out[RELEASE_FACT_KEYS.printed] + // The print keeps the paper as it stood (v2.9238), for every screen that marks one: the tab, Payoffs and the run. + if (change.printed) { + out[RELEASE_FACT_KEYS.printed] = { by: change.printed.by, name: change.printed.name, at: change.printed.at } + out[RELEASE_PRINTED_PAPER_KEY] = paperOf(out) + } else { + delete out[RELEASE_FACT_KEYS.printed] + delete out[RELEASE_PRINTED_PAPER_KEY] + } } if (change.notarizedYmd !== undefined) { const day = change.notarizedYmd.trim() diff --git a/src/lib/jobs/lienReleaseOfRecord.test.ts b/src/lib/jobs/lienReleaseOfRecord.test.ts index 072fcb87b3..adbb4b54a7 100644 --- a/src/lib/jobs/lienReleaseOfRecord.test.ts +++ b/src/lib/jobs/lienReleaseOfRecord.test.ts @@ -3,7 +3,8 @@ import { plainWordsFailures } from '../plainWords' import { plainSentence, val } from '../valuesInPlace' import type { LienPayoffAffidavit, LienPayoffPayment, LienPayoffRelease } from './lienPayoff' import type { BankCheck } from './checkCleared' -import { RELEASE_OF_RECORD_WORDS, canReleaseAnyway, pickReleaseTarget, releaseMoneyBackWords, releaseMoneyGate, releaseNeedsBank, releasePaperBlanks, releasePaperBlanksWords, releaseCorrectable, releasePaymentDatePatch, releasePaymentDateShown, releasePaymentDay, releaseSavedPaymentDay, releasePaymentDayAsk, releasePaymentDayBeforeLien, releasePaymentDayCheck, releasePaymentDayKey, releaseRecordedSentence, releaseSaveFields, releaseSavedHold, releaseStampDayCheck, releaseStampPatch, releaseTargets, releaseWaitsOnCheck } from './lienReleaseOfRecord' +import { releaseFactsPatch } from './lienReleaseFacts' +import { RELEASE_OF_RECORD_WORDS, canReleaseAnyway, pickReleaseTarget, releaseMoneyBackWords, releaseMoneyGate, releaseNeedsBank, releasePaperBlanks, releasePaperBlanksWords, releaseRecordDrift, releaseRecordFactsPatch, releaseReprintWords, releaseCorrectable, releasePaymentDatePatch, releasePaymentDateShown, releasePaymentDay, releaseSavedPaymentDay, releasePaymentDayAsk, releasePaymentDayBeforeLien, releasePaymentDayCheck, releasePaymentDayKey, releaseRecordedSentence, releaseSaveFields, releaseSavedHold, releaseStampDayCheck, releaseStampPatch, releaseTargets, releaseWaitsOnCheck } from './lienReleaseOfRecord' // Every job, instrument and amount here is made up. const TODAY = '2026-11-24' @@ -411,3 +412,49 @@ describe('the facts a release would print as blank lines are named before the sa for (const blanks of [['owner', 'legal'], ['address'], ['county', 'owner', 'legal', 'address']] as const) expect(plainWordsFailures(releasePaperBlanksWords(blanks) ?? '')).toEqual([]) }) }) + +describe('a saved release takes the records’ facts again, and says when it changed after its print (finding 812, v2.9238)', () => { + const saved = { releasesFilingId: 'a1', county: 'Travis', ownerName: '', legalDescription: '', propertyAddress: '212 Larkspur Court, Austin, TX', paymentDate: '2026-11-20', notarizedYmd: '' } + const record = { county: 'Travis', ownerName: 'Marisol Okafor', legalDescription: 'LOT 1 BLK 2 LARKSPUR SUBD', propertyAddress: '212 Larkspur Court, Austin, TX' } + const WHO = { by: 'u1', name: 'Alex Rivera', at: '2026-12-02T18:00:00Z' } + + it('names each fact the records now give differently, and nothing when they agree', () => { + expect(releaseRecordDrift(saved, record)).toEqual([ + { key: 'ownerName', saved: '', record: 'Marisol Okafor' }, + { key: 'legalDescription', saved: '', record: 'LOT 1 BLK 2 LARKSPUR SUBD' }, + ]) + expect(releaseRecordDrift({ ...saved, ...record }, record)).toEqual([]) + }) + + it('never counts a record that holds nothing: the paper keeps the fact it has', () => { + expect(releaseRecordDrift({ ...saved, ownerName: 'Marisol Okafor' }, { ...record, ownerName: ' ', legalDescription: '' })).toEqual([]) + }) + + it('never counts a fact the row does not keep: the print draws that one from the record already', () => { + expect(releaseRecordDrift({ releasesFilingId: 'a1', paymentDate: '2026-11-20' }, record)).toEqual([]) + }) + + it('patches the drifted facts alone and keeps every other fact on the row', () => { + const row = { ...saved, releaseInstrument: '2026-0431955', copiesSent: { ymd: '2026-12-01' } } + expect(releaseRecordFactsPatch(row, record)).toEqual({ ...row, ownerName: 'Marisol Okafor', legalDescription: 'LOT 1 BLK 2 LARKSPUR SUBD' }) + }) + + it('says to print again once the paper changed after its print, and names what changed', () => { + const printed = releaseFactsPatch(saved, { printed: WHO }) + expect(releaseReprintWords(printed)).toBeNull() + const corrected = releaseRecordFactsPatch(printed, record) + expect(plainSentence(releaseReprintWords(corrected) ?? '')).toBe('The legal description and the owner of record changed after this release was printed Dec 2. Print it again before the notary signs.') + expect(releaseReprintWords(corrected)).toContain(val('day', 'Dec 2')) + }) + + it('says to notarize again when the notary’s day is already kept', () => { + const notarized = { ...releaseFactsPatch(saved, { printed: WHO }), notarizedYmd: '2026-12-02', paymentDate: '2026-11-21' } + expect(plainSentence(releaseReprintWords(notarized) ?? '')).toBe('The payment date changed after this release was printed Dec 2. Print it again and have it notarized again.') + }) + + it('says nothing of a release never printed, and reads as plain words', () => { + expect(releaseReprintWords(saved)).toBeNull() + const corrected = releaseRecordFactsPatch(releaseFactsPatch(saved, { printed: WHO }), record) + expect(plainWordsFailures(plainSentence(releaseReprintWords(corrected) ?? ''))).toEqual([]) + }) +}) diff --git a/src/lib/jobs/lienReleaseOfRecord.ts b/src/lib/jobs/lienReleaseOfRecord.ts index 83cbfe69f7..b7c9ea85a7 100644 --- a/src/lib/jobs/lienReleaseOfRecord.ts +++ b/src/lib/jobs/lienReleaseOfRecord.ts @@ -38,7 +38,7 @@ import { BANK_CHECK_WINDOW_DAYS, bankCheckForPayment, canActBeforeCheckClears, c import { isCheckPayment } from './checkClearing' import { lastPayment, payWayWords, releaseForAffidavit, releaseOwnInstrument, type LienPayoffAffidavit, type LienPayoffPayment, type LienPayoffRelease } from './lienPayoff' import { fundsConfirmedWords, type FundsConfirmed } from './lienPayoffFields' -import type { ReleaseMoneyBackMark } from './lienReleaseFacts' +import { releaseByYmd, releaseFacts, releasePaperChangedSincePrint, type ReleaseMoneyBackMark, type ReleasePaperKey } from './lienReleaseFacts' import { releaseMarkHolds, releaseMarkWords, releaseOnReturnedCheck } from './payoffReturned' export const RELEASE_OF_RECORD_WORDS = { @@ -77,6 +77,10 @@ export const RELEASE_OF_RECORD_WORDS = { payDayLabel: 'Payment / satisfaction date', paperHint: 'You can correct this date until the county records the release.', paperCorrected: 'The release has the new payment date.', + /** A saved release takes the records' facts again, and says when it changed after its print (v2.9238). */ + recordSays: 'the record says', + recordBlank: 'blank on the paper', + recordTaken: 'The paper has the record’s facts.', countyRecordTag: 'the county’s record', countyRecord: 'The county recorded this release. Its paper stays as it was saved.', releaseGone: 'This release is no longer open to a change. Close the window and read the job again.', @@ -314,6 +318,64 @@ export function releasePaymentDatePatch(fields: unknown, day: string): Record = { + county: 'the county', + claimantCompany: 'the claimant', + claimantPersonName: 'the signer', + recordingNumber: 'the lien’s instrument number', + filedDate: 'the day the lien was filed', + legalDescription: 'the legal description', + propertyAddress: 'the property address', + ownerName: 'the owner of record', + paymentDate: 'the payment date', +} + +/** A record fact's label on its line: *Owner of record*. */ +export const RELEASE_RECORD_FACT_LABELS: Record = { county: 'County', ownerName: 'Owner of record', legalDescription: 'Legal description', propertyAddress: 'Property address' } + +export type ReleaseRecordDrift = { key: ReleaseRecordFact; saved: string; record: string } + +/** + * Where the records now say something else than the saved paper. A record that holds nothing never counts: taking + * it would put a blank line on a paper that has the fact. A fact the row does not keep at all never counts either: + * the print draws that one from the record already. + */ +export function releaseRecordDrift(savedFields: unknown, record: Record): ReleaseRecordDrift[] { + const saved = savedFields && typeof savedFields === 'object' && !Array.isArray(savedFields) ? (savedFields as Record) : {} + const out: ReleaseRecordDrift[] = [] + for (const key of RELEASE_RECORD_FACTS) { + const now = (record[key] ?? '').trim() + if (typeof saved[key] !== 'string') continue + const kept = (saved[key] as string).trim() + if (now && now !== kept) out.push({ key, saved: kept, record: now }) + } + return out +} + +/** The saved paper with the records' facts taken, as the row's new `fields`: every other fact the row keeps is left as it is. */ +export function releaseRecordFactsPatch(fields: unknown, record: Record): Record { + const base = fields && typeof fields === 'object' && !Array.isArray(fields) ? { ...(fields as Record) } : {} + for (const d of releaseRecordDrift(base, record)) base[d.key] = d.record + return base +} + +/** + * The line under **The paper** when it changed after its last print: *The payment date changed after this release + * was printed Dec 2. Print it again before the notary signs.* Null when the print and the row agree. + */ +export function releaseReprintWords(fields: unknown): string | null { + const changed = releasePaperChangedSincePrint(fields) + const facts = releaseFacts(fields) + if (changed.length === 0 || !facts.printed) return null + const named = wordList(changed.map((k) => PAPER_FACT_NAMES[k])) + const then = facts.notarizedYmd ? 'Print it again and have it notarized again.' : 'Print it again before the notary signs.' + return `${named.charAt(0).toUpperCase()}${named.slice(1)} changed after this release was printed ${val('day', formatYmdMonthDay(releaseByYmd(facts.printed)))}. ${then}` +} + /** A fact the release prints as a blank line when its record holds nothing (finding 825, v2.9234), in the paper's order. */ export type ReleasePaperBlank = 'county' | 'owner' | 'legal' | 'address' @@ -333,7 +395,9 @@ export function releasePaperBlanks(paper: { county: string; ownerName: string; l ] } -const wordList = (words: ReadonlyArray): string => (words.length <= 2 ? words.join(' and ') : `${words.slice(0, -1).join(', ')} and ${words[words.length - 1]}`) +function wordList(words: ReadonlyArray): string { + return words.length <= 2 ? words.join(' and ') : `${words.slice(0, -1).join(', ')} and ${words[words.length - 1]}` +} /** * The blanks named above the presses, and where each is fixed. Null with none. It names and does not hold: the lien's diff --git a/to-dos/lien-release-road-faults/README.md b/to-dos/lien-release-road-faults/README.md index 2258cc2c6f..b6e38f6104 100644 --- a/to-dos/lien-release-road-faults/README.md +++ b/to-dos/lien-release-road-faults/README.md @@ -2,7 +2,7 @@ name: "The release road: every fault found on the way to releasing a paid lien, and the ones left to mend" number: 479 group: ready -status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 3 is built (v2.9216) · the first half of step 4 is built (v2.9219) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · step 10 is built in the tab (v2.9229) · step 12 is built (v2.9232) · step 13 is built (v2.9234) · the owner answered the three calls on 2026-12-02 · steps 2, 7, 8, 9, 11 and 14 are left, with the second halves of steps 4 and 10 +status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 3 is built (v2.9216) · step 4 is built (v2.9219, v2.9238) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · step 10 is built in the tab (v2.9229) · step 12 is built (v2.9232) · step 13 is built (v2.9234) · the owner answered the three calls on 2026-12-02 · steps 2, 7, 8, 9, 11 and 14 are left, with the second half of step 10 summary: > The owner asked for help releasing a paid lien and printing its release, and for every bug on the way. One thread read the road in the code and found fourteen faults, findings 808 to 821. @@ -58,7 +58,7 @@ State is as read on GitHub and on `main` on 2026-12-02 at 19:17 UTC. | 809 | A release that is only saved reads *Released* in five places. They are the window's head, its suit stop, the stop's window, the desk's path and the Accounts Receivable chip. The day its row was made stands in for the county's day. The tab, Payoffs and the Board still say it waits for the county. The chip also shows the lien's own number as the release's. On a job with two liens, one release makes the whole job read released. | seen | Not started. Step 2. | | 810 | A job has nothing open and no payment. It reads *The bills read paid. The release is owed.* A filed lien whose bill goes back to draft is one such job. The tab then prints a paper that swears payment as of today. | seen | Decided on card #477, call 2. Not built. Not a step here. | | 811 | **Payment / satisfaction date** is not checked. Cleared, the paper prints *as of —*. A day still to come is taken. A day before the lien was filed is taken. The date is set once, from the window's kept copy of the job. So it can show today while the money line shows the real day. | read | Mended in part by v2.9179 (PR #10639), on `main`. It stops an empty day and a day still to come. The rest is mended by v2.9216, step 3: the date follows the job as it stands, and a day before the lien was filed is asked about once. | -| 812 | A saved release cannot be corrected, and nothing says so. The only way is **Void**, **Confirm void** and making it again. Print needs no save, so a paper printed and signed can differ from the one saved after it. | read | Mended in part by v2.9219, step 4's first half: a saved release's payment date is corrected in place until the county's day is kept. Left: the facts drawn from the records, and the printed copy. | +| 812 | A saved release cannot be corrected, and nothing says so. The only way is **Void**, **Confirm void** and making it again. Print needs no save, so a paper printed and signed can differ from the one saved after it. | read | Mended, v2.9219 and v2.9238, step 4. A saved release's payment date is corrected in place until the county's day is kept. It takes the records' facts again on one press. A line says when the paper changed after its print. Left: the run's stage for a release corrected after its print. | | 813 | A job has two liens. Keeping **Recorded on** throws the tab onto the other lien before **Instrument number** is typed. | read | Built in step 1, v2.9190. The tab holds the lien it stands on. | | 814 | A release is saved and the county has not recorded it. The job's bills owe again. The tab still says *Sign it before a notary. Then record it at the county.* Its print is live. Payoffs and the day's run hold the same release. | read | Mended by v2.9222, step 5: the tab reads the same hold, its two presses wait and the reason stands under them. | | 815 | **Download PDF** files no copy. Neither press marks the release as printed for the notary. When a check then comes back, the app says no release has left the office. The day's run prints it again. | read | Mended by v2.9224, step 6: a download files a copy, and the tab's print or download marks a saved release as printed for the notary. | @@ -114,13 +114,14 @@ Lien desk lane's note of run 17 and are not on this card. number. On a job with two liens each lien reads for itself. 3. **Built, v2.9216. The rest of the payment date (S). 811.** The date follows the payment's own day, not the window's kept copy. A day before the lien was filed is asked about once and then taken (call 3). -4. **First half built, v2.9219. A saved release, and the paper that was printed (S). 812.** A saved release is corrected in +4. **Built, v2.9219 and v2.9238. A saved release, and the paper that was printed (S). 812.** A saved release is corrected in place until the county's day is kept (call 1). After that the tab says it is the county's record. The tab also says when the facts on the screen differ from the last printed copy. Built: the payment date, the one fact a person types, is a value in place under **The paper**, - and is locked once the county's day is kept. Left, as a second PR: a press that reads the - facts drawn from the records again (the owner, the legal description, the county), and the - line that says the screen differs from the last printed copy. + and is locked once the county's day is kept. The second PR, v2.9238: **The paper** lists each + fact the records now give differently, and one counted press takes them. A print keeps the + paper as it stood, and a line says what changed after it and to print again. Left: the day's + run still reads a release printed and then corrected as waiting on its notary. 5. **Built, v2.9222. Bills that owe again hold the print (S). 814.** The tab reads the same hold as Payoffs and the run, and says why. 6. **Built, v2.9224. A download is a copy, and a print is marked (S). 815.** **Download PDF** files a copy as the From 2f114cc2fb5320fd2fd3853e02e52b828337b5da Mon Sep 17 00:00:00 2001 From: Robert Douglas <57234112+realrobertdouglas@users.noreply.github.com> Date: Wed, 2 Dec 2026 15:06:30 -0600 Subject: [PATCH 14/21] =?UTF-8?q?v2.9239=20=E2=80=94=20Lien=20releases:=20?= =?UTF-8?q?the=20run=20and=20Payoffs=20no=20longer=20overwrite=20a=20fact?= =?UTF-8?q?=20kept=20elsewhere=20(finding=20819,=20punch=20list=20#479=20s?= =?UTF-8?q?tep=2010)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit keepReleaseFacts reads every release it is handed in one read and builds its patch on the facts the database holds, not on the copy the screen read when it drew. A release voided in the meantime is held with its reason. Co-Authored-By: Claude Fable 5.2 --- docs/LIEN_DESK_ARCHITECTURE.md | 1 + docs/recent-features/v2.9239.md | 27 +++++ src/content/releaseNotes/v2.9239.ts | 16 +++ src/lib/jobs/lienReleaseRun.ts | 2 + src/lib/jobs/lienReleaseRunIo.keep.test.ts | 109 +++++++++++++++++++++ src/lib/jobs/lienReleaseRunIo.ts | 27 ++++- to-dos/lien-release-road-faults/README.md | 9 +- 7 files changed, 185 insertions(+), 6 deletions(-) create mode 100644 docs/recent-features/v2.9239.md create mode 100644 src/content/releaseNotes/v2.9239.ts create mode 100644 src/lib/jobs/lienReleaseRunIo.keep.test.ts diff --git a/docs/LIEN_DESK_ARCHITECTURE.md b/docs/LIEN_DESK_ARCHITECTURE.md index 07ac8c44da..17eac6c4a9 100644 --- a/docs/LIEN_DESK_ARCHITECTURE.md +++ b/docs/LIEN_DESK_ARCHITECTURE.md @@ -750,6 +750,7 @@ last_updated: 2026-12-02 > A record that holds nothing never replaces a fact the paper has, and a fact the row does not keep is not counted, since the print draws it from the record already. > **v2.9238 (the paper as last printed):** `releaseFactsPatch` keeps the nine paper facts under `fields.printedPaper` whenever it sets `printedForNotary`, for the tab, Payoffs and the run alike, and takes it off with the mark. > `releasePaperChangedSincePrint` compares the row to it, `releaseReprintWords` says what changed and to print again, and `markReleaseOut` marks a second print when the paper changed since the first. +> **v2.9239 (the run and Payoffs read fresh too, the rest of finding 819):** `keepReleaseFacts` reads every release it is handed in one read and builds `releaseFactsPatch` on the facts the database holds, a release voided in the meantime is held with `RELEASE_RUN_WORDS.gone`, and a row's own `fields` is no longer written. > **v2.9190 (a door names its lien, findings 808 and 813):** `pickReleaseTarget` takes a third value, the lien the door named, read after the lien the tab holds and before the rule. > The doors are a lien's row in Payoffs and a release's line on the day's run: each `onOpenRelease` hands the job and its `affidavitId`, `LienDeskPage` keeps it as `releaseLienId` on the window it opens, and `LienInstrumentsModal` hands it to `LienFilingTabs`. > The tab holds the lien it stands on: an effect writes the picked lien's id into `releaseTargetId`, so a release the county has just recorded no longer hands the tab to the job's other lien. diff --git a/docs/recent-features/v2.9239.md b/docs/recent-features/v2.9239.md new file mode 100644 index 0000000000..7666c513fa --- /dev/null +++ b/docs/recent-features/v2.9239.md @@ -0,0 +1,27 @@ +# v2.9239 — Lien releases: the run and Payoffs no longer overwrite a fact kept elsewhere (2026-12-02) + +The second half of step 10 of punch list #479 (the release road's faults), the rest of finding 819. Client only. No migration, no function change, nothing owed on prod. Stacked on v2.9238, which changes the same card. + +## What was wrong + +- A release keeps its facts in one JSON column, `fields`. v2.9229 made the tab's writes read the row first. +- The day's run, Payoffs and the returned check's mark write through `keepReleaseFacts`, which built the new `fields` on the copy each screen read when it drew. A fact another screen kept in the meantime was written over. + +## What changed + +- [`lienReleaseRunIo.ts`](../../src/lib/jobs/lienReleaseRunIo.ts): `keepReleaseFacts` reads every release it is handed in one read (`id, voided_at, fields`) and builds `releaseFactsPatch` on what the database holds. A row's own `fields` is no longer written. +- A release voided in the meantime, or gone, takes no change. Its line carries `RELEASE_RUN_WORDS.gone`: *This release was voided on another screen. Close this and open it again.* The rest of the batch goes on. +- A read that fails holds every row with its reason, and nothing is written. +- The callers are unchanged: `LienRunReleases.tsx`, `LienPayoffs.tsx` and `useReturnedCaseLiens.ts`. + +## Why not a merge in the database + +- The card allowed either. A read then a write closes the window to the length of one round trip, with no migration and no push. A JSON merge in a function would close it wholly and is still open as a later step if a lost fact is ever seen. + +## Tests + +- `lienReleaseRunIo.keep.test.ts` (new): the write goes over the database's facts, one read for every release, a voided or missing release is held and the batch goes on, a failed read writes nothing, a failed write is passed and named, no rows asks nothing. + +## Look owed + +- None of its own. It rides with the ZZ Test looks of the same train: a notary's day kept in the run on a ZZ Test release keeps its other facts. diff --git a/src/content/releaseNotes/v2.9239.ts b/src/content/releaseNotes/v2.9239.ts new file mode 100644 index 0000000000..98c1e0f362 --- /dev/null +++ b/src/content/releaseNotes/v2.9239.ts @@ -0,0 +1,16 @@ +import type { ReleaseNote } from '../../lib/releaseNotes' + +const note: ReleaseNote = { + version: 'v2.9239', + date: '2026-12-02', + title: 'Lien releases: the run and Payoffs no longer overwrite a fact kept elsewhere', + kind: 'fix', + highlights: [ + 'Keeping a notary’s day or the copies’ day wrote back every fact the screen had read when it opened.', + 'A fact kept on another screen in the meantime could be lost, like the county’s instrument number.', + 'The run, Payoffs and the returned check’s mark now read each release fresh and change their own fact alone.', + 'A release voided on another screen takes no change, and its line says so.', + ], +} + +export default note diff --git a/src/lib/jobs/lienReleaseRun.ts b/src/lib/jobs/lienReleaseRun.ts index 71317a0b39..494e99554b 100644 --- a/src/lib/jobs/lienReleaseRun.ts +++ b/src/lib/jobs/lienReleaseRun.ts @@ -53,6 +53,8 @@ export const RELEASE_RUN_WORDS = { popup: 'The print window was blocked. Allow pop-ups for this site, then print again.', kept: 'The release took the change.', failed: 'The release did not take the change.', + /** The release was voided on another screen after this one read it (finding 819, v2.9239). */ + gone: 'This release was voided on another screen. Close this and open it again.', } as const export type ReleaseRunLine = { diff --git a/src/lib/jobs/lienReleaseRunIo.keep.test.ts b/src/lib/jobs/lienReleaseRunIo.keep.test.ts new file mode 100644 index 0000000000..579abd95a5 --- /dev/null +++ b/src/lib/jobs/lienReleaseRunIo.keep.test.ts @@ -0,0 +1,109 @@ +/** + * `keepReleaseFacts` reads each release fresh before it writes one fact (finding 819, v2.9239). The database is a + * stub: what it holds, what was asked of it and what was written are read back off it. + */ +import { afterEach, describe, expect, it, vi } from 'vitest' +import { plainWordsFailures } from '../plainWords' +import { RELEASE_RUN_WORDS } from './lienReleaseRun' +import { keepReleaseFacts } from './lienReleaseRunIo' + +const db = vi.hoisted(() => ({ + rows: [] as Array<{ id: string; voided_at: string | null; fields: unknown }>, + readError: null as { message: string } | null, + writeErrorFor: '' as string, + asked: [] as string[][], + writes: [] as Array<{ id: string; patch: Record }>, +})) + +vi.mock('../supabase', () => ({ + supabase: { + from: () => ({ + select: () => ({ + in: (_col: string, ids: string[]) => { + db.asked.push(ids) + return Promise.resolve(db.readError ? { data: null, error: db.readError } : { data: db.rows.filter((r) => ids.includes(r.id)), error: null }) + }, + }), + update: (patch: Record) => ({ + eq: (_col: string, id: string) => { + if (db.writeErrorFor === id) return Promise.resolve({ data: null, error: { message: 'permission denied for table job_lien_filings', code: '42501' } }) + db.writes.push({ id, patch }) + return Promise.resolve({ data: null, error: null }) + }, + }), + }), + }, +})) + +afterEach(() => { + db.rows = [] + db.readError = null + db.writeErrorFor = '' + db.asked.length = 0 + db.writes.length = 0 +}) + +// Every name and number here is made up. +const WHO = { by: 'u1', name: 'Alex Rivera', at: '2026-12-02T18:00:00Z' } +const paper = { releasesFilingId: 'a1', paymentDate: '2026-11-20' } + +describe('keepReleaseFacts reads each release fresh (finding 819, v2.9239)', () => { + it('writes the change over the facts the database holds now, not over the screen’s copy', async () => { + // Another screen kept the instrument number after this one read the release. + db.rows = [{ id: 'r1', voided_at: null, fields: { ...paper, releaseInstrument: '2026-0431955' } }] + const out = await keepReleaseFacts([{ releaseId: 'r1', fields: paper }], { notarizedYmd: '2026-12-01' }) + expect(out).toEqual([{ releaseId: 'r1', ok: true, why: null }]) + expect(db.writes).toEqual([{ id: 'r1', patch: { fields: { ...paper, releaseInstrument: '2026-0431955', notarizedYmd: '2026-12-01' } } }]) + }) + + it('reads every release in one read', async () => { + db.rows = [ + { id: 'r1', voided_at: null, fields: paper }, + { id: 'r2', voided_at: null, fields: { ...paper, releasesFilingId: 'a2' } }, + ] + await keepReleaseFacts([{ releaseId: 'r1', fields: paper }, { releaseId: 'r2', fields: paper }], { printed: WHO }) + expect(db.asked).toEqual([['r1', 'r2']]) + expect(db.writes.map((w) => w.id)).toEqual(['r1', 'r2']) + expect((db.writes[1]!.patch.fields as Record).releasesFilingId).toBe('a2') + }) + + it('holds a release voided in the meantime, or gone, with its reason, and keeps going', async () => { + db.rows = [ + { id: 'r1', voided_at: '2026-12-02T17:00:00Z', fields: paper }, + { id: 'r3', voided_at: null, fields: paper }, + ] + const out = await keepReleaseFacts([{ releaseId: 'r1', fields: paper }, { releaseId: 'r2', fields: paper }, { releaseId: 'r3', fields: paper }], { notarizedYmd: '2026-12-01' }) + expect(out).toEqual([ + { releaseId: 'r1', ok: false, why: RELEASE_RUN_WORDS.gone }, + { releaseId: 'r2', ok: false, why: RELEASE_RUN_WORDS.gone }, + { releaseId: 'r3', ok: true, why: null }, + ]) + expect(db.writes.map((w) => w.id)).toEqual(['r3']) + expect(plainWordsFailures(RELEASE_RUN_WORDS.gone)).toEqual([]) + }) + + it('writes nothing when the read fails, and names the reason on every row', async () => { + db.readError = { message: 'permission denied for table job_lien_filings' } + const out = await keepReleaseFacts([{ releaseId: 'r1', fields: paper }], { notarizedYmd: '2026-12-01' }) + expect(out).toHaveLength(1) + expect(out[0]!.ok).toBe(false) + expect(out[0]!.why).toBeTruthy() + expect(db.writes).toEqual([]) + }) + + it('goes past a write that fails and names it', async () => { + db.rows = [ + { id: 'r1', voided_at: null, fields: paper }, + { id: 'r2', voided_at: null, fields: paper }, + ] + db.writeErrorFor = 'r1' + const out = await keepReleaseFacts([{ releaseId: 'r1', fields: paper }, { releaseId: 'r2', fields: paper }], { notarizedYmd: '2026-12-01' }) + expect(out.map((o) => o.ok)).toEqual([false, true]) + expect(db.writes.map((w) => w.id)).toEqual(['r2']) + }) + + it('asks nothing of the database with no rows', async () => { + expect(await keepReleaseFacts([], { notarizedYmd: '2026-12-01' })).toEqual([]) + expect(db.asked).toEqual([]) + }) +}) diff --git a/src/lib/jobs/lienReleaseRunIo.ts b/src/lib/jobs/lienReleaseRunIo.ts index ed9e424aa6..bd8bc78a42 100644 --- a/src/lib/jobs/lienReleaseRunIo.ts +++ b/src/lib/jobs/lienReleaseRunIo.ts @@ -64,12 +64,35 @@ export type ReleaseFactsRow = { releaseId: string; fields: unknown } export type ReleaseFactsOutcome = { releaseId: string; ok: boolean; why: string | null } -/** Keep one change on each release, past a row that fails. */ +/** A release as the database holds it now. */ +type FreshRelease = { id: string; voided_at: string | null; fields: unknown } + +/** + * Keep one change on each release, past a row that fails. Every release is read fresh first, in one read (finding + * 819, v2.9239): a release keeps all its facts in one JSON column, and the change used to go over the copy the screen + * read when it drew, so a fact kept on another screen in the meantime was written over. A row's own `fields` is no + * longer written. A release voided in the meantime takes no change and says so, and a read that fails holds every + * row with its reason. + */ export async function keepReleaseFacts(rows: ReadonlyArray, change: ReleaseFactsChange): Promise { const out: ReleaseFactsOutcome[] = [] + if (rows.length === 0) return out + const fresh = new Map() + let unread: string | null = null + try { + const read = await withSupabaseRetry(() => supabase.from('job_lien_filings').select('id, voided_at, fields').in('id', rows.map((r) => r.releaseId)), 'lien releases: read the releases before a change') + for (const r of (read ?? []) as unknown as FreshRelease[]) fresh.set(r.id, r) + } catch (e) { + unread = formatErrorMessage(e, RELEASE_RUN_WORDS.failed) + } for (const row of rows) { + const now = fresh.get(row.releaseId) + if (unread || !now || now.voided_at) { + out.push({ releaseId: row.releaseId, ok: false, why: unread ?? RELEASE_RUN_WORDS.gone }) + continue + } try { - await withSupabaseRetry(() => supabase.from('job_lien_filings').update({ fields: releaseFactsPatch(row.fields, change) } as never).eq('id', row.releaseId), 'lien releases: keep a release’s facts') + await withSupabaseRetry(() => supabase.from('job_lien_filings').update({ fields: releaseFactsPatch(now.fields, change) } as never).eq('id', row.releaseId), 'lien releases: keep a release’s facts') out.push({ releaseId: row.releaseId, ok: true, why: null }) } catch (e) { out.push({ releaseId: row.releaseId, ok: false, why: formatErrorMessage(e, RELEASE_RUN_WORDS.failed) }) diff --git a/to-dos/lien-release-road-faults/README.md b/to-dos/lien-release-road-faults/README.md index b6e38f6104..ee2eb4719a 100644 --- a/to-dos/lien-release-road-faults/README.md +++ b/to-dos/lien-release-road-faults/README.md @@ -2,7 +2,7 @@ name: "The release road: every fault found on the way to releasing a paid lien, and the ones left to mend" number: 479 group: ready -status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 3 is built (v2.9216) · step 4 is built (v2.9219, v2.9238) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · step 10 is built in the tab (v2.9229) · step 12 is built (v2.9232) · step 13 is built (v2.9234) · the owner answered the three calls on 2026-12-02 · steps 2, 7, 8, 9, 11 and 14 are left, with the second half of step 10 +status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 3 is built (v2.9216) · step 4 is built (v2.9219, v2.9238) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · step 10 is built (v2.9229, v2.9239) · step 12 is built (v2.9232) · step 13 is built (v2.9234) · the owner answered the three calls on 2026-12-02 · steps 2, 7, 8, 9, 11 and 14 are left summary: > The owner asked for help releasing a paid lien and printing its release, and for every bug on the way. One thread read the road in the code and found fourteen faults, findings 808 to 821. @@ -65,7 +65,7 @@ State is as read on GitHub and on `main` on 2026-12-02 at 19:17 UTC. | 816 | Voiding a filed affidavit that has a release leaves the release with no lien. Payoffs, the Board and the tab offer a second release, and the head still says released. Under **Filings on this job** a release's line names no lien, number or day, so two cannot be told apart. A release the county recorded voids with the same two presses and no words. | read, its line seen | Not started. Step 7. | | 817 | Around the reload after **Save release record** a second release row can be written. Nothing in the database ties one release to one lien. A reload that fails draws *No recorded lien on this job*. | plausible | Not started. Step 8. | | 818 | The desk's path is never told that a release waits on a check. It says *Paid — file the release of record.* with **File the release ›** while the tab's presses are dead. The Board keeps one chip a job in a bin. So on a job with two liens **Make N release ›** can leave one out. | read | Not started. Step 9. | -| 819 | Keeping the instrument number writes every kept fact of the release back from the window's copy. A fact another screen wrote in the meantime is lost. That can be the notary's day, the copies' day or the mark of a check that came back. | plausible | Mended in the tab by v2.9229, step 10: the stamp's write reads the row fresh. The day's run and Payoffs still write from their own copy (`keepReleaseFacts`). | +| 819 | Keeping the instrument number writes every kept fact of the release back from the window's copy. A fact another screen wrote in the meantime is lost. That can be the notary's day, the copies' day or the mark of a check that came back. | plausible | Mended, v2.9229 and v2.9239, step 10. The tab's writes read the row fresh. The day's run, Payoffs and the returned check's mark write through `keepReleaseFacts`, which now reads each release fresh too. | | 820 | **Go to the affidavit ›** does nothing a person can see when the **Lien affidavit** tab is already picked. It is the same dead press as 804. | read | Not started. Step 11. | | 821 | The stamp box says the stamped copy is saved on the release's line. That line takes a typed Drive link only. The scan press is drawn for a filed affidavit alone. | read | Built, v2.9232. The release's line draws **Upload the scanned PDF**. Step 12. | @@ -136,8 +136,9 @@ Lien desk lane's note of run 17 and are not on this card. ties one live release to one lien. This step is a migration and owes a push. 9. **The desk's path knows the wait, and one chip a lien (S). 818.** Built after card #477, since that card changes what opens the presses. -10. **Built in the tab, v2.9229. Keeping one fact writes one fact (S). 819.** The write reads the row fresh, or merges in the - database. If it merges in the database it owes a push. +10. **Built, v2.9229 and v2.9239. Keeping one fact writes one fact (S). 819.** Every writer reads the row fresh: the + tab (v2.9229), and the run, Payoffs and the returned check's mark through `keepReleaseFacts` + (v2.9239). No merge in the database was needed, so nothing owes a push. 11. **Go to the affidavit › lands on the work (XS). 820.** The pattern of #10636. 12. **Built, v2.9232. The release's line takes a scan (S). 821.** The saved copy's editor on a release's line has **Upload the scanned PDF**. The scan is named as a release in the job's folder. From 747ed17ea8291e1586e5b6ab6822a2ec81e998dd Mon Sep 17 00:00:00 2001 From: Robert Douglas <57234112+realrobertdouglas@users.noreply.github.com> Date: Wed, 2 Dec 2026 15:15:42 -0600 Subject: [PATCH 15/21] =?UTF-8?q?v2.9240=20=E2=80=94=20Release=20of=20reco?= =?UTF-8?q?rd:=20a=20lien=20takes=20one=20release,=20whatever=20the=20wind?= =?UTF-8?q?ow=20shows=20(finding=20817,=20punch=20list=20#479=20step=208)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The save takes one press at a time and asks the database for a live release of the lien before it inserts. A partial unique index holds the same rule in the database (migration 20261202211100, one push owed after the merge). A reload of the window's lien records that fails keeps what the window holds. Co-Authored-By: Claude Fable 5.2 --- docs/LIEN_DESK_ARCHITECTURE.md | 2 + .../20261202211100_one_live_release_a_lien.md | 16 +++++ docs/recent-features/v2.9240.md | 34 +++++++++++ .../LienFilingTabs.release.render.test.tsx | 60 ++++++++++++++++++- src/components/jobs/LienFilingTabs.tsx | 34 ++++++++++- src/components/jobs/LienInstrumentsModal.tsx | 11 ++-- src/content/releaseNotes/v2.9240.ts | 15 +++++ src/lib/jobs/lienReleaseOfRecord.test.ts | 26 +++++++- src/lib/jobs/lienReleaseOfRecord.ts | 12 ++++ src/lib/jobs/lienWindowNextStep.ts | 3 + ...20261202211100_one_live_release_a_lien.sql | 17 ++++++ to-dos/lien-release-road-faults/README.md | 10 ++-- 12 files changed, 225 insertions(+), 15 deletions(-) create mode 100644 docs/migrations/20261202211100_one_live_release_a_lien.md create mode 100644 docs/recent-features/v2.9240.md create mode 100644 src/content/releaseNotes/v2.9240.ts create mode 100644 supabase/migrations/20261202211100_one_live_release_a_lien.sql diff --git a/docs/LIEN_DESK_ARCHITECTURE.md b/docs/LIEN_DESK_ARCHITECTURE.md index 17eac6c4a9..f94531e2f3 100644 --- a/docs/LIEN_DESK_ARCHITECTURE.md +++ b/docs/LIEN_DESK_ARCHITECTURE.md @@ -751,6 +751,8 @@ last_updated: 2026-12-02 > **v2.9238 (the paper as last printed):** `releaseFactsPatch` keeps the nine paper facts under `fields.printedPaper` whenever it sets `printedForNotary`, for the tab, Payoffs and the run alike, and takes it off with the mark. > `releasePaperChangedSincePrint` compares the row to it, `releaseReprintWords` says what changed and to print again, and `markReleaseOut` marks a second print when the paper changed since the first. > **v2.9239 (the run and Payoffs read fresh too, the rest of finding 819):** `keepReleaseFacts` reads every release it is handed in one read and builds `releaseFactsPatch` on the facts the database holds, a release voided in the meantime is held with `RELEASE_RUN_WORDS.gone`, and a row's own `fields` is no longer written. +> **v2.9240 (one live release a lien, finding 817):** `recordRelease` takes one save at a time and asks the database for a live `release_of_record` row whose `fields ->> 'releasesFilingId'` is this lien before it inserts, and migration `20261202211100` holds the same rule as the partial unique index `job_lien_filings_one_live_release_idx`. +> `isOneLiveReleaseRefusal` reads the index's refusal by its name, and `loadFilings` in `LienInstrumentsModal` keeps the records it holds when a reload fails. > **v2.9190 (a door names its lien, findings 808 and 813):** `pickReleaseTarget` takes a third value, the lien the door named, read after the lien the tab holds and before the rule. > The doors are a lien's row in Payoffs and a release's line on the day's run: each `onOpenRelease` hands the job and its `affidavitId`, `LienDeskPage` keeps it as `releaseLienId` on the window it opens, and `LienInstrumentsModal` hands it to `LienFilingTabs`. > The tab holds the lien it stands on: an effect writes the picked lien's id into `releaseTargetId`, so a release the county has just recorded no longer hands the tab to the job's other lien. diff --git a/docs/migrations/20261202211100_one_live_release_a_lien.md b/docs/migrations/20261202211100_one_live_release_a_lien.md new file mode 100644 index 0000000000..e67a96e81d --- /dev/null +++ b/docs/migrations/20261202211100_one_live_release_a_lien.md @@ -0,0 +1,16 @@ +# 20261202211100_one_live_release_a_lien.sql (2026-12-02, v2.9240) + +One live release a lien: step 8 of punch list #479 (the release road's faults), finding 817. + +A release of record names the affidavit it releases in `fields ->> 'releasesFilingId'`. Nothing in the database tied one release to one lien, so two saves around the Lien window's reload, or two windows, could each write a row. The migration adds one partial unique index, `job_lien_filings_one_live_release_idx`, on that key over rows where `kind = 'release_of_record'`, `voided_at IS NULL` and the key is present and not empty. + +- A voided release does not count, so a release made again after a void is taken. +- A release from before the key was kept is left out. +- Putting a voided release back while another is live is refused. That is the rule working. The dev's **Put back** shows the database's own words for it. +- The client reads the refusal by the index's name (`ONE_LIVE_RELEASE_INDEX` in `src/lib/jobs/lienReleaseOfRecord.ts`). Rename one and rename the other. + +**Order.** The client ships first and is whole without the index: it asks the database for a live release before it saves. Push after the merge, in a quiet moment. The build takes a brief lock on `job_lien_filings`, a small table, under `lock_timeout = '3s'`. + +**If the push fails** with *could not create unique index … is duplicated*, two live releases already name one lien. Nothing was changed. Void the extra one in the app and push again. A read of prod on 2026-12-02 found three live releases on three liens and no duplicate. + +**Proved** on a throwaway local Postgres 15 with a stub table, since Docker was not running for the SQL beds: applied twice, nine checks (a second live release refused by name, another lien taken, a release after a void taken, a put-back beside a live one refused, rows with no key or an empty key left out, another kind of paper not held, a fact kept on the live release taken, a release re-pointed at a released lien refused), and a table that already held a duplicate, where the build failed and changed nothing. The stub is not the app's schema and Postgres 15 is not the app's 17, so the dry run at the push still counts. diff --git a/docs/recent-features/v2.9240.md b/docs/recent-features/v2.9240.md new file mode 100644 index 0000000000..81cad774df --- /dev/null +++ b/docs/recent-features/v2.9240.md @@ -0,0 +1,34 @@ +# v2.9240 — Release of record: a lien takes one release, whatever the window shows (2026-12-02) + +Step 8 of punch list #479 (the release road's faults), finding 817. **Owes prod one `supabase db push`** after the merge: migration `20261202211100_one_live_release_a_lien.sql`. Stacked on v2.9239, which changes the same card. + +## What was wrong + +- The tab drew **Save release record** from the window's own list of the job's lien records. Around the reload after a save, or in a second window, the list could be old, and a second release row was written for the same lien. Nothing in the database tied one release to one lien. +- `loadFilings` in the Lien window ignored a failed read and drew an empty list. A lien with a saved release then read *No recorded lien on this job*. + +## What changed + +- [`LienFilingTabs.tsx`](../../src/components/jobs/LienFilingTabs.tsx): `recordRelease` takes one save at a time and first asks the database for a live release that names this lien. If one is there it saves nothing, says *This lien already has a saved release. It is shown now.* and reads the job again. +- The migration adds a partial unique index on `fields ->> 'releasesFilingId'` over live releases. `isOneLiveReleaseRefusal` reads its refusal by the index's name, and the save answers with the same sentence. +- [`LienInstrumentsModal.tsx`](../../src/components/jobs/LienInstrumentsModal.tsx): a reload of the lien records that fails keeps what the window holds and says so (`LIEN_WINDOW_FILINGS_UNREAD`). +- [`docs/migrations/20261202211100_one_live_release_a_lien.md`](../migrations/20261202211100_one_live_release_a_lien.md) has the order, the proof and what a failed push means. + +## Order on prod + +- The client is whole without the index, so it ships first. The push comes after the merge, with the push slot. +- A read of prod on 2026-12-02 found three live releases on three liens and no duplicate, so the index builds today. + +## Not in this change + +- The dev's **Put back** on a voided release beside a live one. The database now refuses it in its own words. A sentence of the app's own is a later step if it is ever met. + +## Tests + +- `lienReleaseOfRecord.test.ts`: the refusal is known by its code and the index's name, and the test reads the migration for that name. +- `LienFilingTabs.release.render.test.tsx`: the save's look and what it asks, nothing saved when one is there, one save from two fast presses, the database's refusal read as the same sentence. +- The SQL was proved on a throwaway local Postgres 15, applied twice, nine checks and a table that already held a duplicate. Docker was not running for the SQL beds. + +## Look owed + +- After the push, a ZZ Test look with the live-write slot: on the ZZ Test job save a release, then try a second save from a second window opened before the first save. See the sentence and one release row. Void it as the earlier walk did. diff --git a/src/components/jobs/LienFilingTabs.release.render.test.tsx b/src/components/jobs/LienFilingTabs.release.render.test.tsx index 621d8af76f..e091ca32c8 100644 --- a/src/components/jobs/LienFilingTabs.release.render.test.tsx +++ b/src/components/jobs/LienFilingTabs.release.render.test.tsx @@ -20,7 +20,9 @@ vi.mock('../../hooks/useBankChecks', () => ({ }, })) -const writes = vi.hoisted(() => ({ inserts: [] as Array>, updates: [] as Array<{ patch: Record; id: string }> })) +const writes = vi.hoisted(() => ({ inserts: [] as Array>, updates: [] as Array<{ patch: Record; id: string }>, insertError: null as Record | null })) +/** The live releases the database holds for the lien a save names (finding 817): what the save's own look finds. */ +const guard = vi.hoisted(() => ({ live: [] as Array<{ id: string }>, asked: [] as Array<[string, unknown]> })) /** The release row as the database holds it now, for the fresh read a correction makes first (v2.9219). */ const reads = vi.hoisted(() => ({ fresh: null as Record | null, rows: {} as Record> })) @@ -65,8 +67,22 @@ vi.mock('../../lib/supabase', async () => { if (table !== 'job_lien_filings') return from(table) return { ...(from(table) as object), - select: (cols: string) => (cols === 'id, filed_at, voided_at, fields' ? { eq: (_col: string, id: string) => ({ maybeSingle: () => Promise.resolve({ data: reads.fresh ?? reads.rows[id] ?? null, error: null }) }) } : (from(table) as { select: (c: string) => unknown }).select(cols)), + select: (cols: string) => { + // The fresh read of one row before a write (v2.9229). + if (cols === 'id, filed_at, voided_at, fields') return { eq: (_col: string, id: string) => ({ maybeSingle: () => Promise.resolve({ data: reads.fresh ?? reads.rows[id] ?? null, error: null }) }) } + // The save's look for a live release of the lien (v2.9240). + if (cols === 'id') { + const chain = { + eq: (col: string, v: unknown) => (guard.asked.push([col, v]), chain), + is: (col: string, v: unknown) => (guard.asked.push([col, v]), chain), + limit: () => Promise.resolve({ data: guard.live, error: null }), + } + return chain + } + return (from(table) as { select: (c: string) => unknown }).select(cols) + }, insert: (row: Record) => { + if (writes.insertError) return { select: () => ({ single: () => Promise.resolve({ data: null, error: writes.insertError }) }) } writes.inserts.push(row) return { select: () => ({ single: () => Promise.resolve({ data: { id: 'new-release' }, error: null }) }) } }, @@ -88,6 +104,9 @@ afterEach(() => { auth.role = 'assistant' writes.inserts.length = 0 writes.updates.length = 0 + writes.insertError = null + guard.live = [] + guard.asked.length = 0 reads.fresh = null reads.rows = {} printer.opens = true @@ -732,3 +751,40 @@ describe('Release of record: a saved release takes the records’ facts again, a expect((kept.printedForNotary as Record).at).not.toBe(printedThen.at) }) }) + +describe('Release of record: one live release a lien (finding 817, v2.9240)', () => { + const save = () => screen.getByRole('button', { name: 'Save release record' }) + + it('asks the database for a live release of this lien before it saves, then saves', async () => { + draw({ job: paid() }) + fireEvent.click(save()) + await waitFor(() => expect(writes.inserts).toHaveLength(1)) + expect(guard.asked).toEqual([['job_id', 'job-2041'], ['kind', 'release_of_record'], ['voided_at', null], ['fields->>releasesFilingId', 'a1']]) + }) + + it('saves nothing when the database already holds one, says so and reads the job again', async () => { + guard.live = [{ id: 'r-other-window' }] + const { onChanged } = draw({ job: paid() }) + fireEvent.click(save()) + expect(await screen.findByText('This lien already has a saved release. It is shown now.')).toBeTruthy() + expect(writes.inserts).toEqual([]) + expect(onChanged).toHaveBeenCalled() + }) + + it('takes one save from two fast presses', async () => { + draw({ job: paid() }) + fireEvent.click(save()) + fireEvent.click(save()) + await waitFor(() => expect(writes.inserts).toHaveLength(1)) + await new Promise((r) => setTimeout(r, 20)) + expect(writes.inserts).toHaveLength(1) + }) + + it('reads the database’s own refusal of a second release as the same sentence', async () => { + writes.insertError = { code: '23505', message: 'duplicate key value violates unique constraint "job_lien_filings_one_live_release_idx"', details: null, hint: null } + const { onChanged } = draw({ job: paid() }) + fireEvent.click(save()) + expect(await screen.findByText('This lien already has a saved release. It is shown now.')).toBeTruthy() + expect(onChanged).toHaveBeenCalled() + }) +}) diff --git a/src/components/jobs/LienFilingTabs.tsx b/src/components/jobs/LienFilingTabs.tsx index 9653d76585..88e55ce8a2 100644 --- a/src/components/jobs/LienFilingTabs.tsx +++ b/src/components/jobs/LienFilingTabs.tsx @@ -88,7 +88,7 @@ import { lienTradeWords } from '../../lib/jobs/lienTradeWords' import { MoneyText } from '../Money' import { ChangeableValue, ValueLine, ValueLines, ValueSentence, WorkedOutValue } from '../valuesInPlace/ValuesInPlace' import { plainSentence } from '../../lib/valuesInPlace' -import { RELEASE_OF_RECORD_WORDS, canReleaseAnyway, pickReleaseTarget, releaseMoneyBackWords, releaseMoneyGate, releaseNeedsBank, releasePaperBlanks, releasePaperBlanksWords, releaseRecordDrift, releaseRecordFactsPatch, releaseReprintWords, RELEASE_RECORD_FACT_LABELS, type ReleaseRecordFact, releaseCorrectable, releasePaymentDatePatch, releasePaymentDateShown, releasePaymentDayAsk, releasePaymentDayBeforeLien, releasePaymentDayKey, releaseSavedHold, releaseSavedPaymentDay, releaseRecordedSentence, releaseSaveFields, releaseStampDayCheck, releaseStampPatch, releaseTargets, releasePaymentDayCheck } from '../../lib/jobs/lienReleaseOfRecord' +import { RELEASE_OF_RECORD_WORDS, canReleaseAnyway, pickReleaseTarget, isOneLiveReleaseRefusal, releaseMoneyBackWords, releaseMoneyGate, releaseNeedsBank, releasePaperBlanks, releasePaperBlanksWords, releaseRecordDrift, releaseRecordFactsPatch, releaseReprintWords, RELEASE_RECORD_FACT_LABELS, type ReleaseRecordFact, releaseCorrectable, releasePaymentDatePatch, releasePaymentDateShown, releasePaymentDayAsk, releasePaymentDayBeforeLien, releasePaymentDayKey, releaseSavedHold, releaseSavedPaymentDay, releaseRecordedSentence, releaseSaveFields, releaseStampDayCheck, releaseStampPatch, releaseTargets, releasePaymentDayCheck } from '../../lib/jobs/lienReleaseOfRecord' import { payoffNote } from '../../lib/jobs/lienPayoffFields' import { releaseByNow, releaseFacts, releaseFactsPatch, releasePaperChangedSincePrint } from '../../lib/jobs/lienReleaseFacts' import { countedLabel } from '../../lib/batchWords' @@ -830,7 +830,11 @@ export default function LienFilingTabs({ setDocNote('') onChanged() } catch (e) { - showToast(formatErrorMessage(e, 'Could not save the record.'), 'error') + // The database's rule refused a second live release for a lien (finding 817, v2.9240): read the job again, so the saved one draws. + if (isOneLiveReleaseRefusal(e)) { + showToast(RELEASE_OF_RECORD_WORDS.alreadyReleased, 'error') + onChanged() + } else showToast(formatErrorMessage(e, 'Could not save the record.'), 'error') } finally { setBusy(false) } @@ -951,10 +955,34 @@ export default function LienFilingTabs({ }, [filedAffidavit, busy, serviceDate, ownerProof, ocProof, isSub, showToast, onChanged]) /** Save the release of the lien the tab is on. It names its affidavit, and a lien that has a release takes no second one. */ - const recordRelease = () => { + /** One save at a time (finding 817, v2.9240): a second press while the first is still asking the database does nothing. */ + const releaseSaving = useRef(false) + const recordRelease = async () => { if (!releaseTarget || releaseTarget.release || releaseGate.hold || releasePaymentDayCheck(releasePaymentDate, todayYmd())) return // A date before the lien was filed waits for its one answer (v2.9216). if (releasePaymentDayAsk(releasePaymentDate, releaseTarget.affidavit.filed_at, releaseDayKept === releasePaymentDayKey(releaseTarget.affidavit.id, releasePaymentDate))) return + if (releaseSaving.current) return + releaseSaving.current = true + try { + // One live release a lien: asked of the database, since the window's own list can be old or unread. + const live = await withSupabaseRetry( + () => supabase.from('job_lien_filings').select('id').eq('job_id', job.id).eq('kind', 'release_of_record').is('voided_at', null).eq('fields->>releasesFilingId', releaseTarget.affidavit.id).limit(1), + 'save the release: look for one already saved', + ) + if (((live ?? []) as unknown[]).length > 0) { + showToast(RELEASE_OF_RECORD_WORDS.alreadyReleased, 'error') + onChanged() + return + } + await saveRelease() + } catch (e) { + showToast(formatErrorMessage(e, 'Could not save the record.'), 'error') + } finally { + releaseSaving.current = false + } + } + const saveRelease = () => { + if (!releaseTarget) return return insertFiling( { kind: 'release_of_record', diff --git a/src/components/jobs/LienInstrumentsModal.tsx b/src/components/jobs/LienInstrumentsModal.tsx index a1bc2f988a..203a458dc8 100644 --- a/src/components/jobs/LienInstrumentsModal.tsx +++ b/src/components/jobs/LienInstrumentsModal.tsx @@ -60,7 +60,7 @@ import type { LienTimelineCourtesy } from '../../lib/jobs/lienTimeline' import LienTimelineStrip from './LienTimelineStrip' import { LienLastWorkDayLine } from './LienLastWorkDayLine' import { isLienOffice } from '../../lib/jobs/lienDesk' -import { LIEN_WINDOW_TAB_LABEL, lienWindowNextStep } from '../../lib/jobs/lienWindowNextStep' +import { LIEN_WINDOW_FILINGS_UNREAD, LIEN_WINDOW_TAB_LABEL, lienWindowNextStep } from '../../lib/jobs/lienWindowNextStep' import { lienApproverFor } from '../../lib/jobs/lienApprovalWait' import { LIEN_LAST_WORK_COLUMNS, lienLastWorkFactsOf, type LienLastWorkFacts } from '../../lib/jobs/lienLastWorkJobs' import LienWindowFoldedSteps from './LienWindowFoldedSteps' @@ -347,17 +347,20 @@ export default function LienInstrumentsModal({ setFilings([]) return } + // A read that fails keeps the records the window holds (finding 817, v2.9240). It used to draw none, so a lien + // with a saved release read as *No recorded lien on this job* and its release could be saved a second time. try { - const { data } = await supabase + const { data, error } = await supabase .from('job_lien_filings') .select('*') .eq('job_id', job.id) .order('created_at', { ascending: false }) + if (error) throw error setFilings((data ?? []) as JobLienFilingRow[]) } catch { - setFilings([]) + showToast(LIEN_WINDOW_FILINGS_UNREAD, 'error') } - }, [job?.id]) + }, [job?.id, showToast]) // The job's property (v2.5832), read first and on its own from the job's row: the kind was the last of five // reads and came from the opener's copy of the row, so the window drew the residential dates until it landed. diff --git a/src/content/releaseNotes/v2.9240.ts b/src/content/releaseNotes/v2.9240.ts new file mode 100644 index 0000000000..2d4dc49e16 --- /dev/null +++ b/src/content/releaseNotes/v2.9240.ts @@ -0,0 +1,15 @@ +import type { ReleaseNote } from '../../lib/releaseNotes' + +const note: ReleaseNote = { + version: 'v2.9240', + date: '2026-12-02', + title: 'Release of record: a lien takes one release, whatever the window shows', + kind: 'fix', + highlights: [ + 'Two fast presses of Save release record, or two open windows, could write two releases for one lien.', + 'The save now asks first whether the lien already has a release. If it has, the saved one is shown.', + 'A reload of the job’s lien records that fails no longer draws No recorded lien on this job. The window keeps what it holds and says so.', + ], +} + +export default note diff --git a/src/lib/jobs/lienReleaseOfRecord.test.ts b/src/lib/jobs/lienReleaseOfRecord.test.ts index adbb4b54a7..fa09632760 100644 --- a/src/lib/jobs/lienReleaseOfRecord.test.ts +++ b/src/lib/jobs/lienReleaseOfRecord.test.ts @@ -1,10 +1,11 @@ +import { readFileSync } from 'node:fs' import { describe, expect, it } from 'vitest' import { plainWordsFailures } from '../plainWords' import { plainSentence, val } from '../valuesInPlace' import type { LienPayoffAffidavit, LienPayoffPayment, LienPayoffRelease } from './lienPayoff' import type { BankCheck } from './checkCleared' import { releaseFactsPatch } from './lienReleaseFacts' -import { RELEASE_OF_RECORD_WORDS, canReleaseAnyway, pickReleaseTarget, releaseMoneyBackWords, releaseMoneyGate, releaseNeedsBank, releasePaperBlanks, releasePaperBlanksWords, releaseRecordDrift, releaseRecordFactsPatch, releaseReprintWords, releaseCorrectable, releasePaymentDatePatch, releasePaymentDateShown, releasePaymentDay, releaseSavedPaymentDay, releasePaymentDayAsk, releasePaymentDayBeforeLien, releasePaymentDayCheck, releasePaymentDayKey, releaseRecordedSentence, releaseSaveFields, releaseSavedHold, releaseStampDayCheck, releaseStampPatch, releaseTargets, releaseWaitsOnCheck } from './lienReleaseOfRecord' +import { ONE_LIVE_RELEASE_INDEX, RELEASE_OF_RECORD_WORDS, canReleaseAnyway, isOneLiveReleaseRefusal, pickReleaseTarget, releaseMoneyBackWords, releaseMoneyGate, releaseNeedsBank, releasePaperBlanks, releasePaperBlanksWords, releaseRecordDrift, releaseRecordFactsPatch, releaseReprintWords, releaseCorrectable, releasePaymentDatePatch, releasePaymentDateShown, releasePaymentDay, releaseSavedPaymentDay, releasePaymentDayAsk, releasePaymentDayBeforeLien, releasePaymentDayCheck, releasePaymentDayKey, releaseRecordedSentence, releaseSaveFields, releaseSavedHold, releaseStampDayCheck, releaseStampPatch, releaseTargets, releaseWaitsOnCheck } from './lienReleaseOfRecord' // Every job, instrument and amount here is made up. const TODAY = '2026-11-24' @@ -458,3 +459,26 @@ describe('a saved release takes the records’ facts again, and says when it cha expect(plainWordsFailures(plainSentence(releaseReprintWords(corrected) ?? ''))).toEqual([]) }) }) + +describe('one live release a lien: the database’s refusal (finding 817, v2.9240)', () => { + it('knows the rule’s own refusal by its code and the index’s name', () => { + expect(isOneLiveReleaseRefusal({ code: '23505', message: `duplicate key value violates unique constraint "${ONE_LIVE_RELEASE_INDEX}"` })).toBe(true) + expect(isOneLiveReleaseRefusal({ code: '23505', message: 'duplicate key', details: `Key ... ${ONE_LIVE_RELEASE_INDEX}` })).toBe(true) + }) + + it('is not any other refusal', () => { + expect(isOneLiveReleaseRefusal({ code: '23505', message: 'duplicate key value violates unique constraint "job_lien_filings_pkey"' })).toBe(false) + expect(isOneLiveReleaseRefusal({ code: '42501', message: ONE_LIVE_RELEASE_INDEX })).toBe(false) + expect(isOneLiveReleaseRefusal(null)).toBe(false) + expect(isOneLiveReleaseRefusal('x')).toBe(false) + }) + + it('carries the name the migration gives the index, and says it in plain words', () => { + expect(ONE_LIVE_RELEASE_INDEX).toBe('job_lien_filings_one_live_release_idx') + const sql = readFileSync('supabase/migrations/20261202211100_one_live_release_a_lien.sql', 'utf8') + expect(sql).toContain(`CREATE UNIQUE INDEX IF NOT EXISTS ${ONE_LIVE_RELEASE_INDEX}`) + expect(sql).toContain("(fields ->> 'releasesFilingId')") + expect(sql).toContain('voided_at IS NULL') + expect(plainWordsFailures(RELEASE_OF_RECORD_WORDS.alreadyReleased)).toEqual([]) + }) +}) diff --git a/src/lib/jobs/lienReleaseOfRecord.ts b/src/lib/jobs/lienReleaseOfRecord.ts index b7c9ea85a7..c6403f5109 100644 --- a/src/lib/jobs/lienReleaseOfRecord.ts +++ b/src/lib/jobs/lienReleaseOfRecord.ts @@ -77,6 +77,8 @@ export const RELEASE_OF_RECORD_WORDS = { payDayLabel: 'Payment / satisfaction date', paperHint: 'You can correct this date until the county records the release.', paperCorrected: 'The release has the new payment date.', + /** One live release a lien (finding 817, v2.9240): the save found one already there. */ + alreadyReleased: 'This lien already has a saved release. It is shown now.', /** A saved release takes the records' facts again, and says when it changed after its print (v2.9238). */ recordSays: 'the record says', recordBlank: 'blank on the paper', @@ -318,6 +320,16 @@ export function releasePaymentDatePatch(fields: unknown, day: string): Record> 'releasesFilingId'. Nothing tied one release to +-- one lien: two presses of Save release record around the window's reload, or two windows, could each write a row. +-- The index refuses the second live row for the same affidavit. A voided release does not count, so a release made +-- again after a void is taken. A release from before the key was kept (no releasesFilingId) is left out. +-- +-- The build reads a small table once. It fails, and changes nothing, if two live releases already name one lien: +-- void the extra one in the app, then push again. +CREATE UNIQUE INDEX IF NOT EXISTS job_lien_filings_one_live_release_idx + ON public.job_lien_filings ((fields ->> 'releasesFilingId')) + WHERE kind = 'release_of_record' + AND voided_at IS NULL + AND (fields ->> 'releasesFilingId') IS NOT NULL + AND (fields ->> 'releasesFilingId') <> ''; diff --git a/to-dos/lien-release-road-faults/README.md b/to-dos/lien-release-road-faults/README.md index ee2eb4719a..daf3cb96d7 100644 --- a/to-dos/lien-release-road-faults/README.md +++ b/to-dos/lien-release-road-faults/README.md @@ -2,7 +2,7 @@ name: "The release road: every fault found on the way to releasing a paid lien, and the ones left to mend" number: 479 group: ready -status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 3 is built (v2.9216) · step 4 is built (v2.9219, v2.9238) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · step 10 is built (v2.9229, v2.9239) · step 12 is built (v2.9232) · step 13 is built (v2.9234) · the owner answered the three calls on 2026-12-02 · steps 2, 7, 8, 9, 11 and 14 are left +status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 3 is built (v2.9216) · step 4 is built (v2.9219, v2.9238) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · step 8 is built and owes a push (v2.9240) · step 10 is built (v2.9229, v2.9239) · step 12 is built (v2.9232) · step 13 is built (v2.9234) · the owner answered the three calls on 2026-12-02 · steps 2, 7, 9, 11 and 14 are left summary: > The owner asked for help releasing a paid lien and printing its release, and for every bug on the way. One thread read the road in the code and found fourteen faults, findings 808 to 821. @@ -15,7 +15,7 @@ summary: > next: Step 2, finding 809. A release that is only saved stops reading Released, and one reading says where a release stands. ask: owner · decide · A look at one drawing, still to be made. The window that refuses the void of an affidavit with a live release, and where its Take me there press lands. size: L as a train of fourteen (M · M · S · S · S · S · M · M · S · S · XS · S · S · S); left: steps 2 and 4 to 14 -blocker: Steps 2, 4 to 6 and 10 to 14 have none. Step 7 waits on the owner's look at its drawing. Step 8 owes a migration. Step 9 is built after card #477. +blocker: Steps 2, 4 to 6 and 10 to 14 have none. Step 7 waits on the owner's look at its drawing. Step 8 is built and owes one push after its merge. Step 9 is built after card #477. opinion: build — step 2 next. With step 1 it is the pair that can mislead on a real lien, and a release cannot be taken back once the county records it. mockup: not required — each step mends a press, a line or a guard on a screen that is already drawn. A step that redraws a screen draws it then. --- @@ -63,7 +63,7 @@ State is as read on GitHub and on `main` on 2026-12-02 at 19:17 UTC. | 814 | A release is saved and the county has not recorded it. The job's bills owe again. The tab still says *Sign it before a notary. Then record it at the county.* Its print is live. Payoffs and the day's run hold the same release. | read | Mended by v2.9222, step 5: the tab reads the same hold, its two presses wait and the reason stands under them. | | 815 | **Download PDF** files no copy. Neither press marks the release as printed for the notary. When a check then comes back, the app says no release has left the office. The day's run prints it again. | read | Mended by v2.9224, step 6: a download files a copy, and the tab's print or download marks a saved release as printed for the notary. | | 816 | Voiding a filed affidavit that has a release leaves the release with no lien. Payoffs, the Board and the tab offer a second release, and the head still says released. Under **Filings on this job** a release's line names no lien, number or day, so two cannot be told apart. A release the county recorded voids with the same two presses and no words. | read, its line seen | Not started. Step 7. | -| 817 | Around the reload after **Save release record** a second release row can be written. Nothing in the database ties one release to one lien. A reload that fails draws *No recorded lien on this job*. | plausible | Not started. Step 8. | +| 817 | Around the reload after **Save release record** a second release row can be written. Nothing in the database ties one release to one lien. A reload that fails draws *No recorded lien on this job*. | plausible | Built, v2.9240, step 8. The save asks the database first, and a partial unique index holds the rule. It owes one push after its merge. | | 818 | The desk's path is never told that a release waits on a check. It says *Paid — file the release of record.* with **File the release ›** while the tab's presses are dead. The Board keeps one chip a job in a bin. So on a job with two liens **Make N release ›** can leave one out. | read | Not started. Step 9. | | 819 | Keeping the instrument number writes every kept fact of the release back from the window's copy. A fact another screen wrote in the meantime is lost. That can be the notary's day, the copies' day or the mark of a check that came back. | plausible | Mended, v2.9229 and v2.9239, step 10. The tab's writes read the row fresh. The day's run, Payoffs and the returned check's mark write through `keepReleaseFacts`, which now reads each release fresh too. | | 820 | **Go to the affidavit ›** does nothing a person can see when the **Lien affidavit** tab is already picked. It is the same dead press as 804. | read | Not started. Step 11. | @@ -132,8 +132,8 @@ Lien desk lane's note of run 17 and are not on this card. looks at the drawing before this half is built. The other half does not wait: a release's line under **Filings on this job** names its lien, its number and its day, and voiding a release the county recorded takes words. -8. **One release a lien (M). 817.** The save is guarded in the client. A rule in the database - ties one live release to one lien. This step is a migration and owes a push. +8. **Built, v2.9240. One release a lien (M). 817.** The save is guarded in the client. A rule in the database + ties one live release to one lien. This step is a migration and owes a push after its merge. 9. **The desk's path knows the wait, and one chip a lien (S). 818.** Built after card #477, since that card changes what opens the presses. 10. **Built, v2.9229 and v2.9239. Keeping one fact writes one fact (S). 819.** Every writer reads the row fresh: the From f673f0a8b8e074ea94b81774a51fe864939ba6f2 Mon Sep 17 00:00:00 2001 From: Robert Douglas <57234112+realrobertdouglas@users.noreply.github.com> Date: Wed, 2 Dec 2026 16:05:01 -0600 Subject: [PATCH 16/21] chore(edge-kernels): regenerate the copy after the release scan's names (v2.9232) lienScanFile.ts gained the release's scan name and words in this PR and the copy under supabase/functions/_shared/gcKernels was not regenerated, so the copy's test failed here and in every PR stacked above. Co-Authored-By: Claude Fable 5.2 --- .../gcKernels/lib/jobs/lienScanFile.ts | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/supabase/functions/_shared/gcKernels/lib/jobs/lienScanFile.ts b/supabase/functions/_shared/gcKernels/lib/jobs/lienScanFile.ts index ba95ef0645..71686ac29b 100644 --- a/supabase/functions/_shared/gcKernels/lib/jobs/lienScanFile.ts +++ b/supabase/functions/_shared/gcKernels/lib/jobs/lienScanFile.ts @@ -24,8 +24,8 @@ export function lienScanIsPdf(file: Pick): bo return file.type === 'application/pdf' || /\.pdf$/i.test(file.name) } -/** Why a file cannot be added, in sentences, or null when it can. `paper` is the one to scan alone: *notice*, *affidavit*. */ -export function lienScanProblem(file: LienScanFileLike, paper: 'notice' | 'affidavit'): string | null { +/** Why a file cannot be added, in sentences, or null when it can. `paper` is the one to scan alone: *notice*, *affidavit*, *release*. */ +export function lienScanProblem(file: LienScanFileLike, paper: 'notice' | 'affidavit' | 'release'): string | null { if (!lienScanIsPdf(file) && !file.type.startsWith('image/')) return 'That file is not a scan or a photo. Add a PDF or a picture.' if (file.size <= 0) return 'That file is empty. Scan the papers again.' if (addFileTooBig(file.size)) return `That file is ${addFileSizeWords(file.size)}. The most a file can be is ${addFileSizeWords(ADD_FILE_MAX_BYTES)}. Scan this ${paper} alone, or at a lower quality.` @@ -55,6 +55,19 @@ export function lienFiledScanName(jobNumber: string, ymd: string, file: Pick): string { + const job = jobNumber.trim() ? `Job ${jobNumber.trim()}, ` : '' + const day = ymd.trim() ? `, ${ymd.trim()}` : '' + return `Lien release, ${job}${LIEN_RELEASE_SCAN_NOTE}${day}.${lienScanExtension(file)}` +} + /** The press's words. Each sentence is one idea, as a first-timer reads it. */ export const LIEN_FILED_SCAN_WORDS = { press: 'Upload the scanned PDF', @@ -64,3 +77,11 @@ export const LIEN_FILED_SCAN_WORDS = { title: 'Pick the scan of the stamped affidavit from this computer. It goes in the job’s Drive folder, under Sent by us.', failed: 'The file was not added. Nothing was saved.', } as const + +/** The same press on a release's line (finding 821, v2.9232): only the paper it names differs. */ +export const LIEN_RELEASE_SCAN_WORDS = { + ...LIEN_FILED_SCAN_WORDS, + title: 'Pick the scan of the stamped release from this computer. It goes in the job’s Drive folder, under Sent by us.', + kept: 'Scan saved as the release’s saved copy.', + linkFailed: 'The scan is in the job’s Drive folder, but its link was not saved on the release.', +} as const From 2415e42f453392faa73b453f45a9cf04180ffdac Mon Sep 17 00:00:00 2001 From: Robert Douglas <57234112+realrobertdouglas@users.noreply.github.com> Date: Wed, 2 Dec 2026 16:05:43 -0600 Subject: [PATCH 17/21] test(sql-beds): the early-on-check bed's releases each name a lien of their own The bed saved twenty-one releases on one made-up lien to ask who may save one and with which reason. The one-live-release index this PR adds refuses the second. The trigger does not read the lien by that id, so each release now names a made-up lien of its own and the bed asks what it asked before. Co-Authored-By: Claude Fable 5.2 --- .../tests/lien_early_on_check/20_scenario.sql | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/supabase/tests/lien_early_on_check/20_scenario.sql b/supabase/tests/lien_early_on_check/20_scenario.sql index cdd1306e29..6b48b838c8 100644 --- a/supabase/tests/lien_early_on_check/20_scenario.sql +++ b/supabase/tests/lien_early_on_check/20_scenario.sql @@ -11,6 +11,9 @@ \set ON_ERROR_STOP 1 BEGIN; +-- Since 20261202211100 a lien holds one live release (job_lien_filings_one_live_release_idx). This bed asks who may +-- save a release and with which reason, not which lien it releases, and the trigger does not read the lien by that +-- id. So each release this scenario saves names a made-up lien of its own, 437901 upward, and none meets the index. CREATE SCHEMA leo; CREATE FUNCTION leo.same(label text, got text, want text) RETURNS void LANGUAGE plpgsql AS $$ BEGIN @@ -91,8 +94,8 @@ SET LOCAL ROLE authenticated; -- ── dev ───────────────────────────────────────────────────────────────────────────────────────── SELECT leo.as_user('00000000-0000-0000-0000-0000004370d1'); -SELECT leo.same('dev: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d1')$q$), 'allowed 1'); -SELECT leo.same('dev: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d1')$q$), 'allowed 1'); +SELECT leo.same('dev: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437901","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d1')$q$), 'allowed 1'); +SELECT leo.same('dev: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437902","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d1')$q$), 'allowed 1'); SELECT leo.same('dev: the bank confirmed the funds, set on a lien', leo.answer($q$UPDATE public.job_lien_filings SET fields = fields || '{"fundsConfirmed":{"by":"00000000-0000-0000-0000-0000004370d1","name":"Early dev","at":"2026-11-27T16:00:00.000Z","note":"set by dev"}}'::jsonb WHERE id = '00000000-0000-0000-0000-000000437c01'$q$), 'allowed 1'); SELECT leo.same('dev: a confirmation changed', leo.answer($q$UPDATE public.job_lien_filings SET fields = jsonb_set(fields, '{fundsConfirmed,note}', '"reworded by dev"') WHERE id = '00000000-0000-0000-0000-000000437c02'$q$), 'allowed 1'); RESET ROLE; @@ -102,8 +105,8 @@ SELECT leo.same('dev: a confirmation taken off', leo.answer($q$UPDATE public.job -- ── master_technician ───────────────────────────────────────────────────────────────────────────────────────── SELECT leo.as_user('00000000-0000-0000-0000-0000004370d2'); -SELECT leo.same('master_technician: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d2')$q$), 'allowed 1'); -SELECT leo.same('master_technician: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d2')$q$), 'allowed 1'); +SELECT leo.same('master_technician: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437903","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d2')$q$), 'allowed 1'); +SELECT leo.same('master_technician: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437904","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d2')$q$), 'allowed 1'); SELECT leo.same('master_technician: the bank confirmed the funds, set on a lien', leo.answer($q$UPDATE public.job_lien_filings SET fields = fields || '{"fundsConfirmed":{"by":"00000000-0000-0000-0000-0000004370d2","name":"Early master_technician","at":"2026-11-27T16:00:00.000Z","note":"set by master_technician"}}'::jsonb WHERE id = '00000000-0000-0000-0000-000000437c01'$q$), 'allowed 1'); SELECT leo.same('master_technician: a confirmation changed', leo.answer($q$UPDATE public.job_lien_filings SET fields = jsonb_set(fields, '{fundsConfirmed,note}', '"reworded by master_technician"') WHERE id = '00000000-0000-0000-0000-000000437c02'$q$), 'allowed 1'); RESET ROLE; @@ -113,8 +116,8 @@ SELECT leo.same('master_technician: a confirmation taken off', leo.answer($q$UPD -- ── controller ───────────────────────────────────────────────────────────────────────────────────────── SELECT leo.as_user('00000000-0000-0000-0000-0000004370d3'); -SELECT leo.same('controller: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d3')$q$), 'allowed 1'); -SELECT leo.same('controller: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d3')$q$), 'allowed 1'); +SELECT leo.same('controller: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437905","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d3')$q$), 'allowed 1'); +SELECT leo.same('controller: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437906","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d3')$q$), 'allowed 1'); SELECT leo.same('controller: the bank confirmed the funds, set on a lien', leo.answer($q$UPDATE public.job_lien_filings SET fields = fields || '{"fundsConfirmed":{"by":"00000000-0000-0000-0000-0000004370d3","name":"Early controller","at":"2026-11-27T16:00:00.000Z","note":"set by controller"}}'::jsonb WHERE id = '00000000-0000-0000-0000-000000437c01'$q$), 'allowed 1'); SELECT leo.same('controller: a confirmation changed', leo.answer($q$UPDATE public.job_lien_filings SET fields = jsonb_set(fields, '{fundsConfirmed,note}', '"reworded by controller"') WHERE id = '00000000-0000-0000-0000-000000437c02'$q$), 'allowed 1'); RESET ROLE; @@ -124,48 +127,48 @@ SELECT leo.same('controller: a confirmation taken off', leo.answer($q$UPDATE pub -- ── assistant ───────────────────────────────────────────────────────────────────────────────────────── SELECT leo.as_user('00000000-0000-0000-0000-0000004370d4'); -SELECT leo.same('assistant: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d4')$q$), '42501 Only a leader, a controller or a dev can release a lien before its check clears.'); -SELECT leo.same('assistant: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d4')$q$), '42501 Only a leader, a controller or a dev can release a lien with money still open.'); +SELECT leo.same('assistant: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437907","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d4')$q$), '42501 Only a leader, a controller or a dev can release a lien before its check clears.'); +SELECT leo.same('assistant: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437908","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d4')$q$), '42501 Only a leader, a controller or a dev can release a lien with money still open.'); SELECT leo.same('assistant: the bank confirmed the funds, set on a lien', leo.answer($q$UPDATE public.job_lien_filings SET fields = fields || '{"fundsConfirmed":{"by":"00000000-0000-0000-0000-0000004370d4","name":"Early assistant","at":"2026-11-27T16:00:00.000Z","note":"set by assistant"}}'::jsonb WHERE id = '00000000-0000-0000-0000-000000437c01'$q$), '42501 Only a leader, a controller or a dev can say the bank confirmed the funds, or take that back.'); SELECT leo.same('assistant: a confirmation changed', leo.answer($q$UPDATE public.job_lien_filings SET fields = jsonb_set(fields, '{fundsConfirmed,note}', '"reworded by assistant"') WHERE id = '00000000-0000-0000-0000-000000437c02'$q$), '42501 Only a leader, a controller or a dev can say the bank confirmed the funds, or take that back.'); SELECT leo.same('assistant: a confirmation taken off', leo.answer($q$UPDATE public.job_lien_filings SET fields = fields - 'fundsConfirmed' WHERE id = '00000000-0000-0000-0000-000000437c02'$q$), '42501 Only a leader, a controller or a dev can say the bank confirmed the funds, or take that back.'); -- ── estimator ───────────────────────────────────────────────────────────────────────────────────────── SELECT leo.as_user('00000000-0000-0000-0000-0000004370d5'); -SELECT leo.same('estimator: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d5')$q$), '42501 Only a leader, a controller or a dev can release a lien before its check clears.'); -SELECT leo.same('estimator: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d5')$q$), '42501 Only a leader, a controller or a dev can release a lien with money still open.'); +SELECT leo.same('estimator: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437909","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d5')$q$), '42501 Only a leader, a controller or a dev can release a lien before its check clears.'); +SELECT leo.same('estimator: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437910","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d5')$q$), '42501 Only a leader, a controller or a dev can release a lien with money still open.'); SELECT leo.same('estimator: the bank confirmed the funds, set on a lien, reaches no row', leo.answer($q$UPDATE public.job_lien_filings SET fields = fields || '{"fundsConfirmed":{"by":"00000000-0000-0000-0000-0000004370d5","name":"Early estimator","at":"2026-11-27T16:00:00.000Z","note":"set by estimator"}}'::jsonb WHERE id = '00000000-0000-0000-0000-000000437c01'$q$), 'allowed 0'); SELECT leo.same('estimator: a confirmation changed, reaches no row', leo.answer($q$UPDATE public.job_lien_filings SET fields = jsonb_set(fields, '{fundsConfirmed,note}', '"reworded by estimator"') WHERE id = '00000000-0000-0000-0000-000000437c02'$q$), 'allowed 0'); SELECT leo.same('estimator: a confirmation taken off, reaches no row', leo.answer($q$UPDATE public.job_lien_filings SET fields = fields - 'fundsConfirmed' WHERE id = '00000000-0000-0000-0000-000000437c02'$q$), 'allowed 0'); -- ── primary ───────────────────────────────────────────────────────────────────────────────────────── SELECT leo.as_user('00000000-0000-0000-0000-0000004370d6'); -SELECT leo.same('primary: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d6')$q$), '42501 Only a leader, a controller or a dev can release a lien before its check clears.'); -SELECT leo.same('primary: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d6')$q$), '42501 Only a leader, a controller or a dev can release a lien with money still open.'); +SELECT leo.same('primary: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437911","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d6')$q$), '42501 Only a leader, a controller or a dev can release a lien before its check clears.'); +SELECT leo.same('primary: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437912","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d6')$q$), '42501 Only a leader, a controller or a dev can release a lien with money still open.'); SELECT leo.same('primary: the bank confirmed the funds, set on a lien, reaches no row', leo.answer($q$UPDATE public.job_lien_filings SET fields = fields || '{"fundsConfirmed":{"by":"00000000-0000-0000-0000-0000004370d6","name":"Early primary","at":"2026-11-27T16:00:00.000Z","note":"set by primary"}}'::jsonb WHERE id = '00000000-0000-0000-0000-000000437c01'$q$), 'allowed 0'); SELECT leo.same('primary: a confirmation changed, reaches no row', leo.answer($q$UPDATE public.job_lien_filings SET fields = jsonb_set(fields, '{fundsConfirmed,note}', '"reworded by primary"') WHERE id = '00000000-0000-0000-0000-000000437c02'$q$), 'allowed 0'); SELECT leo.same('primary: a confirmation taken off, reaches no row', leo.answer($q$UPDATE public.job_lien_filings SET fields = fields - 'fundsConfirmed' WHERE id = '00000000-0000-0000-0000-000000437c02'$q$), 'allowed 0'); -- ── superintendent ───────────────────────────────────────────────────────────────────────────────────────── SELECT leo.as_user('00000000-0000-0000-0000-0000004370d7'); -SELECT leo.same('superintendent: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d7')$q$), '42501 Only a leader, a controller or a dev can release a lien before its check clears.'); -SELECT leo.same('superintendent: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d7')$q$), '42501 Only a leader, a controller or a dev can release a lien with money still open.'); +SELECT leo.same('superintendent: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437913","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d7')$q$), '42501 Only a leader, a controller or a dev can release a lien before its check clears.'); +SELECT leo.same('superintendent: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437914","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d7')$q$), '42501 Only a leader, a controller or a dev can release a lien with money still open.'); SELECT leo.same('superintendent: the bank confirmed the funds, set on a lien, reaches no row', leo.answer($q$UPDATE public.job_lien_filings SET fields = fields || '{"fundsConfirmed":{"by":"00000000-0000-0000-0000-0000004370d7","name":"Early superintendent","at":"2026-11-27T16:00:00.000Z","note":"set by superintendent"}}'::jsonb WHERE id = '00000000-0000-0000-0000-000000437c01'$q$), 'allowed 0'); SELECT leo.same('superintendent: a confirmation changed, reaches no row', leo.answer($q$UPDATE public.job_lien_filings SET fields = jsonb_set(fields, '{fundsConfirmed,note}', '"reworded by superintendent"') WHERE id = '00000000-0000-0000-0000-000000437c02'$q$), 'allowed 0'); SELECT leo.same('superintendent: a confirmation taken off, reaches no row', leo.answer($q$UPDATE public.job_lien_filings SET fields = fields - 'fundsConfirmed' WHERE id = '00000000-0000-0000-0000-000000437c02'$q$), 'allowed 0'); -- ── subcontractor ───────────────────────────────────────────────────────────────────────────────────────── SELECT leo.as_user('00000000-0000-0000-0000-0000004370d8'); -SELECT leo.same('subcontractor: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d8')$q$), '42501 Only a leader, a controller or a dev can release a lien before its check clears.'); -SELECT leo.same('subcontractor: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d8')$q$), '42501 Only a leader, a controller or a dev can release a lien with money still open.'); +SELECT leo.same('subcontractor: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437915","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d8')$q$), '42501 Only a leader, a controller or a dev can release a lien before its check clears.'); +SELECT leo.same('subcontractor: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437916","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d8')$q$), '42501 Only a leader, a controller or a dev can release a lien with money still open.'); SELECT leo.same('subcontractor: the bank confirmed the funds, set on a lien, reaches no row', leo.answer($q$UPDATE public.job_lien_filings SET fields = fields || '{"fundsConfirmed":{"by":"00000000-0000-0000-0000-0000004370d8","name":"Early subcontractor","at":"2026-11-27T16:00:00.000Z","note":"set by subcontractor"}}'::jsonb WHERE id = '00000000-0000-0000-0000-000000437c01'$q$), 'allowed 0'); SELECT leo.same('subcontractor: a confirmation changed, reaches no row', leo.answer($q$UPDATE public.job_lien_filings SET fields = jsonb_set(fields, '{fundsConfirmed,note}', '"reworded by subcontractor"') WHERE id = '00000000-0000-0000-0000-000000437c02'$q$), 'allowed 0'); SELECT leo.same('subcontractor: a confirmation taken off, reaches no row', leo.answer($q$UPDATE public.job_lien_filings SET fields = fields - 'fundsConfirmed' WHERE id = '00000000-0000-0000-0000-000000437c02'$q$), 'allowed 0'); -- ── helpers ───────────────────────────────────────────────────────────────────────────────────────── SELECT leo.as_user('00000000-0000-0000-0000-0000004370d9'); -SELECT leo.same('helpers: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d9')$q$), '42501 Only a leader, a controller or a dev can release a lien before its check clears.'); -SELECT leo.same('helpers: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d9')$q$), '42501 Only a leader, a controller or a dev can release a lien with money still open.'); +SELECT leo.same('helpers: a release before the check clears', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437917","releasedBeforeClearedReason":"the builder wired it too"}'::jsonb, '00000000-0000-0000-0000-0000004370d9')$q$), '42501 Only a leader, a controller or a dev can release a lien before its check clears.'); +SELECT leo.same('helpers: a release with money still open', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437918","releasedUnpaidReason":"the owner asked for it"}'::jsonb, '00000000-0000-0000-0000-0000004370d9')$q$), '42501 Only a leader, a controller or a dev can release a lien with money still open.'); SELECT leo.same('helpers: the bank confirmed the funds, set on a lien, reaches no row', leo.answer($q$UPDATE public.job_lien_filings SET fields = fields || '{"fundsConfirmed":{"by":"00000000-0000-0000-0000-0000004370d9","name":"Early helpers","at":"2026-11-27T16:00:00.000Z","note":"set by helpers"}}'::jsonb WHERE id = '00000000-0000-0000-0000-000000437c01'$q$), 'allowed 0'); SELECT leo.same('helpers: a confirmation changed, reaches no row', leo.answer($q$UPDATE public.job_lien_filings SET fields = jsonb_set(fields, '{fundsConfirmed,note}', '"reworded by helpers"') WHERE id = '00000000-0000-0000-0000-000000437c02'$q$), 'allowed 0'); SELECT leo.same('helpers: a confirmation taken off, reaches no row', leo.answer($q$UPDATE public.job_lien_filings SET fields = fields - 'fundsConfirmed' WHERE id = '00000000-0000-0000-0000-000000437c02'$q$), 'allowed 0'); @@ -180,7 +183,7 @@ SELECT leo.same('and the first lien carries none, taken off last by a controller SET LOCAL ROLE authenticated; SELECT leo.as_user('00000000-0000-0000-0000-0000004370d4'); SELECT leo.same('an assistant records an ordinary release', - leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01"}'::jsonb, '00000000-0000-0000-0000-0000004370d4')$q$), 'allowed 1'); + leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437919"}'::jsonb, '00000000-0000-0000-0000-0000004370d4')$q$), 'allowed 1'); SELECT leo.same('an assistant records a release that rests on a leader''s confirmation', leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b02', 'release_of_record', 7000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c02","releasedOnConfirmedFunds":{"by":"00000000-0000-0000-0000-0000004370d2","name":"Early master_technician","at":"2026-11-20T15:00:00.000Z","note":"the bank said good funds"}}'::jsonb, '00000000-0000-0000-0000-0000004370d4')$q$), 'allowed 1'); SELECT leo.same('an assistant records a notice and a lien', @@ -210,7 +213,7 @@ SELECT leo.same('the confirmation outlived the assistant''s other writes, with t SET LOCAL ROLE authenticated; SELECT leo.as_user('00000000-0000-0000-0000-0000004370d9'); SELECT leo.same('a helper''s ordinary release is refused by the row policy, as before', - (leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01"}'::jsonb, '00000000-0000-0000-0000-0000004370d9')$q$) LIKE '42501 new row violates row-level security policy%')::text, 'true'); + (leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437920"}'::jsonb, '00000000-0000-0000-0000-0000004370d9')$q$) LIKE '42501 new row violates row-level security policy%')::text, 'true'); SELECT leo.same('and a helper reads no filing', (SELECT count(*)::text FROM public.job_lien_filings), '0'); RESET ROLE; @@ -221,7 +224,7 @@ SELECT leo.same('the service role''s write of a lien''s sends passes, and so doe leo.answer($q$UPDATE public.job_lien_filings SET sends = '[{"recipient":"owner","method":"certified","tracking":"ZZ1","sent_on":"2026-10-03"}]'::jsonb WHERE id = '00000000-0000-0000-0000-000000437c01'$q$) || ' ' || leo.answer($q$UPDATE public.job_lien_filings SET fields = fields || '{"fundsConfirmed":{"by":"","name":"","at":"2026-11-27T16:30:00.000Z","note":"by the service role"}}'::jsonb WHERE id = '00000000-0000-0000-0000-000000437c01'$q$), 'allowed 1 allowed 1'); SELECT leo.same('the service role''s release with money still open passes too', - leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437c01","releasedUnpaidReason":"by the service role"}'::jsonb, '00000000-0000-0000-0000-0000004370d2')$q$), 'allowed 1'); + leo.answer($q$INSERT INTO public.job_lien_filings (job_id, kind, amount, fields, created_by) VALUES ('00000000-0000-0000-0000-000000437b01', 'release_of_record', 5000, '{"releasesFilingId":"00000000-0000-0000-0000-000000437921","releasedUnpaidReason":"by the service role"}'::jsonb, '00000000-0000-0000-0000-0000004370d2')$q$), 'allowed 1'); RESET ROLE; DO $$ BEGIN RAISE NOTICE 'lien_early_on_check PASSED'; END $$; From f59c800b75b0cafd3ab2f3c7fc646e1903f5f56b Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 2 Dec 2026 20:59:49 -0600 Subject: [PATCH 18/21] docs(to-dos): card #479, its status lines brought current (steps 2 and 11 are built, step 14 measured) Co-Authored-By: Claude Fable 5.2 --- to-dos/lien-release-road-faults/README.md | 52 +++++++++++++---------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/to-dos/lien-release-road-faults/README.md b/to-dos/lien-release-road-faults/README.md index cca2203700..e7c9afe70a 100644 --- a/to-dos/lien-release-road-faults/README.md +++ b/to-dos/lien-release-road-faults/README.md @@ -2,7 +2,7 @@ name: "The release road: every fault found on the way to releasing a paid lien, and the ones left to mend" number: 479 group: ready -status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 3 is built (v2.9216) · step 4 is built (v2.9219, v2.9238) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · step 8 is built and owes a push (v2.9240) · step 10 is built (v2.9229, v2.9239) · step 12 is built (v2.9232) · step 13 is built (v2.9234) · the owner answered the three calls on 2026-12-02 · steps 2, 7, 9, 11 and 14 are left +status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 2 is built (v2.9195) · step 3 is built (v2.9216) · step 4 is built (v2.9219, v2.9238) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · step 8 is built and owes a push (v2.9240) · step 10 is built (v2.9229, v2.9239) · step 11 is built (v2.9230) · step 12 is built (v2.9232) · step 13 is built (v2.9234) · the owner answered the three calls on 2026-12-02 · step 14 is measured · steps 7 and 9 are left, and the word on step 14 summary: > The owner asked for help releasing a paid lien and printing its release, and for every bug on the way. One thread read the road in the code and found fourteen faults, findings 808 to 821. @@ -12,11 +12,11 @@ summary: > the most serious first. Two can mislead on a real lien today. On a job with two liens the county's stamp can land on the wrong release. And a release that is only saved already reads Released. -next: Step 2, finding 809. A release that is only saved stops reading Released, and one reading says where a release stands. -ask: owner · decide · A look at one drawing, still to be made. The window that refuses the void of an affidavit with a live release, and where its Take me there press lands. -size: L as a train of fourteen (M · M · S · S · S · S · M · M · S · S · XS · S · S · S); left: steps 2 and 4 to 14 -blocker: Steps 2, 4 to 6 and 10 to 14 have none. Step 7 waits on the owner's look at its drawing. Step 8 is built and owes one push after its merge. Step 9 is built after card #477. -opinion: build — step 2 next. With step 1 it is the pair that can mislead on a real lien, and a release cannot be taken back once the county records it. +next: Step 7, finding 816. A release's line names its lien, its number and its day. The void of an affidavit with a live release is refused by the window as drawn. +ask: owner · look · A look at the refused void on a ZZ Test lien once step 7 is built: the window, its Take me there press, and the way back to the affidavit. +size: L as a train of fourteen (M · M · S · S · S · S · M · M · S · S · XS · S · S · S); left: steps 7 and 9 +blocker: Step 7 has none: the owner said *Yes, build it* on its drawing. Step 8 is built and owes one push after its merge. Step 9 is built after card #477. Step 14 is measured, and the measure found nothing of this door's to mend. +opinion: build — step 7 next. A voided affidavit that leaves its release behind makes the desk offer a second release on the same lien. mockup: mockup.html — the window that refuses the void of an affidavit with a live release, and where Take me there lands (call 2, step 7). Every other step mends a press, a line or a guard on a screen that is already drawn. --- @@ -55,7 +55,7 @@ State is as read on GitHub and on `main` on 2026-12-02 at 19:17 UTC. | # | What a person sees | Sure | State | | --- | --- | --- | --- | | 808 | A job has two filed liens, each with a saved release. **Record the county's stamp ›** on the second lien's Payoffs row opens the tab on the first lien. The day and the number are kept on the wrong release. | read | Built in step 1, v2.9190. Every door from a lien's own row names that lien. | -| 809 | A release that is only saved reads *Released* in five places. They are the window's head, its suit stop, the stop's window, the desk's path and the Accounts Receivable chip. The day its row was made stands in for the county's day. The tab, Payoffs and the Board still say it waits for the county. The chip also shows the lien's own number as the release's. On a job with two liens, one release makes the whole job read released. | seen | Not started. Step 2. | +| 809 | A release that is only saved reads *Released* in five places. They are the window's head, its suit stop, the stop's window, the desk's path and the Accounts Receivable chip. The day its row was made stands in for the county's day. The tab, Payoffs and the Board still say it waits for the county. The chip also shows the lien's own number as the release's. On a job with two liens, one release makes the whole job read released. | seen | Built in step 2, v2.9195. One reading says where a release stands, saved or recorded, and the five places read it. | | 810 | A job has nothing open and no payment. It reads *The bills read paid. The release is owed.* A filed lien whose bill goes back to draft is one such job. The tab then prints a paper that swears payment as of today. | seen | Decided on card #477, call 2. Not built. Not a step here. | | 811 | **Payment / satisfaction date** is not checked. Cleared, the paper prints *as of —*. A day still to come is taken. A day before the lien was filed is taken. The date is set once, from the window's kept copy of the job. So it can show today while the money line shows the real day. | read | Mended in part by v2.9179 (PR #10639), on `main`. It stops an empty day and a day still to come. The rest is mended by v2.9216, step 3: the date follows the job as it stands, and a day before the lien was filed is asked about once. | | 812 | A saved release cannot be corrected, and nothing says so. The only way is **Void**, **Confirm void** and making it again. Print needs no save, so a paper printed and signed can differ from the one saved after it. | read | Mended, v2.9219 and v2.9238, step 4. A saved release's payment date is corrected in place until the county's day is kept. It takes the records' facts again on one press. A line says when the paper changed after its print. Left: the run's stage for a release corrected after its print. | @@ -66,7 +66,7 @@ State is as read on GitHub and on `main` on 2026-12-02 at 19:17 UTC. | 817 | Around the reload after **Save release record** a second release row can be written. Nothing in the database ties one release to one lien. A reload that fails draws *No recorded lien on this job*. | plausible | Built, v2.9240, step 8. The save asks the database first, and a partial unique index holds the rule. It owes one push after its merge. | | 818 | The desk's path is never told that a release waits on a check. It says *Paid — file the release of record.* with **File the release ›** while the tab's presses are dead. The Board keeps one chip a job in a bin. So on a job with two liens **Make N release ›** can leave one out. | read | Not started. Step 9. | | 819 | Keeping the instrument number writes every kept fact of the release back from the window's copy. A fact another screen wrote in the meantime is lost. That can be the notary's day, the copies' day or the mark of a check that came back. | plausible | Mended, v2.9229 and v2.9239, step 10. The tab's writes read the row fresh. The day's run, Payoffs and the returned check's mark write through `keepReleaseFacts`, which now reads each release fresh too. | -| 820 | **Go to the affidavit ›** does nothing a person can see when the **Lien affidavit** tab is already picked. It is the same dead press as 804. | read | Not started. Step 11. | +| 820 | **Go to the affidavit ›** does nothing a person can see when the **Lien affidavit** tab is already picked. It is the same dead press as 804. | read | Built in step 11, v2.9230. The press lands on the paper and lights its presses. | | 821 | The stamp box says the stamped copy is saved on the release's line. That line takes a typed Drive link only. The scan press is drawn for a filed affidavit alone. | read | Built, v2.9232. The release's line draws **Upload the scanned PDF**. Step 12. | ## Found on the same road @@ -79,7 +79,7 @@ State is as read on GitHub and on `main` on 2026-12-02 at 19:17 UTC. | 824 | The bin *Paid awaiting release* counts liens. Its press leaves no To do row for a paid lien that owes its release. | seen | Mended, v2.9163 (PR #10623), on `main`. It is step 6 of card #472. | | 825 | On a job with no property facts, the paper's owner and property description are blank lines. The tab says nothing before **Save release record** takes it. | seen | Built, v2.9234. A line above the presses names each blank and where it is fixed. Step 13. | | 826 | A lien was filed and then released. It never had a To do row, while the Board and Payoffs showed it. | seen | v2.9163 (PR #10623) added the rows, on `main`. This case is still to check on the live site. | -| 827 | A link that opens the Lien window on a job took about nine seconds to draw the window. | seen | Not started. Step 14. | +| 827 | A link that opens the Lien window on a job took about nine seconds to draw the window. | seen | Measured on 2026-12-02. The door costs about a second on a warm load. Step 14. | Findings 822 and 823 are faults of the desk's Board and To do, not of the road. They are in the Lien desk lane's note of run 17 and are not on this card. @@ -88,8 +88,8 @@ Lien desk lane's note of run 17 and are not on this card. - **Card #477**, [*Lien release: what opens it once a payment is in*](../lien-release-opens-when-funds-land/README.md). It holds what opens the three presses, the wait on a check, the override and its prompt. It - also holds 810's mend: a job with no payment stops reading paid. Nothing of it is built: the - override prompt's mock-up waits for the owner's look. + also holds 810's mend: a job with no payment stops reading paid. Nothing of it is built. The + owner said *Yes, build it* on the override prompt's mock-up on 2026-12-02. - **Card #472**, [*Lien desk Board: the flow after a lien is filed*](../lien-desk-board-flow-after-filing/README.md). Its step 6 is the two To do rows of 824 and 826. Its steps 7 and 8 are the lapsed lien's answer and the counsel row. @@ -99,8 +99,8 @@ Lien desk lane's note of run 17 and are not on this card. - Check **Payment / satisfaction date** before printing. It is the day the paper swears to. - Print and save the same paper. Save before the paper is signed, and change nothing between. - A print before the save files a copy on the job. Each print press files another. -- After **Save release record** the head reads *Released* at once. The county's day is still - owed in **The county's stamp**. +- After **Save release record** nothing reads *Released* until the county's day is kept in + **The county's stamp** (v2.9195). ## The steps left, one PR each @@ -109,7 +109,7 @@ Lien desk lane's note of run 17 and are not on this card. doors are a lien's row in Payoffs and a release's line on the day's run. A door that names no lien is left to the tab's own rule: the Accounts Receivable chip, a deep link and the head's step. -2. **Saved is not released (M). 809.** One reading says where a release stands: saved, or +2. **Built, v2.9195. Saved is not released (M). 809.** One reading says where a release stands: saved, or recorded with the county's day. The five places read it. The chip shows the release's own number. On a job with two liens each lien reads for itself. 3. **Built, v2.9216. The rest of the payment date (S). 811.** The date follows the payment's own day, not the @@ -129,8 +129,8 @@ Lien desk lane's note of run 17 and are not on this card. 7. **Voids that leave nothing behind (M). 816.** The void of an affidavit with a live release is refused by a window with a **Take me there** press, which brings the person to the release and shows where to press (call 2). The window and its flow are drawn in - [`mockup.html`](mockup.html), *Now* beside the suggestion, and the owner looks at the drawing - before this half is built. The other half does not wait: a release's line + [`mockup.html`](mockup.html), *Now* beside the suggestion. The owner said *Yes, build it* on + the drawing on 2026-12-02. Neither half is built yet. The other half: a release's line under **Filings on this job** names its lien, its number and its day, and voiding a release the county recorded takes words. 8. **Built, v2.9240. One release a lien (M). 817.** The save is guarded in the client. A rule in the database @@ -140,13 +140,17 @@ Lien desk lane's note of run 17 and are not on this card. 10. **Built, v2.9229 and v2.9239. Keeping one fact writes one fact (S). 819.** Every writer reads the row fresh: the tab (v2.9229), and the run, Payoffs and the returned check's mark through `keepReleaseFacts` (v2.9239). No merge in the database was needed, so nothing owes a push. -11. **Go to the affidavit › lands on the work (XS). 820.** The pattern of #10636. +11. **Built, v2.9230. Go to the affidavit › lands on the work (XS). 820.** The pattern of #10636. 12. **Built, v2.9232. The release's line takes a scan (S). 821.** The saved copy's editor on a release's line has **Upload the scanned PDF**. The scan is named as a release in the job's folder. 13. **Built, v2.9234. Missing property facts are named before the save (S). 825.** A line above the presses names each fact the paper would print blank. It names and does not hold. -14. **The slow link (S). 827.** Measure what the nine seconds are first. Then mend what the - measure shows. +14. **Measured, 2026-12-02. The slow link (S). 827.** Measure what the nine seconds are first. Then mend what the + measure shows. Two warm loads of the link on a ZZ Test job drew the window 2.5 and 1.5 seconds + after the load began. The one job's read took between half a second and a second and a half. + The window was up at once after it. So the door costs about a second. The nine seconds was a + cold load of the Jobs page's scripts, which is the app's own start. The measure shows nothing + of this door's to mend. Whether the step closes with no build is asked of the owner. ## The calls, each answered @@ -201,7 +205,9 @@ files have landed since, and the lines have moved. ## Where it stands -Written on 2026-12-02 (UTC), brought current at 19:17 UTC the same day. Of the fourteen faults -of the read, two are built in step 1 (808 and 813, v2.9190), one is mended in part on `main` (811) -and one is decided on card #477 (810). Of the seven neighbours, five are mended on `main` by four -PRs, and their looks on the live site are owed. Thirteen steps are left. Step 2 is next. +Written on 2026-12-02 (UTC), brought current on 2026-12-03 (UTC). Of the fourteen steps, eleven +are built: 1 to 6, 8, 10, 11, 12 and 13. Step 8 owes one push after its merge. Step 14 is +measured, and the measure found nothing of this door's to mend. Two steps are left. Step 7 is +next, both halves: the release's line that names its lien, and the refused void as drawn. Step 9 +is built after card #477. Finding 810 is decided on card #477 and is built with it. The looks on +the live site are owed for every step. From 035ad6b2b5d87bcb09d855ac760eac959a5e3cd0 Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 2 Dec 2026 21:02:41 -0600 Subject: [PATCH 19/21] =?UTF-8?q?v2.9255=20=E2=80=94=20Release=20of=20reco?= =?UTF-8?q?rd:=20a=20release's=20line=20names=20its=20lien=20(finding=2081?= =?UTF-8?q?6,=20punch=20list=20#479=20step=207,=20first=20half)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5.2 --- docs/LIEN_DESK_ARCHITECTURE.md | 1 + docs/recent-features/v2.9255.md | 29 ++++++++ .../LienFilingTabs.release.render.test.tsx | 31 ++++++++ src/components/jobs/LienFilingTabs.tsx | 7 ++ .../release-a-filed-lien-after-it-is-paid.md | 2 + src/content/releaseNotes/v2.9255.ts | 16 +++++ src/lib/jobs/lienReleaseLine.test.ts | 71 +++++++++++++++++++ src/lib/jobs/lienReleaseLine.ts | 51 +++++++++++++ to-dos/lien-release-road-faults/README.md | 16 ++--- 9 files changed, 216 insertions(+), 8 deletions(-) create mode 100644 docs/recent-features/v2.9255.md create mode 100644 src/content/releaseNotes/v2.9255.ts create mode 100644 src/lib/jobs/lienReleaseLine.test.ts create mode 100644 src/lib/jobs/lienReleaseLine.ts diff --git a/docs/LIEN_DESK_ARCHITECTURE.md b/docs/LIEN_DESK_ARCHITECTURE.md index faebd5dbcb..9df8ab62a1 100644 --- a/docs/LIEN_DESK_ARCHITECTURE.md +++ b/docs/LIEN_DESK_ARCHITECTURE.md @@ -770,6 +770,7 @@ last_updated: 2026-12-02 > **v2.9239 (the run and Payoffs read fresh too, the rest of finding 819):** `keepReleaseFacts` reads every release it is handed in one read and builds `releaseFactsPatch` on the facts the database holds, a release voided in the meantime is held with `RELEASE_RUN_WORDS.gone`, and a row's own `fields` is no longer written. > **v2.9240 (one live release a lien, finding 817):** `recordRelease` takes one save at a time and asks the database for a live `release_of_record` row whose `fields ->> 'releasesFilingId'` is this lien before it inserts, and migration `20261202211100` holds the same rule as the partial unique index `job_lien_filings_one_live_release_idx`. > `isOneLiveReleaseRefusal` reads the index's refusal by its name, and `loadFilings` in `LienInstrumentsModal` keeps the records it holds when a reload fails. +> **v2.9255 (a release's line names its lien, finding 816's first half):** a `release_of_record` row under *Filings on this job* draws `releaseLineWords` (`lienReleaseLine.ts`, `data-lien-release-line`): the lien from `releaseLineLien`, read over every filing on the job with the voided ones, then *saved December 2, 2026 · not yet recorded* or *recorded December 4, 2026 · instrument M* from `releaseOwnInstrument`. > **v2.9190 (a door names its lien, findings 808 and 813):** `pickReleaseTarget` takes a third value, the lien the door named, read after the lien the tab holds and before the rule. > The doors are a lien's row in Payoffs and a release's line on the day's run: each `onOpenRelease` hands the job and its `affidavitId`, `LienDeskPage` keeps it as `releaseLienId` on the window it opens, and `LienInstrumentsModal` hands it to `LienFilingTabs`. > The tab holds the lien it stands on: an effect writes the picked lien's id into `releaseTargetId`, so a release the county has just recorded no longer hands the tab to the job's other lien. diff --git a/docs/recent-features/v2.9255.md b/docs/recent-features/v2.9255.md new file mode 100644 index 0000000000..5b88dd18bd --- /dev/null +++ b/docs/recent-features/v2.9255.md @@ -0,0 +1,29 @@ +# v2.9255 — Release of record: a release's line names its lien (2026-12-03) + +Step 7 of punch list #479 (the release road's faults), finding 816, the half the card says does not wait. Client only. No migration, no function change, nothing owed on prod. Cut on top of v2.9240 (step 8), which changes the same tab. + +## What was wrong + +- Under **Filings on this job** a `release_of_record` row drew its kind, *Release of record*, and no fact. An affidavit's line names its filed day, its number and its service. +- On a job with two liens the two releases could not be told apart. After an affidavit was voided, the release left behind looked like any other. + +## What changed + +- [`lienReleaseLine.ts`](../../src/lib/jobs/lienReleaseLine.ts), new: `releaseLineLien` reads the lien a release belongs to from every filing on the job, voided ones included. It reads `fields.releasesFilingId` first. A release saved before that key was kept goes to the job's one live filed lien, and to none on a job with two. `releaseLineWords` writes the line: *for instrument N · saved · not yet recorded*, then *recorded December 4, 2026 · instrument M* once the county's day is kept. A lien with no number is named by its filed day. A voided lien reads *which is voided*. A release that names no lien reads *names no lien on this job*. +- The release's own number is `fields.releaseInstrument` alone, never the lien's number, as `releaseOwnInstrument` reads it (finding 809). +- [`LienFilingTabs.tsx`](../../src/components/jobs/LienFilingTabs.tsx): the release's row draws the line (`data-lien-release-line`), with the same day words as the affidavit's line. +- The help guide *release a filed lien after it is paid* says what the line reads. + +## Not in this change + +- The void of an affidavit with a live release still goes through. The window that refuses it is drawn on the card and is the step's other half. +- Voiding a release the county recorded still takes two presses and no words. + +## Tests + +- `lienReleaseLine.test.ts`: the named lien, a voided lien, a release with no key on a job with one lien and with two, a key that points at no row, the saved and the recorded line, a lien with no number, two releases on one job. +- `LienFilingTabs.release.render.test.tsx`: the line on a saved release and on a recorded one, two releases told apart, a voided lien, and no such line on an affidavit. + +## Look owed + +- Read only, on the live site: a job with a saved release shows its lien's instrument number and saved day on the release's line under **Filings on this job**. Nothing is pressed. diff --git a/src/components/jobs/LienFilingTabs.release.render.test.tsx b/src/components/jobs/LienFilingTabs.release.render.test.tsx index 72a859d6f9..43508b16e5 100644 --- a/src/components/jobs/LienFilingTabs.release.render.test.tsx +++ b/src/components/jobs/LienFilingTabs.release.render.test.tsx @@ -796,3 +796,34 @@ describe('Release of record: one live release a lien (finding 817, v2.9240)', () expect(onChanged).toHaveBeenCalled() }) }) + +describe('Release of record: a release’s line names its lien, its day and where it stands (finding 816, punch list #479 step 7)', () => { + const line = (id: string) => document.querySelector(`[data-lien-release-line="${id}"]`)! + + it('names the lien and says the county has not recorded it', () => { + draw({ job: paid(), filings: [lien() as never, release() as never] }) + expect(line('r1').textContent).toBe('for instrument 2026-0412207 · saved November 21, 2026 · not yet recorded') + }) + + it('names the county’s day and the release’s own number, never the lien’s as its own', () => { + draw({ job: paid(), filings: [lien() as never, release({ filed_at: '2026-11-23', fields: { releasesFilingId: 'a1', releaseInstrument: '2026-0431955' } }) as never] }) + expect(line('r1').textContent).toBe('for instrument 2026-0412207 · recorded November 23, 2026 · instrument 2026-0431955') + }) + + it('tells the two releases of a job with two liens apart', () => { + const second = lien({ id: 'a2', recording_number: '2026-0500001', filed_at: '2026-11-16' }) + draw({ job: paid(), filings: [lien() as never, second as never, release() as never, release({ id: 'r2', fields: { releasesFilingId: 'a2' } }) as never] }) + expect(line('r1').textContent).toContain('for instrument 2026-0412207') + expect(line('r2').textContent).toContain('for instrument 2026-0500001') + }) + + it('says its lien is voided when the affidavit under it was voided', () => { + draw({ job: paid(), filings: [lien({ voided_at: '2026-11-25T15:00:00Z' }) as never, release() as never] }) + expect(line('r1').textContent).toBe('for instrument 2026-0412207, which is voided · saved November 21, 2026 · not yet recorded') + }) + + it('draws no such line on an affidavit', () => { + draw({ job: paid(), filings: [lien() as never] }) + expect(document.querySelector('[data-lien-release-line]')).toBeNull() + }) +}) diff --git a/src/components/jobs/LienFilingTabs.tsx b/src/components/jobs/LienFilingTabs.tsx index 560c542212..0824347762 100644 --- a/src/components/jobs/LienFilingTabs.tsx +++ b/src/components/jobs/LienFilingTabs.tsx @@ -89,6 +89,7 @@ import { MoneyText } from '../Money' import { ChangeableValue, ValueLine, ValueLines, ValueSentence, WorkedOutValue } from '../valuesInPlace/ValuesInPlace' import { plainSentence } from '../../lib/valuesInPlace' import { RELEASE_OF_RECORD_WORDS, canReleaseAnyway, pickReleaseTarget, isOneLiveReleaseRefusal, releaseMoneyBackWords, releaseMoneyGate, releaseNeedsBank, releasePaperBlanks, releasePaperBlanksWords, releaseRecordDrift, releaseRecordFactsPatch, releaseReprintWords, RELEASE_RECORD_FACT_LABELS, type ReleaseRecordFact, releaseCorrectable, releasePaymentDatePatch, releasePaymentDateShown, releasePaymentDayAsk, releasePaymentDayBeforeLien, releasePaymentDayKey, releaseSavedHold, releaseSavedPaymentDay, releaseRecordedSentence, releaseSaveFields, releaseStampDayCheck, releaseStampPatch, releaseTargets, releasePaymentDayCheck } from '../../lib/jobs/lienReleaseOfRecord' +import { releaseLineWords } from '../../lib/jobs/lienReleaseLine' import { payoffNote } from '../../lib/jobs/lienPayoffFields' import { releaseByNow, releaseFacts, releaseFactsPatch, releasePaperChangedSincePrint } from '../../lib/jobs/lienReleaseFacts' import { countedLabel } from '../../lib/batchWords' @@ -1267,6 +1268,12 @@ export default function LienFilingTabs({ {f.kind === 'affidavit' && f.filed_at ? `filed ${demandDate(f.filed_at)} · #${f.recording_number || '—'} · ${f.served_at ? `served ${demandDate(f.served_at)}` : `serve by ${demandDate(f.serve_due ?? '')}`}` : ''} {f.kind === 'notice_53_056' || f.kind === 'retainage_53_057' ? : ''} + {/* A release names its lien, its day and where it stands (finding 816, v2.9255): two on one job are told apart, and one whose lien is voided says so. */} + {f.kind === 'release_of_record' ? ( + + {releaseLineWords({ fields: f.fields, created_at: f.created_at ?? '', filed_at: f.filed_at }, filings, demandDate)} + + ) : null} {isLienAppliedRow(f as unknown as LienAppliedRow) ? ( {lienAppliedRowWords(f as unknown as LienAppliedRow, calendarYmdInAppTzFromIso(f.created_at ?? ''))} diff --git a/src/content/help/release-a-filed-lien-after-it-is-paid.md b/src/content/help/release-a-filed-lien-after-it-is-paid.md index 75a7e25ef2..c29cdc4e79 100644 --- a/src/content/help/release-a-filed-lien-after-it-is-paid.md +++ b/src/content/help/release-a-filed-lien-after-it-is-paid.md @@ -131,6 +131,8 @@ Back on the Lien desk, press {{button:blue|Record the county’s stamp ›}} on Until that day is kept, nothing reads *Released*. The top of the Lien window says *The release was made* with its day. The job's row in Accounts Receivable reads *Release saved*. The lien stands on the county's record until the county records the release. +Under **Filings on this job** the release's line names its lien by instrument number. It shows the day the release was saved and says *not yet recorded*. After the county's day is kept it shows that day and the release's own instrument number. + The stamped copy goes on the release's line under **Filings on this job**. Press *link the saved copy* there. Then press {{button:outline|Upload the scanned PDF}} and pick the scan from this computer. The scan goes in the job's Drive folder and its link is kept on the line. A Drive link can be pasted there too. ## Print the releases in the run diff --git a/src/content/releaseNotes/v2.9255.ts b/src/content/releaseNotes/v2.9255.ts new file mode 100644 index 0000000000..b45998102b --- /dev/null +++ b/src/content/releaseNotes/v2.9255.ts @@ -0,0 +1,16 @@ +import type { ReleaseNote } from '../../lib/releaseNotes' + +const note: ReleaseNote = { + version: 'v2.9255', + date: '2026-12-03', + title: 'Release of record: a release’s line names its lien', + kind: 'fix', + highlights: [ + 'Under Filings on this job, a release’s line read Release of record and nothing else. Two releases on one job could not be told apart.', + 'The line now names the lien by its instrument number, the day the release was saved, and that the county has not recorded it yet.', + 'Once the county’s day is kept, the line shows that day and the release’s own instrument number.', + 'A release whose lien was voided says so on its line.', + ], +} + +export default note diff --git a/src/lib/jobs/lienReleaseLine.test.ts b/src/lib/jobs/lienReleaseLine.test.ts new file mode 100644 index 0000000000..5e3b0edd23 --- /dev/null +++ b/src/lib/jobs/lienReleaseLine.test.ts @@ -0,0 +1,71 @@ +import { describe, expect, it } from 'vitest' +import { releaseLineLien, releaseLineWords, type ReleaseLineFiling } from './lienReleaseLine' + +// Every id, number and day here is made up. +const fmt = (ymd: string) => `<${ymd}>` +const lien = (id: string, over: Partial = {}): ReleaseLineFiling => ({ id, kind: 'affidavit', filed_at: '2026-11-09', recording_number: '2026-0000001', voided_at: null, ...over }) +const release = (fields: Record, filed_at: string | null = null) => ({ fields, created_at: '2026-12-02T18:00:00Z', filed_at }) + +describe('releaseLineLien', () => { + it('reads the lien the release names', () => { + const all = [lien('a1'), lien('a2', { recording_number: '2026-0000002', filed_at: '2026-11-20' })] + expect(releaseLineLien(release({ releasesFilingId: 'a2' }), all)).toEqual({ how: 'live', instrument: '2026-0000002', filedYmd: '2026-11-20' }) + }) + + it('says when the named lien is voided', () => { + const all = [lien('a1', { voided_at: '2026-12-03T00:00:00Z' })] + expect(releaseLineLien(release({ releasesFilingId: 'a1' }), all)).toMatchObject({ how: 'voided', instrument: '2026-0000001' }) + }) + + it('gives a release with no key to the job’s one filed lien', () => { + expect(releaseLineLien(release({}), [lien('a1')])).toMatchObject({ how: 'live', instrument: '2026-0000001' }) + }) + + it('names no lien for a release with no key on a job with two filed liens', () => { + expect(releaseLineLien(release({}), [lien('a1'), lien('a2')])).toEqual({ how: 'none' }) + }) + + it('names no lien when the key points at no row, and never claims a voided or an unfiled lien by default', () => { + expect(releaseLineLien(release({ releasesFilingId: 'gone' }), [lien('a1')])).toEqual({ how: 'none' }) + expect(releaseLineLien(release({}), [lien('a1', { voided_at: '2026-12-03T00:00:00Z' })])).toEqual({ how: 'none' }) + expect(releaseLineLien(release({}), [lien('a1', { filed_at: null })])).toEqual({ how: 'none' }) + }) + + it('reads only affidavits as liens', () => { + const all: ReleaseLineFiling[] = [{ id: 'n1', kind: 'notice_53_056', filed_at: '2026-10-01', recording_number: null }] + expect(releaseLineLien(release({ releasesFilingId: 'n1' }), all)).toEqual({ how: 'none' }) + }) +}) + +describe('releaseLineWords', () => { + it('names the lien, the saved day and that the county has not recorded it', () => { + expect(releaseLineWords(release({ releasesFilingId: 'a1' }), [lien('a1')], fmt)).toBe('for instrument 2026-0000001 · saved <2026-12-02> · not yet recorded') + }) + + it('names the county’s day and the release’s own number once they are kept', () => { + expect(releaseLineWords(release({ releasesFilingId: 'a1', releaseInstrument: '2026-0000099' }, '2026-12-04'), [lien('a1')], fmt)).toBe('for instrument 2026-0000001 · recorded <2026-12-04> · instrument 2026-0000099') + }) + + it('never shows the lien’s number as the release’s own', () => { + expect(releaseLineWords(release({ releasesFilingId: 'a1' }, '2026-12-04'), [lien('a1')], fmt)).toBe('for instrument 2026-0000001 · recorded <2026-12-04> · no instrument number kept') + }) + + it('names a lien with no number by its filed day', () => { + expect(releaseLineWords(release({ releasesFilingId: 'a1' }), [lien('a1', { recording_number: ' ' })], fmt)).toBe('for the lien filed <2026-11-09> · saved <2026-12-02> · not yet recorded') + }) + + it('says a voided lien is voided', () => { + expect(releaseLineWords(release({ releasesFilingId: 'a1' }), [lien('a1', { voided_at: '2026-12-03T00:00:00Z' })], fmt)).toBe('for instrument 2026-0000001, which is voided · saved <2026-12-02> · not yet recorded') + }) + + it('says a release names no lien', () => { + expect(releaseLineWords(release({}), [lien('a1'), lien('a2')], fmt)).toBe('names no lien on this job · saved <2026-12-02> · not yet recorded') + }) + + it('tells two releases on one job apart', () => { + const all = [lien('a1'), lien('a2', { recording_number: '2026-0000002' })] + const one = releaseLineWords(release({ releasesFilingId: 'a1' }), all, fmt) + const two = releaseLineWords(release({ releasesFilingId: 'a2' }), all, fmt) + expect(one).not.toBe(two) + }) +}) diff --git a/src/lib/jobs/lienReleaseLine.ts b/src/lib/jobs/lienReleaseLine.ts new file mode 100644 index 0000000000..86a7b2c368 --- /dev/null +++ b/src/lib/jobs/lienReleaseLine.ts @@ -0,0 +1,51 @@ +/** + * What a release of record's line says under **Filings on this job** (finding 816, punch list #479, step 7). + * + * The line read *Release of record* and nothing else. On a job with two liens the two releases could not be told + * apart, and a release whose lien was voided looked like any other. The line now names three things: + * + * - its lien: *for instrument N*, or *for the lien filed November 9, 2026* when the lien has no number yet; + * - its own day: *saved December 2, 2026* until the county’s day is kept, then *recorded December 4, 2026*; + * - where it stands: *not yet recorded*, or the number the county gave the release itself. + * + * A release names its lien in `fields.releasesFilingId`. One saved before that key was kept belongs to the job's + * one filed lien, as `releaseForAffidavit` reads it. A release whose lien is voided says so, and one that names no + * lien on a job with two says that. + * + * The app counts the days and does not judge the law. + */ +import { calendarYmdInAppTzFromIso } from '../../utils/dateUtils' +import { releaseAffidavitId, releaseOwnInstrument, type LienPayoffRelease } from './lienPayoff' + +/** A filing as the line needs it: any row of the job, voided ones included. */ +export type ReleaseLineFiling = { id: string; kind: string; filed_at: string | null; recording_number: string | null; voided_at?: string | null } + +/** The lien a release's line names: a live filed lien, a voided one, or none. */ +export type ReleaseLineLien = { how: 'live' | 'voided'; instrument: string; filedYmd: string } | { how: 'none' } + +/** The lien this release belongs to, read from every filing on the job (`all`), voided ones included. */ +export function releaseLineLien(release: Pick, all: ReadonlyArray): ReleaseLineLien { + const affidavits = all.filter((f) => f.kind === 'affidavit') + const named = releaseAffidavitId(release) + const liveFiled = affidavits.filter((a) => !a.voided_at && a.filed_at) + // A release saved before the key was kept belongs to the job's one filed lien, and to none on a job with two. + const lien = named ? affidavits.find((a) => a.id === named) : liveFiled.length === 1 ? liveFiled[0] : undefined + if (!lien) return { how: 'none' } + return { how: lien.voided_at ? 'voided' : 'live', instrument: (lien.recording_number ?? '').trim(), filedYmd: (lien.filed_at ?? '').slice(0, 10) } +} + +/** + * The line's words: *for instrument 2026-0412207 · saved December 2, 2026 · not yet recorded*. `fmt` writes a day + * ('YYYY-MM-DD') as the line's other rows do. + */ +export function releaseLineWords(release: Pick, all: ReadonlyArray, fmt: (ymd: string) => string): string { + const lien = releaseLineLien(release, all) + const forLien = + lien.how === 'none' + ? 'names no lien on this job' + : `${lien.instrument ? `for instrument ${lien.instrument}` : lien.filedYmd ? `for the lien filed ${fmt(lien.filedYmd)}` : 'for a lien not yet filed'}${lien.how === 'voided' ? ', which is voided' : ''}` + const recordedYmd = (release.filed_at ?? '').slice(0, 10) + if (!recordedYmd) return `${forLien} · saved ${fmt(calendarYmdInAppTzFromIso(release.created_at))} · not yet recorded` + const own = releaseOwnInstrument(release) + return `${forLien} · recorded ${fmt(recordedYmd)} · ${own ? `instrument ${own}` : 'no instrument number kept'}` +} diff --git a/to-dos/lien-release-road-faults/README.md b/to-dos/lien-release-road-faults/README.md index e7c9afe70a..0004fd73be 100644 --- a/to-dos/lien-release-road-faults/README.md +++ b/to-dos/lien-release-road-faults/README.md @@ -2,7 +2,7 @@ name: "The release road: every fault found on the way to releasing a paid lien, and the ones left to mend" number: 479 group: ready -status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 2 is built (v2.9195) · step 3 is built (v2.9216) · step 4 is built (v2.9219, v2.9238) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · step 8 is built and owes a push (v2.9240) · step 10 is built (v2.9229, v2.9239) · step 11 is built (v2.9230) · step 12 is built (v2.9232) · step 13 is built (v2.9234) · the owner answered the three calls on 2026-12-02 · step 14 is measured · steps 7 and 9 are left, and the word on step 14 +status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 2 is built (v2.9195) · step 3 is built (v2.9216) · step 4 is built (v2.9219, v2.9238) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · step 8 is built and owes a push (v2.9240) · step 10 is built (v2.9229, v2.9239) · step 11 is built (v2.9230) · step 12 is built (v2.9232) · step 13 is built (v2.9234) · the owner answered the three calls on 2026-12-02 · the first half of step 7 is built (v2.9255) · step 14 is measured · the rest of step 7 and step 9 are left, and the word on step 14 summary: > The owner asked for help releasing a paid lien and printing its release, and for every bug on the way. One thread read the road in the code and found fourteen faults, findings 808 to 821. @@ -12,7 +12,7 @@ summary: > the most serious first. Two can mislead on a real lien today. On a job with two liens the county's stamp can land on the wrong release. And a release that is only saved already reads Released. -next: Step 7, finding 816. A release's line names its lien, its number and its day. The void of an affidavit with a live release is refused by the window as drawn. +next: The rest of step 7, finding 816. The void of an affidavit with a live release is refused by the window as drawn, and the void of a recorded release takes words. ask: owner · look · A look at the refused void on a ZZ Test lien once step 7 is built: the window, its Take me there press, and the way back to the affidavit. size: L as a train of fourteen (M · M · S · S · S · S · M · M · S · S · XS · S · S · S); left: steps 7 and 9 blocker: Step 7 has none: the owner said *Yes, build it* on its drawing. Step 8 is built and owes one push after its merge. Step 9 is built after card #477. Step 14 is measured, and the measure found nothing of this door's to mend. @@ -62,7 +62,7 @@ State is as read on GitHub and on `main` on 2026-12-02 at 19:17 UTC. | 813 | A job has two liens. Keeping **Recorded on** throws the tab onto the other lien before **Instrument number** is typed. | read | Built in step 1, v2.9190. The tab holds the lien it stands on. | | 814 | A release is saved and the county has not recorded it. The job's bills owe again. The tab still says *Sign it before a notary. Then record it at the county.* Its print is live. Payoffs and the day's run hold the same release. | read | Mended by v2.9222, step 5: the tab reads the same hold, its two presses wait and the reason stands under them. | | 815 | **Download PDF** files no copy. Neither press marks the release as printed for the notary. When a check then comes back, the app says no release has left the office. The day's run prints it again. | read | Mended by v2.9224, step 6: a download files a copy, and the tab's print or download marks a saved release as printed for the notary. | -| 816 | Voiding a filed affidavit that has a release leaves the release with no lien. Payoffs, the Board and the tab offer a second release, and the head still says released. Under **Filings on this job** a release's line names no lien, number or day, so two cannot be told apart. A release the county recorded voids with the same two presses and no words. | read, its line seen | Not started. Step 7. | +| 816 | Voiding a filed affidavit that has a release leaves the release with no lien. Payoffs, the Board and the tab offer a second release, and the head still says released. Under **Filings on this job** a release's line names no lien, number or day, so two cannot be told apart. A release the county recorded voids with the same two presses and no words. | read, its line seen | Built in part, v2.9255: a release's line names its lien, its day and where it stands. Left: the refused void, and the words on a recorded release's void. Step 7. | | 817 | Around the reload after **Save release record** a second release row can be written. Nothing in the database ties one release to one lien. A reload that fails draws *No recorded lien on this job*. | plausible | Built, v2.9240, step 8. The save asks the database first, and a partial unique index holds the rule. It owes one push after its merge. | | 818 | The desk's path is never told that a release waits on a check. It says *Paid — file the release of record.* with **File the release ›** while the tab's presses are dead. The Board keeps one chip a job in a bin. So on a job with two liens **Make N release ›** can leave one out. | read | Not started. Step 9. | | 819 | Keeping the instrument number writes every kept fact of the release back from the window's copy. A fact another screen wrote in the meantime is lost. That can be the notary's day, the copies' day or the mark of a check that came back. | plausible | Mended, v2.9229 and v2.9239, step 10. The tab's writes read the row fresh. The day's run, Payoffs and the returned check's mark write through `keepReleaseFacts`, which now reads each release fresh too. | @@ -126,13 +126,13 @@ Lien desk lane's note of run 17 and are not on this card. the run, and says why. 6. **Built, v2.9224. A download is a copy, and a print is marked (S). 815.** **Download PDF** files a copy as the print does. Either press marks the release as out for the notary. -7. **Voids that leave nothing behind (M). 816.** The void of an affidavit with a live release +7. **First half built, v2.9255. Voids that leave nothing behind (M). 816.** The void of an affidavit with a live release is refused by a window with a **Take me there** press, which brings the person to the release and shows where to press (call 2). The window and its flow are drawn in [`mockup.html`](mockup.html), *Now* beside the suggestion. The owner said *Yes, build it* on - the drawing on 2026-12-02. Neither half is built yet. The other half: a release's line - under **Filings on this job** names its lien, its number and its day, and voiding a release - the county recorded takes words. + the drawing on 2026-12-02. That half is not built yet. Built, v2.9255: a release's line + under **Filings on this job** names its lien, its number and its day. Left with the window: + voiding a release the county recorded takes words. 8. **Built, v2.9240. One release a lien (M). 817.** The save is guarded in the client. A rule in the database ties one live release to one lien. This step is a migration and owes a push after its merge. 9. **The desk's path knows the wait, and one chip a lien (S). 818.** Built after card #477, since @@ -208,6 +208,6 @@ files have landed since, and the lines have moved. Written on 2026-12-02 (UTC), brought current on 2026-12-03 (UTC). Of the fourteen steps, eleven are built: 1 to 6, 8, 10, 11, 12 and 13. Step 8 owes one push after its merge. Step 14 is measured, and the measure found nothing of this door's to mend. Two steps are left. Step 7 is -next, both halves: the release's line that names its lien, and the refused void as drawn. Step 9 +next. Its first half is built, the release's line that names its lien (v2.9255). The refused void as drawn is left. Step 9 is built after card #477. Finding 810 is decided on card #477 and is built with it. The looks on the live site are owed for every step. From 0942f404b84c7d66e420310512652a4e697dbe5e Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 2 Dec 2026 21:23:31 -0600 Subject: [PATCH 20/21] =?UTF-8?q?v2.9260=20=E2=80=94=20Lien=20window:=20a?= =?UTF-8?q?=20lien=20with=20a=20release=20is=20not=20voided=20out=20from?= =?UTF-8?q?=20under=20it=20(finding=20816,=20punch=20list=20#479=20step=20?= =?UTF-8?q?7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5.2 --- docs/LIEN_DESK_ARCHITECTURE.md | 4 + docs/recent-features/v2.9260.md | 34 ++++++ .../LienFilingTabs.release.render.test.tsx | 113 +++++++++++++++++- src/components/jobs/LienFilingTabs.tsx | 61 +++++++++- src/components/jobs/LienInstrumentsModal.tsx | 5 + ...ile-a-lien-and-never-miss-its-deadlines.md | 2 + .../release-a-filed-lien-after-it-is-paid.md | 8 ++ src/content/releaseNotes/v2.9260.ts | 16 +++ src/lib/jobs/lienVoidRefusal.test.ts | 112 +++++++++++++++++ src/lib/jobs/lienVoidRefusal.ts | 97 +++++++++++++++ to-dos/lien-release-road-faults/README.md | 42 +++---- 11 files changed, 471 insertions(+), 23 deletions(-) create mode 100644 docs/recent-features/v2.9260.md create mode 100644 src/content/releaseNotes/v2.9260.ts create mode 100644 src/lib/jobs/lienVoidRefusal.test.ts create mode 100644 src/lib/jobs/lienVoidRefusal.ts diff --git a/docs/LIEN_DESK_ARCHITECTURE.md b/docs/LIEN_DESK_ARCHITECTURE.md index 9df8ab62a1..543fba09e1 100644 --- a/docs/LIEN_DESK_ARCHITECTURE.md +++ b/docs/LIEN_DESK_ARCHITECTURE.md @@ -771,6 +771,10 @@ last_updated: 2026-12-02 > **v2.9240 (one live release a lien, finding 817):** `recordRelease` takes one save at a time and asks the database for a live `release_of_record` row whose `fields ->> 'releasesFilingId'` is this lien before it inserts, and migration `20261202211100` holds the same rule as the partial unique index `job_lien_filings_one_live_release_idx`. > `isOneLiveReleaseRefusal` reads the index's refusal by its name, and `loadFilings` in `LienInstrumentsModal` keeps the records it holds when a reload fails. > **v2.9255 (a release's line names its lien, finding 816's first half):** a `release_of_record` row under *Filings on this job* draws `releaseLineWords` (`lienReleaseLine.ts`, `data-lien-release-line`): the lien from `releaseLineLien`, read over every filing on the job with the voided ones, then *saved December 2, 2026 · not yet recorded* or *recorded December 4, 2026 · instrument M* from `releaseOwnInstrument`. +> **v2.9260 (the refused void, the rest of finding 816):** **Void** on a filing's line goes through `pressVoid`, which asks `affidavitVoidRefusal` (`lienVoidRefusal.ts`) whether the affidavit has a live release as `releaseForAffidavit` reads it. +> A saved release opens the confirm window *Void the release first*, and **Take me there ›** lights the release's own **Void** (`filingVoidPressSelector`, `data-lien-void-coach`), then the affidavit's once that release is voided (`data-lien-void-way-back`). +> A release the county recorded opens *The county recorded this lien's release*, and **Go to the release of record ›** calls `onGoToRelease`, on which `LienInstrumentsModal` picks the paper and lands on the county's stamp, voiding nothing. +> The void of a recorded release from its own line asks first (`releaseVoidTakesWords`, `recordedReleaseVoidWindow`): **Keep the release** is the safe press and **Void the release anyway** is red. > **v2.9190 (a door names its lien, findings 808 and 813):** `pickReleaseTarget` takes a third value, the lien the door named, read after the lien the tab holds and before the rule. > The doors are a lien's row in Payoffs and a release's line on the day's run: each `onOpenRelease` hands the job and its `affidavitId`, `LienDeskPage` keeps it as `releaseLienId` on the window it opens, and `LienInstrumentsModal` hands it to `LienFilingTabs`. > The tab holds the lien it stands on: an effect writes the picked lien's id into `releaseTargetId`, so a release the county has just recorded no longer hands the tab to the job's other lien. diff --git a/docs/recent-features/v2.9260.md b/docs/recent-features/v2.9260.md new file mode 100644 index 0000000000..c58733d424 --- /dev/null +++ b/docs/recent-features/v2.9260.md @@ -0,0 +1,34 @@ +# v2.9260 — Lien window: a lien with a release is not voided out from under it (2026-12-03) + +The rest of step 7 of punch list #479 (the release road's faults), finding 816. Built as the card's `mockup.html` draws it, on the owner's *Yes, build it* of 2026-12-02 and *Every pick* of 2026-12-03. Client only. No migration, no function change, nothing owed on prod. Cut on top of v2.9255, the step's first half. + +## What was wrong + +- **Void**, then **Confirm void**, on a filed affidavit that had a live release went through. The release was left with no lien, and Payoffs, the Board and the tab then offered a second release. +- A release the county had recorded voided from its own line with the same two presses and no words. + +## What changed + +- [`lienVoidRefusal.ts`](../../src/lib/jobs/lienVoidRefusal.ts), new and pure. `affidavitVoidRefusal` answers whether a filed affidavit has a live release, read as every other surface reads it (`releaseForAffidavit`), and whether the county has recorded it. `affidavitVoidRefusalWindow` writes the confirm window for each case. `releaseVoidTakesWords` and `recordedReleaseVoidWindow` are the void of a recorded release from its own line. +- [`LienFilingTabs.tsx`](../../src/components/jobs/LienFilingTabs.tsx): **Void** on a filing's line goes through `pressVoid`. + - **A saved release.** The window *Void the release first* opens and nothing is voided. **Take me there ›** lights **Void** on the release's line through `landOnWhenThere`, with the line *Press Void here, then Confirm void. Then void the affidavit.* Once that release is voided, the affidavit's **Void** is lit with *The release is voided. The affidavit can be voided now.* + - **A release the county recorded.** The window *The county recorded this lien's release* names the county's day and the release's own number. **Go to the release of record ›** stands beside **Close**. It picks that lien on the tab and calls `onGoToRelease`. + - **A recorded release's own Void.** A confirm window, *The county recorded this release*. **Keep the release** is the safe press and takes the focus. **Void the release anyway** is red. + - Every other record keeps **Void**, then **Confirm void**. +- [`LienInstrumentsModal.tsx`](../../src/components/jobs/LienInstrumentsModal.tsx): `onGoToRelease` picks the paper *Release of record* and lands on the county's stamp, the light **Go to the release of record ›** already uses. +- The guides *file a lien and never miss its deadlines* and *release a filed lien after it is paid* say what the windows do. + +## Not in this change + +- The database refuses nothing here. A void written outside the Lien window is not stopped. +- The window's own switch of paper has no render test of its own: the tab's test proves the call, and the look below proves the landing. + +## Tests + +- `lienVoidRefusal.test.ts`: no release, a saved one, a recorded one, a job with two liens, a release with no key, records that are not filed affidavits, each window's words, and the plain-words rules on every sentence. +- `LienFilingTabs.release.render.test.tsx`: the refused void and Cancel; **Take me there ›**, the lit **Void**, the release's void and the way back; the recorded window and its press; an affidavit with no release; a job with two liens; the recorded release's own void, kept and voided; a saved release's two presses. + +## Look owed + +- A ZZ Test lien, with the live-write slot: a ZZ Test job with a filed affidavit and a saved release. Press **Void** on the affidavit's line, read the window, press **Take me there ›**, void the release, then void the affidavit. Every row is voided before the look ends, the release before its affidavit. +- A real lien is read only. No walker presses **Void** on one. diff --git a/src/components/jobs/LienFilingTabs.release.render.test.tsx b/src/components/jobs/LienFilingTabs.release.render.test.tsx index 43508b16e5..fdaa08ad73 100644 --- a/src/components/jobs/LienFilingTabs.release.render.test.tsx +++ b/src/components/jobs/LienFilingTabs.release.render.test.tsx @@ -5,7 +5,7 @@ * save, and a job with two filed liens picks which one. The rules are held by `lienReleaseOfRecord.test.ts`. * Wiring only: the writes go to a stub and are read back off it. */ -import { afterEach, describe, expect, it, vi } from 'vitest' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { cleanup, fireEvent, screen, waitFor } from '@testing-library/react' import { makeJob, renderWithProviders } from '../../test/renderSmokeMocks' import type { BankCheck } from '../../lib/jobs/checkCleared' @@ -827,3 +827,114 @@ describe('Release of record: a release’s line names its lien, its day and wher expect(document.querySelector('[data-lien-release-line]')).toBeNull() }) }) + +const voids = vi.hoisted(() => ({ ids: [] as string[] })) +vi.mock('../../lib/jobs/lienFilingVoidIo', () => ({ + voidLienFiling: vi.fn(async (f: { id: string }) => { + voids.ids.push(f.id) + return 'none' + }), +})) + +describe('Filings on this job: the void of an affidavit with a live release is refused (finding 816, punch list #479 step 7)', () => { + const row = (id: string) => document.querySelector(`[data-lien-filing-row="${id}"]`)! + const voidPress = (id: string) => row(id).querySelector('[data-lien-filing-void]')! + beforeEach(() => { + voids.ids = [] + }) + + it('opens a window, voids nothing, and Cancel leaves the line as it was', async () => { + draw({ job: paid(), filings: [lien() as never, release() as never] }) + fireEvent.click(voidPress('a1')) + const dialog = await screen.findByRole('alertdialog', { name: 'Void the release first' }) + expect(dialog.textContent).toContain('This lien has a release of record, saved November 21, 2026. A release needs its lien.') + expect(dialog.textContent).toContain('Void the release. Then void the affidavit.') + fireEvent.click(screen.getByRole('button', { name: 'Cancel' })) + await waitFor(() => expect(screen.queryByRole('alertdialog', { name: 'Void the release first' })).toBeNull()) + expect(voidPress('a1').textContent).toBe('Void') + expect(document.querySelector('[data-lien-void-coach]')).toBeNull() + expect(voids.ids).toEqual([]) + }) + + it('takes the person to the release’s Void, then back to the affidavit once the release is voided', async () => { + draw({ job: paid(), filings: [lien() as never, release() as never] }) + fireEvent.click(voidPress('a1')) + fireEvent.click(await screen.findByRole('button', { name: 'Take me there ›' })) + await waitFor(() => expect(row('r1').querySelector('[data-lien-void-coach]')!.textContent).toBe('Press Void here, then Confirm void. Then void the affidavit.')) + expect(voidPress('r1').getAttribute('data-landed')).toBe('yes') + expect(voids.ids).toEqual([]) + fireEvent.click(voidPress('r1')) + expect(voidPress('r1').textContent).toBe('Confirm void') + fireEvent.click(voidPress('r1')) + await waitFor(() => expect(voids.ids).toEqual(['r1'])) + await waitFor(() => expect(row('a1').querySelector('[data-lien-void-way-back]')!.textContent).toBe('The release is voided. The affidavit can be voided now.')) + expect(document.querySelector('[data-lien-void-coach]')).toBeNull() + expect(voidPress('a1').getAttribute('data-landed')).toBe('yes') + }) + + it('says the county’s record stands for a recorded release, and its press opens the release of record and voids nothing', async () => { + const onGoToRelease = vi.fn() + draw({ job: paid(), activeTab: 'affidavit', onGoToRelease, filings: [lien() as never, release({ filed_at: '2026-11-23', fields: { releasesFilingId: 'a1', releaseInstrument: '2026-0431955' } }) as never] }) + fireEvent.click(voidPress('a1')) + const dialog = await screen.findByRole('alertdialog', { name: 'The county recorded this lien’s release' }) + expect(dialog.textContent).toContain('The release was recorded November 23, 2026 as 2026-0431955. The county’s record stands.') + expect(dialog.textContent).toContain('Ask counsel before either paper is voided.') + expect(screen.getByRole('button', { name: 'Close' })).toBeTruthy() + fireEvent.click(screen.getByRole('button', { name: 'Go to the release of record ›' })) + await waitFor(() => expect(onGoToRelease).toHaveBeenCalledWith('a1')) + expect(voids.ids).toEqual([]) + expect(document.querySelector('[data-lien-void-coach]')).toBeNull() + }) + + it('voids an affidavit with no release with the same two presses as before', async () => { + draw({ job: paid(), filings: [lien() as never] }) + fireEvent.click(voidPress('a1')) + expect(voidPress('a1').textContent).toBe('Confirm void') + expect(screen.queryByRole('alertdialog')).toBeNull() + fireEvent.click(voidPress('a1')) + await waitFor(() => expect(voids.ids).toEqual(['a1'])) + }) + + it('refuses only the lien the release names on a job with two', async () => { + const second = lien({ id: 'a2', recording_number: '2026-0500001', filed_at: '2026-11-16' }) + draw({ job: paid(), filings: [lien() as never, second as never, release() as never] }) + fireEvent.click(voidPress('a2')) + expect(voidPress('a2').textContent).toBe('Confirm void') + fireEvent.click(voidPress('a1')) + expect(await screen.findByRole('alertdialog', { name: 'Void the release first' })).toBeTruthy() + }) +}) + +describe('Filings on this job: voiding a release the county recorded takes words (finding 816)', () => { + const voidPress = (id: string) => document.querySelector(`[data-lien-filing-row="${id}"] [data-lien-filing-void]`)! + const recorded = () => release({ filed_at: '2026-11-23', fields: { releasesFilingId: 'a1', releaseInstrument: '2026-0431955' } }) + beforeEach(() => { + voids.ids = [] + }) + + it('asks in a window, and Keep the release voids nothing', async () => { + draw({ job: paid(), filings: [lien() as never, recorded() as never] }) + fireEvent.click(voidPress('r1')) + const dialog = await screen.findByRole('alertdialog', { name: 'The county recorded this release' }) + expect(dialog.textContent).toContain('It was recorded November 23, 2026 as 2026-0431955. Voiding it here does not undo the county’s record.') + expect(dialog.textContent).toContain('Ask counsel first.') + fireEvent.click(screen.getByRole('button', { name: 'Keep the release' })) + await waitFor(() => expect(screen.queryByRole('alertdialog')).toBeNull()) + expect(voidPress('r1').textContent).toBe('Void') + expect(voids.ids).toEqual([]) + }) + + it('voids on the red press that names the act', async () => { + draw({ job: paid(), filings: [lien() as never, recorded() as never] }) + fireEvent.click(voidPress('r1')) + fireEvent.click(await screen.findByRole('button', { name: 'Void the release anyway' })) + await waitFor(() => expect(voids.ids).toEqual(['r1'])) + }) + + it('leaves a release that is only saved to the two presses', () => { + draw({ job: paid(), filings: [lien() as never, release() as never] }) + fireEvent.click(voidPress('r1')) + expect(voidPress('r1').textContent).toBe('Confirm void') + expect(screen.queryByRole('alertdialog')).toBeNull() + }) +}) diff --git a/src/components/jobs/LienFilingTabs.tsx b/src/components/jobs/LienFilingTabs.tsx index 0824347762..23bebc0652 100644 --- a/src/components/jobs/LienFilingTabs.tsx +++ b/src/components/jobs/LienFilingTabs.tsx @@ -65,6 +65,7 @@ import { lienServeHasContractor } from '../../lib/jobs/lienServeNumbers' import { LienServeCopiesPress } from './LienServeCopiesPress' import { withSupabaseRetry, formatErrorMessage } from '../../utils/errorHandling' import { useToastContext } from '../../contexts/ToastContext' +import { useConfirmDialog } from '../../contexts/ConfirmDialogContext' import { useAuth } from '../../hooks/useAuth' import { LienVoidedByHandRecords } from './LienVoidedByHandRecords' import { LienVoidedRecords } from './LienVoidedRecords' @@ -90,6 +91,7 @@ import { ChangeableValue, ValueLine, ValueLines, ValueSentence, WorkedOutValue } import { plainSentence } from '../../lib/valuesInPlace' import { RELEASE_OF_RECORD_WORDS, canReleaseAnyway, pickReleaseTarget, isOneLiveReleaseRefusal, releaseMoneyBackWords, releaseMoneyGate, releaseNeedsBank, releasePaperBlanks, releasePaperBlanksWords, releaseRecordDrift, releaseRecordFactsPatch, releaseReprintWords, RELEASE_RECORD_FACT_LABELS, type ReleaseRecordFact, releaseCorrectable, releasePaymentDatePatch, releasePaymentDateShown, releasePaymentDayAsk, releasePaymentDayBeforeLien, releasePaymentDayKey, releaseSavedHold, releaseSavedPaymentDay, releaseRecordedSentence, releaseSaveFields, releaseStampDayCheck, releaseStampPatch, releaseTargets, releasePaymentDayCheck } from '../../lib/jobs/lienReleaseOfRecord' import { releaseLineWords } from '../../lib/jobs/lienReleaseLine' +import { VOID_REFUSAL_WORDS, affidavitVoidRefusal, affidavitVoidRefusalWindow, filingVoidPressSelector, recordedReleaseVoidWindow, releaseVoidTakesWords } from '../../lib/jobs/lienVoidRefusal' import { payoffNote } from '../../lib/jobs/lienPayoffFields' import { releaseByNow, releaseFacts, releaseFactsPatch, releasePaperChangedSincePrint } from '../../lib/jobs/lienReleaseFacts' import { countedLabel } from '../../lib/batchWords' @@ -157,6 +159,7 @@ export default function LienFilingTabs({ landRelease = null, landAffidavit = null, releaseLienId = null, + onGoToRelease, headSlotRef, onServePrinted, onClose, @@ -191,6 +194,8 @@ export default function LienFilingTabs({ landAffidavit?: { at: number } | null /** The filed lien the opener's press was made on (finding 808): the Release of record tab opens on that lien, not on the job's first. Absent, the tab picks. */ releaseLienId?: string | null + /** The window that refuses an affidavit's void sends the person to that lien's release of record (finding 816): the window picks the paper and lands on the county's stamp. */ + onGoToRelease?: (affidavitId: string) => void /** The Lien window's slot at the top of each paper's pane (Way 2 of finding 803): on a computer the window draws its steps' band and the papers' bar there, inside the paper's own scroll. */ headSlotRef?: (el: HTMLElement | null) => void /** The filed lien's copies went to the printer from this window's press. */ @@ -222,10 +227,14 @@ export default function LienFilingTabs({ const isMobile = useIsMobile() const { user: authUser, role: authRole, profileName } = useAuth() const { showToast } = useToastContext() + const confirmDialog = useConfirmDialog() const [pdfBusy, setPdfBusy] = useState(false) const [encloseInvoice, setEncloseInvoice] = useState(true) const enclosedDocs = useMemo(() => (encloseInvoice ? invoiceDocs : []), [encloseInvoice, invoiceDocs]) const [voidPendingId, setVoidPendingId] = useState(null) + // The refused void's way (finding 816, v2.9260): the release whose **Void** is lit for the affidavit that was pressed, then the affidavit once that release is voided. + const [voidCoach, setVoidCoach] = useState<{ releaseId: string; affidavitId: string } | null>(null) + const [voidWayBackId, setVoidWayBackId] = useState(null) const [recordStep, setRecordStep] = useState<'notice_sends' | 'notice_by_hand' | 'affidavit_filing' | 'affidavit_service' | null>(null) const [ownerSend, setOwnerSend] = useState({ method: 'certified_mail', tracking: '', sentOn: todayYmd(), receiptUrl: '' }) const [ocSend, setOcSend] = useState({ method: 'certified_mail', tracking: '', sentOn: todayYmd(), receiptUrl: '' }) @@ -1192,12 +1201,49 @@ export default function LienFilingTabs({ const outcome = await voidLienFiling({ id: f.id, kind: f.kind }) showToast(lienVoidPaperWords(outcome, f.kind), lienVoidPaperStuck(outcome) ? 'error' : 'success') setVoidPendingId(null) + // The release the refused void sent the person to is voided: the affidavit's line says so and its Void is lit. + if (voidCoach?.releaseId === f.id) { + const affidavitId = voidCoach.affidavitId + setVoidCoach(null) + setVoidWayBackId(affidavitId) + landUndo.current?.() + landUndo.current = landOnWhenThere(() => document.querySelector(filingVoidPressSelector(affidavitId))) + } + if (voidWayBackId === f.id) setVoidWayBackId(null) onChanged() } catch (e) { showToast(formatErrorMessage(e, 'Could not void the record.'), 'error') } } + /** + * **Void** on a filing's line (finding 816, v2.9260). An affidavit with a live release is not voided: a window + * refuses it and its blue press leads to the release (`lienVoidRefusal.ts`). A release the county recorded asks + * in a confirm window first. Every other record turns its press into **Confirm void**, as before. + */ + const pressVoid = async (f: JobLienFilingRow) => { + const refusal = affidavitVoidRefusal(f, live) + if (refusal) { + if (!(await confirmDialog(affidavitVoidRefusalWindow(refusal, demandDate)))) return + if (refusal.kind === 'saved') { + setVoidWayBackId(null) + setVoidCoach({ releaseId: refusal.releaseId, affidavitId: f.id }) + landUndo.current?.() + landUndo.current = landOnWhenThere(() => document.querySelector(filingVoidPressSelector(refusal.releaseId))) + } else { + // The county's record: the release's own paper, on this lien, with the stamp lit. Nothing is voided. + setReleaseTargetId(f.id) + onGoToRelease?.(f.id) + } + return + } + if (releaseVoidTakesWords(f)) { + if (await confirmDialog(recordedReleaseVoidWindow(f, demandDate))) await voidFiling(f) + return + } + setVoidPendingId(f.id) + } + // ---------- render helpers ---------- const kindLabel = (k: string) => @@ -1331,15 +1377,26 @@ export default function LienFilingTabs({ View {voidPendingId === f.id ? ( - ) : ( - )} + {/* The refused void's way (finding 816): what to press on the release's line, then the way back on the affidavit's. */} + {voidCoach?.releaseId === f.id ? ( +
+ {VOID_REFUSAL_WORDS.pressVoidHere} +
+ ) : null} + {voidWayBackId === f.id ? ( +
+ {VOID_REFUSAL_WORDS.wayBack} +
+ ) : null} {/* What went out (`lienMailProof.ts`): every mailed file with its own link, each envelope's number and receipt, and the receipt press. */}
{ + setActiveTab('release_record') + setLandRelease({ at: Date.now() }) + }} headSlotRef={setHeadSlot} // The copies went to the printer here: this window's card reads the next stage at once, and the opener reads again once the print is filed. onServePrinted={(id) => { diff --git a/src/content/help/file-a-lien-and-never-miss-its-deadlines.md b/src/content/help/file-a-lien-and-never-miss-its-deadlines.md index 7dfeba8729..a632112625 100644 --- a/src/content/help/file-a-lien-and-never-miss-its-deadlines.md +++ b/src/content/help/file-a-lien-and-never-miss-its-deadlines.md @@ -156,6 +156,8 @@ Was the lien filed without this tab, by counsel or on paper from elsewhere? The Was a filing recorded on the wrong job, or with the wrong day? Open that job's Lien window. Find the record under **Filings on this job**. Press **Void** on it, then **Confirm void**. The lien's paper goes back to the Lien desk by itself. A paper the leader approved is approved again, so nobody asks him twice. The Board shows it in **Ready to file**, or in **Held** when a fact holds it. A paper nobody had approved goes back to a draft. Then record the lien again with the right facts. +Does the lien have a release of record? The app does not void the affidavit. A window says *Void the release first*. Press {{button:blue|Take me there ›}}. The release's **Void** lights up on its line. Press it, then **Confirm void**. The affidavit's line then says it can be voided now. Has the county already recorded the release? The window says so instead. Press {{button:blue|Go to the release of record ›}} to read the county's day and number. Ask counsel before either paper is voided. + ### Several liens back from the clerk Did a stack of liens come back from the County Clerk together? Record them in one sitting. Open the Lien desk's To do. On the Board, find the bin **Ready to file**. Under its print a line reads *Back from the clerk?* Press {{button:outline|Enter document numbers · 3 ›}} beside it. The press counts the liens in the bin. One window opens. It is named **Back from the clerk: record the filings**. diff --git a/src/content/help/release-a-filed-lien-after-it-is-paid.md b/src/content/help/release-a-filed-lien-after-it-is-paid.md index c29cdc4e79..d110fe21a3 100644 --- a/src/content/help/release-a-filed-lien-after-it-is-paid.md +++ b/src/content/help/release-a-filed-lien-after-it-is-paid.md @@ -167,6 +167,14 @@ The office takes a returned check off its job in Accounts Receivable. The check' Accounts Receivable shows the liens too. The check's case has a box named **Liens on this money**. Read [the liens on a check that came back](/help/match-bank-deposits-to-bills#the-liens-on-a-check-that-came-back). +## Void a release + +A release is voided on its line under **Filings on this job**. Press **Void**, then **Confirm void**. You can then make the release again. + +Has the county already recorded the release? **Void** opens a window first. It says that voiding the release here does not undo the county's record. Press {{button:blue|Keep the release}} to leave it as it is. Press {{button:red|Void the release anyway}} only after you ask counsel. + +A lien that has a release is not voided first. The app sends you to the release. Read [file a lien and never miss its deadlines](/help/file-a-lien-and-never-miss-its-deadlines). + ## What the window does not do The window does not make the paper. The Lien window's **Release of record** tab does that. A single payment is recorded on the job's Bill tab. The window says which one to open and when. diff --git a/src/content/releaseNotes/v2.9260.ts b/src/content/releaseNotes/v2.9260.ts new file mode 100644 index 0000000000..8a5ec7691d --- /dev/null +++ b/src/content/releaseNotes/v2.9260.ts @@ -0,0 +1,16 @@ +import type { ReleaseNote } from '../../lib/releaseNotes' + +const note: ReleaseNote = { + version: 'v2.9260', + date: '2026-12-03', + title: 'Lien window: a lien with a release is not voided out from under it', + kind: 'fix', + highlights: [ + 'Void on a filed lien that has a release of record no longer goes through. A window says to void the release first.', + 'Take me there lights Void on the release’s own line. Once the release is voided, the lien’s line says it can be voided now.', + 'When the county has already recorded the release, the window says the county’s record stands. Go to the release of record shows the county’s day and number, and voids nothing.', + 'Void on a release the county recorded now asks first. Keep the release is the safe press.', + ], +} + +export default note diff --git a/src/lib/jobs/lienVoidRefusal.test.ts b/src/lib/jobs/lienVoidRefusal.test.ts new file mode 100644 index 0000000000..7c77f828be --- /dev/null +++ b/src/lib/jobs/lienVoidRefusal.test.ts @@ -0,0 +1,112 @@ +import { describe, expect, it } from 'vitest' +import { VOID_REFUSAL_WORDS, affidavitVoidRefusal, affidavitVoidRefusalWindow, filingVoidPressSelector, recordedReleaseVoidWindow, releaseVoidTakesWords } from './lienVoidRefusal' +import { plainWordsFailures } from '../plainWords' + +// Every id, number and day here is made up. +const fmt = (ymd: string) => `<${ymd}>` +const row = (over: Record) => ({ id: 'x', job_id: 'j1', kind: 'affidavit', amount: 100, county: 'Travis', recording_number: '2026-0000001', filed_at: '2026-11-09' as string | null, created_at: '2026-11-09T15:00:00Z', fields: {} as unknown, ...over }) +const lien = (id = 'a1', over: Record = {}) => row({ id, ...over }) +const release = (id = 'r1', over: Record = {}) => row({ id, kind: 'release_of_record', filed_at: null, created_at: '2026-12-02T18:00:00Z', fields: { releasesFilingId: 'a1' }, ...over }) + +describe('affidavitVoidRefusal', () => { + it('lets the void go on with no release', () => { + const a = lien() + expect(affidavitVoidRefusal(a, [a])).toBeNull() + }) + + it('refuses while a saved release names the lien', () => { + const a = lien() + expect(affidavitVoidRefusal(a, [a, release()])).toEqual({ kind: 'saved', releaseId: 'r1', savedYmd: '2026-12-02' }) + }) + + it('refuses with the county’s day and the release’s own number once it is recorded', () => { + const a = lien() + const r = release('r1', { filed_at: '2026-12-04', fields: { releasesFilingId: 'a1', releaseInstrument: '2026-0000099' } }) + expect(affidavitVoidRefusal(a, [a, r])).toEqual({ kind: 'recorded', releaseId: 'r1', recordedYmd: '2026-12-04', instrument: '2026-0000099' }) + }) + + it('reads each lien for itself on a job with two', () => { + const a = lien() + const b = lien('a2', { recording_number: '2026-0000002' }) + const all = [a, b, release('r2', { fields: { releasesFilingId: 'a2' } })] + expect(affidavitVoidRefusal(a, all)).toBeNull() + expect(affidavitVoidRefusal(b, all)).toMatchObject({ kind: 'saved', releaseId: 'r2' }) + }) + + it('reads a release saved before the key was kept as the one filed lien’s own', () => { + const a = lien() + expect(affidavitVoidRefusal(a, [a, release('r1', { fields: {} })])).toMatchObject({ kind: 'saved', releaseId: 'r1' }) + }) + + it('refuses nothing for a record that is not a filed affidavit', () => { + const draft = lien('a1', { filed_at: null }) + expect(affidavitVoidRefusal(draft, [draft, release()])).toBeNull() + const notice = row({ id: 'n1', kind: 'notice_53_056' }) + expect(affidavitVoidRefusal(notice, [notice, release()])).toBeNull() + const r = release() + expect(affidavitVoidRefusal(r, [lien(), r])).toBeNull() + }) +}) + +describe('affidavitVoidRefusalWindow', () => { + it('sends the person to the release, and names the press for the act', () => { + const w = affidavitVoidRefusalWindow({ kind: 'saved', releaseId: 'r1', savedYmd: '2026-12-02' }, fmt) + expect(w).toEqual({ + title: 'Void the release first', + message: 'This lien has a release of record, saved <2026-12-02>. A release needs its lien.\n\nVoid the release. Then void the affidavit.', + confirmLabel: 'Take me there ›', + cancelLabel: 'Cancel', + }) + }) + + it('says the county’s record stands, and offers the release of record beside Close', () => { + const w = affidavitVoidRefusalWindow({ kind: 'recorded', releaseId: 'r1', recordedYmd: '2026-12-04', instrument: '2026-0000099' }, fmt) + expect(w).toEqual({ + title: 'The county recorded this lien’s release', + message: 'The release was recorded <2026-12-04> as 2026-0000099. The county’s record stands.\n\nAsk counsel before either paper is voided.', + confirmLabel: 'Go to the release of record ›', + cancelLabel: 'Close', + }) + expect(w.danger).toBeUndefined() + }) + + it('leaves the number out when none is kept', () => { + const w = affidavitVoidRefusalWindow({ kind: 'recorded', releaseId: 'r1', recordedYmd: '2026-12-04', instrument: '' }, fmt) + expect(w.message.startsWith('The release was recorded <2026-12-04>. The county’s record stands.')).toBe(true) + }) +}) + +describe('the void of a release the county recorded', () => { + it('takes words only once the county’s day is kept', () => { + expect(releaseVoidTakesWords(release())).toBe(false) + expect(releaseVoidTakesWords(release('r1', { filed_at: '2026-12-04' }))).toBe(true) + expect(releaseVoidTakesWords(lien())).toBe(false) + }) + + it('opens on the safe press, with the act red and named', () => { + const w = recordedReleaseVoidWindow(release('r1', { filed_at: '2026-12-04', fields: { releaseInstrument: '2026-0000099' } }), fmt) + expect(w).toEqual({ + title: 'The county recorded this release', + message: 'It was recorded <2026-12-04> as 2026-0000099. Voiding it here does not undo the county’s record.\n\nAsk counsel first.', + confirmLabel: 'Void the release anyway', + cancelLabel: 'Keep the release', + danger: true, + cancelIsSafe: true, + }) + }) +}) + +describe('the words on the way', () => { + it('are plain words', () => { + const windows = [ + affidavitVoidRefusalWindow({ kind: 'saved', releaseId: 'r1', savedYmd: '2026-12-02' }, () => 'December 2, 2026'), + affidavitVoidRefusalWindow({ kind: 'recorded', releaseId: 'r1', recordedYmd: '2026-12-04', instrument: '2026-0000099' }, () => 'December 4, 2026'), + recordedReleaseVoidWindow(release('r1', { filed_at: '2026-12-04' }), () => 'December 4, 2026'), + ] + for (const text of [...windows.flatMap((w) => w.message.split('\n\n')), ...Object.values(VOID_REFUSAL_WORDS)]) expect(plainWordsFailures(text), text).toEqual([]) + }) + + it('finds a line’s Void press', () => { + expect(filingVoidPressSelector('r1')).toBe('[data-lien-filing-row="r1"] [data-lien-filing-void]') + }) +}) diff --git a/src/lib/jobs/lienVoidRefusal.ts b/src/lib/jobs/lienVoidRefusal.ts new file mode 100644 index 0000000000..7385c72998 --- /dev/null +++ b/src/lib/jobs/lienVoidRefusal.ts @@ -0,0 +1,97 @@ +/** + * The void that is refused, and the void that takes words (finding 816, punch list #479, step 7). + * + * Voiding a filed affidavit that has a live release left the release with no lien. Payoffs, the Board and the tab + * then offered a second release. The owner's answer (2026-12-02): the void is refused by a window, and its one blue + * press takes the person to the release and shows where to press. The drawing is `mockup.html` on the card. + * + * - **A saved release.** *Void the release first*, with **Take me there ›**. The press lights **Void** on the + * release's own line, with a line that says what to press. Once the release is voided, the affidavit's line + * says it can be voided now. + * - **A release the county recorded.** *The county recorded this lien's release*, with **Go to the release of + * record ›** beside Close. The press opens that lien's release on its paper and voids nothing. + * + * A release the county recorded voided from its own line with the same two presses as any record, and no words. + * Its **Void** now opens a confirm window (the owner's pick of 2026-12-03): the county's record stands whatever the + * app holds, the safe press keeps the release, and the red press names the act. A county day typed on the wrong + * release still has a way out. + * + * Nothing here voids anything. The app counts the days and does not judge the law. + */ +import type { ConfirmDialogOptions } from '../confirmDialogPress' +import { calendarYmdInAppTzFromIso } from '../../utils/dateUtils' +import { releaseForAffidavit, releaseOwnInstrument, type LienPayoffAffidavit, type LienPayoffRelease } from './lienPayoff' + +type FilingLike = LienPayoffAffidavit & LienPayoffRelease & { kind: string } + +/** Why an affidavit's void is refused: its release is saved, or the county has recorded it. */ +export type AffidavitVoidRefusal = { kind: 'saved'; releaseId: string; savedYmd: string } | { kind: 'recorded'; releaseId: string; recordedYmd: string; instrument: string } + +/** + * Whether the void of this affidavit is refused. `live` is the job's filings with the voided ones left out. The + * release is the affidavit's own as every other surface reads it (`releaseForAffidavit`): the one that names it, or + * on a job with one filed lien the one saved before the key was kept. Null lets the void go on. + */ +export function affidavitVoidRefusal(affidavit: F, live: ReadonlyArray): AffidavitVoidRefusal | null { + if (affidavit.kind !== 'affidavit' || !affidavit.filed_at) return null + const filed = live.filter((f) => f.kind === 'affidavit' && f.filed_at) + const release = releaseForAffidavit( + affidavit, + live.filter((f) => f.kind === 'release_of_record'), + filed.length, + ) + if (!release) return null + const recordedYmd = (release.filed_at ?? '').slice(0, 10) + if (recordedYmd) return { kind: 'recorded', releaseId: release.id, recordedYmd, instrument: releaseOwnInstrument(release) } + return { kind: 'saved', releaseId: release.id, savedYmd: calendarYmdInAppTzFromIso(release.created_at) } +} + +/** The window that refuses the void. Its blue press is the way on, so it is the plain confirm: Cancel or Close is quiet. */ +export function affidavitVoidRefusalWindow(refusal: AffidavitVoidRefusal, fmt: (ymd: string) => string): ConfirmDialogOptions { + if (refusal.kind === 'saved') { + return { + title: 'Void the release first', + message: `This lien has a release of record, saved ${fmt(refusal.savedYmd)}. A release needs its lien.\n\nVoid the release. Then void the affidavit.`, + confirmLabel: 'Take me there ›', + cancelLabel: 'Cancel', + } + } + return { + title: 'The county recorded this lien’s release', + message: `${recordedSentence('The release', refusal.recordedYmd, refusal.instrument, fmt)} The county’s record stands.\n\nAsk counsel before either paper is voided.`, + confirmLabel: 'Go to the release of record ›', + cancelLabel: 'Close', + } +} + +/** True for a release whose void takes words: the county's day is kept on it. */ +export function releaseVoidTakesWords(f: { kind: string; filed_at: string | null }): boolean { + return f.kind === 'release_of_record' && Boolean((f.filed_at ?? '').slice(0, 10)) +} + +/** The confirm window on the void of a release the county recorded. Keeping it is the safe press, and the act is red. */ +export function recordedReleaseVoidWindow(release: Pick, fmt: (ymd: string) => string): ConfirmDialogOptions { + return { + title: 'The county recorded this release', + message: `${recordedSentence('It', (release.filed_at ?? '').slice(0, 10), releaseOwnInstrument(release), fmt)} Voiding it here does not undo the county’s record.\n\nAsk counsel first.`, + confirmLabel: 'Void the release anyway', + cancelLabel: 'Keep the release', + danger: true, + cancelIsSafe: true, + } +} + +function recordedSentence(subject: string, ymd: string, instrument: string, fmt: (ymd: string) => string): string { + return instrument ? `${subject} was recorded ${fmt(ymd)} as ${instrument}.` : `${subject} was recorded ${fmt(ymd)}.` +} + +/** The lines the tab draws on the way: under the release's lit **Void**, and on the affidavit's line once the release is voided. */ +export const VOID_REFUSAL_WORDS = { + pressVoidHere: 'Press Void here, then Confirm void. Then void the affidavit.', + wayBack: 'The release is voided. The affidavit can be voided now.', +} as const + +/** The **Void** press of a filing's line, for the light. */ +export function filingVoidPressSelector(filingId: string): string { + return `[data-lien-filing-row="${filingId}"] [data-lien-filing-void]` +} diff --git a/to-dos/lien-release-road-faults/README.md b/to-dos/lien-release-road-faults/README.md index 0004fd73be..ef2c7ee6d8 100644 --- a/to-dos/lien-release-road-faults/README.md +++ b/to-dos/lien-release-road-faults/README.md @@ -2,7 +2,7 @@ name: "The release road: every fault found on the way to releasing a paid lien, and the ones left to mend" number: 479 group: ready -status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 2 is built (v2.9195) · step 3 is built (v2.9216) · step 4 is built (v2.9219, v2.9238) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · step 8 is built and owes a push (v2.9240) · step 10 is built (v2.9229, v2.9239) · step 11 is built (v2.9230) · step 12 is built (v2.9232) · step 13 is built (v2.9234) · the owner answered the three calls on 2026-12-02 · the first half of step 7 is built (v2.9255) · step 14 is measured · the rest of step 7 and step 9 are left, and the word on step 14 +status: asked 2026-12-02 (UTC) by the owner · the road read in the code and walked once on a ZZ Test lien the same day · the five mends that were in open PRs are on main · step 1 is built (v2.9190) · step 2 is built (v2.9195) · step 3 is built (v2.9216) · step 4 is built (v2.9219, v2.9238) · step 5 is built (v2.9222) · step 6 is built (v2.9224) · step 8 is built and owes a push (v2.9240) · step 10 is built (v2.9229, v2.9239) · step 11 is built (v2.9230) · step 12 is built (v2.9232) · step 13 is built (v2.9234) · the owner answered the three calls on 2026-12-02 · step 7 is built (v2.9255, v2.9260) · step 14 is measured and closed with no build · step 9 is left summary: > The owner asked for help releasing a paid lien and printing its release, and for every bug on the way. One thread read the road in the code and found fourteen faults, findings 808 to 821. @@ -12,11 +12,11 @@ summary: > the most serious first. Two can mislead on a real lien today. On a job with two liens the county's stamp can land on the wrong release. And a release that is only saved already reads Released. -next: The rest of step 7, finding 816. The void of an affidavit with a live release is refused by the window as drawn, and the void of a recorded release takes words. -ask: owner · look · A look at the refused void on a ZZ Test lien once step 7 is built: the window, its Take me there press, and the way back to the affidavit. -size: L as a train of fourteen (M · M · S · S · S · S · M · M · S · S · XS · S · S · S); left: steps 7 and 9 -blocker: Step 7 has none: the owner said *Yes, build it* on its drawing. Step 8 is built and owes one push after its merge. Step 9 is built after card #477. Step 14 is measured, and the measure found nothing of this door's to mend. -opinion: build — step 7 next. A voided affidavit that leaves its release behind makes the desk offer a second release on the same lien. +next: Step 9, finding 818, after card #477 is built. The desk's path knows the wait on a check, and the Board keeps one chip a lien. +ask: owner · look · A look at the refused void on a ZZ Test lien: the window, its Take me there press, and the way back to the affidavit. +size: L as a train of fourteen (M · M · S · S · S · S · M · M · S · S · XS · S · S · S); left: step 9 +blocker: Step 9 is built after card #477. Step 8 owes one push after its merge. Nothing else is left. +opinion: build — card #477 next, then step 9, which closes this card. mockup: mockup.html — the window that refuses the void of an affidavit with a live release, and where Take me there lands (call 2, step 7). Every other step mends a press, a line or a guard on a screen that is already drawn. --- @@ -62,7 +62,7 @@ State is as read on GitHub and on `main` on 2026-12-02 at 19:17 UTC. | 813 | A job has two liens. Keeping **Recorded on** throws the tab onto the other lien before **Instrument number** is typed. | read | Built in step 1, v2.9190. The tab holds the lien it stands on. | | 814 | A release is saved and the county has not recorded it. The job's bills owe again. The tab still says *Sign it before a notary. Then record it at the county.* Its print is live. Payoffs and the day's run hold the same release. | read | Mended by v2.9222, step 5: the tab reads the same hold, its two presses wait and the reason stands under them. | | 815 | **Download PDF** files no copy. Neither press marks the release as printed for the notary. When a check then comes back, the app says no release has left the office. The day's run prints it again. | read | Mended by v2.9224, step 6: a download files a copy, and the tab's print or download marks a saved release as printed for the notary. | -| 816 | Voiding a filed affidavit that has a release leaves the release with no lien. Payoffs, the Board and the tab offer a second release, and the head still says released. Under **Filings on this job** a release's line names no lien, number or day, so two cannot be told apart. A release the county recorded voids with the same two presses and no words. | read, its line seen | Built in part, v2.9255: a release's line names its lien, its day and where it stands. Left: the refused void, and the words on a recorded release's void. Step 7. | +| 816 | Voiding a filed affidavit that has a release leaves the release with no lien. Payoffs, the Board and the tab offer a second release, and the head still says released. Under **Filings on this job** a release's line names no lien, number or day, so two cannot be told apart. A release the county recorded voids with the same two presses and no words. | read, its line seen | Built in step 7, v2.9255 and v2.9260. A release's line names its lien, its day and where it stands. The void of an affidavit with a live release is refused by a window that leads to the release. The void of a recorded release asks first. | | 817 | Around the reload after **Save release record** a second release row can be written. Nothing in the database ties one release to one lien. A reload that fails draws *No recorded lien on this job*. | plausible | Built, v2.9240, step 8. The save asks the database first, and a partial unique index holds the rule. It owes one push after its merge. | | 818 | The desk's path is never told that a release waits on a check. It says *Paid — file the release of record.* with **File the release ›** while the tab's presses are dead. The Board keeps one chip a job in a bin. So on a job with two liens **Make N release ›** can leave one out. | read | Not started. Step 9. | | 819 | Keeping the instrument number writes every kept fact of the release back from the window's copy. A fact another screen wrote in the meantime is lost. That can be the notary's day, the copies' day or the mark of a check that came back. | plausible | Mended, v2.9229 and v2.9239, step 10. The tab's writes read the row fresh. The day's run, Payoffs and the returned check's mark write through `keepReleaseFacts`, which now reads each release fresh too. | @@ -79,7 +79,7 @@ State is as read on GitHub and on `main` on 2026-12-02 at 19:17 UTC. | 824 | The bin *Paid awaiting release* counts liens. Its press leaves no To do row for a paid lien that owes its release. | seen | Mended, v2.9163 (PR #10623), on `main`. It is step 6 of card #472. | | 825 | On a job with no property facts, the paper's owner and property description are blank lines. The tab says nothing before **Save release record** takes it. | seen | Built, v2.9234. A line above the presses names each blank and where it is fixed. Step 13. | | 826 | A lien was filed and then released. It never had a To do row, while the Board and Payoffs showed it. | seen | v2.9163 (PR #10623) added the rows, on `main`. This case is still to check on the live site. | -| 827 | A link that opens the Lien window on a job took about nine seconds to draw the window. | seen | Measured on 2026-12-02. The door costs about a second on a warm load. Step 14. | +| 827 | A link that opens the Lien window on a job took about nine seconds to draw the window. | seen | Measured on 2026-12-02: the door costs about a second on a warm load. Closed with no build on the owner's word of 2026-12-03. Step 14. | Findings 822 and 823 are faults of the desk's Board and To do, not of the road. They are in the Lien desk lane's note of run 17 and are not on this card. @@ -126,13 +126,15 @@ Lien desk lane's note of run 17 and are not on this card. the run, and says why. 6. **Built, v2.9224. A download is a copy, and a print is marked (S). 815.** **Download PDF** files a copy as the print does. Either press marks the release as out for the notary. -7. **First half built, v2.9255. Voids that leave nothing behind (M). 816.** The void of an affidavit with a live release +7. **Built, v2.9255 and v2.9260. Voids that leave nothing behind (M). 816.** The void of an affidavit with a live release is refused by a window with a **Take me there** press, which brings the person to the release and shows where to press (call 2). The window and its flow are drawn in [`mockup.html`](mockup.html), *Now* beside the suggestion. The owner said *Yes, build it* on - the drawing on 2026-12-02. That half is not built yet. Built, v2.9255: a release's line - under **Filings on this job** names its lien, its number and its day. Left with the window: - voiding a release the county recorded takes words. + the drawing on 2026-12-02 and again on 2026-12-03 (*Every pick*). It is built as drawn, v2.9260. + Built, v2.9255: a release's line under **Filings on this job** names its lien, its number and + its day. Voiding a release the county recorded takes words: **Void** on its own line opens a + confirm window, *The county recorded this release*, with **Keep the release** and a red + **Void the release anyway** (the owner's pick of 2026-12-03, v2.9260). 8. **Built, v2.9240. One release a lien (M). 817.** The save is guarded in the client. A rule in the database ties one live release to one lien. This step is a migration and owes a push after its merge. 9. **The desk's path knows the wait, and one chip a lien (S). 818.** Built after card #477, since @@ -145,12 +147,12 @@ Lien desk lane's note of run 17 and are not on this card. **Upload the scanned PDF**. The scan is named as a release in the job's folder. 13. **Built, v2.9234. Missing property facts are named before the save (S). 825.** A line above the presses names each fact the paper would print blank. It names and does not hold. -14. **Measured, 2026-12-02. The slow link (S). 827.** Measure what the nine seconds are first. Then mend what the +14. **Closed with no build, 2026-12-03. The slow link (S). 827.** Measure what the nine seconds are first. Then mend what the measure shows. Two warm loads of the link on a ZZ Test job drew the window 2.5 and 1.5 seconds after the load began. The one job's read took between half a second and a second and a half. The window was up at once after it. So the door costs about a second. The nine seconds was a cold load of the Jobs page's scripts, which is the app's own start. The measure shows nothing - of this door's to mend. Whether the step closes with no build is asked of the owner. + of this door's to mend. The owner closed the step with no build on 2026-12-03 (*Every pick*). ## The calls, each answered @@ -170,6 +172,8 @@ The owner answered on 2026-12-02 (UTC), relayed by the managing session of run 1 **Answered on the drawing, 2026-12-02.** Asked *Card #479: is the release of record the right place for the press to lead?*, the owner pressed *Yes, build it*. So the window for a release the county has already recorded carries **Go to the release of record ›** beside Close, it leads where the drawing's step 4 shows, and it voids nothing. The whole drawing is the build: the refused void, **Take me there ›**, the lit **Void**, the way back, and this window. +**Three more calls, answered 2026-12-03 (UTC).** They were put with their picks, and the owner said: *Every pick, both*. The refused void is built as drawn. The void of a release the county has recorded opens a confirm window, with **Keep the release** as the safe press and a red **Void the release anyway**: a county day typed on the wrong release still has a way out. Step 14 closes with no build, on the measure written under it. + ## Where each lives Files and lines are `main`'s at `c7cdafa95c`. Read them again before a step: five PRs on these @@ -205,9 +209,7 @@ files have landed since, and the lines have moved. ## Where it stands -Written on 2026-12-02 (UTC), brought current on 2026-12-03 (UTC). Of the fourteen steps, eleven -are built: 1 to 6, 8, 10, 11, 12 and 13. Step 8 owes one push after its merge. Step 14 is -measured, and the measure found nothing of this door's to mend. Two steps are left. Step 7 is -next. Its first half is built, the release's line that names its lien (v2.9255). The refused void as drawn is left. Step 9 -is built after card #477. Finding 810 is decided on card #477 and is built with it. The looks on -the live site are owed for every step. +Written on 2026-12-02 (UTC), brought current on 2026-12-03 (UTC). Of the fourteen steps, twelve +are built: 1 to 8 and 10 to 13. Step 8 owes one push after its merge. Step 14 was measured and +the owner closed it with no build. One step is left. Step 9 is built after card #477, and +finding 810 is built with that card. The looks on the live site are owed for every step. From 578cceabc5ea83d9eecb0b293bfd8d84078800d4 Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 2 Dec 2026 22:37:15 -0600 Subject: [PATCH 21/21] migration restamped 20261203043643: main holds a later stamp than 20261202211100 and prod has applied it (punch list #479 step 8) Co-Authored-By: Claude Fable 5.2 --- docs/LIEN_DESK_ARCHITECTURE.md | 2 +- ...se_a_lien.md => 20261203043643_one_live_release_a_lien.md} | 2 +- docs/recent-features/v2.9240.md | 4 ++-- src/lib/jobs/lienReleaseOfRecord.test.ts | 2 +- src/lib/jobs/lienReleaseOfRecord.ts | 2 +- ..._a_lien.sql => 20261203043643_one_live_release_a_lien.sql} | 0 supabase/tests/lien_early_on_check/20_scenario.sql | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) rename docs/migrations/{20261202211100_one_live_release_a_lien.md => 20261203043643_one_live_release_a_lien.md} (97%) rename supabase/migrations/{20261202211100_one_live_release_a_lien.sql => 20261203043643_one_live_release_a_lien.sql} (100%) diff --git a/docs/LIEN_DESK_ARCHITECTURE.md b/docs/LIEN_DESK_ARCHITECTURE.md index c5704e91b9..b403ccc1b0 100644 --- a/docs/LIEN_DESK_ARCHITECTURE.md +++ b/docs/LIEN_DESK_ARCHITECTURE.md @@ -770,7 +770,7 @@ last_updated: 2026-12-03 > **v2.9238 (the paper as last printed):** `releaseFactsPatch` keeps the nine paper facts under `fields.printedPaper` whenever it sets `printedForNotary`, for the tab, Payoffs and the run alike, and takes it off with the mark. > `releasePaperChangedSincePrint` compares the row to it, `releaseReprintWords` says what changed and to print again, and `markReleaseOut` marks a second print when the paper changed since the first. > **v2.9239 (the run and Payoffs read fresh too, the rest of finding 819):** `keepReleaseFacts` reads every release it is handed in one read and builds `releaseFactsPatch` on the facts the database holds, a release voided in the meantime is held with `RELEASE_RUN_WORDS.gone`, and a row's own `fields` is no longer written. -> **v2.9240 (one live release a lien, finding 817):** `recordRelease` takes one save at a time and asks the database for a live `release_of_record` row whose `fields ->> 'releasesFilingId'` is this lien before it inserts, and migration `20261202211100` holds the same rule as the partial unique index `job_lien_filings_one_live_release_idx`. +> **v2.9240 (one live release a lien, finding 817):** `recordRelease` takes one save at a time and asks the database for a live `release_of_record` row whose `fields ->> 'releasesFilingId'` is this lien before it inserts, and migration `20261203043643` holds the same rule as the partial unique index `job_lien_filings_one_live_release_idx`. > `isOneLiveReleaseRefusal` reads the index's refusal by its name, and `loadFilings` in `LienInstrumentsModal` keeps the records it holds when a reload fails. > **v2.9190 (a door names its lien, findings 808 and 813):** `pickReleaseTarget` takes a third value, the lien the door named, read after the lien the tab holds and before the rule. > The doors are a lien's row in Payoffs and a release's line on the day's run: each `onOpenRelease` hands the job and its `affidavitId`, `LienDeskPage` keeps it as `releaseLienId` on the window it opens, and `LienInstrumentsModal` hands it to `LienFilingTabs`. diff --git a/docs/migrations/20261202211100_one_live_release_a_lien.md b/docs/migrations/20261203043643_one_live_release_a_lien.md similarity index 97% rename from docs/migrations/20261202211100_one_live_release_a_lien.md rename to docs/migrations/20261203043643_one_live_release_a_lien.md index e67a96e81d..747b1ad423 100644 --- a/docs/migrations/20261202211100_one_live_release_a_lien.md +++ b/docs/migrations/20261203043643_one_live_release_a_lien.md @@ -1,4 +1,4 @@ -# 20261202211100_one_live_release_a_lien.sql (2026-12-02, v2.9240) +# 20261203043643_one_live_release_a_lien.sql (2026-12-02, v2.9240) One live release a lien: step 8 of punch list #479 (the release road's faults), finding 817. diff --git a/docs/recent-features/v2.9240.md b/docs/recent-features/v2.9240.md index 81cad774df..67ac650222 100644 --- a/docs/recent-features/v2.9240.md +++ b/docs/recent-features/v2.9240.md @@ -1,6 +1,6 @@ # v2.9240 — Release of record: a lien takes one release, whatever the window shows (2026-12-02) -Step 8 of punch list #479 (the release road's faults), finding 817. **Owes prod one `supabase db push`** after the merge: migration `20261202211100_one_live_release_a_lien.sql`. Stacked on v2.9239, which changes the same card. +Step 8 of punch list #479 (the release road's faults), finding 817. **Owes prod one `supabase db push`** after the merge: migration `20261203043643_one_live_release_a_lien.sql`. Stacked on v2.9239, which changes the same card. ## What was wrong @@ -12,7 +12,7 @@ Step 8 of punch list #479 (the release road's faults), finding 817. **Owes prod - [`LienFilingTabs.tsx`](../../src/components/jobs/LienFilingTabs.tsx): `recordRelease` takes one save at a time and first asks the database for a live release that names this lien. If one is there it saves nothing, says *This lien already has a saved release. It is shown now.* and reads the job again. - The migration adds a partial unique index on `fields ->> 'releasesFilingId'` over live releases. `isOneLiveReleaseRefusal` reads its refusal by the index's name, and the save answers with the same sentence. - [`LienInstrumentsModal.tsx`](../../src/components/jobs/LienInstrumentsModal.tsx): a reload of the lien records that fails keeps what the window holds and says so (`LIEN_WINDOW_FILINGS_UNREAD`). -- [`docs/migrations/20261202211100_one_live_release_a_lien.md`](../migrations/20261202211100_one_live_release_a_lien.md) has the order, the proof and what a failed push means. +- [`docs/migrations/20261203043643_one_live_release_a_lien.md`](../migrations/20261203043643_one_live_release_a_lien.md) has the order, the proof and what a failed push means. ## Order on prod diff --git a/src/lib/jobs/lienReleaseOfRecord.test.ts b/src/lib/jobs/lienReleaseOfRecord.test.ts index fa09632760..85dd1e3442 100644 --- a/src/lib/jobs/lienReleaseOfRecord.test.ts +++ b/src/lib/jobs/lienReleaseOfRecord.test.ts @@ -475,7 +475,7 @@ describe('one live release a lien: the database’s refusal (finding 817, v2.924 it('carries the name the migration gives the index, and says it in plain words', () => { expect(ONE_LIVE_RELEASE_INDEX).toBe('job_lien_filings_one_live_release_idx') - const sql = readFileSync('supabase/migrations/20261202211100_one_live_release_a_lien.sql', 'utf8') + const sql = readFileSync('supabase/migrations/20261203043643_one_live_release_a_lien.sql', 'utf8') expect(sql).toContain(`CREATE UNIQUE INDEX IF NOT EXISTS ${ONE_LIVE_RELEASE_INDEX}`) expect(sql).toContain("(fields ->> 'releasesFilingId')") expect(sql).toContain('voided_at IS NULL') diff --git a/src/lib/jobs/lienReleaseOfRecord.ts b/src/lib/jobs/lienReleaseOfRecord.ts index c6403f5109..d93eade3fb 100644 --- a/src/lib/jobs/lienReleaseOfRecord.ts +++ b/src/lib/jobs/lienReleaseOfRecord.ts @@ -320,7 +320,7 @@ export function releasePaymentDatePatch(fields: unknown, day: string): Record