OH10: fix fixtures, bypass comment, drop unsupported metadata

Align list view-model test fixtures with updatedAt, justify the CAS
advisor read bypass, and remove createOfflineAction metadata the
TanStack API does not accept.

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
This commit is contained in:
Cursor Agent 2026-08-02 01:36:31 +00:00
parent a517638e3c
commit 26bda9e430
No known key found for this signature in database
4 changed files with 9 additions and 7 deletions

View file

@ -297,6 +297,8 @@ export const assignMunicipalityAdvisorsRecord = async (
await acquireTextAdvisoryLocks(payload, req, [`municipality-advisors:${municipality}`]) await acquireTextAdvisoryLocks(payload, req, [`municipality-advisors:${municipality}`])
if (enforceCas && baseUpdatedAt !== undefined) { if (enforceCas && baseUpdatedAt !== undefined) {
// Intentional admin bypass: unrestricted role verified above; advisors
// field access would otherwise hide `updatedAt` from some actors.
const current = await payload.findByID({ const current = await payload.findByID({
collection: 'municipality', collection: 'municipality',
id: municipality, id: municipality,

View file

@ -48,8 +48,6 @@ const municipalityUpdatesCollection = createRowCollection<OpsMunicipalityUpdate>
'ops-municipality-updates', 'ops-municipality-updates',
) )
export { municipalityUpdatesCollection }
let goalsMirror: OpsGoals | null = null let goalsMirror: OpsGoals | null = null
let revisedAtMirror: string = new Date(0).toISOString() let revisedAtMirror: string = new Date(0).toISOString()
let schemaVersionMirror: number = OPS_MIRROR_SCHEMA_VERSION let schemaVersionMirror: number = OPS_MIRROR_SCHEMA_VERSION

View file

@ -381,7 +381,6 @@ export const enqueueDeclareVotes = async (input: {
const run = executor.createOfflineAction<typeof input>({ const run = executor.createOfflineAction<typeof input>({
mutationFnName: DECLARE_MUTATION_FN, mutationFnName: DECLARE_MUTATION_FN,
metadata: { declareKey: id },
onMutate: (variables) => { onMutate: (variables) => {
const next: OpsDeclareVotesOutboxRow = { const next: OpsDeclareVotesOutboxRow = {
id, id,
@ -428,7 +427,6 @@ export const enqueueMunicipalityUpdate = async (input: {
const executor = await getOpsMunicipalityOfflineExecutor() const executor = await getOpsMunicipalityOfflineExecutor()
const run = executor.createOfflineAction<typeof input>({ const run = executor.createOfflineAction<typeof input>({
mutationFnName: MUNICIPALITY_UPDATE_MUTATION_FN, mutationFnName: MUNICIPALITY_UPDATE_MUTATION_FN,
metadata: { clientId: input.clientId },
onMutate: (variables) => { onMutate: (variables) => {
const next: OpsMunicipalityUpdateOutboxRow = { const next: OpsMunicipalityUpdateOutboxRow = {
id: variables.clientId, id: variables.clientId,
@ -465,7 +463,6 @@ export const enqueuePoliticalTrend = async (input: {
const executor = await getOpsMunicipalityOfflineExecutor() const executor = await getOpsMunicipalityOfflineExecutor()
const run = executor.createOfflineAction<typeof input>({ const run = executor.createOfflineAction<typeof input>({
mutationFnName: TREND_MUTATION_FN, mutationFnName: TREND_MUTATION_FN,
metadata: { municipalityId: input.municipalityId },
onMutate: (variables) => { onMutate: (variables) => {
const next: OpsPoliticalTrendOutboxRow = { const next: OpsPoliticalTrendOutboxRow = {
municipalityId: variables.municipalityId, municipalityId: variables.municipalityId,
@ -503,7 +500,6 @@ export const enqueueEngagementLevel = async (input: {
const executor = await getOpsMunicipalityOfflineExecutor() const executor = await getOpsMunicipalityOfflineExecutor()
const run = executor.createOfflineAction<typeof input>({ const run = executor.createOfflineAction<typeof input>({
mutationFnName: ENGAGEMENT_MUTATION_FN, mutationFnName: ENGAGEMENT_MUTATION_FN,
metadata: { municipalityId: input.municipalityId },
onMutate: (variables) => { onMutate: (variables) => {
const next: OpsEngagementLevelOutboxRow = { const next: OpsEngagementLevelOutboxRow = {
municipalityId: variables.municipalityId, municipalityId: variables.municipalityId,
@ -537,7 +533,6 @@ export const enqueueAdvisorsAssignment = async (input: {
const executor = await getOpsMunicipalityOfflineExecutor() const executor = await getOpsMunicipalityOfflineExecutor()
const run = executor.createOfflineAction<typeof input>({ const run = executor.createOfflineAction<typeof input>({
mutationFnName: ADVISORS_MUTATION_FN, mutationFnName: ADVISORS_MUTATION_FN,
metadata: { municipalityId: input.municipalityId },
onMutate: (variables) => { onMutate: (variables) => {
const next: OpsAdvisorsOutboxRow = { const next: OpsAdvisorsOutboxRow = {
municipalityId: variables.municipalityId, municipalityId: variables.municipalityId,

View file

@ -194,6 +194,7 @@ describe('campaign visual foundation', () => {
priority: 'alta', priority: 'alta',
lastUpdateAt: null, lastUpdateAt: null,
lastSignalAt: null, lastSignalAt: null,
updatedAt: '2026-08-01T00:00:00.000Z',
expectedVotes: { pessimistic: null, central: 1500, optimistic: null }, expectedVotes: { pessimistic: null, central: 1500, optimistic: null },
politicalTrendStatus: 'favoravel', politicalTrendStatus: 'favoravel',
politicalTrendNote: null, politicalTrendNote: null,
@ -237,6 +238,7 @@ describe('campaign visual foundation', () => {
priority: 'normal', priority: 'normal',
lastUpdateAt: null, lastUpdateAt: null,
lastSignalAt: null, lastSignalAt: null,
updatedAt: '2026-08-01T00:00:00.000Z',
expectedVotes: toVoteEstimateScenarioViewModel(null), expectedVotes: toVoteEstimateScenarioViewModel(null),
politicalTrendStatus: null, politicalTrendStatus: null,
politicalTrendNote: null, politicalTrendNote: null,
@ -377,6 +379,7 @@ describe('campaign visual foundation', () => {
priority: 'alta', priority: 'alta',
lastUpdateAt: staleSignal, lastUpdateAt: staleSignal,
lastSignalAt: staleSignal, lastSignalAt: staleSignal,
updatedAt: '2026-08-01T00:00:00.000Z',
expectedVotes: toVoteEstimateScenarioViewModel(null), expectedVotes: toVoteEstimateScenarioViewModel(null),
politicalTrendStatus: null, politicalTrendStatus: null,
politicalTrendNote: null, politicalTrendNote: null,
@ -421,6 +424,7 @@ describe('campaign visual foundation', () => {
priority: 'normal', priority: 'normal',
lastUpdateAt: null, lastUpdateAt: null,
lastSignalAt: null, lastSignalAt: null,
updatedAt: '2026-08-01T00:00:00.000Z',
expectedVotes: toVoteEstimateScenarioViewModel(null), expectedVotes: toVoteEstimateScenarioViewModel(null),
politicalTrendStatus: null, politicalTrendStatus: null,
politicalTrendNote: null, politicalTrendNote: null,
@ -462,6 +466,7 @@ describe('campaign visual foundation', () => {
priority: 'normal', priority: 'normal',
lastUpdateAt: null, lastUpdateAt: null,
lastSignalAt: null, lastSignalAt: null,
updatedAt: '2026-08-01T00:00:00.000Z',
expectedVotes: toVoteEstimateScenarioViewModel(null), expectedVotes: toVoteEstimateScenarioViewModel(null),
politicalTrendStatus: null, politicalTrendStatus: null,
politicalTrendNote: null, politicalTrendNote: null,
@ -509,6 +514,7 @@ describe('campaign visual foundation', () => {
priority: 'alta', priority: 'alta',
lastUpdateAt: null, lastUpdateAt: null,
lastSignalAt: null, lastSignalAt: null,
updatedAt: '2026-08-01T00:00:00.000Z',
expectedVotes: toVoteEstimateScenarioViewModel(null), expectedVotes: toVoteEstimateScenarioViewModel(null),
politicalTrendStatus: null, politicalTrendStatus: null,
politicalTrendNote: null, politicalTrendNote: null,
@ -582,6 +588,7 @@ describe('campaign visual foundation', () => {
priority: 'normal' as const, priority: 'normal' as const,
lastUpdateAt: null, lastUpdateAt: null,
lastSignalAt: null, lastSignalAt: null,
updatedAt: '2026-08-01T00:00:00.000Z',
expectedVotes: toVoteEstimateScenarioViewModel(null), expectedVotes: toVoteEstimateScenarioViewModel(null),
politicalTrendStatus: null, politicalTrendStatus: null,
politicalTrendNote: null, politicalTrendNote: null,