isStale), so users like SE Region can keep agreements current for report lock without treating charge/service-only edits as invalidating a signature.signedContentHash, which commonly happens after charges change because stale checks run from inspection and charge streams.jobCreationType === 'attik' in the stale worker). The ask is a configurable policy, not a hard-coded region exception.queueAgreementStaleCheck debounces ~30s then agreementStaleWorker recomputes merged content and flips isStale when the hash diverges. Report unlock uses agreementLockSync: only non-stale active agreements count as signed for lock purposes, so all active rows stale leaves reports locked even if something is still “signed” on paper.src/events/streamHandlers/chargeStream.ts (insert/update/delete paths that call queueAgreementStaleCheck), and inspection updates in src/events/streamHandlers/inspectionStream.ts (e.g. datetime reschedule, charges / charges.*, people, address/property — the latter two are already gated so they do not double-queue when hasChargesChange is true). Policy work will need a clear rule for which paths still enqueue a stale check under an opted-in template/company.src/events/bullmq/agreementStaleWorker.ts (queueAgreementStaleCheck, processStaleCheck, merge + signedContentHash / computeSignedContentHash flow) and helpers such as mergeAgreementBlocksToContent and resolveAgreementTextForStaleCheck imported there — today the worker compares full resolved text; selective behavior may mean skipping the job, no-oping when the only pending change class is charge-only, or narrowing what invalidates, depending on the approach the implementer chooses.src/models/agreementSchema.ts (isStale, staleAt, signedContentHash, template link via _agreementTemplateId). Template documents use src/models/agreementTemplateSchema.ts (timestamps exist for versioning-style signals; no dedicated “version” field beyond normal doc evolution — decision needed on how to represent policy and template identity).src/util/functions/agreements/agreementLockSync.ts encodes the non-stale-only signed rule used by src/util/functions/inspection/checkReportAccess.ts and by src/events/streamHandlers/agreementStream.ts when syncing inspection.agreement.signed / present. If product changes when rows count as stale vs signed, keep portal and API behavior consistent with those rules.tests/unit/agreementLockSync.test.ts and tests/integration/lockReport.test.ts — extend or add cases when behavior flags change.attik-frontend/src/util/functions/report/computeAgreementSignedForReportLock.ts (see cross-repo note in agreementLockSync.ts). Any change to what counts as signed for lock must stay aligned with backend and be regression-tested in the portal paths that consume the same semantics.src/events/bullmq/agreementStaleWorker.ts, src/events/streamHandlers/inspectionStream.ts, src/events/streamHandlers/chargeStream.tssrc/util/functions/agreements/agreementLockSync.ts, src/util/functions/inspection/checkReportAccess.ts, src/events/streamHandlers/agreementStream.tsattik-frontend/src/util/functions/report/computeAgreementSignedForReportLock.tsPlease authenticate to join the conversation.
Canceled
Main App
26 days ago
Linear
Get notified by email when there are changes.
Canceled
Main App
26 days ago
Linear
Get notified by email when there are changes.