Skip to content

fix: repair main build breakage (65 TS errors) + smoke-test verification#7

Open
devin-ai-integration[bot] wants to merge 3 commits into
mainfrom
devin/1784816109-smoke-test-fixes
Open

fix: repair main build breakage (65 TS errors) + smoke-test verification#7
devin-ai-integration[bot] wants to merge 3 commits into
mainfrom
devin/1784816109-smoke-test-fixes

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

After all feature branches were consolidated into main, the merged tree did not compiletsc --noEmit reported 65 errors and vitest had 1 failing test. The Caddy edge-gateway commit and the Drizzle query/enhancement helpers were authored against assumptions that didn't hold once merged. This PR repairs that breakage so main is functional (compiles, builds, tests pass) and adds a smoke test proving the auth → DB round-trip works against real Postgres.

Root causes & fixes

1. Logger arg order (caddy-service.ts, caddy-router.ts, db-enhancements.ts)
The project's logger wrapper is logger.info(message, context), but these files used pino's native logger.info(obj, message). All call sites corrected:

- logger.info({ serverId, routeId }, "Caddy route added");
+ logger.info("Caddy route added", { serverId, routeId });

2. db-queries.ts referenced columns that don't exist in the schema (35 errors)
The query builders assumed a different schema. Mapped every reference to the real Drizzle columns, e.g.:

  • users.name/users.phoneusers.firstName/users.lastName/users.phoneNumber
  • farms.namefarms.farmName
  • harvests.farmId/harvests.totalValueharvests.userId/harvests.revenue
  • carbonCredits.quantity/pricePerToncarbonCredits.tonnes / project pricePerTonne
  • iotReadings.soilMoisture/... (columns don't exist — generic metric/value model) → conditional CASE WHEN metric = '...' THEN value aggregations
  • pipelineMetrics.recordsWritten/throughputRpsCASE WHEN metricName = '...' over metricValue
  • federatedParticipants.contributionScore/localDataSizelocalAccuracy/dataPoints
  • carbonProjects.annualSequestrationannualCredits
  • marketPrices/harvests timestamp comparisons: pass Date objects instead of date strings

3. db-enhancements.ts used array destructuring on a QueryResult (node-postgres)
getDb() uses drizzle-orm/node-postgres, whose db.execute() returns { rows }, not an array:

- const [connStats] = await this.db.execute(sql`...`);
+ const { rows: connRows } = await this.db.execute(sql`...`);

The corresponding unit-test mock was returning a bare array (wrong shape for this driver); updated it to return { rows: [...] }.

4. Vitest could not load the suite (@dapr/dapr)
The real @dapr/dapr ships an ESM proto file inside a CommonJS package, which Vitest's loader can't parse. Added a test-only alias in vitest.config.tstests/mocks/dapr-stub.ts exposing the same surface used by server/dapr-client.ts. Production imports the real package unchanged.

Verification

  • npx tsc --noEmit0 errors
  • npx vitest run1076 passed, 30 skipped, 0 failed
  • npm run build → builds dist/index.js + PWA (321 precache entries)
  • Full dev server boots (Vite :3000, API :3001); Redis/Kafka absent → graceful fallback
  • Smoke test against real Postgres: auth.register → row persisted (users.id=367) → auth.login → JWT-protected auth.me returns the user; protected endpoints correctly return 401 without a token (middleware enforced)

Notes

  • The @dapr/dapr stub is strictly a test-loader workaround — it does not establish production Dapr runtime behavior.
  • 30 skipped tests are all in phase118-integration.test.ts (require live external infra).

Link to Devin session: https://app.devin.ai/sessions/87560355a8b7425392cbfab1aa9e89fa
Requested by: @munisp

…addy + db layers

- caddy-service.ts / caddy-router.ts: correct logger call arg order to
  match project logger API (message, context) instead of pino-native
  (obj, message)
- db-queries.ts: fix Drizzle column references to match the actual
  schema (users.firstName/lastName/phoneNumber, farms.farmName,
  harvests.userId/revenue, carbonCredits.tonnes, marketPrices date
  comparisons, iot/pipeline/federated aggregations, carbonProjects.annualCredits)
- db-enhancements.ts: read QueryResult.rows for node-postgres driver;
  fix logger arg order
- drizzle-enhancements.test.ts: mock db.execute to return { rows }
  matching node-postgres shape
- vitest.config.ts + tests/mocks/dapr-stub.ts: alias @dapr/dapr to a
  test-only stub so Vitest can load the suite (the real package ships an
  ESM proto inside a CommonJS package); production imports unchanged

tsc: 0 errors; vitest: 1076 passed, 30 skipped; build: ok
Co-Authored-By: Patrick Munis <pmunis@gmail.com>
@munisp munisp self-assigned this Jul 23, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author
Original prompt from Patrick

https://drive.google.com/file/d/1xoRlAMbf0QPI9WGN9K11iXEDhsTCgf_0/view?usp=sharing
https://drive.google.com/file/d/1kpaWHhlZq1410zZdqm87cSkY8MNvMOLI/view?usp=sharing
Extract ALL the files and artifact. Analyse and perform the following
1)
1)how robust and integrated is postgres ?
2)how robust and integrated is tigerbeetle ?
3)how robust and integrated is redis ?
4)how robust and integrated is mojaloop ?
5) how robust and integrated is kafka ?
6)how robust and integrated is apisix ?
7)how robust and integrated is keycloak ?
8)how robust and integrated is openappsec ?
9)how robust and integrated is permify ?
10)how robust and integrated is opensearch ?
11) how robust and integrated is fluvio ?
12. How robust and integrated is dapr
2)implement all the gaps and recommendation
3)how do ensure and assess that features for example domain and business logic/rules/requirements are fully impemented and production ready and complete - can you thoroughly assess each files and features to determine there are ready for production

  1. Database integration (replace in-memory with real Postgres)
  2. Inter-service HTTP wiring with retries/circuit breakers
  3. Security hardening (JWT everywhere, remove hardcoded creds, mTLS)
  4. Integration tests for critical flows
  5. Graceful shutdown, observability, alerting
  6. inter-service grpc wiring with retries/circuit breakers

4)search for orphan, partially and generic scaffolded features across the platform - fully implement them end to end -generic CRUD-only patterns , modules with no domain logic, disconnected features, and incomplete implementations.

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

devin-ai-integration Bot and others added 2 commits July 23, 2026 14:39
The mobile job's single-line `run:` values contained `WARN: ` — an
unquoted colon-space that YAML reads as a mapping key, so the whole
ci-cd.yml failed to parse and every run errored at 0s (pre-existing on
main). Single-quote the three affected run values.

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
…tion-readiness)

The branch-protection gate declared needs: production-audit, but no job
by that name exists (the job is production-readiness). GitHub rejects a
workflow with a needs edge to a non-existent job, which is why the whole
run errored at 0s with no jobs created.

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
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.

1 participant