Skip to content

fix: resolve CI failures from release-metadata PR feedback#233

Merged
sfreeman422 merged 6 commits intomasterfrom
feature/updated-release-messaging
Apr 8, 2026
Merged

fix: resolve CI failures from release-metadata PR feedback#233
sfreeman422 merged 6 commits intomasterfrom
feature/updated-release-messaging

Conversation

@sfreeman422
Copy link
Copy Markdown
Collaborator

@sfreeman422 sfreeman422 commented Apr 8, 2026

Three CI jobs were failing after the release-metadata / Moonbeam redeploy feedback PR: the docker-build job had no release-metadata.json to COPY, the no-restricted-syntax lint rule rejected an as cast in a non-spec file, and Prettier flagged README.md and ai.service.ts.

Changes

  • ci.yml — docker-build job: Added actions/setup-node@v4 + write-release-metadata.js pre-step before docker build, matching deploy.yml. Removed stale --build-arg PREVIOUS_RELEASE_SHA.
  • ai.service.ts — ENOENT check: Replaced (error as NodeJS.ErrnoException).code with explicit TypeScript narrowing to satisfy the no-restricted-syntax rule banning as in non-spec files:
    if (
      typeof error === 'object' &&
      error !== null &&
      'code' in error &&
      error.code === 'ENOENT'
    ) {
      continue;
    }
  • Prettier: Reformatted README.md and ai.service.ts.

Copilot AI review requested due to automatic review settings April 8, 2026 12:47
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Moonbeam “release” Slack messaging by attaching a release changelog and syncing the bot’s profile photo to the generated image, and adds build-time plumbing to generate and ship release metadata into the runtime container.

Changes:

  • Add Slack users.setPhoto support and update Moonbeam redeploy flow to resize + upload the generated image as the bot profile photo.
  • Generate/read release metadata (from a file baked into the image, with git fallback) and include a short changelog in the deployment Slack blocks.
  • Update Docker build + GitHub Actions to pass PREVIOUS_RELEASE_SHA and ensure full git history is available for metadata generation.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
README.md Updates Docker build instructions and the “Available Scripts” listing to document the new build arg.
packages/backend/src/shared/services/web/web.service.ts Adds setProfilePhoto() wrapper around Slack users.setPhoto.
packages/backend/src/ai/ai.service.ts Adds release changelog generation, profile photo update via sharp, and refactors image disk writing to use buffers.
packages/backend/src/ai/ai.service.spec.ts Updates redeploy test to assert changelog + profile photo update behavior.
packages/backend/scripts/write-release-metadata.js New script that writes release-metadata.json from git history + env override.
packages/backend/package.json Adds sharp dependency for image resizing.
packages/backend/Dockerfile Generates release metadata during build and copies it into the final image.
package-lock.json Locks new dependencies (sharp + transitive deps).
.github/workflows/deploy.yml Ensures full checkout history and passes PREVIOUS_RELEASE_SHA into Docker build on deploy.
.github/workflows/ci.yml Ensures full checkout history and passes PREVIOUS_RELEASE_SHA into Docker build in CI docker-build job.
.dockerignore Stops ignoring .git so the Docker build can access git history.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Comment on lines +297 to +298
| Command | Description |
| --------------------------------------------------------------------------------- | ------------------------------------ | -------------------------------------------------- | ------------------------------ |
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Available Scripts" table markdown is malformed: the header row defines 2 columns, but the separator line has additional | ... | segments, which will break rendering. Update the separator line to match the actual column count (2), or split this section into multiple tables.

Copilot uses AI. Check for mistakes.
Comment thread README.md Outdated
| `npm run test:backend` | Run tests for the backend only |
| `npm run lint` | Lint all packages |
| `npm run lint:fix` | Lint and auto-fix issues |
| `docker build --build-arg PREVIOUS_RELEASE_SHA="$(git rev-parse HEAD^ 2>/dev/null | | true)" -f packages/backend/Dockerfile -t muzzle .` | Build the backend Docker image |
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table row contains literal | characters inside the shell command, which Markdown interprets as column separators. Escape the pipes (e.g., \|), or move the docker build example out of the table into a fenced code block so the command is not corrupted when rendered.

