Implements automated verification to ensure the OSS distribution: 1. Only includes open-source licensed dependencies 2. Properly tree-shakes proprietary fonts (ABCROM) 3. Removes telemetry code (Mixpanel) from OSS builds New scripts: - scripts/verify-licenses.js - Validates production dependency licenses - scripts/verify-oss-build.js - Checks dist/ for violations New CI workflow: - .github/workflows/ci-oss-compliance.yaml - Runs compliance checks New npm scripts: - pnpm verify:licenses - Check dependency licenses - pnpm verify:oss - Verify OSS build compliance - pnpm verify:compliance - Run all checks - pnpm build:oss - Build OSS distribution Documentation: - docs/OSS_COMPLIANCE.md - Complete guide for compliance checks 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
5.1 KiB
OSS Compliance Verification
This document describes the automated compliance checks that ensure the OSS (Open Source Software) distribution of ComfyUI Frontend meets licensing and privacy requirements.
Overview
The OSS build verification system consists of two main components:
- License Compliance Check - Ensures all production dependencies use approved open-source licenses
- OSS Build Verification - Ensures the OSS distribution doesn't contain proprietary code or telemetry
Quick Start
Run All Compliance Checks
pnpm verify:compliance
This command will:
- Check all production dependency licenses
- Build the OSS distribution
- Verify the build output doesn't contain violations
Individual Checks
# Check licenses only
pnpm verify:licenses
# Build OSS distribution
pnpm build:oss
# Verify OSS build (requires build first)
pnpm verify:oss
License Compliance
Purpose
Verifies that all production dependencies use licenses compatible with ComfyUI's GPL-3.0-only license.
Script Location
scripts/verify-licenses.js
Approved Licenses
The following licenses are approved for use:
- Permissive: MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC
- Copyleft: GPL-2.0, GPL-3.0, LGPL-2.1, LGPL-3.0, MPL-2.0
- Public Domain: CC0-1.0, Unlicense, WTFPL
- And other OSI-approved licenses
How It Works
- Runs
pnpm licenses list --json --prodto get all production dependencies - Checks each license against the approved list
- Flags any non-compliant or unknown licenses
- Exits with error code 1 if violations are found
Adding New Approved Licenses
If a legitimate open-source license is being flagged, edit scripts/verify-licenses.js and add it to the APPROVED_LICENSES set.
OSS Build Verification
Purpose
Ensures the OSS distribution (DISTRIBUTION=localhost) doesn't contain:
- Proprietary licensed assets (e.g., ABCROM font files)
- Telemetry code (e.g., Mixpanel tracking)
Script Location
scripts/verify-oss-build.js
What Gets Checked
Proprietary Font Files
- Searches for
.woff,.woff2,.ttf,.otffiles containing "ABCROM" - These fonts are proprietary and licensed only for cloud distribution
Telemetry Code
Searches JavaScript files for:
mixpanelreferencesMixpanelTelemetryProviderclass- Tracking method calls (
trackWorkflow,trackEvent) - Mixpanel API endpoints (
mp.comfy.org)
How It Works
- Recursively scans the
dist/directory - Checks font files by filename
- Checks JavaScript files for telemetry code patterns
- Reports all violations with file locations and matches
- Exits with error code 1 if violations are found
Tree-Shaking Mechanism
The codebase uses compile-time constants for tree-shaking:
// src/platform/distribution/types.ts
const DISTRIBUTION: Distribution = __DISTRIBUTION__
export const isCloud = DISTRIBUTION === 'cloud'
// src/platform/telemetry/index.ts
if (isCloud) {
_telemetryProvider = new MixpanelTelemetryProvider()
}
When building with DISTRIBUTION=localhost:
isCloudevaluates tofalse- Dead code elimination removes all cloud-specific code
- Mixpanel library is never imported or bundled
CI Integration
GitHub Actions Workflow
.github/workflows/ci-oss-compliance.yaml
The workflow runs on all pushes to main/dev branches and pull requests:
-
license-check job
- Installs dependencies
- Runs license verification
-
oss-build-check job
- Installs dependencies
- Builds OSS distribution
- Runs build verification
- Uploads artifacts on failure for debugging
When Checks Run
- On push to:
main,master,dev*,core/*,desktop/* - On pull requests (except
wip/*,draft/*,temp/*)
Troubleshooting
License Check Fails
- Review the flagged packages
- Check if the license is genuinely non-compliant
- If it's a false positive, add the license to
APPROVED_LICENSES - If it's truly non-compliant, find an alternative package
OSS Build Check Fails
- Review the violations in the output
- Check if cloud-specific code is being included
- Verify tree-shaking is working:
- Check
vite.config.mtsfordefineconfiguration - Ensure
DISTRIBUTIONis set correctly - Check that cloud imports are conditionally loaded
- Check
Build Artifacts
If the OSS build check fails in CI, artifacts are uploaded for 7 days:
- Go to the failed workflow run
- Download "oss-build-artifacts"
- Inspect the files to identify violations
Adding New Cloud-Specific Code
When adding code that should only be in cloud builds:
- Place it in
src/platform/cloud/- Recommended approach - Use conditional imports:
if (isCloud) { const { CloudFeature } = await import('./cloud/CloudFeature') // Use CloudFeature } - Test locally:
pnpm build:oss pnpm verify:oss