Skip to content

Preprod readiness: wire contract circuits, link ledger parser, fix CVEs, add feature flags#56

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/check-repo-preprod-readiness
Draft

Preprod readiness: wire contract circuits, link ledger parser, fix CVEs, add feature flags#56
Copilot wants to merge 4 commits intomainfrom
copilot/check-repo-preprod-readiness

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 10, 2026

Completes the contract integration layer so the codebase is ready for preprod deployment once contract addresses are populated.

Security: npm vulnerabilities (27 → 8, 0 critical/high)

  • npm audit fix resolves 19 transitive vulnerabilities
  • react-router-dom 6.17.0 → 6.30.3 in both frontends (XSS via open redirect, GHSA-2w69-qvjg-hvjx)
  • Remaining 8 are low/moderate with no available fix (elliptic transitive, esbuild dev-only)

Link @autodiscovery/contract ledger parser into discovery-core-reader

  • Add workspace dependency @autodiscovery/contract: "*" to frontend-realdeal
  • Replace heuristic rawState.includes(id) string matching with typed DiscoveryCore.ledger() calls in both frontends
import { DiscoveryCore } from '@autodiscovery/contract';

const parsed = DiscoveryCore.ledger(rawState as any);
const exists = parsed.caseStatusByCaseIdentifier.member(caseId);
const statusCode = Number(parsed.caseStatusByCaseIdentifier.lookup(caseId));

Wire callTx.* circuit calls in all 6 providers

  • New chain/bytes-utils.ts with hexToBytes32, tierToNumber, categoryToNumber, stringToBytes32
  • All 6 providers use wallet-guard pattern — local-only fallback when wallet isn't connected:
Provider Circuit
real-case createNewCase + chain mapping storage
real-compliance attestStepLevelCompliance
real-access-control grantDocumentAccessToParticipant, revokeDocumentAccessFromParticipant
real-document registerDocument
real-expert-witness registerExpertWitness
real-jurisdiction verifyRulePackHashMatchesExpected

Feature flags for off-chain providers

  • VITE_FEATURE_AI, VITE_FEATURE_EMAIL_SAFETY, VITE_FEATURE_CONTACTS — default true, set "false" to disable
  • When disabled, providers return safe defaults (empty arrays, zero scores) instead of operating

Still requires manual action

  • Contract deployment: deploy 6 Compact contracts to preprod, populate VITE_CONTRACT_* env vars
  • configureProviders() was already complete in midnight-connection.ts — no changes needed

Copilot AI and others added 3 commits April 10, 2026 13:52
- npm audit fix: 27 → 8 vulnerabilities (fix flatted, glob, undici, vite, yaml, etc.)
- Update react-router-dom 6.17.0 → 6.30.3 (both frontends) — fixes GHSA-2w69-qvjg-hvjx XSS
- Remaining 8 are low/moderate with no available fix (elliptic transitive, esbuild dev-only)

Agent-Logs-Url: https://github.com/SpyCrypto/AutoDiscovery/sessions/39c17a3b-b2c6-42a5-8a49-8f91b5f03888

Co-authored-by: SpyCrypto <[email protected]>
…rser

- Add @autodiscovery/contract as workspace dep to frontend-realdeal
- Create bytes-utils.ts with hexToBytes32, tierToNumber, categoryToNumber, etc.
- Wire createNewCase in real-case.ts with chain mapping storage
- Wire attestStepLevelCompliance in real-compliance.ts
- Wire grantDocumentAccessToParticipant + revokeDocumentAccessFromParticipant in real-access-control.ts
- Wire registerDocument in real-document.ts
- Wire registerExpertWitness in real-expert-witness.ts
- Wire verifyRulePackHashMatchesExpected in real-jurisdiction.ts
- Replace heuristic string matching with DiscoveryCore.ledger() parser in both frontends
- All write operations use wallet-guard pattern (graceful local-only fallback)

Agent-Logs-Url: https://github.com/SpyCrypto/AutoDiscovery/sessions/39c17a3b-b2c6-42a5-8a49-8f91b5f03888

Co-authored-by: SpyCrypto <[email protected]>
…alue cast

- Add VITE_FEATURE_AI, VITE_FEATURE_EMAIL_SAFETY, VITE_FEATURE_CONTACTS env vars
- Gate AI provider methods to return safe defaults when disabled
- Gate email safety checkRecipients to return safe defaults when disabled
- Gate contacts getContactsByCaseId to return empty when disabled
- Fix DiscoveryCore.ledger() TypeScript — cast raw indexer data via `as any`
- Update both .env.realdeal files with all new config variables

Agent-Logs-Url: https://github.com/SpyCrypto/AutoDiscovery/sessions/39c17a3b-b2c6-42a5-8a49-8f91b5f03888

Co-authored-by: SpyCrypto <[email protected]>
@SpyCrypto
Copy link
Copy Markdown
Owner

@copilot resolve the merge conflicts in this pull request

Resolve 9 merge conflicts:
- frontend-realdeal/package.json: keep both sets of @midnight-ntwrk deps
- frontend-realdeal/.env.realdeal: accept deletion (now gitignored)
- 6 provider files: accept main's Phase 2 implementations (participantPublicKey,
  improved error messages, proper type casts)
- discovery-core-reader.ts: accept main's _ledgerParser dynamic import pattern
  with heuristic fallback

Co-authored-by: SpyCrypto <[email protected]>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 15, 2026

@copilot resolve the merge conflicts in this pull request

Resolved all 9 merge conflicts in ce70fd6:

  • package.json: merged dependency lists (added dapp-connector-api, fetch-zk-config-provider from main)
  • .env.realdeal: accepted deletion (now gitignored per main's a22eeb6)
  • 6 provider files + discovery-core-reader.ts: accepted main's Phase 2 implementations (participantPublicKey handling, _ledgerParser dynamic import, proper type casts, improved error messages)

All 39 frontend-realdeal tests pass, lint shows 0 errors.

Copilot AI requested a review from SpyCrypto April 15, 2026 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants