Skip to content

Move to production - #3

Merged
danielmarv merged 27 commits into
masterfrom
staging
Mar 6, 2026
Merged

danielmarv merged 27 commits into
masterfrom
staging

Conversation

@danielmarv

Copy link
Copy Markdown
Member

Summary of Changes (What does this PR do?)

  • Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Status of maturity (all need to be checked before merging):

  • I've tested this locally
  • I consider this code done
  • This change ready to hit production in its current state
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included issue number in the "Closes #ISSUE-NUMBER" part of the "What are the relevant tickets?" section to link the issue.
  • I've updated corresponding documentation for the changes in this PR.
  • I have written unit and/or e2e tests for my change(s).

How should this be manually tested?

  • Please include the steps to be done inorder to setup and test this PR.

What are the relevant tickets?

  • Closes #

Screenshots (optional)

- Created GITHUB_WORKFLOWS_ARCHITECTURE.md to outline the developer workflow, event triggers, status check flow, Docker image pipeline, release pipeline, deployment pipeline, scheduled testing pipeline, branch strategy, and team organization structure.
- Ensured clarity on automated testing, code quality, reproducible deployments, and team responsibilities.

chore: Add commitlint configuration

- Introduced commitlint.config.js to enforce conventional commit message standards.
- Configured rules for commit message types, subject casing, and body formatting.

chore: Create GitHub setup scripts for organization setup

- Added github-setup.bat for Windows users to guide through GitHub organization setup.
- Added github-setup.ps1 for PowerShell users to assist in the same setup process.
- Added github-setup.sh for Unix-based systems to facilitate organization setup.
chore: remove outdated release checklist file
- Implement unit tests for shipment creation, listing, retrieval, and status updates in `logistics.shipments.controller.test.js`.
- Add tests for CRUD operations on routes, vehicles, drivers, tracking events, and cold chain logs in `logistics.workspace.controller.test.js`.
- Introduce OpenAPI contract tests to ensure endpoint coverage and schema validation in `openapi.logistics-workspace.contract.test.js`.
- Validate status transitions and UI status mappings for various logistics entities.
- Implement tests for CRUD operations and status transitions in finance workspace controller, covering invoices, credits, and insurance policies.
- Create OpenAPI contract tests to ensure all relevant endpoints and schemas are documented correctly.
- Develop tests for payments workspace controller, including wallet operations, transaction filtering, escrow lifecycle, and payout workflows.
- Mock necessary models and services to isolate tests and ensure deterministic behavior.
- Implemented GET /profiles to list user profiles with pagination and filtering options.
- Added POST /profiles/:profileId/forecast/refresh to refresh forecast data for a specific profile.
- Introduced GET /profiles/:profileId/forecast/history to retrieve forecast history for a profile.
- Enhanced validation for profile-related endpoints.

feat(weather): extend alert and rule management functionality

- Added POST /rules/:id/test to test weather rules with provided readings.
- Introduced new enums for alert UI status and rule lifecycle status.
- Updated weather alert model to include resolution metadata (resolvedAt, resolvedBy, resolutionReason).
- Enhanced weather alert service to handle UI status transitions and resolution logic.
- Updated weather rule model to support workflow state management.

fix(weather): improve validation and error handling

- Enhanced validation for alert and rule status transitions.
- Updated alert listing to support filtering by UI status.
- Improved test coverage for weather workspace controller, ensuring proper handling of alerts and rules.

test(weather): add comprehensive tests for new endpoints and features

- Created tests for profile management, forecast refresh, and history retrieval.
- Added tests for alert acknowledgment, dismissal, and escalation, ensuring correct UI status updates.
- Implemented tests for rule creation, updating, and testing, validating status transitions and expected behaviors.
…, and controller tests

- Implemented Recommendation and Price Estimation models with appropriate schemas and validations.
- Created Price Prediction and Price Validator models to handle price-related data and validation logic.
- Developed comprehensive tests for prices workspace controller, ensuring CRUD operations and workflow transitions are validated.
- Added OpenAPI contract tests to verify endpoint coverage and schema alignment.
- Enhanced market intelligence features with insights, trends, alerts, recommendations, and data sources, including their respective tests.
…mas and indexes

test: implement comprehensive tests for expert workspace controller including field case and research report workflows

test: add OpenAPI contract tests for expert workspace endpoints and schemas
…ts, and reports

