feat: log aggregation and retention#3
Open
devEunicee wants to merge 319 commits into
Open
Conversation
…act-versioning feat(contracts): add version tracking and migration support (AnnabelJoe#70)
…ng-env feat(infra): set up staging environment on Vercel (AnnabelJoe#89)
docs(adr): add ADR template, index, and 4 ADRs (AnnabelJoe#99)
feat(backup): daily pg_dump to S3 with 30-day retention and Slack ale…
docs: add API reference for all endpoints (AnnabelJoe#96)
fix(ci): commit pnpm lockfile for frozen-lockfile enforcement (AnnabelJoe#86)
…itoring feat(monitoring): add uptime checks for /api/health and /verify (AnnabelJoe#84)
) - Add auth.cooperative_id() and auth.is_admin() JWT claim helpers - Enable RLS on cooperatives, meters, readings, certificates - Operators scoped to their own cooperative_id via JWT app_metadata claim - readings scoped via parent meter's cooperative_id (no direct FK) - Admin role bypasses all restrictions - Migration 004: 5-assertion DO block tests cross-operator isolation
…nnabelJoe#61) - Fix metadata: name 'SolarProof kWh', symbol 'SKWH' - Add DataKey::Allowance(from, spender) storage key - Implement approve(), allowance(), transfer_from(), burn_from() - Extract move_balance/deduct_balance/add_burned/spend_allowance helpers - Fix setup() to consistently return 2-tuple across all tests - Add 8 SEP-41 compliance tests: metadata, approve, allowance, transfer_from, burn_from, overwrite, revoke, cross-operator guard
…age (AnnabelJoe#56) Add 14 missing tests covering all functions and edge cases: - initialize: double-init panics - balance: zero for unknown account - total_supply: zero before any mint - mint: zero amount panics - transfer: zero amount panics, no balance panics, self-transfer - burn: zero amount panics, no balance panics - approve: negative amount panics - transfer_from: zero amount panics - burn_from: zero amount panics - set_minter: rotates minter correctly - admin: returns correct address
…token-coverage Test/issue 56 energy token coverage
- Add VoteLock key to DataKey enum - Set lock at entry of vote(), clear on exit - Panic with 'reentrant call' if lock already held - State updates (bitmap + proposals) happen before lock release - Add test_vote_reentrancy_rejected test Closes AnnabelJoe#53
- Add ApiSigner key to DataKey enum - initialize() now requires api_signer address alongside admin - anchor() takes caller param; panics 'unauthorized' if caller != api_signer - set_api_signer() allows admin to rotate the authorized signer - Tests updated: unauthorized caller rejected, set_api_signer coverage Closes AnnabelJoe#52
…l-anchor fix(audit-registry): add access control to anchor() [AnnabelJoe#52]
…ard-vote fix(governance): add reentrancy guard to vote() [AnnabelJoe#53]
- Add PendingUpgrade key and UpgradeProposal struct to DataKey - propose_upgrade(): admin-only, stores wasm hash + unlock_ledger (now + 17280 ledgers ≈ 48h) - cancel_upgrade(): admin-only, removes pending proposal within window - execute_upgrade(): admin-only, calls update_current_contract_wasm after timelock - pending_upgrade() getter - Events emitted: upg_prop, upg_cncl, upg_exec - Tests: proposal stored, duplicate rejected, cancel works, execute before timelock panics Closes AnnabelJoe#55
- not-found.tsx: branded 404 with Sun icon and link back to /dashboard - error.tsx: branded 500 with error reference ID (error.digest fallback), Try again reset button, and link back to /dashboard - Both pages use existing Tailwind classes and are accessible/responsive Closes AnnabelJoe#22
…-pages feat(web): add custom 404 and 500 error pages [AnnabelJoe#22]
…lock feat(governance): add contract upgrade mechanism with 48h timelock [AnnabelJoe#55]
…lication-integration-test Add audit registry deduplication + local Soroban integration tests
- Add pnpm test step between type-check and build - Cache apps/web/.next/cache keyed on source files + lockfile - Add TURBO_TOKEN/TURBO_TEAM env to build step Closes AnnabelJoe#76
… support - Add src/lib/secrets.ts: getMinterKeypair() and getValidMinterKeypairs() - Previous key stays valid for 24 h after rotation (grace window) - Every key load is written to the Supabase audit_log table - stellar.ts updated to call getMinterKeypair() instead of reading env directly - env.ts: MINTER_SECRET_ARN (required in prod), MINTER_PREVIOUS_SECRET_ARN (grace window), MINTER_SECRET_KEY (local dev fallback) - .env.example updated with new vars - Add @aws-sdk/client-secrets-manager dependency Closes AnnabelJoe#50
- Add src/lib/logger.ts: structured JSON logger that ships to Logtail in production and falls back to stdout locally - env.ts: add optional LOGTAIL_SOURCE_TOKEN server var - .env.example: document LOGTAIL_SOURCE_TOKEN - docs/LOGGING.md: setup guide, log format, alert configuration Closes AnnabelJoe#92
- .github/workflows/branch-protection.yml: applies protection rules via GitHub API on push to main (or manual trigger) - Rules: 1 required approval, stale review dismissal, CI must pass, no force pushes, no deletions, conversation resolution required - enforce_admins: true on main, false on develop - docs/BRANCH_PROTECTION.md: setup guide and rule reference Closes AnnabelJoe#81
- Accept up to 100 signed meter readings in a single request - Validate and anchor each reading independently in parallel - Return per-reading status with partial success (HTTP 207) - Bulk-fetch meters in one DB query for efficiency Also fixes pre-existing CI failures: - Add eslint.config.mjs (ESLint was unconfigured) - Fix SorobanRpc import (renamed to Soroban.rpc in stellar-sdk v13) - Fix Sentry hideSourceMaps -> sourcemaps.disable (v9 API) - Fix database.types.ts to satisfy GenericSchema (add Relationships) - Fix verify() -> verifyAsync() (@noble/ed25519 v3 sync API change) - Add missing @noble/ed25519 and @eslint/eslintrc deps
- Add .github/workflows/blue-green-deploy.yml: deploy preview → health checks (5x) → promote to production - Add docs/runbook/blue-green-deployment.md: step-by-step runbook with rollback instructions - Health checks run against preview URL before any traffic shift - Instant rollback via vercel promote <previous-url> Closes AnnabelJoe#301
…-deployment devops(deploy): add blue-green deployment strategy for zero-downtime releases
…g-checks ci(lint): add Prettier formatting check to CI and pre-commit hooks
…lth-checks devops(docker): add health checks for all services
…ction fix: implement CSRF protection for state-changing API endpoints
## [1.7.1](AnnabelJoe/solarproof@v1.7.0...v1.7.1) (2026-05-29) ### Bug Fixes * implement CSRF protection for state-changing API endpoints ([AnnabelJoe#335](AnnabelJoe#335)) ([2c6c8c8](AnnabelJoe@2c6c8c8))
…sions docs(adr): add ADR-005 monorepo structure and ADR-006 certificate retirement model
…automation feat: automate Stellar Testnet faucet funding in CI
## [1.8.0](AnnabelJoe/solarproof@v1.7.1...v1.8.0) (2026-05-29) ### Features * automate Stellar Testnet faucet funding in CI ([AnnabelJoe#303](AnnabelJoe#303)) ([25598db](AnnabelJoe@25598db)) ### Documentation * **adr:** add ADR-005 monorepo structure and ADR-006 certificate retirement model ([d7c679a](AnnabelJoe@d7c679a)), closes [AnnabelJoe#311](AnnabelJoe#311)
…ack-protection fix: add replay attack protection to audit_registry contract
## [1.8.1](AnnabelJoe/solarproof@v1.8.0...v1.8.1) (2026-05-29) ### Bug Fixes * add replay attack protection to audit_registry contract ([AnnabelJoe#280](AnnabelJoe#280)) ([b4e10b7](AnnabelJoe@b4e10b7))
…erflow-audit fix: use checked arithmetic in energy_token to prevent integer overflow
## [1.8.2](AnnabelJoe/solarproof@v1.8.1...v1.8.2) (2026-05-29) ### Bug Fixes * use checked arithmetic in energy_token to prevent overflow ([AnnabelJoe#277](AnnabelJoe#277)) ([f526e26](AnnabelJoe@f526e26))
…t, and governance contract tests
…elJoe#282\n\nCloses AnnabelJoe#310\nCloses AnnabelJoe#292\nCloses AnnabelJoe#305\nCloses AnnabelJoe#282
AnnabelJoe#282\n\nCloses AnnabelJoe#310\nCloses AnnabelJoe#292\nCloses AnnabelJoe#305\nCloses AnnabelJoe#282
…-smoke-governance-tests Add contract docs, backup recovery guide, smoke test, and governance tests
✅ pnpm audit |
🔍 Vercel Preview DeploymentURL: Learn More: https://err.sh/vercel/no-credentials-found
|
| * violations are found. Baseline violations (if any) are documented below. | ||
| */ | ||
|
|
||
| import { test, expect } from '@playwright/test' |
|
|
||
| const METER_ID = '123e4567-e89b-12d3-a456-426614174000' | ||
| const KWH = 12.5 | ||
| const TIMESTAMP = 1_700_000_000 |
| /** Build a Supabase mock that returns the given meter row. */ | ||
| function mockDb(meter: unknown) { | ||
| const single = vi.fn().mockResolvedValue({ data: meter, error: null }) | ||
| const eq = vi.fn().mockReturnValue({ single }) |
Comment on lines
+3
to
+12
| import { | ||
| Zap, | ||
| ShieldCheck, | ||
| Link2, | ||
| Award, | ||
| FlameKindling, | ||
| ExternalLink, | ||
| CheckCircle2, | ||
| Clock, | ||
| } from 'lucide-react' |
|
|
||
| export function Navbar() { | ||
| const pathname = usePathname() | ||
| const { resolvedTheme, setTheme } = useTheme() |
| } | ||
|
|
||
| /** Delays that grow as 1 s, 2 s, 4 s for attempts 1, 2, 3. */ | ||
| const BACKOFF_MS = [1_000, 2_000, 4_000] |
|
|
||
| /** Delays that grow as 1 s, 2 s, 4 s for attempts 1, 2, 3. */ | ||
| const BACKOFF_MS = [1_000, 2_000, 4_000] | ||
| const MAX_RETRIES = 3 |
| const inMock = vi.fn().mockReturnValue({ error: null }) | ||
| deleteMock.mockReturnValue({ in: inMock }) | ||
|
|
||
| function makeInsertMock(row: Record<string, unknown>) { |
|
|
||
| #[test] | ||
| fn test_api_signer_query() { | ||
| let (env, api_signer, client) = setup(); |
✅ cargo audit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes AnnabelJoe#299
Changes