Skip to content

Latest commit

 

History

History
174 lines (114 loc) · 22 KB

CONTRIBUTING.md

File metadata and controls

174 lines (114 loc) · 22 KB

Contributing to OpenFrame OSS Tenant

Thank you for your interest in contributing to OpenFrame OSS Tenant (flamingo-stack/openframe-oss-tenant) — the deployable tenant service repository for OpenFrame (flamingo.run/openframe), built by Flamingo. This repository assembles Spring Boot application entry points (openframe-api, openframe-authorization-server, openframe-client, openframe-config, openframe-external-api, openframe-gateway, openframe-management, openframe-stream, openframe-test), the Kubernetes/Argo CD manifests that deploy them (manifests/), shared runtime configuration (configs/base/), and the Rust openframe-client agent under clients/openframe-client.

This guide covers setting up a development environment, the development workflow, code style and conventions, running and writing tests, reporting security issues, and where to find more documentation.

Community and Communication

This project does not use GitHub Issues or GitHub Discussions for feature requests, bug reports, or general discussion. Coordination and support happen on the OpenMSP Slack community (join here).

GitHub pull requests remain the mechanism for proposing and reviewing code changes. Open a pull request directly for code changes; use Slack to discuss direction first for anything non-trivial, and reference the relevant Slack discussion in your pull request description instead of a GitHub issue number.

How This Repository Fits the Ecosystem

Per the organization's repository graph (coverage: partial — one repository is not indexed, so an empty consumer list is not proof nothing depends on this repository), OpenFrame OSS Tenant publishes nine Maven artifacts under com.openframe (all 1.0.0-SNAPSHOT) plus the openframe_client Cargo crate (0.1.0). It pins com.openframe.oss:* Maven artifacts and the openframe_agent_lib Cargo crate (tag v0.0.5) from OpenFrame OSS Library at version 7.0.11. No repository is currently recorded as consuming artifacts published from here.

A practical consequence: most domain logic (controllers, GraphQL data fetchers, authorization flows, client registration, gateway routing, stream processing) lives upstream in OpenFrame OSS Library, not in this repository. Before writing new logic here, check whether it belongs in openframe-oss-lib instead. Each service module (for example openframe/services/openframe-api/pom.xml) is deliberately thin: a <parent> pointing at com.openframe:openframe-parent, plus one *-service-core/*-core dependency and only the Spring starters actually needed.

The Rust agent at clients/openframe-client follows the same shape: clients/openframe-client/Cargo.toml pins openframe-agent-lib to tag v0.0.5 of the openframe-oss-lib Git repository, and clients/openframe-client/src/main.rs is a thin wrapper that delegates to it.

If you are touching the CLI surface exposed by the separately maintained openframe-cli tool, work in that repository directly — see its installation guide and documentation. It is not part of this codebase.

Setting Up a Development Environment

Do not try to piece a setup together from scratch here — follow the dedicated guides, which are kept current with the repository's actual structure:

  1. Introduction and Prerequisites — orientation and tools you need before you start.
  2. Quick Start and First Steps — get something running quickly.
  3. Environment Setup — JDK (Java 25), Maven, the Rust toolchain, IDE configuration (VS Code launch configs and tasks), and required environment variables.
  4. Local Development — building and running services and the Rust agent locally, Spring Cloud Config, gateway routing, and debug configurations.
  5. Architecture Overview — how the gateway, authorization server, API, client, management, and stream services fit together before you start changing code.

In short: the backend is a Maven multi-module project rooted at pom.xml (Spring Boot 4.1.1, Java 25, Spring Cloud 2025.1.3), and the Rust agent lives at clients/openframe-client/, with its release build requiring the OPENFRAME_VERSION environment variable, consumed by openframe-agent-lib's build script. The full toolchain list, verification commands, and IDE configuration live in Environment Setup — they are not duplicated here.

Development Workflow

Branches

  • Work happens on a topic branch cut from main; open a pull request against main. Do not push directly to main.
  • Avoid branch name prefixes reserved for automation: ai-fix/, setup/, and code-documentation/ are treated differently by CI and are reserved for the organization's automated pipelines.
  • A scheduled cleanup workflow (.github/workflows/cleanup.yml, stale-branches job) automatically deletes branches with no commits for 60 days. Keep topic branches short-lived — merge or close your pull request rather than letting a branch go stale.
  • Use a short, descriptive, hyphenated branch name that signals the kind of change and the module or service it touches (for example feature/openframe-api-device-filter, fix/gateway-route-timeout, chore/update-openframe-libs-version), since both CODEOWNERS review routing and the CI change-detection matrix key off which paths your branch touches.

Commits

This repository does not enforce a commit-lint tool in CI, but keep commits reviewable and keep the per-component change detection meaningful:

  • Write commits in the imperative mood ("fix", "add", "bump"), not past tense.
  • Scope the first line to the module or manifest you changed, e.g. openframe-gateway: fix WebSocket route timeout on reconnect or manifests/datasources/kafka: bump chart dependency to ~32.5.0.
  • Keep the subject line short and specific; add a body when the change needs justification — particularly for a pinned dependency version change in the root pom.xml (explain the CVE or compatibility reason), a configs/base/ change (it affects every service at once), or a bump to openframe.libs.version (it repins every com.openframe.oss:* artifact this repository consumes).
  • Do not reference GitHub issue numbers — this repository does not use GitHub Issues. Reference the relevant OpenMSP Slack discussion in the pull request description instead.

Opening a Pull Request

  1. Branch from main and make your change in the appropriate module — see Setting Up a Development Environment above, and ../setup/environment.md / ../setup/local-development.md within the development docs for module layout.

  2. Keep the change scoped. The CI pipeline (.github/workflows/changes.yaml) only rebuilds images, clients, and the Helm chart for the paths your pull request actually touches, driven by dorny/paths-filter. A tightly scoped pull request builds faster and is easier to review.

  3. Open the pull request against main on flamingo-stack/openframe-oss-tenant. Pull requests are listed at github.com/flamingo-stack/openframe-oss-tenant/pulls.

  4. Let CODEOWNERS routing work. .github/CODEOWNERS assigns review ownership by path, with the more specific path winning over a broader one:

    Path Owning Team
    /openframe/ @flamingo-stack/backend-engineers
    /clients/openframe-client/ @flamingo-stack/client-engineers
    /configs/ @flamingo-stack/backend-engineers
    /configs/base/ @flamingo-stack/tech-leads and @flamingo-stack/tech-heads-of (overrides the broader /configs/ rule)
    /manifests/ @flamingo-stack/devops-engineers
    /.github/CODEOWNERS @flamingo-stack/devops-engineers

    A change under /configs/base/ needs sign-off from tech leads and heads-of, not just the general backend-engineers reviewers — plan for the right reviewers to be available before opening a pull request that touches shared, base-level configuration, since it governs datasource connectivity and Kafka topic wiring for every service.

  5. Let CI run. Pushing to main (or opening/updating a pull request) triggers .github/workflows/code-documentation.yml's code-graph job (re-indexing the code graph used by review and documentation tooling) and .github/workflows/flamingo-code-review.yml (the automated review pipeline, see below). On a push to main that touches manifests/**, openframe/**, integrated-tools/**, pom.xml, or clients/**, .github/workflows/release.yml builds and publishes affected service images, the Rust client binaries, and the app-of-apps Helm chart.

  6. Request automated review explicitly. The reviewer does not run the moment a pull request is opened — an invitation comment is posted when the pull request enters review (opened, reopened, or marked ready for review). Check its box, or add the comment @flamingo-review, to request a pass. Use @flamingo-review full to force a full re-read of the cumulative diff instead of only the delta since the last reviewed commit. Adding the flamingo-review label also requests a pass and is consumed (removed) automatically once picked up, so it can be re-added to ask again. Adding flamingo-review-always subscribes the pull request to review on every push, for higher-risk changes.

  7. Respond to review feedback and to any CODEOWNERS-required approvals.

  8. Merge once approved and green. There is no separate GitHub Discussions or Issues workflow tied to merging — coordinate any broader rollout communication via the OpenMSP Slack community.

  9. Do not reference GitHub Issues or Discussions in commit messages, pull request descriptions, or comments — this repository does not use them.

Code Style and Conventions

Code style in this repository is enforced mechanically by the organization's automated reviewer against its active rule catalog, scoped to the languages and paths a pull request touches. Check configs/base/application.yml and .github/workflows/release.yml for working examples of these patterns before writing new config or CI code.

Java / Spring Boot Services (openframe/services/**)

  • Every service module is a child pom.xml with <parent><artifactId>openframe-parent</artifactId></parent> pointing at the root pom.xml. Keep new modules consistent with the existing module layout (see openframe/services/openframe-api/pom.xml, openframe/services/openframe-client/pom.xml) — declare dependencies on the relevant com.openframe.oss:* artifact at ${openframe.libs.version} rather than a hardcoded version string or duplicating shared code locally.
  • Lombok must be listed explicitly as a maven-compiler-plugin annotation processor path (JDK 23+ no longer auto-discovers processors on the classpath); follow the pattern already configured in the root pom.xml's pluginManagement.
  • New Spring configuration properties must be namespaced under openframe.oss-tenant.* or openframe.* — both in YAML files under configs/ and in @ConditionalOnProperty / @Value annotations. Top-level or ad-hoc property prefixes conflict with shared-library property resolution and will fail review. This is enforced by code rule OPENFRAM-009-4, scoped to configs/**/*.yml and service src/main/resources/**/*.yml.
  • Kafka topic names must be declared under openframe.oss-tenant.kafka.topics.inbound.<logical-name>.name or openframe.oss-tenant.kafka.topics.outbound.<logical-name> in the service's base YAML config (see configs/base/application.yml, configs/base/openframe-api.yml). Hardcoded topic strings in @KafkaListener or KafkaTemplate calls are rejected in review (OPENFRAM-002-4) — always reference the configured property placeholder.
  • Security-sensitive dependency versions (plexus-utils, bcprov-lts8on, libthrift, lz4-java) are pinned in dependencyManagement specifically to stay past known HIGH/CRITICAL CVEs. Do not silently let a transitive dependency regress one of these pinned versions; if you bump a BOM or parent, re-check these overrides still apply.
  • Logging dependencies are centralized (slf4j-api, logback-classic, logback-core, logstash-logback-encoder); do not introduce an alternative logging framework in a service module.
  • Local shared-library development (testing an unreleased change to openframe-oss-lib) uses the 999-SNAPSHOT handshake: build and install the library locally as 999-SNAPSHOT, point <openframe.libs.version> at 999-SNAPSHOT for your local testing, and do not commit that version bump or publish a new snapshot release as part of the pull request.

Rust Client (clients/openframe-client)

  • The client is a thin binary (src/main.rs) over the openframe-agent-lib crate, pulled from openframe-oss-lib at a pinned Git tag (currently v0.0.5 in clients/openframe-client/Cargo.toml). Business logic for agent behavior belongs in that upstream library, not duplicated in this binary.
  • Use the existing Cargo tasks for local iteration: .vscode/tasks.json defines rust-build, rust-build-release, rust-test, rust-check, and rust-clippy, all run with cwd set to the client directory. Run cargo clippy and cargo test before opening a pull request — rust-analyzer.checkOnSave.command is configured to clippy in .vscode/settings.json, so editor diagnostics should already surface most issues.
  • Formatting is enforced via rustfmt (editor.formatOnSave is enabled for Rust files in .vscode/settings.json); do not hand-format around it.
  • Any Rust dependency on openframe-agent-lib must reference a specific Git tag, not a floating branch.

Deployment Manifests (Helm / Argo CD)

  • Each datasource, platform, or tenant component is its own Helm chart under manifests/datasources/*, manifests/platform/*, or manifests/tenant, each with its own Chart.yaml and values.yaml. Image and chart versions are pinned explicitly (for example manifests/datasources/kafka/Chart.yaml pins ~32.4.3); do not float a version unless you also verify compatibility.
  • Argo CD application composition is centralized in manifests/apps/values.yaml, which assigns each application a sync wave (-1 for namespaces, 0 for the rest) and project (platform, datasources, default). New components should follow this wave/project pattern rather than inventing a new ordering mechanism.
  • Every Deployment, Job, StatefulSet, and init container must declare both a pod-level podSecurityContext and a container-level securityContext, with runAsNonRoot: true, explicit non-zero runAsUser/runAsGroup/fsGroup, allowPrivilegeEscalation: false, capabilities.drop: [ALL], privileged: false, readOnlyRootFilesystem: true, and seccompProfile.type: RuntimeDefault — openframe-saas services use UID/GID 1001, init containers use UID 100/GID 101. Copy the block from an existing, already-hardened entry in the same directory rather than writing one from scratch (rules OPENFRAM-005-4, OPENFRAM-005-18, OPENFRAM-006-8, OPENFRAM-009-7, OPENFRAM-009-9, OPENFRAM-009-12).
  • Shared datasource connection details (MongoDB, Redis Cluster, Cassandra, Pinot) are defined once in configs/base/application.yml, not duplicated per service.

CI Workflows

  • Any docker buildx build step added to a workflow must be wrapped with nick-fields/retry@v4 configured with max_attempts: 3, retry_wait_seconds: 5, and timeout_minutes: 30, with the build invoked via the command: key rather than run: — see the Build and push image step in .github/workflows/release.yml for the pattern to copy (rule OPENFRAM-007-4).
  • Component and client matrices for CI (images_matrix, clients_matrix) are defined once in .github/workflows/changes.yaml and consumed by .github/workflows/release.yml. If you add a new service module or client target, register it there rather than hardcoding a parallel matrix elsewhere.

Running and Writing Tests

Full detail on test layout, local test commands, the openframe-test post-deployment runner, and Helm chart tests lives in Testing. The summary below covers what every contributor should know before opening a pull request.

Java Services

Each service module has its own src/test/java tree. Test infrastructure actually present in openframe-api (TestConstants, TestUtils, config/TestConfig, util/TestAuthenticationManager) establishes the pattern to follow in other modules: centralize fixtures in one TestUtils-style class, mock every external datastore and message broker (MongoTemplate, UserRepository, RedisTemplate, KafkaTemplate, CassandraTemplate, the Pinot Connection) via a @TestConfiguration, and keep a real BCryptPasswordEncoder where hashing behavior matters. Every module inherits JUnit 5, Spring Security test support, and Mockito (with the JUnit Jupiter extension) from the root pom.xml — no module needs to redeclare them.

Run the full reactor's tests from the repository root:

mvn test

Run tests for a single service module:

mvn -pl openframe/services/openframe-api -am test

Run a single test class:

mvn -pl openframe/services/openframe-api test -Dtest=TestUtils

The openframe-test Module

openframe/services/openframe-test is a standalone application, not a unit-test module — its entry point com.openframe.test.TestApplication runs JUnit Platform test suites tagged registration, oss, and reset against a deployed environment and reports results to Slack via SLACK_OAUTH_TOKEN. It is built like any other module (mvn -pl openframe/services/openframe-test -am package) and then run directly; it is the gate that confirms a deployed tenant is actually healthy, not a substitute for per-module unit tests.

Helm Chart Tests

Deployment manifests have their own helm-unittest-style specs under manifests/app-of-apps/tests/, asserting on rendered Argo CD Application and AppProject manifests. Run them from the chart directory once the plugin is installed:

helm unittest manifests/app-of-apps

When you add or change a template under manifests/app-of-apps/templates, add or update the matching spec under manifests/app-of-apps/tests/ — a chart change without a corresponding assertion update is incomplete.

Rules That Apply to Test Code Too

The active code review rules apply to **/*.java, including test sources. Several are blocking (error severity): never call a method inside another call's argument list (OFJAVA-002); consume Optional as a pipeline, never .get() (OFJAVA-003); return a real object or throw, never null, from a test helper (OFJAVA-013); no throws clauses on test methods, since exceptions are unchecked (OFJAVA-014); no Javadoc blocks (OFJAVA-008). Warn-level rules worth following anyway: name literal fixture values as constants, extract compound boolean assertion conditions into named predicates, and double-check any new test import resolves to a local class, a declared dependency, or a symbol another managed repository actually publishes.

Rust Client

clients/openframe-client is an intentionally minimal entry point with no logic of its own to unit test; almost all client behavior and its tests live in the upstream openframe-agent-lib crate. Run cargo clippy and cargo test (or the rust-clippy / rust-test VS Code tasks) before opening a pull request.

Coverage Expectations

This repository does not define a numeric line/branch coverage threshold. Coverage is treated as behavioral, enforced through three mechanisms instead: the openframe-test exit code as a hard release gate, Helm chart assertions staying green under manifests/app-of-apps/tests/, and the automated code reviewer's blocking rules on every pull request, including test code. See Testing for the full detail.

Reporting Security Issues

Do not open a public GitHub issue, pull request, or discussion for a security problem, and do not post it in a community channel. Report a suspected vulnerability by emailing security@flamingo.run, following the scope, disclosure timeline, and reporting guidelines in SECURITY.md.

Where to Find More Documentation