- Introduced status fields for IChartDocument and IDashboardDocument to manage lifecycle states (draft, published, archived).
- Updated validation logic to include status checks for charts and dashboards.
- Created new models for AnalyticsDataset and AnalyticsReport with appropriate status management.
- Implemented CRUD operations and status workflows for datasets, charts, dashboards, and reports in the controller.
- Added comprehensive tests for all new functionalities, ensuring proper status transitions and validations.
- Enhanced OpenAPI documentation to reflect new status enums and endpoint behaviors.
…d permissions management

- Implemented admin workspace routes for organizations, roles, and permissions.
- Added validation logic for creating, updating, and listing roles and permissions.
- Created comprehensive unit tests for the admin workspace controller, covering CRUD operations and status transitions.
- Developed OpenAPI contract tests to ensure endpoint coverage and schema validation for admin workspace functionalities.
…erties

refactor(expert): enhance uiStatus handling with optional number conversion
refactor(finance): improve type safety in toPlainObject function
refactor(logistics): update toPlainObject for better type handling
refactor(logisticsWorkspace): refine toPlainObject and uiStatus handling
refactor(marketIntelligence): enhance toPlainObject and add toObjectId utility
refactor(organization): improve toPlainObject type handling
refactor(payment): enhance toPlainObject for better type safety
refactor(price): improve type handling in price controller methods
refactor(weather): update toPlainObject for better type safety
feat(types): extend Express Request interface with additional user properties
@danielmarv danielmarv self-assigned this Mar 6, 2026
Copilot AI review requested due to automatic review settings March 6, 2026 20:49
@danielmarv danielmarv added the Move to production Move to production Branch label Mar 6, 2026
@danielmarv
danielmarv merged commit 713b69d into master Mar 6, 2026
1 check failed
@github-actions

github-actions Bot commented Mar 6, 2026

Copy link
Copy Markdown

❌ Build Status: FAILURE

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR appears to introduce GitHub organization/repo setup automation and CI/CD workflow scaffolding (Actions, CODEOWNERS, commit linting), while removing a large set of prior “V1/IAM/E‑market” planning and reference documents.

Changes:

  • Added GitHub Actions workflows for CI, code-quality, releases, deploy, scheduled tests, PR checks, and commit linting.
  • Added organization/repo setup scripts (bash/PowerShell/batch), commitlint configuration, CODEOWNERS, and several GitHub workflow docs.
  • Removed multiple older product/implementation/reference markdown documents (V1 plans, IAM guides, API references, etc.).

Reviewed changes

Copilot reviewed 50 out of 167 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
github-setup.sh Adds a bash helper to print org setup instructions/checklists and validate gh/git availability.
github-setup.ps1 Adds a PowerShell helper with similar org setup instructions/checklists and prereq checks.
github-setup.bat Adds a Windows batch helper to validate tools and print setup instructions.
commitlint.config.js Introduces commitlint rules (Conventional Commits) and interactive prompt configuration.
V1_IMPLEMENTATION_PLAN.md Removes a legacy V1 implementation plan document.
V1_GAP_REPORT.md Removes a legacy V1 gap report document.
V1 IMPLEMENTATION PLAN.md Removes a duplicate/variant V1 implementation plan document.
RELEASE_CHECKLIST.md Removes a legacy release checklist document.
RELEASE CHECKLIST.md Removes a duplicate/variant release checklist document.
PROJECT_SUMMARY.md Removes a legacy project overview/summary document.
PEST_DISEASE_QUICK_REFERENCE.md Removes a legacy pest/disease quick reference document.
IMPLEMENTATION_SUMMARY.md Removes a legacy implementation summary document.
IAM_SYSTEM_DOCUMENTATION.md Removes a legacy IAM system documentation document.
IAM_QUICK_START.md Removes a legacy IAM quick start document.
IAM_QUICK_REFERENCE.md Removes a legacy IAM quick reference document.
IAM_INSTALLATION_GUIDE.md Removes a legacy IAM installation guide document.
IAM_IMPLEMENTATION_SUMMARY.md Removes a legacy IAM implementation summary document.
IAM_COMPLETE_GUIDE.md Removes a legacy IAM complete guide document.
FILE_STRUCTURE.md Removes a legacy file structure document.
E_MARKET_API_REFERENCE.md Removes a legacy e-market API quick reference document.
ERRORS_AND_FIXES.md Removes a legacy “errors and fixes” document.
CLYCITES CONCEPT GAP REPORT.md Removes a legacy concept gap report document.
CHANGELOG.md Expands the changelog content substantially (new “workspace APIs/uiStatus/transition rules” notes).
API_TESTING.md Removes a legacy API testing collection document.
API_DOCUMENTATION.md Removes a legacy API documentation document.
GITHUB_WORKFLOWS_ARCHITECTURE.md Adds an architecture overview doc describing intended workflow execution and branch strategy.
GITHUB_WORKFLOWS.md Adds documentation for the GitHub Actions workflows and repo/org configuration.
GITHUB_SETUP_SUMMARY.md Adds a summary of what was created for GitHub workflows/setup and next steps.
GITHUB_QUICK_REFERENCE.md Adds a developer quick reference for branches, commits, PR flow, and local dev commands.
GITHUB_ORGANIZATION_SETUP.md Adds an org/repo setup guide (secrets/variables/branch protection/teams/CODEOWNERS).
.github/workflows/schedule-tests.yml Adds scheduled (and push-triggered) test workflow including Codecov + Slack notification.
.github/workflows/release.yml Adds tag-triggered GitHub Release creation with generated changelog.
.github/workflows/pull-request.yml Adds PR validation (title/branch naming/lint/tests) + Codecov upload + PR comment.
.github/workflows/lint-commit.yml Adds commit message linting workflow.
.github/workflows/deploy.yml Adds a deploy workflow with optional AWS role assumption and Slack notifications.
.github/workflows/code-quality.yml Adds SonarCloud scan, npm audit, and TypeScript type-check workflows.
.github/workflows/ci.yml Adds a CI workflow for lint/test + Codecov upload + npm audit.
.github/workflows/build-and-push.yml Adds an artifact build workflow (uploads dist/package.json/README).
.github/README.md Adds documentation for the .github/ directory and how to run setup scripts.
.github/CODEOWNERS Adds CODEOWNERS rules for teams by path.
.github/.gitignore Adds a .gitignore within .github/ with patterns for artifacts/logs/env/deps.
Files not reviewed (1)
  • express-app/package-lock.json: Language not supported

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

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +30 to +31
environment:
name: ${{ github.event.inputs.environment || 'staging' }}

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

On push events there is no github.event.inputs.environment, so this workflow will always target staging even when pushing to master. Derive the environment from github.ref_name for push-triggered runs (e.g., master → production, staging → staging) and only use the input for workflow_dispatch.

Copilot uses AI. Check for mistakes.
if: ${{ steps.config.outputs.configured == 'true' }}
env:
AWS_REGION: ${{ vars.AWS_REGION }}
ENVIRONMENT: ${{ github.event.inputs.environment || 'staging' }}

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

On push events there is no github.event.inputs.environment, so this workflow will always target staging even when pushing to master. Derive the environment from github.ref_name for push-triggered runs (e.g., master → production, staging → staging) and only use the input for workflow_dispatch.

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml
Comment on lines +36 to +40
- name: Upload coverage reports
if: ${{ hashFiles('coverage/coverage-final.json') != '' }}
uses: codecov/codecov-action@v5
with:
files: ./coverage/coverage-final.json

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

This uploads coverage/coverage-final.json, but the workflow only runs npm test (no explicit --coverage). Unless coverage is enabled by default in the test script, the file won’t exist and coverage won’t be published. Make the test step generate coverage explicitly (e.g., run the test command with coverage or use a dedicated coverage script) and align the uploaded file path with the actual output.

Copilot uses AI. Check for mistakes.
Comment on lines +96 to +101
- name: Generate coverage report
run: npm test

- name: Upload coverage to Codecov
if: ${{ hashFiles('coverage/coverage-final.json') != '' }}
uses: codecov/codecov-action@v5

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

The code-coverage job runs npm test but doesn’t explicitly generate coverage, yet it tries to upload coverage/coverage-final.json. Update this job to run tests with coverage output (or call the project’s coverage script) so the upload condition/file is meaningful.

Copilot uses AI. Check for mistakes.
types: [ opened, synchronize, reopened, edited ]

jobs:
pr-validation:

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

Both pr-validation and code-coverage jobs perform a full checkout + npm ci + npm test, which doubles CI time for each PR. Consider merging coverage generation into pr-validation (single job), or make code-coverage depend on pr-validation and reuse artifacts/cache outputs to avoid re-running tests.

Copilot uses AI. Check for mistakes.
Comment thread .github/.gitignore
Comment on lines +4 to +10
.github/
!.github/workflows/
!.github/ISSUE_TEMPLATE/
!.github/PULL_REQUEST_TEMPLATE.md
!.github/CODEOWNERS
!.github/dependabot.yml
!.github/renovate.json

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

This .gitignore lives inside .github/, so the pattern .github/ is relative to that directory and effectively targets .github/.github/, which is almost certainly not intended. If the intent is to ignore root-level .github/, this file should likely be at repo root (or the pattern should be adjusted to match paths relative to .github/).

