Skip to content

Feat/new offchain proposal notification#224

Merged
LeonardoVieira1630 merged 18 commits intodevfrom
feat/new_offchain_proposal_notification
Mar 6, 2026
Merged

Feat/new offchain proposal notification#224
LeonardoVieira1630 merged 18 commits intodevfrom
feat/new_offchain_proposal_notification

Conversation

@LeonardoVieira1630
Copy link
Member

Summary

  • Add end-to-end notification pipeline for new Snapshot (offchain) proposals: polling trigger in logic-system, dispatcher handler, message templates, and CTA buttons
  • Extend anticapture-client with listOffchainProposals GraphQL query and Zod validation schema
  • Add unit tests (logic-system trigger, dispatcher handler, anticapture-client) and integration tests (Telegram + Slack delivery)

Test coverage

File Stmts Branch Funcs Lines Tests
new-offchain-proposal-trigger.ts (logic-system) 100% 100% 100% 100% 12
new-offchain-proposal-trigger.service.ts (dispatcher) 100% 100% 100% 100% 9

@LeonardoVieira1630 LeonardoVieira1630 self-assigned this Feb 26, 2026
@vercel
Copy link

vercel bot commented Feb 26, 2026

@LeonardoVieira1630 must be a member of the Blockful team on Vercel to deploy.
- Click here to add @LeonardoVieira1630 to the team.
- If you initiated this build, request access.
- If you're already a member of the Blockful team, make sure that your Vercel account is connected to your GitHub account.

Learn more about collaboration on Vercel and other options here.

@LeonardoVieira1630 LeonardoVieira1630 added the enhancement New feature or request label Feb 26, 2026
Copy link
Member

@pikonha pikonha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Overall

Well-structured PR that follows existing patterns closely. Excellent test coverage (100% on trigger + handler). Clean separation of concerns across the stack.

Issues

1. initialTimestamp parsing may silently produce wrong cursor values
new-offchain-proposal-trigger.ts:18parseInt(initialTimestamp, 10) assumes a numeric string (epoch seconds), but the integration test passes an ISO string via new Date(Date.now() - timeouts.wait.long).toISOString(). parseInt("2026-03-05T...") returns 2026, which is incorrect. Worth verifying this doesn't produce bad cursor values in practice.

2. Dist files committed
packages/anticapture-client/dist/ changes add ~1500 lines of generated code. If there's no CI build step this is understandable, but it bloats the PR significantly and makes review harder. Consider adding a build step to CI instead.

3. Unrelated schema field-order churn in dist/schemas.d.ts
Large chunks of the diff are just reordering value/from/to fields — likely a TypeScript/codegen artifact. Not a bug, but adds noise.

4. Potential graphql version conflict
Adding msw@2.12.10 pulls in graphql@16.13.0 while the project already has graphql@16.11.0. Verify there are no runtime conflicts from duplicate GraphQL versions.

5. pnpm-lock.yaml churn
~200 lines of lockfile changes beyond msw, with resolution flips between @types/node@20.17.46 and @types/node@24.3.1. May indicate different Node versions across contributors — consider pinning @types/node.

Minor / Nits

  • Missing trailing newline in anticapture-client.ts and fixtures/index.ts
  • Sequential DAO querying in listOffchainProposals is consistent with existing code but could benefit from Promise.allSettled for parallelization in the future
  • crypto import in new-offchain-proposal-trigger.service.ts just for randomUUID() — available globally in Node 19+

Verdict

Looks good overall. Main item to address is #1 (timestamp parsing). The rest are minor.

import { AnticaptureClient } from '@notification-system/anticapture-client';
import { OffchainProposalDataSource, OffchainProposal, ListOffchainProposalsOptions } from '../interfaces/offchain-proposal.interface';

export class OffchainProposalRepository implements OffchainProposalDataSource {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is more like a service than a repository to me

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont agree hehe

Comment on lines +341 to +373
async listOffchainProposals(
variables?: ListOffchainProposalsQueryVariables,
daoId?: string
): Promise<(OffchainProposalItem & { daoId: string })[]> {
if (!daoId) {
const allDAOs = await this.getDAOs();
const allProposals: (OffchainProposalItem & { daoId: string })[] = [];

for (const dao of allDAOs) {
try {
const validated = await this.query(ListOffchainProposalsDocument, SafeOffchainProposalsResponseSchema, variables, dao.id);
const items = validated.offchainProposals.items.map(item => ({ ...item, daoId: dao.id }));
if (items.length > 0) {
allProposals.push(...items);
}
} catch (error) {
console.warn(`Skipping offchain proposals for ${dao.id} due to API error: ${error instanceof Error ? error.message : error}`);
}
}

// Sort by created timestamp desc (most recent first)
allProposals.sort((a, b) => b.created - a.created);
return allProposals;
}

try {
const validated = await this.query(ListOffchainProposalsDocument, SafeOffchainProposalsResponseSchema, variables, daoId);
return validated.offchainProposals.items.map(item => ({ ...item, daoId }));
} catch (error) {
console.warn(`Error querying offchain proposals for DAO ${daoId}: ${error instanceof Error ? error.message : error}`);
return [];
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im pretty sure this could be simplified by relying on TS types like ReturnType. not something we should worry now, but nice to have in mind

@vercel
Copy link

vercel bot commented Mar 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flow-editor Ready Ready Preview, Comment Mar 6, 2026 5:51pm
notification-system-dashboard Ready Ready Preview, Comment Mar 6, 2026 5:51pm

Request Review

@LeonardoVieira1630 LeonardoVieira1630 merged commit df41da0 into dev Mar 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants