Coding Rules - space-station-os/space_station_os GitHub Wiki

Coding Rules

This document defines the coding and development rules for Space Station OS (SSOS).
All contributors are expected to follow these rules.


1. Development Flow (MANDATORY)

1.1 Issue First

All development must start from an Issue.

  • Every PR must be linked to an Issue
  • Direct commits to main without Issue are not allowed

1.2 Issue Requirements

Each Issue must include User Story and Acceptance Criteria:

User Story

Describe the purpose from a system or user perspective.

Example:

As a system integrator,
I want ARS to fail when overheating occurs,
so that failure propagation can be validated.


Acceptance Criteria

Define testable conditions.

Example:

  • Action fails when temperature exceeds threshold
  • result.success == false
  • summary_message contains "Bed failure"

1.3 PR Requirements

  • PR must reference Issue using:

closes #<issue_number>

  • PR must include:
    • What was changed
    • Why it was changed
    • Test impact

2. Contract vs Experimental (CRITICAL RULE)

SSOS uses a two-layer model for implementation maturity.


2.1 Contracted

Features that are guaranteed in release.

Requirements:

  • Covered by tests
  • Behavior is deterministic
  • Safe for integration with other subsystems

Examples:

  • ARS starts when DDCU power is granted
  • Invalid CO2 request is rejected
  • CO2 storage request failure works

2.2 Experimental

All other behaviors.

Includes:

  • Simplified simulation
  • Incomplete failure semantics
  • Boundary conditions not finalized
  • Partial implementations

3. Mandatory Visibility Rule

Experimental behavior must never be silent.


3.1 Logging Rule

Any Experimental path must emit:

RCLCPP_WARN_ONCE(this->get_logger(), "[EXPERIMENTAL] ");


3.2 Result / API Rule

If behavior is not Contracted, output must include:

  • "EXPERIMENTAL"
  • or equivalent status indicator

Example:

summary_message = "EXPERIMENTAL: fallback path used";


4. Testing Rules

4.1 Contracted Tests

  • Must pass before release
  • Included in CI

4.2 Experimental Tests

  • Optional
  • Not required for release
  • May be:
    • Disabled (DISABLED_)
    • Separate test file

5. Behavior Tree (BT) Rule

Behavior Tree defines system logic.

Example:

Rules:

  • BT defines execution structure
  • Failure semantics must be explicit
  • Fallback does not equal failure unless explicitly escalated

6. Failure Handling Policy

Failure must follow:

  • Contracted failure → Deterministic + tested
  • Experimental failure → Logged + clearly marked
  • Undefined failure → Must not silently pass

7. Simulation Philosophy

SSOS does not require full physical fidelity.

Instead:

  • Prioritize system behavior consistency
  • Allow partial models
  • Explicitly label incomplete logic

8. Code Style

8.1 General

  • Clear naming
  • Separation of logic and interface
  • No hidden behavior

8.2 Logging

  • Use RCLCPP_INFO / WARN / ERROR appropriately
  • Avoid silent failures

9. Release Policy

Release (e.g. v0.8.8)

Must include:

  • Only Contracted behaviors
  • Passing core tests

Patch (e.g. v0.8.8.1)

Used for:

  • Test fixes
  • Behavior clarification
  • Contract promotion

10. Summary

The core principle is:

Only Contracted behavior is reliable.
Experimental behavior must be visible.

⚠️ **GitHub.com Fallback** ⚠️