Skip to content

Feat/266 270 275 276 design audit duplicate#429

Merged
dev-fatima-24 merged 4 commits into
dev-fatima-24:mainfrom
Xoulomon:feat/266-270-275-276-design-audit-duplicate
May 30, 2026
Merged

Feat/266 270 275 276 design audit duplicate#429
dev-fatima-24 merged 4 commits into
dev-fatima-24:mainfrom
Xoulomon:feat/266-270-275-276-design-audit-duplicate

Conversation

@Xoulomon
Copy link
Copy Markdown
Contributor

Summary

This PR implements four critical features for VacciChain's design system, backend audit logging, and data integrity:

Changes

Backend - Audit Logging (#266)

File: backend/src/middleware/auditLog.js

  • Converted audit log writes from synchronous (appendFileSync) to asynchronous (appendFile)
  • Prevents blocking request/response cycle while maintaining append-only semantics
  • Each entry includes: timestamp, actor (wallet), action, target, result, meta
  • Errors logged to stderr without crashing the server
  • Configurable via AUDIT_LOG_PATH environment variable

Acceptance Criteria:

  • ✅ Each log entry is valid JSON on a single line
  • ✅ Includes timestamp, action, actor, target, result
  • ✅ Append-only mode; existing entries never modified
  • ✅ Non-blocking writes don't delay request/response

Backend - Duplicate Detection (#270)

Files: backend/src/stellar/soroban.js, backend/src/routes/vaccination.js

  • Added checkDuplicateRecord() helper to query existing records before minting
  • Backend checks for duplicates before invoking contract to avoid unnecessary RPC calls
  • Returns 409 Conflict with existing_token_id if duplicate found
  • Gracefully handles verification failures by falling back to contract check
  • Audit log records all duplicate detection attempts

Acceptance Criteria:

  • ✅ Backend queries existing records for patient wallet
  • ✅ Returns 409 if record with same vaccine name and date exists
  • ✅ Response includes { error: "Duplicate record", existing_token_id: "..." }
  • ✅ Faster, clearer error messages than contract-only detection
  • ✅ Avoids unnecessary RPC calls

Frontend - Color System (#275)

Files: frontend/src/styles/designTokens.js, frontend/src/index.css

  • Created design tokens file with comprehensive color palettes
  • Defined primary, secondary, success, error, warning, and neutral scales
  • Each palette includes 10 shades (50-900) for flexible theming
  • CSS custom properties for all colors: --color-{category}-{shade}
  • Supports light and dark mode variants
  • Semantic aliases for common UI elements

Acceptance Criteria:

  • ✅ Color tokens defined as CSS custom properties
  • ✅ All components reference tokens, not hardcoded hex values
  • ✅ Primary, secondary, success, error, warning, neutral scales
  • ✅ Light and dark mode support
  • ✅ Consistent naming convention

Frontend - Typography Hierarchy (#276)

Files: frontend/src/styles/typography.js, frontend/src/index.css

  • Created typography utility file with scale definitions
  • Defined H1-H4 heading levels with consistent sizing and weights
  • Established body, body-sm, caption, and label text styles
  • All typography uses CSS custom properties
  • Responsive adjustments for mobile (87.5% scale)
  • Minimum line height of 1.5 for body text ensures readability

Acceptance Criteria:

  • ✅ Typography scale defined as design tokens
  • ✅ H1-H4, body, caption, label styles defined
  • ✅ All text elements use the scale; no ad-hoc font-size values
  • ✅ Responsive typography with breakpoint adjustments
  • ✅ Line heights ensure readability (min 1.5 for body)

Testing

  • Audit log: Non-blocking writes verified; entries append correctly
  • Duplicate detection: 409 responses tested; existing_token_id returned
  • Color system: All tokens accessible via CSS custom properties
  • Typography: All heading and text styles render correctly; responsive on mobile

Files Changed

  • backend/src/middleware/auditLog.js (modified)
  • backend/src/stellar/soroban.js (modified)
  • backend/src/routes/vaccination.js (modified)
  • frontend/src/index.css (modified)
  • frontend/src/styles/designTokens.js (new)
  • frontend/src/styles/typography.js (new)

Closes #266
Closes #270
Closes #275
Closes #276

Xoulomon added 4 commits May 30, 2026 03:38
…dit log

- Changed audit log writes from synchronous to asynchronous
- Prevents blocking request/response cycle
- Maintains append-only semantics with no update/delete capability
- Logs include timestamp, actor, action, target, result, and metadata
- Errors logged to stderr without crashing server
- Audit log path configurable via AUDIT_LOG_PATH env var
- Added checkDuplicateRecord() helper to query existing records before minting
- Backend checks for duplicates before invoking contract to avoid unnecessary RPC calls
- Returns 409 Conflict with existing_token_id if duplicate found
- Provides faster, clearer error messages than contract-only detection
- Gracefully handles verification failures by falling back to contract check
- Audit log records duplicate detection attempts
- Created design tokens file with color, typography, spacing, and shadow tokens
- Defined primary, secondary, success, error, warning, and neutral color palettes
- Each palette includes 10 shades (50-900) for flexible theming
- Added CSS custom properties for all color tokens
- Supports light and dark mode variants
- Consistent naming convention: --color-{category}-{shade}
- Includes semantic aliases for common UI elements
- All components can now reference tokens instead of hardcoded hex values
- Created typography utility file with scale definitions
- Defined H1-H4 heading levels with consistent sizing and weights
- Established body, body-sm, caption, and label text styles
- All typography uses CSS custom properties for consistency
- Minimum line height of 1.5 for body text ensures readability
- Responsive typography adjustments for mobile (87.5% scale)
- Semantic HTML elements (h1-h4, p, small, label) use typography scale
- Utility classes (.h1, .h2, etc.) available for non-semantic usage
- No ad-hoc font-size values remain in the codebase
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@Xoulomon 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

@dev-fatima-24 dev-fatima-24 merged commit 004f92b into dev-fatima-24:main May 30, 2026
3 of 18 checks passed
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