Copilot uses AI. Check for mistakes.
Comment thread packages/backend/src/ai/ai.service.ts Outdated
const [imageBytes, quote, changelog] = results;
const [imageUrl] = await Promise.all([
this.writeImageBufferToDiskAndReturnUrl(imageBytes),
this.updateMoonbeamProfilePhoto(imageBytes),
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redeployMoonbeam awaits updateMoonbeamProfilePhoto in the same Promise.all as writing the image to disk. If the profile-photo update fails (Slack permission/token issues, sharp errors), the whole redeploy flow will skip sending the deployment message and only log the error. Consider making the profile-photo update best-effort (catch/log its failure) so the release message + image still get posted.

Suggested change
this.updateMoonbeamProfilePhoto(imageBytes),
this.updateMoonbeamProfilePhoto(imageBytes).catch((error) => {
logError(this.aiServiceLogger, 'Failed to update Moonbeam profile photo during redeploy', error);
}),

Copilot uses AI. Check for mistakes.
Comment thread packages/backend/src/ai/ai.service.ts Outdated
Comment on lines +682 to +683
} catch {
continue;
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readReleaseMetadataFromDisk swallows all read/parse errors silently. If release-metadata.json exists but is malformed, this will fail over to readReleaseMetadataFromGit() (which may not work in distroless) and you end up with an unavailable changelog with no diagnostic trail. Consider only ignoring ENOENT and logging JSON parse/other IO errors at least once (or at debug level) for easier troubleshooting.

Suggested change
} catch {
continue;
} catch (error) {
if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
continue;
}
logger.debug('Failed to read release metadata from disk', {
candidatePath,
error,
});

Copilot uses AI. Check for mistakes.
Comment thread .dockerignore Outdated
Comment on lines +5 to +6
!.git
!.git/**
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Including the entire .git directory in the Docker build context can significantly increase context upload time and invalidate caching frequently (large object packs change often). If the goal is only to generate release metadata, consider generating release-metadata.json outside the Docker build and copying it in, or otherwise avoid sending .git as part of the build context.

Suggested change
!.git
!.git/**

Copilot uses AI. Check for mistakes.
Comment on lines 7 to +11
COPY package.json package-lock.json ./
COPY tsconfig.base.json ./
COPY .git ./.git
COPY packages/backend/package.json ./packages/backend/
COPY packages/backend/scripts ./packages/backend/scripts
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copying .git into the build stage makes the build context and intermediate layers much larger and more cache-sensitive. Since the final image only needs release-metadata.json, consider producing that file outside the image build (CI step) and COPY it in, rather than copying the full Git history into the Docker build.

Copilot uses AI. Check for mistakes.
@sfreeman422
Copy link
Copy Markdown
Collaborator Author

@copilot address all feedback

…ndling, README table, and move git metadata generation out of Docker

Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/6876c937-2062-4c4c-82c7-8d8b8cf882ae

Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI commented Apr 8, 2026

@copilot address all feedback

All feedback addressed in commit 7472ddf:

  • README.md table: Fixed the malformed separator (had 4 columns, now correctly 2), and moved the docker build command (which contains |) out of the table into a fenced code block.
  • updateMoonbeamProfilePhoto best-effort: Now uses .catch() so Slack/sharp failures are logged but don't abort the deployment message flow.
  • readReleaseMetadataFromDisk error handling: Now only silently ignores ENOENT; all other errors (malformed JSON, unexpected IO) are logged at debug level for easier troubleshooting.
  • .git out of Docker build context: Removed the !.git/!.git/** exceptions from .dockerignore, removed COPY .git and apk add git from the Dockerfile. A new step in deploy.yml now runs write-release-metadata.js before the docker build so the pre-generated file is simply COPY'd in.
  • release-metadata.json added to .gitignore since it's a build artifact.

Copilot AI changed the title feature/updated release messaging Address PR review feedback: Docker build hygiene, error handling, README fixes Apr 8, 2026
@sfreeman422
Copy link
Copy Markdown
Collaborator Author

@copilot dont use the debug log level - please use info instead. debug is off by default in deployed state

…ilures

Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/1653283a-306b-499e-96a0-d672ef72a512

Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI commented Apr 8, 2026

@copilot dont use the debug log level - please use info instead. debug is off by default in deployed state

Changed to info in commit e7eea4c.

Copilot AI changed the title Address PR review feedback: Docker build hygiene, error handling, README fixes fix: address release messaging PR review feedback Apr 8, 2026
@sfreeman422
Copy link
Copy Markdown
Collaborator Author

@copilot fix failing checks bruv

Copy link
Copy Markdown

Copilot AI commented Apr 8, 2026

@copilot fix failing checks bruv

Fixed in commit da2a745. Three issues addressed:

  1. CI docker-build job — added Node.js setup + write-release-metadata.js generation step before docker build, matching what deploy.yml already does.
  2. Lint error — replaced (error as NodeJS.ErrnoException).code with proper TypeScript narrowing (typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT') to satisfy the no-restricted-syntax rule banning as in non-spec files.
  3. Prettier — ran prettier --write on README.md and ai.service.ts.

Copilot AI changed the title fix: address release messaging PR review feedback fix: resolve CI failures from release-metadata PR feedback Apr 8, 2026
@sfreeman422 sfreeman422 merged commit b701e31 into master Apr 8, 2026
10 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

Development

Successfully merging this pull request may close these issues.

3 participants