Skip to content

Fix/issues 407 408 409 410#416

Merged
hman38705 merged 6 commits intosolutions-plug:mainfrom
fejilaup-cloud:fix/issues-407-408-409-410
Mar 29, 2026
Merged

Fix/issues 407 408 409 410#416
hman38705 merged 6 commits intosolutions-plug:mainfrom
fejilaup-cloud:fix/issues-407-408-409-410

Conversation

@fejilaup-cloud
Copy link
Copy Markdown
Contributor

PR Message

Title: fix: sync API spec, docs, pagination bounds, and database schema (#407 #408 #409 #410)

Body:

This PR resolves four maintenance issues across contracts and documentation.

#410 — API_SPEC refresh
Creates API_SPEC.md from the live source code. All 50 error codes carry their correct numeric values, all 21 contract events list their exact topic
symbols and data payloads, and method signatures include the current multi-oracle parameters (oracle_id, full OracleConfig struct). Also removes duplicate
function/struct definitions in events.rs and types.rs that would have caused compile errors.

#407 — Pagination hard bounds
Exposes the already-implemented get_markets, get_markets_by_status, and get_guardians_paginated query functions in lib.rs. All three silently clamp limit
to MAX_PAGE_LIMIT = 100, bounding per-call gas and memory regardless of dataset size. Tests cover: limit clamped to max, status-filtered limit clamped,
zero limit returns empty.

#408 — Docs index links
Creates docs/README.md with links only to files that exist in the repository. Removes stale references to docs/security/SECURITY_BEST_PRACTICES.md and
docs/ARCHITECTURE.md.

#409 — Database documentation
Creates services/api/DATABASE.md with workspace-relative psql commands, the correct ordered migration list, and per-table schema documentation. Fixes
migration 002 and seed 01 to use newsletter_subscribers — the table name the application code (db.rs) actually queries — reconciling the long-standing
newsletter_subscriptions vs newsletter_subscribers naming split.

Close #407
Close #408
Close #409
Close #410

…contract queries

- Add MAX_PAGE_LIMIT = 100 constant to queries module
- Clamp limit param in get_markets, get_markets_by_status, get_guardians_paginated
- Document truncation behaviour in each function's doc-comment
- Add inline tests: clamping to max, status-filtered clamping, zero-limit
…tions-plug#407)

- Introduce MAX_PAGE_LIMIT = 100 constant in queries.rs
- Silently clamp limit in get_markets, get_markets_by_status, and
  get_guardians_paginated to prevent unbounded gas/memory usage
- Expose get_markets, get_markets_by_status, get_guardians_paginated
  in lib.rs so callers can use the paginated API
- Add unit tests: limit clamped to max, status filter clamped, zero
  limit returns empty slice
…s-plug#410)

- Create API_SPEC.md with full method signatures including multi-oracle
  parameters (oracle_id, OracleConfig fields)
- Error code table reflects all 50 ErrorCode enum values with correct
  numeric assignments
- Event table lists all emitted events with exact topic symbols and
  data payloads sourced from events.rs
- Remove duplicate emit_monitoring_state_reset definition in events.rs
- Remove duplicate UpgradeStats and PendingGuardianRemoval structs in
  types.rs
- Create docs/README.md with links only to files that exist in the repo
- Remove references to non-existent docs/security/SECURITY_BEST_PRACTICES.md
  and incorrect docs/ARCHITECTURE.md path
- Link to API_SPEC.md and services/api/openapi.yaml which are present
- Add repository layout overview reflecting the current directory tree
…s-plug#409)

- Create services/api/DATABASE.md with correct table names and
  workspace-relative commands (no absolute paths)
- Migration 002 updated to create newsletter_subscribers table with
  columns matching db.rs usage (confirmed, confirmation_token) instead
  of the stale newsletter_subscriptions schema (status)
- Seed file 01 updated to insert into newsletter_subscribers with the
  correct column list
- DATABASE.md documents the newsletter_subscribers vs
  newsletter_subscriptions naming discrepancy and provides a one-time
  ALTER TABLE migration path
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Mar 29, 2026

@fejilaup-cloud Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@hman38705 hman38705 merged commit abfe535 into solutions-plug:main Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants