Skip to content

fix(ci): stream nx output so failures are not lost in buffered dumps#831

Merged
diegomayorga-dept merged 2 commits into
developmentfrom
fix/cicd-stream-output
Jul 7, 2026
Merged

fix(ci): stream nx output so failures are not lost in buffered dumps#831
diegomayorga-dept merged 2 commits into
developmentfrom
fix/cicd-stream-output

Conversation

@diegomayorga-dept

Copy link
Copy Markdown
Contributor

Title*

fix(ci): back-end pipeline — fix cdk synth type error and stop losing failure logs

Type of Change*

  • New feature
  • Bug fix
  • Documentation update
  • Refactoring
  • Hotfix
  • Security patch
  • UI/UX improvement

Description

The cicd-release-quality Build & Deploy Back-End job has failed on every push to development since PR #823 (aws-cdk-lib 2.176 → 2.260). This PR fixes the actual root cause and the log-visibility defect that hid it for days. Two commits:

1. fix(infra): guard optional GSI partitionKey so cdk synth compiles on cdk 2.26x — the real pipeline fix.
The back-end build task is compile → test → package → cdk synth. aws-cdk-lib 2.26x changed SchemaOptions.partitionKey to be optional, so the GSI loop in dynamodb-construct.ts (value.partitionKey.name) no longer compiles under strict mode when cdk synth type-checks main.ts via ts-node. Every failing CI run actually passed both Jest phases (~11 min of green tests) and then died on this compile error in the synth step — the very last step of the build. The fix adds a guard that narrows the type and throws a descriptive error if a GSI is ever defined without a partition key.

2. fix(ci): stream nx output so failures are not lost in buffered dumps — the reason this took days to find.
The CICD scripts ran nx with --outputStyle=static, which buffers the entire target output and dumps it all at once when the target fails. The GitHub runner closes the output pipe when the process exits, discarding the unread tail of the dump — which is exactly where the Jest summary and the synth error live. Every failing run's log therefore cut off mid-test-noise, hiding the real error and misdirecting diagnosis toward Jest/memory. Switching to --outputStyle=stream (already used by the local build-back-end script) prints output live so nothing can be lost. Both changes are made in .projenrc.ts and regenerated.

Related context: PR #823 introduced the regression; PRs #828/#830 addressed other real issues surfaced by the same investigation (CI test memory, js-yaml override, Node 20.20.2 floor, CDK CLI schema version, nuxt dev-server pin) but could not fix the pipeline because this synth error was invisible.

Testing*

  • Root cause reproduced locally: pnpm exec projen synth:silent in packages/back-end fails on development with TS18048: 'value.partitionKey' is possibly 'undefined' — the same failure CI has been hitting.
  • Fix verified locally: with the guard, back-end cdk synth -q exits 0 and synthesizes both stacks (*-main-back-end-stack, *-easy-genomics-api-stack); projen compile (tsc) exits 0.
  • Full back-end Jest suite green: 66/66 suites, 491/491 tests — including a run with CI-shaped environment variables (CI_CD=true, AWS_ACCOUNT_ID, ENV_NAME, JWT_SECRET_KEY, etc.) to rule out env-dependent test failures.
  • Linux CI replica: full build phase (frozen install → shared-lib build → back-end compile + both Jest passes + synth) executed in an Ubuntu 24.04 container matched to the runner (4 CPU / 16 GB, Node 20.20.2, pnpm 9.15.0, exact CI command and env).
  • No new tests added: the failure is a compile-time error, now guarded; the pre-commit hook runs the full back-end suite on every commit.

Impact

  • Unblocks the quality pipeline — first push to development after this merge should get past the back-end build for the first time since Jul 6.
  • CI logs become trustworthy: any future target failure will show its real error instead of a truncated dump. Log volume per run increases slightly (streamed output is not deduplicated), which is the trade-off for never losing the tail.
  • Runtime behavior unchanged: the guard only throws for a configuration (GSI without partition key) that was always invalid and would previously have crashed synth with a less clear error.
  • No new dependencies.

Additional Information

  • After the build phase passes, CI proceeds to cdk deploy against the quality account — that step has not run since Jul 6 and cannot be tested locally, so watch the first run through the deploy phase.
  • The front-end and E2E jobs will also run for the first time on the new dependency stack (nuxt 3.21.2, cdk 2.261) once back-end goes green.
  • Reminder for the team: local environments need Node 20.20.2 (nvm install 20.20.2 && nvm use.nvmrc is updated) since PR fix(security): dependabot follow-up — transitive overrides + remove stale npm lockfile #830.

Checklist*

  • No new errors or warnings have been introduced.
  • All tests pass successfully and new tests added as necessary.
  • Documentation has been updated accordingly. (N/A — CI/infra fix)
  • Code adheres to the coding and style guidelines of the project.
  • Code has been commented in particularly hard-to-understand areas.

@diegomayorga-dept diegomayorga-dept merged commit fce8bb7 into development Jul 7, 2026
2 checks passed
@diegomayorga-dept diegomayorga-dept deleted the fix/cicd-stream-output branch July 7, 2026 20:38
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