Suggested change
.github/
!.github/workflows/
!.github/ISSUE_TEMPLATE/
!.github/PULL_REQUEST_TEMPLATE.md
!.github/CODEOWNERS
!.github/dependabot.yml
!.github/renovate.json
*
!/.gitignore
!/workflows/
!/ISSUE_TEMPLATE/
!/PULL_REQUEST_TEMPLATE.md
!/CODEOWNERS
!/dependabot.yml
!/renovate.json

Copilot uses AI. Check for mistakes.
Comment thread GITHUB_WORKFLOWS.md
Comment on lines +10 to +13
**Trigger:** Push to `main`/`develop`, Pull Requests

**Jobs:**
- **lint-and-test** (Node 18.x, 20.x matrix)

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

This documentation doesn’t match the added workflows: the YAML files use staging/master branches and Node.js 22 (not a Node 18/20 matrix). Update the docs to reflect the actual configured triggers and Node versions to avoid incorrect setup/expectations.

Suggested change
**Trigger:** Push to `main`/`develop`, Pull Requests
**Jobs:**
- **lint-and-test** (Node 18.x, 20.x matrix)
**Trigger:** Push to `staging`/`master`, Pull Requests
**Jobs:**
- **lint-and-test** (Node 22.x)

Copilot uses AI. Check for mistakes.
Comment thread .github/CODEOWNERS
Comment on lines +16 to +35
/src/services/auth/ @clycites-org/platform-core
/src/common/middleware/auth* @clycites-org/platform-core

# Farmers Module
/src/services/farmers/ @clycites-org/platform-core

# Marketplace Module
/src/services/marketplace/ @clycites-org/platform-core

# Products/Catalog Module
/src/services/products/ @clycites-org/platform-core

# Orders Module
/src/services/orders/ @clycites-org/platform-core

# Notifications Service
/src/services/notifications/ @clycites-org/platform-core

# Analytics Service
/src/services/analytics/ @clycites-org/platform-core

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

The CODEOWNERS rules target /src/services/... paths, but the repository’s module layout may be under /src/modules/... (based on other project docs/history). If these paths don’t exist, CODEOWNERS won’t apply and required reviews won’t be enforced. Update CODEOWNERS entries to match the actual directory structure used in the repo.

Suggested change
/src/services/auth/ @clycites-org/platform-core
/src/common/middleware/auth* @clycites-org/platform-core
# Farmers Module
/src/services/farmers/ @clycites-org/platform-core
# Marketplace Module
/src/services/marketplace/ @clycites-org/platform-core
# Products/Catalog Module
/src/services/products/ @clycites-org/platform-core
# Orders Module
/src/services/orders/ @clycites-org/platform-core
# Notifications Service
/src/services/notifications/ @clycites-org/platform-core
# Analytics Service
/src/services/analytics/ @clycites-org/platform-core
/src/modules/auth/ @clycites-org/platform-core
/src/common/middleware/auth* @clycites-org/platform-core
# Farmers Module
/src/modules/farmers/ @clycites-org/platform-core
# Marketplace Module
/src/modules/marketplace/ @clycites-org/platform-core
# Products/Catalog Module
/src/modules/products/ @clycites-org/platform-core
# Orders Module
/src/modules/orders/ @clycites-org/platform-core
# Notifications Service
/src/modules/notifications/ @clycites-org/platform-core
# Analytics Service
/src/modules/analytics/ @clycites-org/platform-core

Copilot uses AI. Check for mistakes.
Comment on lines +62 to +63
- name: Comment PR with build status
if: always()

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

This will create a new PR comment on every workflow run (including re-runs and pushes), which can spam PR discussions. Consider updating an existing comment (search by a marker) or posting status to the job summary / a single 'sticky' comment instead.

Copilot uses AI. Check for mistakes.
Comment on lines +69 to +76
const comment = `${statusEmoji} **Build Status:** ${buildStatus.toUpperCase()}`;

github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

This will create a new PR comment on every workflow run (including re-runs and pushes), which can spam PR discussions. Consider updating an existing comment (search by a marker) or posting status to the job summary / a single 'sticky' comment instead.

Suggested change
const comment = `${statusEmoji} **Build Status:** ${buildStatus.toUpperCase()}`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
const marker = '<!-- build-status-comment -->';
const commentBody = `${marker}
${statusEmoji} **Build Status:** ${buildStatus.toUpperCase()}`;
const { data: comments } = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 100
});
const existingComment = comments.find(c => typeof c.body === 'string' && c.body.startsWith(marker));
if (existingComment) {
await github.rest.issues.updateComment({
comment_id: existingComment.id,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
} else {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Move to production Move to production Branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants