Commit Graph
506 Commits
Author SHA1 Message Date
Jacob Dahl a4697ed08e ci(clang-tidy): stop false positives in the inline review comments (#29013)
* ci(clang-tidy): stop false positives in the inline review comments

Of the 828 inline comments the clang-tidy job posted on 98 PRs since May, only 328 were unique: COMMENT reviews can't be dismissed, so every push posted every finding again. Most of the rest were artifacts of how the diff step runs:

- It parses against the test build dir, which is only configured, so the uORB, events and parameter headers don't exist and every TU stops at a missing include. clang-tidy then reports on the half-parsed AST: events::send<T>(...) as a chained comparison, sizeof on uORB arrays as sizeof of a pointer.
- It parses every changed .h on its own as C++, including board configs, NuttX headers and headers shared with C. The gating run never lints .h.
- .clang-tidy disabled macro-parentheses, incorrect-roundings and misplaced-widening-cast under their old misc- names, which clang-tidy 18 no longer knows, so all three were on.

Generate the test dir's headers, skip .h and board/NuttX files, drop clang-diagnostic-error (the build jobs report real compile errors), skip findings already posted on the PR, and disable four checks that only produced noise: googletest underscore names, virtual-class-destructor on gtest fixtures and singletons, suspicious-call-argument, and not-null-terminated-result on binary packet buffers.

Assisted-by: Claude:claude-opus-5-5

* ci(clang-tidy): keep the gating checks and skip the fuzztest header

.clang-tidy also configures the gating run, which enabled incorrect-roundings, macro-parentheses and virtual-class-destructor on purpose, with code fixes. Drop the stale misc- names instead of renaming them, and turn virtual-class-destructor, suspicious-call-argument and not-null-terminated-result off for the inline comments only.

Header generation also built fuzztest's json_grammar.h, which pulls in abseil and the antlr4 runtime: 336 ninja edges and 39 s in CI instead of 22 edges and 4 s.

Match already-posted comments on the line too, so a second finding with the same message elsewhere in a file is still posted. Drop only headers under boards/ and platforms/nuttx/, so SITL's own board sources are still linted.

Assisted-by: Claude:claude-opus-5-5
2026-10-06 19:52:54 -06:00
Ramon Roche a9a86dad76 feat(ci): show the AI review among the PR's checks
Comment-triggered runs belong to main, so GitHub never lists them in the
PR's checks and the only sign of a running review is a reaction on the
comment. Set an informational "AI PR Review" commit status on the PR
head, linking to the run: pending when the gate accepts, then success or
error. A run cancelled by a newer review of the same commit leaves the
newer run's status alone.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-10-02 19:38:09 -07:00
Ramon Roche 87f6f9e9d8 fix(ci): let the AI review react to the triggering comment
The gate and finish jobs had issues: write, but a comment on a pull
request is a pull request comment for permissions, so adding the 👀, 🚀
and 😕 reactions failed with HTTP 403 (seen on the first run, PR #28982).
Grant pull-requests: write instead. The review itself was unaffected:
reactions are best effort.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-10-02 16:33:32 -07:00
Ramon Roche f92f17dbc8 feat(ci): add the AI PR review workflow
pr-ai-review.yml runs the review when someone with write access comments
`!ai-review` on a PR (optionally with model= and effort=), or on manual
dispatch. A gate job checks the commenter's repository permission through
the API. The review job assumes an OIDC role that only this workflow on
main can use, and pr-review-poster.yml posts the result as a COMMENT
review, accepting this workflow's issue_comment and workflow_dispatch
runs; its pull_request path is unchanged. python_checks.yml runs the new
tests, mypy and flake8.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-10-02 15:50:14 -07:00
Jacob Dahl 42ce28a986 ci(labeler): apply at most one scope label per PR (#28965)
actions/labeler adds every scope whose globs match any changed file, so a PR touching a test, a param file and a board config collects a pile of scope labels (2.6 per PR on average over the last 300, up to 20) and nobody reads them. A scope label is only useful when it names the core of the PR.

The title's conventional-commit scope already states that core, so the scope label now comes from it, resolved to an area of the tree; the diff decides only when the title names nothing. Each file belongs to one scope, and labels this workflow added earlier are removed when they stop matching. scope:testing, scope:uorb, scope:middleware and scope:logging are no longer applied.

Assisted-by: Claude:claude-opus-5-5
2026-10-01 20:42:03 -06:00
Ramon Roche b287561f8c ci(build_all): run on pull requests only when build inputs change
Build all targets ran on every pull request except docs-only ones, so a
PR touching only MAINTAINERS.md, another workflow, test/ or the macOS
setup still built every board. Pull requests now skip it unless a
changed file can affect a firmware build. Build inputs that live under
otherwise ignored directories (this workflow, its ccache actions and
runner config, the Tools/ci scripts it runs and the SBOM generator
inputs) are re-included. Pushes to main, stable, beta, release branches
and tags are unchanged.

Replayed against the 435 PRs of the last 30 days, this skips the 39
that could not affect any target (79 runs, ~24.6k job-minutes) and no
others.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-10-01 15:10:32 -07:00
Saibernard b492664e41 fix(mc_nn_control): correct errors and add the first unit tests (#28433)
* fix(mc_nn_control): use single precision sqrt and correct two parameter/comment errors

Three small corrections in the neural network controller, none of which
change the commanded thrust for a valid configuration:

- RescaleActions() called sqrt() rather than sqrtf(), promoting to double
  in a loop that runs once per angular velocity sample. On an FPU without
  double precision that is a software routine, four times per cycle, in
  the path whose execution time the module exists to measure.

- MC_NN_THRST_COEF declared a minimum of 0.0, but the value is used as a
  divisor in RescaleActions(). Zero is therefore an in-range setting that
  makes the motor scaling non-finite. Raise the minimum off zero.

- The comment above PopulateInputTensor() gives the observation order as
  [pos_err(3), lin_vel(3), att(6), ang_vel(3)], but the code below it,
  NeuralControl.msg and the module usage text all use
  [pos_err(3), att(6), lin_vel(3), ang_vel(3)]. Attitude and linear
  velocity are transposed in the comment only.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>

* refactor(mc_nn_control): extract the action rescaling into a testable header

The mapping from network action to motor command lived inside a private
member operating on the TFLM output tensor, so it could not be unit
tested. Move the per element math into a dependency free header
function. Behaviour is unchanged.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>

* fix(mc_nn_control): keep motor commands between idle and full scale

The action to motor command mapping ran past both ends of the motor. On
the shipped defaults action -1 mapped to -0.0077, which the motor output
treats as a stopped motor while the other three keep thrusting, and every
action above 0.61 mapped past full scale. With a minimum rpm above a ninth
of the maximum the last stage also ran backwards for the first few
thousandths of the range. All three come from normalizing the rpm against
limits the thrust coefficient does not reach. Reported in #28417.

Bound the normalized rpm between the limits, so a thrust below what the
minimum rpm gives idles the motor and one above the maximum runs it at
full scale, and write the thrust curve compensation as a x^2 + (1 - a) x
so idle is exactly 0 and full scale exactly 1. The curve inside the
limits is unchanged.

Validate the three parameters at start and on every parameter update:
finite, the coefficient above zero, the minimum at least zero and below
the maximum, and a part of the action range wider than float resolution
reaching the motor, so rounding cannot pass a window with no action
inside it. Raw parameter writes are not bounded by the metadata, so this
is checked in code. The mapping only ever uses a set that passed. An invalid set is
reported as an error event, repeated while it stands, and the arming
check for the mode is refused until it is corrected, so the commander
neither arms into the mode nor keeps flying it. The mapping keeps the
last valid set meanwhile, so the write itself never steps the motors. A
valid set that covers less than the whole action range is reported as a
warning naming what it does cover, when it changes and again when the
mode is entered.

The arming check reply was not zero initialized, which left two mode
requirement fields to whatever was on the stack. Also from #28417: the
loop performance counter was left open on the two early returns after
inference, and actuator_motors.timestamp_sample was never set.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>

* test(mc_nn_control): add the module's first unit tests

The action to motor command mapping had no tests. These assert the
properties it has to keep rather than any particular output value:
actions beyond the boundary clamp, every command stays between 0 and 1,
the lowest action idles the motor and the highest runs it at full scale,
the mapping never decreases and rises inside the achievable range,
actions outside that range sit on the bounds, the output stays finite
for every normal action and across the documented parameter ranges, a
non finite action gives no command, and invalid limits are rejected.

Every threshold comes from the mapping's own achievable range, and each
property is checked for the shipped defaults, a smaller motor, and a
motor whose limits cover the whole action range, so a change to the
defaults only fails them when a property is broken.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>

* ci(tests): run the mc_nn_control unit tests in the neural configuration

make tests builds px4_sitl_test, which does not enable MC_NN_CONTROL, so
the unit tests the module registers were never built or run upstream. The
only configuration that enables the module is px4_sitl_neural.

Add a tests_neural target that builds that configuration with testing on
and runs the module's tests, the same shape as tests_daa_crosstrack and
tests_vtest_moving, and run it from the Unit Tests job.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>

---------

Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
2026-09-30 15:26:44 -06:00
Jacob Dahl d5223850dd docs(contributing): discourage force-pushing during review (#28931)
* docs(contributing): discourage force-pushing during review

A force-push after review has begun erases the commits a reviewer has read, so they cannot see what changed since. The guidance told contributors to squash and reword instead, which contradicts the commit and pr agent skills. PRs are typically squash-merged, so branch history does not need cleaning up before merge.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* ci(workflows): remove commit message check

PRs are squash-merged under the PR title, which is still checked. Flagging the individual commits pushed contributors to rewrite history mid-review.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

---------

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-09-30 11:04:19 -06:00
Ramon Roche 39f8b7bbfd ci(build_all): keep build artifacts for 1 day
Every build_all_targets run uploads about 1.3 GB of firmware, and
without retention-days it took the 90-day repository default. At
1,200-1,500 runs a month that held roughly 10 TB of Actions storage,
about $2k/month gross. PR artifacts only exist so authors can download
a build to test, and on pushes and tags the artifacts job copies them
to S3 and the GitHub Release in the same run.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-29 12:56:15 -07:00
Ramon Roche 47ce39d468 ci(macos): run on pull requests only when macOS setup changes; add weekly run
macOS runners cost roughly 10x Linux per minute, and this workflow was
about $1.8k/month gross running on every pull request. Pull requests now
run it only when they touch the macOS setup scripts, Homebrew pins, pixi
environment, Python requirements or the workflow itself. Pushes to main
still run it on every non-docs change, and a weekly scheduled run catches
upstream Homebrew/conda-forge drift. Non-PR runs save the ccache so pull
requests keep restoring from a fresh entry.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-29 12:47:45 -07:00
Ramon Roche ec2687abc3 ci(usb-ids): check board USB IDs on PRs that change them
The workflow triggers on pull requests that touch a board defconfig or
the USB ID tooling, and checks only the defconfigs the PR adds or
modifies. The file list comes from diffing the checked-out PR merge
commit against its base parent, so no API call or token is needed. A PR that changes the tooling itself is checked against every
board, so a checker change is proven on the real tree and not only by
its unit tests. A test keeps the tooling list and the workflow paths
filter in sync.

A manual run checks every board. There is no push or scheduled run: the
registry repo checks its own changes against PX4 main, and board
changes reach main only through PRs.

The mypy and flake8 step for the checker and runner lives in
python_checks.yml with the other Python tooling checks.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-28 14:44:48 -07:00
Ramon Roche 14cf29bb31 fix(build): check submodules once per configure, never reset changes
Every px4_add_git_submodule call ran check_submodules.sh twice, at
configure and build time, and with CI=true force-updated each submodule
every time, a 2017 workaround for an interactive prompt that is gone.
VS Code and CLion force-updated too, resetting submodule changes under
development.

The check now runs once per configure. A missing submodule is fetched;
one at another commit is kept as it is, with a warning locally and an
error in CI.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-28 11:50:38 -07:00
Ramon Roche 9a17deda06 ci(clang-tidy): prepare the clang build dirs in sequence
`make -j clang-ci` configured px4_sitl_default-clang and
px4_sitl_default-clang-test at the same time, and both configures fetch
the same submodules. About 1 in 200 Static Analysis runs failed with
`index.lock: File exists` or a half-cloned libevents.

The workflow now runs the configure-only test dir first, which fetches
the submodules, then builds the clang dir, which finds them present.
clang-ci had no other user, so it is removed.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-28 10:55:25 -07:00
Ramon Roche 89c68cd37f ci(build-all): build two targets per job concurrently
Each build job compiled its group one target at a time, and the serial
parts of every build (configure, the NuttX make, linking) left the 4-vCPU
runners about half idle. Two concurrent builds keep them around 80% busy
and cut total build-step time about 24% and runner cost about 17%.
Larger runners and more slots were measured and cost more than they save.

build_all_runner.py replaces build_all_runner.sh. NuttX compiles inside
its source tree, so each extra slot is a git worktree under .build_slots/.
All submodules are fetched once before building, each slot clones them
locally from the checkout, and builds run with GIT_SUBMODULES_ARE_EVIL=1
so CMake's per-configure submodule check does not sync and update them
concurrently on the shared .git/config. Targets that write the same
build/ directory (<board>_deb with <board>_default, the metadata targets
with px4_sitl_default) always share a slot, and the runner refuses a plan
that would split them. Every target is built even after a failure. Build
output streams with a [seconds|slot target] prefix, each target prints its
memory usage or, on failure, the excerpt from the first error, and a Build
Logs step prints each target's full log as one collapsed group. Slot build
directories are moved into build/, so packaging is unchanged.

The matrix now carries targets as a list plus a slot count from
build_all_config.yml; the comma-joined string existed only because
workflow expressions could not pass an array to a shell command, which
join() now does. The scan job runs new tests for the generated matrix and
the slot assignment.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-28 09:45:09 -07:00
Ramon Roche 939b420488 ci(codecov): upload unit test coverage (#28869)
* ci(codecov): upload unit test coverage and limit SITL coverage to main

Coverage on main came from a single standard_vtol SITL flight, unit tests
were never uploaded, and the Coverage build never hit ccache because
ccache 4.9.1 (Ubuntu 24.04) rejects -fprofile-update=atomic. The flag only
keeps hit counts exact under thread races; line coverage is unaffected and
lcov already ignores the resulting negative counts.

Unit tests now build with coverage and upload as the unittests flag on
every PR and push to main. standard_vtol builds as Coverage on main only
and uploads as sitl-vtol, carried forward on PRs. codecov.yml sets the
default branch, informational project/patch statuses and ignores.
Per-build-type ccache keys stop the Coverage and RelWithDebInfo jobs from
overwriting each other's cache.

Fixes #28862

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>

* ci(codecov): run unit test coverage as its own job

The Coverage build shifts EKF replay float output, so running it in the
Unit Tests job made the change indication step auto-commit new baselines
to the PR branch. Unit Tests goes back to the plain build and a separate
job produces the unittests upload. disable_search keeps the Codecov
uploader to the lcov report instead of running gcov over the build tree.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>

---------

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-26 19:11:53 -07:00
Ramon Roche bf9b1610ca fix(ros2): pin BuildKit for larger dev container SBOMs
Publishing px4-dev-ros2-gazebo fails because its SPDX attestation exceeds
BuildKit 0.32's 40 MiB limit. Pin the builder to v0.33.0 (80 MiB), matching
the fix already applied to build_deb_package.yml in 61907962c9.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-26 18:51:08 -07:00
Ramon Roche 786893436c ci(macos): save ccache only on main
The macOS build runs on GitHub-hosted runners, so its ccache lives in
the repository's 10 GB Actions cache. Every run saved a new entry, about
300 a week and 80% from pull requests, which kept the cache full and
evicting. Pull requests already restore from main's newest entry, so
only main needs to save. Pull requests still print the final ccache
stats.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-26 18:13:56 -07:00
Ramon Roche 5ecc673e23 ci(macos): drop the Homebrew download cache and double ccache
The Homebrew download cache restored from any older key and saved the
result under the new one, so it only ever grew: each entry is now about
2.9 GB, three of them fill most of the 10 GB repository cache, and
GitHub evicts the ccache entries to make room. Restoring and saving it
cost about 72 s per run, more than the Homebrew install it saves.

The 200M ccache is full after px4_sitl, so px4_fmu-v5_default only hits
about 81%.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-26 15:34:46 -07:00
Ramon Roche a8b0e91ebe feat(setup): install macOS Gazebo from a locked conda-forge environment
Homebrew rebuilds and drops the gz bottles whenever homebrew-core bumps
protobuf or abseil, which breaks the macOS Gazebo install until the pins
catch up. conda-forge keeps every package it has published, so
Tools/setup/macos/pixi.toml and its lock install the same gz, protobuf,
abseil, OpenCV and GStreamer binaries until the lock is updated on
purpose. OpenCV is the headless build, and GStreamer brings the good,
bad and ugly plugin sets the gz camera plugin's pipeline uses.

macos.sh installs the environment with pixi and loads it from the venv
activation through a small script, since pixi shell-hook would export
the installing shell's PATH. The build and the gz launch do not depend
on that activation: CMake searches the environment like it pins the
.venv Python, and px4-rc.gzsim sources gz_env.sh before it looks for
gz, which loads the environment when it is not already active and puts
its lib dir ahead of Homebrew's in the dyld fallback path.
conda-forge's gz-transport13 does not pull in cppzmq, so the manifest
lists it.

The osrf/simulation pin, the protobuf pin and the weekly bot that
refreshed them are removed. The homebrew-core commit moves into
homebrew-pins.txt unchanged.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-26 15:12:00 -07:00
Ramon Roche a4b722d400 ci(packaging): seed the container build caches from main (#28859)
* ci(packaging): seed the container build caches from main

The workflow only ran on pull requests, tags and manual dispatch, so
nothing ever saved a cache under main. Pull requests can only read
their own ref and main, so every first run on a PR built all images
cold (30 min vs 13 min warm). Running on main and weekly gives PRs a
cache to fall back to; the weekly run also keeps it inside the runner
cache's 10-day expiry.

The ROS ccache fallback also skipped the image name, so sih and gazebo
could restore each other's cache.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>

* ci(packaging): clarify why main is rebuilt weekly

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>

---------

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-26 14:27:05 -07:00
Ramon Roche 55a577ffd0 ci(docs): skip site artifact upload on pull requests
Only T4: Deploy reads px4_docs_build, and it runs on push and
workflow_dispatch. On pull requests the upload spent ~93 s and ~1 GB of
artifact storage per run for nothing. The site is still built, so the
check keeps failing on broken docs.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-26 13:43:41 -07:00
Jacob Dahl 4e91ae1c42 ci(flash_analysis): rename size table columns to Δ and Total (#28844)
Shorter headers keep the five-column table narrow, and "used" read as the amount used by the change rather than the target's total.

Assisted-by: Claude:claude-opus-5-5

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-09-25 15:59:06 -06:00
Jacob Dahl 253479bbeb feat(ci): report flash and RAM use against capacity, analyze fmu-v2 (#28838)
* feat(ci): report flash and RAM use against capacity, analyze fmu-v2

The size comment showed only the delta, which does not say how close a target is to its limit. Capacity comes from the board's own linker script, because the flash-analysis build links against an oversized flash region so that a change which overflows still gets a report.

fmu-v2 adds an F4 next to the F7 and H7 targets, and with 1 MB of flash it is the FMU that overflows first.

Assisted-by: Claude:claude-opus-5-5

* fix(ci): shorten the size comment's usage columns

Five columns with capacities spelled out made the table too wide to read at a glance.

Assisted-by: Claude:claude-opus-5-5
2026-09-24 17:54:56 -06:00
Jacob Dahl 2ec03ff1c3 fix(ci): skip the flash comment for sub-30 B deltas and agent-doc changes (#28806)
The commit hash compiled into px4_firmware_version_binary() changes its code size, so a PR with no code change reported -8 B on v6x and got a comment. Changes that only touch agent instructions also no longer build the targets.

Assisted-by: Claude:claude-opus-5-5

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-09-22 17:52:55 -06:00
Jacob Dahl 1d761cdf2e fix(ci): report flash and static RAM usage separately (#28789)
* fix(ci): report flash and static RAM usage separately

Bloaty's VM total includes zero-initialized RAM and understates the combined cost of data and code copied from flash into RAM. Report the flash load image and static RAM allocations independently so the PR headline reflects each resource's actual change.

Assisted-by: Codex

* docs(ci): trim memory analysis comment

Assisted-by: Codex

* fix(ci): diff PR flash usage against the merge commit's base

The base branch tip is fetched when the job runs, so a PR merged while its job was queued was compared against itself and reported a near-zero change, and commits landed in the meantime showed up as reverted.

* fix(ci): measure flash image from section headers

ld maps the ELF header into the first LOAD segment when its max page size exceeds the flash origin's alignment (binutils 2.34 defaults to 64 KiB), so segment-based accounting rejected valid firmware as outside the flash region.

* feat(ci): flag notable flash and RAM changes

Growth over 100 B and 1000 B gets yellow and red markers, savings over 100 B green, so reviewers can spot size regressions without reading the numbers.

* refactor(ci): derive flash and RAM totals without per-target constants

The matrix duplicated each board's flash-analysis linker region, which would drift silently. Section headers alone distinguish code executing in place (VMA == LMA) from data copied to or reserved in RAM, and the image span matches objcopy -O binary.

* fix(ci): limit the bloaty breakdown to VM sizes

Debug, symbol and string table rows only change the file size and made up most of the comment.

* fix(ci): post flash analysis only when size changes

A push that puts flash and static RAM back to zero was still rewriting the sticky comment, so a PR with no size change carried a zero report. Remove that comment instead. Fork tokens cannot delete it, so those PRs hand a delete artifact to the poster.

Assisted-by: Grok:grok-4.7
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* fix(ci): retain zero-delta flash analysis comments

Existing reports can be updated when size deltas return to zero, avoiding a separate privileged deletion path.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Assisted-by: Codex:gpt-6

---------

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-09-22 16:56:58 -06:00
Jacob Dahl fbfc1386ee ci(macos): install from pinned Homebrew commits
The job ran brew update and then installed whatever Homebrew was publishing, except Gazebo, which stayed on one commit. Those were built against different protobufs, so a release upstream failed the build with no commit here. Check the package repos out at commits recorded in the tree and do not update them. Run on macos-15 only, so the OS label cannot move either.

Assisted-by: Grok:grok-4.7
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-09-21 16:55:31 -07:00
Jacob Dahl 49339b843f ci(macos): remove the MacOS workflows
The build runs brew update and then pours Gazebo from one pinned tap commit while the rest of the install, including protobuf, comes from current Homebrew. A release in either repo fails the check with no commit here, and the GitHub-hosted image moves on its own, so the job cannot be a closed set. Drop the build and the weekly pin refresh. The setup script, the pins, and the refresh script stay for local use.

Assisted-by: Grok:grok-4.7
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-09-21 16:55:31 -07:00
Jacob Dahl db99f32cf2 ci(macos): disable the MacOS build check
make px4_sitl fails when Homebrew's protobuf is not the one the pinned Gazebo bottles were generated against. Those generated headers are a fatal error against any other version, and that has been failing these legs since 2026-09-02. Take the check off push and pull requests. workflow_dispatch still runs it.

Assisted-by: Grok:grok-4.7
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-09-21 16:55:31 -07:00
Julian Oes 1d7b23e198 build(macos): pin protobuf to what the gz bottles need (#28774)
Every gz .pb.h refuses to compile against anything but the exact protobuf
its gencode came from, so the bottles gz-tap-pin.txt holds osrf/simulation
at only build against the protobuf homebrew-core shipped the day OSRF built
them. homebrew-core moves protobuf on its own schedule and OSRF rebuilds
days later, so `make px4_sitl` has been failing on macOS on every branch
since homebrew-core shipped protobuf 36.2.

Pin protobuf as well, to the homebrew-core revision that installs the
version the pinned gz bottles carry, and derive that pin from the bottles
themselves so the two can never disagree. A protobuf release then becomes a
no-op here instead of days of red CI while OSRF catches up.

The pinned install has to run after the other simulation packages and with
the dependents check off: opencv@4 depends on protobuf too, brew resolves a
dependency against the versions recorded in the dependent's bottle, and it
reinstalls dependents whose linkage it has just broken. Pinning the formula
with `brew pin` is not an option either, brew then refuses to install
anything that depends on it.

Assisted-by: Claude:claude-opus-5

Signed-off-by: Julian Oes <julian@oes.ch>
2026-09-22 10:15:13 +12:00
Beniamino Pozzan 403b957e77 ci(ros_dev): add ros2-gazebo-dev target to ros_dev_container.yml
Signed-off-by: Beniamino Pozzan <beniamino.pozzan@gmail.com>
2026-09-21 11:18:58 -07:00
Julian Oes 2fc441493e ci(commit_checks): pass the PR title through the environment (#28772)
The PR title was interpolated directly into the shell command, so bash
parsed it as syntax before argparse ever saw it. A title containing double
quotes split into several arguments and failed the check for the wrong
reason, and a hostile title could run arbitrary commands on the runner.
Pass it via the environment like the labeler workflow already does, so it
is data rather than syntax.

Also make sure a report exists when the check fails without writing one,
otherwise the posting step dies on a missing comment.md and hides the
actual error.

Assisted-by: Claude:claude-opus-5

Signed-off-by: Julian Oes <julian@oes.ch>
2026-09-21 11:15:57 +12:00
Claudio ChiesandClaudio Chies 651b8687b8 feat(failure_injection): selectable detected/un-detected motor failure via SYS_FAIL_MOT_OFF (#28210)
* feat(failure-injection): implement motor failure injection with soft and hard modes

* feat(failure-injection): update motor failure injection descriptions and behaviors for annunciated and un-annunciated modes

* feat(failure-injection): update motor failure injection terminology to detected and undetected modes

* feat(failure-injection): refine motor failure injection handling for detected and undetected modes

* fix(boards): remove FailureInjector::update() from itcm_functions

FailureInjector was replaced by the shared failure_injection library, so
the symbol no longer exists and the ITCM check fails on the boards that
still list it. Its successor failure_injection::Config::update() is an
inline no-op unless MODULES_FAILURE_INJECTION_MANAGER is enabled, which
none of these boards do, so there is no replacement symbol to map.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Claudio-Chies <61051109+Claudio-Chies@users.noreply.github.com>

---------

Signed-off-by: Claudio-Chies <61051109+Claudio-Chies@users.noreply.github.com>
Co-authored-by: Claudio Chies <chiesc@chies.com>
2026-09-16 10:10:18 +02:00
Ramon Roche d57d7f3b11 ci(ros): use PX4 development images for translation tests (#28683)
* ci(ros): reuse the Jazzy toolchain for translation tests

Use the same pinned PX4 development image as the ROS integration tests while preserving the Humble environment and both distro-specific caches.

Assisted-by: Copilot:gpt-6-astra

* ci(ros): pin published Humble and Jazzy development images

Use the multi-architecture toolchains published from d8c01514ac for both translation-test distributions. Reuse bundled ccache while preserving separate caches, message-versioning checks and checkout-matched translation builds.

Assisted-by: Copilot:gpt-6-astra
2026-09-11 18:49:48 -07:00
Ramon Roche d8c01514ac feat(ros2): add Humble development images and distro releases (#28684)
* feat(ros2): add Humble development images and distro releases

Build Humble on Jammy without replacing its ROS DDS libraries: Agent 2.4.3
links private, pinned Fast DDS/CDR dependencies. Publish Humble and Jazzy
tags independently while leaving packaged runtime images Jazzy-only.

Assisted-by: Copilot:gpt-6-astra

* refactor(ros2): share pinned Agent DDS libraries across distros

Build the Agent against the same private Fast DDS and Fast CDR pins on Humble and Jazzy, without replacing either ROS underlay. Remove distro-specific build branches and name the dependency manifest for its shared role.

Assisted-by: Copilot:gpt-6-astra
2026-09-11 14:10:22 -07:00
Ramon Roche 269fba3e53 fix(ros2): publish the development image to Docker Hub
Make the standalone ROS toolchain available from the same registries as the ROS runtime images. Preserve opt-in publication, existing GHCR tags and both architecture SBOM indexes.

Assisted-by: Copilot
2026-09-10 18:28:12 -07:00
Ramon Roche 61907962c9 fix(packaging): support larger container SBOM attestations
Gazebo ROS image publication exceeds BuildKit 0.32's 40 MiB attestation limit. Pin the builder daemon to 0.33.0 for its 80 MiB limit while preserving the existing scanner and complete package/file coverage.

Assisted-by: Copilot:gpt-6-astra
2026-09-10 17:49:41 -07:00
Ramon Roche b28ba0eedb ci(ros2): test PR firmware in the ROS development container
Build each PR firmware and matching ROS workspace from source against the digest-pinned Jazzy toolchain. Run the interface library unit and SIH integration suites without reusing stale firmware or generated messages.

Assisted-by: Copilot:gpt-6-astra
2026-09-10 16:07:58 -07:00
Ramon Roche f7052b281c feat(ros2): add PX4 ROS development containers
Provide a supported Jazzy environment for SIH/Gazebo development and source builds, with pinned tooling and reproducible multi-architecture image publishing. Separate package and container assets from ROS source preparation, and keep checkout workspaces fresh through a Python CLI.

Assisted-by: Copilot:gpt-6-astra
2026-09-10 16:07:58 -07:00
Julian Oes cc976e150a feat(posix): separate the filesystem root from the storage directory (#28582)
On NuttX these are two things: / is the filesystem root, and /fs/microsd is the
SD card mounted under it. MAVLink FTP serves the root and confines writes to the
SD card, so the read-only ROMFS at /etc is visible but cannot be written.

On POSIX they were the same directory. PX4_ROOTFSDIR and PX4_STORAGEDIR both
resolved to CONFIG_BOARD_ROOT_PATH, which on SITL is ".", so the working
directory was simultaneously the FTP root and the only writable area. The
consequences were that the ROMFS symlink sat inside the FTP root, and that
_validatePathIsWritable() had nothing meaningful to check against and so was
compiled out on POSIX entirely, leaving no write restriction at all.

Give POSIX the same split. CONFIG_BOARD_ROOT_PATH keeps its meaning as the
storage directory, and a new CONFIG_BOARD_FS_ROOT_PATH names the root FTP
serves, defaulting to the storage path so every existing board is unchanged.
SITL sets the root to "." and storage to "./fs", which mirrors NuttX: logs,
parameters, dataman and eeprom move under ./fs, and etc/ stays in the root as
read-only data.

With storage distinct from the root, the write restriction now applies on every
platform rather than NuttX only, and no longer compares against a hardcoded
prefix length that was wrong for any board not using /fs/microsd.

Assisted-by: Claude:claude-opus-5[1m]

Signed-off-by: Julian Oes <julian@oes.ch>
2026-09-08 17:01:55 -06:00
Ramon Roche 6f93287fdd ci(macos): rewrite gz tap pin refresh in Ruby under brew ruby
The bash version spent most of its lines on plumbing: parsing a report
back out of a per-commit `brew ruby` child, awk and herestrings for set
logic, bash 3.2 workarounds, and a trap to restore the tap. The job
itself is small and lives inside Homebrew anyway, so run the whole thing
under Homebrew's Ruby and call its tap, formula and bottle APIs directly.

One process instead of one Homebrew startup per candidate commit, the
tap checkout restored by ensure, tarballs checked with Net::HTTP, and no
second language embedded in a string. Formulary.clear_cache and
Tap#clear_cache between checkouts keep each candidate's formulae fresh.
GITHUB_OUTPUT still arrives because brew forwards GITHUB_* whenever CI
is set. Same walk, same exemption for formulae unbottled at the pin,
same outputs; verified to pick the same commit as the bash version.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-04 13:26:30 -07:00
Ramon Roche 2d6329fab2 ci(macos): brew update before macos.sh so both legs see current core
The macOS runner images set HOMEBREW_NO_AUTO_UPDATE in their bashrc and
carry a homebrew-core snapshot from image build time. Today the macos-15
image (20260828) installs protobuf 36.0 while macos-26 (20260707) still
installs 35.1, so the two legs of this workflow cannot both be
compatible with any single gz tap pin. The pin is refreshed against tap
HEAD, which OSRF keeps consistent with current homebrew-core, so update
core before installing. Dev machines already do this through brew's
auto-update.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-04 13:26:30 -07:00
Ramon Roche 045f249929 ci(macos): move gz tap pin refresh into a script that checks bottles
The weekly refresh workflow carried its logic inline, compared only the
tap SHA against the pin, and duplicated the --sim-tools package list.
`brew install --dry-run` never prints "from source", so its bottle check
could not fire.

Tools/ci/refresh_gz_tap_pin.sh now owns the job and the workflow calls
it. It reads the osrf/simulation formulae from macos.sh, walks the tap
from HEAD back to the pin, asks Homebrew at each commit whether every
formula in the runtime closure has a bottle for the host, HEAD-requests
each tarball, and rewrites the pin to the first commit that passes.
Formulae with no bottle at the current pin (the gz-harmonic
meta-formula, which OSRF never bottles) are not required.
peter-evans/create-pull-request opens or updates the bot PR from the
script's outputs, so an unmerged bump is refreshed instead of duplicated.

The job runs on macos-15, the oldest macOS in compile_macos.yml, because
Homebrew pours an older macOS bottle onto a newer one, not the reverse.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-04 13:26:30 -07:00
FARHANG d840da70b6 build(macos): pin gz tap unconditionally, add weekly refresh
macos.sh only pinned osrf/simulation when --ci was passed, so dev
machines still hit OSRF's bottle-gap window and built Gazebo from
source. Apply it whenever --sim-tools runs.

The pin is a point-in-time SHA with nothing to advance it, so add a
weekly workflow that checks whether osrf/simulation HEAD is fully
bottled and opens a PR bumping gz-tap-pin.txt when it is.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: FARHANG <farhang.nba@gmail.com>
2026-09-04 13:26:30 -07:00
Jacob Dahl 9338031b11 fix(ci): attach FMU bootloader .bin to GitHub releases (#28495)
* fix(ci): attach FMU bootloader .bin to GitHub releases

Releases only shipped `_bootloader.px4`, the USB uploader envelope. SWD recovery needs the raw `.bin` at 0x08000000.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* fix(ci): do not attach unused bootloader .px4

USB flashing would write it into the application slot. SWD uses the raw .bin.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* fix(ci): omit bootloader SBOMs from GitHub releases

GitHub Releases glob artifacts/**/*.sbom.spdx.json. Bootloader metadata dirs are not a recovery artifact.

*_bootloader_* variants (e.g. bootloader_secureboot) stay omitted: those images are baked with in-tree test keys.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* docs(bootloader): point SWD recovery at the release .bin

Match the cannode pre-built blurb. The .px4 envelope is not the SWD image.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* docs(bootloader): scope release .bin to SWD programmers

gdb load needs ELF program headers. The release image is a raw .bin for ST-Link / CubeProgrammer / OpenOCD, and only in-tree *_bootloader targets are attached.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

---------

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-09-01 14:41:26 -06:00
Jacob Dahl 3969a1b8ff fix(ci): publish flashable CAN node firmware (#28445)
* fix(ci): publish flashable CAN node firmware

Release packaging only collected .px4 files, which the DroneCAN bootloader cannot flash.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* fix(ci): attach canbootloader .bin as the SWD image

The cannode bootloader is a raw .bin for st-flash, not a .px4 envelope.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* fix(ci): drop cannode.zip from release assets

The target-named .uavcan.bin and _canbootloader.bin files are the flashable images; the zip only duplicated them.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

---------

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-08-28 22:17:34 -06:00
Ramon Roche 6db88017b8 ci(macos): key ccache per matrix OS
Both legs of the macOS matrix built the same ccache key, since the prefix
carried no OS component and setup-ccache appends only ref and sha. Two
consequences, reproducible on every run:

One leg always lost its save, reporting "Unable to reserve cache with key
ccache-macos-<ref>-<sha>, another job may be creating this cache".

The survivor then poisoned the other. compiler_check=content means ccache
hashes the compiler binary, and macos-latest is now macOS 26 while macos-15
is macOS 15, so neither can reuse the other's objects. Measured on run
32291495373, same commit, after ccache -z: macos-latest hit 860/944 (91.10%)
on px4_sitl while macos-15 managed 332/944 (35.17%), recompiling two thirds
of what it should have had cached.

The 200M budget was shared between both toolchains as well, and reported
full, so they were also evicting each other.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-08-20 12:11:36 -07:00
Ramon Roche 97c35057ce ci(build-all): install only what the matrix generator needs
The scan job is the one job in this workflow that runs outside the build
container, so it installs its own Python dependencies. It was installing all
31 entries of requirements.txt to run a script that reaches four of them, and
every one of the other 27 was a chance to fail: the job has died on packaging
and on lxml, neither of which it imports.

Drop the pip cache with it. Restoring it costs about as long as fetching four
small wheels, and its key used hashFiles('**./Tools/setup/requirements.txt'),
a glob that matches nothing. The hash was empty, so the key collapsed to
"Linux-pip-", matched its own restore-key, and never saved again after the
first write in April.

Verified in a clean python:3.12-slim container: generate_board_targets_json.py
exits 0 for both --group and --group --seeders with exactly these four
installed. pyyaml and kconfiglib alone are not enough, since
loadconfig.ensure_env() shells out to the zenoh generator, which needs empy
and pyros-genmsg.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-08-20 12:11:15 -07:00
Ramon Roche 6ed16e2748 build(macos): pin osrf/simulation tap under --ci
When homebrew-core bumps a shared dependency, OSRF's bot bumps each gz
formula's revision and deletes its bottle block within minutes of the upstream
merge. The matching rebuild is a separate, unautomated step: across 2026 the
gap ran 0.5 to 11 days, median 2.5, leaving gz unbottled roughly 18% of the
time. In that window macos.sh compiles gz-sim8, gz-msgs10 and five others from
source and the setup step goes from ~8min to 20-30min.

The removal only edits the formula. The bottle tarballs are never deleted from
OSRF's S3 bucket, so pinning to the last fully bottled revision keeps installs
binary while upstream catches up.

Gated behind a new --ci flag rather than applied unconditionally. Automation
wants a reproducible, fast install; development machines want the current
formulae and can absorb a source build, and should not have their tap left on
a detached HEAD as a side effect of running the setup script.

Only the gz tap is pinned. opencv@4, protobuf, gstreamer and the rest still
track homebrew-core, so CI keeps catching upstream formula breakage on every
PR, which is the reason --sim-tools runs there in the first place.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-08-19 13:10:10 -07:00
Ramon Roche 3f81372147 ci(itcm): bump px4-dev container and drop pip install
The image now ships pyelftools, so the job no longer has to fetch it from
PyPI on every run. That install was a recurring failure: 502s from
files.pythonhosted.org killed 6 ITCM jobs in the last 30 days.

Removing the step matters as much as the bump. Left in place it would still
reach PyPI for the symforce line, which the check has never needed:
Tools/itcm_check.py imports only elftools.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-08-18 17:04:21 -07:00
Ramon Roche a7aecfb9fb build(container): bake optional requirements into px4-dev image
The Dockerfile only ever copied requirements.txt, so optional-requirements.txt
was never installed into the image even though it sits in the build context.
Every CI job needing pyelftools therefore fetched it from PyPI at job time and
failed whenever files.pythonhosted.org returned 502s.

symforce publishes no Linux aarch64 wheel and no sdist, so installing the file
unguarded would break the linux/arm64 image build. Gate it with an environment
marker so aarch64 installs pyelftools only.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-08-18 15:13:33 -07:00