Repository navigation
fix: a missing mcpp.lock is named by emit sbom and --locked - #893
Open
NopeCharon wants to merge 1 commit into
Open
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
mcpp::pm::load returns an empty Lockfile when the file does not exist, and two callers took a successful load to mean the file was there, so the branches they wrote for a missing lock were never taken. `mcpp emit sbom` wrote a root-only document, exit 0, without the note its own comment requires: that document is true of a project with no dependencies and false of one that was never built. It now asks whether the file exists before loading it. The note goes to the narration stream, so standard output stays the document. `mcpp build --locked` reported every resolved package as "(not in the lock)" under "this resolution differs from mcpp.lock", naming a file that is not there. It now gives the refusal that says the lock is missing and how to record one. `load` keeps its meaning: the build's own readers want an empty lock from a project that has none. A lock that exists behaves as before in both commands, and one that cannot be read is still an error. Tests: tests/e2e/333 runs `--locked` and `emit sbom` with the lock moved aside. docs/51 states the note in both languages. Closes mcpp-community#891
3 of 4 tasks
This branch has not been deployed
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
mcpp::pm::loadreturns an emptyLockfilewhenmcpp.lockdoes not exist, and two callers took a successful load to mean the file was there, so the branches they wrote for a missing lock were never taken.mcpp emit sbomwrote a root-only document with no note, although its own comment says this case is "NOT AN ERROR, AND NOT SILENCE EITHER". It now asks whether the file exists before loading it, and prints the note on the narration stream. Standard output stays the document.mcpp build --lockedreported every resolved package as(not in the lock)under "this resolution differs from mcpp.lock". It now gives the refusal that says the lock is missing and how to record one.loadkeeps its meaning, because the build's own readers want an empty lock from a project that has none.docs/51-supported-versions.mdstates the note in both languages.Closes #891.
Criteria
emit sbomwith no lock prints the note and writes a root-only document. The new assertions intests/e2e/333_named_runners_locked_and_sbom.shstate it. No build of the whole engine was possible on the host I had, so this ran on macOS arm64 against the realsrc/cli/cmd_sbom.cppm,src/pm/lock_io.cppmandmodules/libs/src/toml.cppmcompiled together, with stubs for the manifest loader and the CLI around them. Before the change: exit 0, no note, as the released 2026.11.5.1 binary also behaves. After it: exit 0, the note,componentsempty.--lockedwith no lock gives the refusal that names it, and writes no lock. This did not run locally, since it needs a resolved dependency and a built engine. It is asserted intests/e2e/333_named_runners_locked_and_sbom.sh, which passed on this PR'slinux-e2ejob (linux x86_64, self-host) with both new lines:--locked says a missing lock is missingandsbom says when no lock records the resolution. All of this PR's CI checks pass.check_docs_style.sh,check_docs_structure.sh,check_version_pins.sh,check_file_lengths.sh,check_workflow_assertions.pypass locally.step13_lockfileis 391 lines by a text count, under the 400 ofcheck_function_sizes.sh; that gate itself needs a compile database and is left to CI.Intersections
emit sbomasks whether the lock existsloadfailure branch is unchanged; run by hand as above, no e2e sits there--lockedrefuses a missing lock--lockedreports drift by name when a lock exists9.9.9 -> 0.0.1assertions in e2e 333Compatibility
mcpp emit sbomwith no lock gains one line on standard error; its document and exit code are unchanged.mcpp build --lockedwith no lock still fails, with a different message. No cache key or file format changes.Checks before merging
bash .github/tools/check_docs_style.sh,check_docs_structure.shandcheck_version_pins.shpass.python3 .github/tools/check_workflow_assertions.pypasses (a step asserts what its name says).git log origin/main..HEAD -i --grep='Co-Authored-By'prints nothing.compose one from the branch's commits. Suggested subject:
fix: a missing mcpp.lock is named byemit sbomand--locked``.