ci: apply Depends-On dependencies to the memory report - #20042
Open
zhangning21 wants to merge 1 commit into
Open
ci: apply Depends-On dependencies to the memory report#20042zhangning21 wants to merge 1 commit into
zhangning21 wants to merge 1 commit into
Conversation
The memory report builds this pull request merged into master, together with the nuttx-apps default branch, and nothing else, so a companion or predecessor pull request it declares is absent. For a breaking change the target then fails to build and no report is produced at all, even though the Build workflow already tests the declared sources through Depends-On. Apply the declared dependencies before building, reusing the parser and the fetch/cherry-pick sequence that build.yml uses, and mapping each repository to its checkout exactly as build.yml does. A stacked nuttx dependency is no more optional than an apps one: a pull request that uses an API its predecessor introduces does not build without it. As build.yml does, read the description through the API rather than trusting the event payload, so that a manual re-run after editing a Depends-On line applies the current declaration instead of the one the run was created with. Unlike build.yml, a failed read stops the job rather than falling back to the payload: build.yml resolves this once and hands every target the same tree, while this job runs per target, so a fallback could leave targets on different declarations while their results are filed under one SHA. A declared dependency that cannot be applied fails the job, and so does a missing parser, a parser crash, or a status this step does not recognise: each of those means the declaration was never evaluated, and continuing would measure a combination nobody asked for. build.yml fails Fetch-Source on the same conditions, and no other step in this job carries continue-on-error, so falling back silently would be inconsistent with both. A declaration that parses to nothing valid only warns, again matching build.yml. Forward the parser's warnings too. --print-state prints only the state, so an entry the parser drops -- an unsupported repository, say -- would otherwise leave no trace here at all, although build.yml annotates it, and the source set named below would be silently incomplete. The report is filed under the pull request head SHA rather than the SHA of the tree that was built, so the measurement cannot be reproduced from that SHA alone and cannot be split per dependency. That limits provenance, not the measurement: a combined result is what the declaration asks for, and a regression that only appears in combination is still a regression. Name the whole source set in the step summary so the reader knows which heads went into the number. Note in the parser that the --print-state output is a parsed contract; the edit gate that used to be its only caller is gone. Update the CI documentation to match. Its Pull Request Dependencies section attributes dependency application to build.yml's Fetch-Source job alone, so after this change it would read as if the memory report measured the normal source selection. Cross-reference the two sections rather than restating the rules, which stay shared. Signed-off-by: zhangning21 <zhangning21@xiaomi.com>
zhangning21
requested review from
lupyuen,
raiden00pl and
simbit18
as code owners
September 2, 2026 06:44
Contributor
|
@michael-membrowse please take a look |
Contributor
|
@acassis looks good to me |
xiaoxiang781216
approved these changes
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Teaches the MemBrowse memory report to honour the
Depends-On:declarationsthat
build.ymlalready understands, so a pull request that builds only withanother one can produce a report from the declared combined source set.
Requested in #19867.
For pull requests targeting
master, the workflow re-reads the currentdescription, parses dependencies with the existing
.github/scripts/depends_on.py, and applies acceptedapache/nuttxandapache/nuttx-appsdependencies to the matching checkout in declaration order.A dependency already reachable from the checkout is recorded without being
cherry-picked again. Unsupported references are dropped with a warning; a
declaration with no valid references retains the default sources.
Failures that leave the declaration unevaluated, or a parsed dependency
unapplied, stop the job rather than produce a report for the wrong source set.
Checkout deepening is best effort, but the subsequent common-base and
commit-list checks remain fail-closed.
Changes
.github/workflows/membrowse-report.yml— add anApply depends-on PRsstepand grant
pull-requests: readso it can re-read the pull requestdescription.
.github/scripts/depends_on.py— document that--print-stateis a parsedoutput contract with a second consumer.
Documentation/testing/nuttx-ci.rst— cross-reference the dependency andmemory-footprint sections.
Impact
The functional change affects only MemBrowse reports for pull requests
targeting
master. Pull requests without a declaration retain the normal sourceselection, but the step still re-reads the description and invokes the parser;
a failure in either operation fails the job. Push runs and release-branch pull
requests do not run the dependency step.
The workflow's
GITHUB_TOKENgainspull-requests: read. Its GitHubpermissions remain read-only, and it does not post pull request comments;
commenting stays in the separate privileged
membrowse-comment.yml.Declared dependency code shares the upload job's trust boundary, so
secret-bearing same-repository runs must reference trusted dependency heads;
details are documented below.
No NuttX runtime, board, hardware, or
build.ymlbehaviour changes..github/scripts/depends_on.pychanges only its module docstring, and the CIdocumentation is updated in
Documentation/testing/nuttx-ci.rst.Known limitations
The source set is not sampled atomically across the matrix. Each matrix leg
independently checks out the unpinned nuttx-apps default branch, re-reads the
live pull request body, and resolves dependencies from mutable
refs/pull/N/headrefs. The apps baseline was already a mutable input; the livebody read and the mutable dependency refs are the two this change adds. Run
33403284777observed the same checkout and dependency SHAs in both legs, butthat does not guarantee atomicity. Eliminating the race would require resolving
the complete source set once and distributing immutable SHAs or a shared source
artifact to every leg.
A stale or mixed downstream comment is a conditional risk. The comment
workflow was not exercised by the staging runs. It runs after every
non-cancelled report conclusion, including failures, and queries MemBrowse by
workflow_run.head_shawithout an originating run ID or target manifest. Are-run after editing
Depends-On:reuses the same head SHA, so MemBrowse'soverwrite and retention behaviour could expose stale targets or a mixture from
different runs. This was not observed: the staging upload identity and
workflow_run.head_shamatched.Provenance is per-leg. Each job summary records the pre-apply
apache/nuttxandapache/nuttx-appscheckout SHAs and every dependency headSHA in declaration order, including already-contained dependencies. These
values can reconstruct the source set while the Git objects remain available,
but there is no combined post-apply tree SHA or matrix-wide manifest.
Dependency inclusion uses commit reachability, not patch equivalence. Like
build.yml, the step cherry-picksHEAD..depand treats a dependency asincluded only when its commits are reachable by identity. If equivalent changes
land under rewritten SHAs, or overlapping stack members are declared
separately, replay may stop as empty, conflict, or apply cleanly and reach the
same tree. Declare only the unlanded stack tip, rebase or update it after an
ancestor lands under rewritten SHAs, and remove declarations once their
dependencies land.
Declared dependencies share the upload job's trust boundary. Unlike the
limitations above, this one is introduced here: before this change the report
workflow built only its own checkouts. Dependency code is built in the same job
before the final upload step receives
MEMBROWSE_API_KEY. The key is scoped tothat step, and fork-triggered runs do not receive repository secrets, but
earlier code can still affect the shared workspace and runner environment files.
Secret-bearing same-repository runs must therefore declare only trusted
dependency heads. Full isolation would require separate build and upload jobs
connected by an artifact.
Testing
The staging runs used GitHub-hosted
ubuntu-latestrunners and the NuttX CIcontainer. They ran in the
zhn-testmirror, so logs showzhn-test/nuttx-appswhere upstream usesapache/nuttx-apps. The stagingrevisions also carried mirror mapping and a two-target matrix; neither change is
part of this pull request.
Base-ref gate. Two runs used identical source trees and declarations but
targeted different branches:
Apply depends-on PRs33255928602membrowse-base-20260824(master-equivalent)33373845058releases/membrowse-e2eThe corresponding merge commits (
7879d12b72,e3e9e6228d) had identicalparents, trees, and workflow content. Staging replaced the literal
masterwithits master-equivalent branch, so this verifies the gating mechanism rather than
the literal branch name.
Dependency application. Run
33255928602applied both a same-repositoryNuttX dependency (
pull/33@995cd8dde0…) and a companion nuttx-appsdependency (
pull/18@d826dcfc8a…) in both the ARMstm32-nucleo-f103rband RISC-Vhifive1-revblegs, then built successfully.Order, already-included handling, and provenance. Run
33403284777applied two dependencies in declaration order, recognised a third as already
included, recorded full checkout and dependency SHAs, and built both targets.
The submitted workflow and the tested candidate
4a77864b…are byte-identicalafter comments are removed, so the commands and parser behaviour exercised by
the run are unchanged.
The mirror had no MemBrowse API key, so its tokenless uploads returned HTTP 404
and were tolerated by a staging-only
continue-on-error. The run thereforeverifies dependency handling, provenance, and builds, but not a successful
MemBrowse upload or the downstream comment workflow. The upload identity still
matched the pull request head SHA.
Local checks. The submitted commit passed 40 parser tests,
py_compile,YAML parsing,
bash -nover all 14 shell blocks, andgit diff --check.Extracted-step tests confirmed that body/parser, fetch/history, commit-list, and
cherry-pick failures stop the job.
noneandinvalidretain the defaultsources; invalid declarations emit one warning, and unsupported repositories
warn without preventing supported entries in the same declaration from being
applied. The recorded summary contains full source SHAs in declaration order,
including already-contained dependencies.
The RST section references were also checked, and parsing introduced no new
diagnostics.