test(resolve-dependencies): demonstrate the ci-serialisation baseline reuse (item 4) - #8
Closed
sakanni wants to merge 1 commit into
Closed
test(resolve-dependencies): demonstrate the ci-serialisation baseline reuse (item 4)#8sakanni wants to merge 1 commit into
sakanni wants to merge 1 commit into
Conversation
… reuse Register item 4. Pester tests establishing that the baseline leg is built against the branch's dependency code, and that the two causes are independent: the already-cloned shortcut at Resolve-DependencyGraph.ps1:91, and PR_BRANCH being sourced from the event payload with no per-invocation override. Hermetic: a local bare repo via git insteadOf, no network and no BHoM. An end-to-end sandbox reproduction is not possible because every sandbox repo's dependencies.txt points at production BHoM repos. Demonstration only. Assertions describe current behaviour and are marked INVERTS-ON-ITEM4 where a fix would change them. No production code touched.
Collaborator
Author
|
Superseded by #9, which cherry-picks this commit ( The register amendments quoted here (items 4a, 4b, U2, U3) are restated in #9's body. |
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.
Investigation of findings-register item 4, the ci-serialisation baseline. No production code changed and no fix designed — the deliverable is the demonstration. Item 4 is a correctness finding on a check under a standing gate, so the fix gets its own session.
Verdict: item 4 HOLDS, with the mechanism corrected
The register led with clone reuse. That is real but it is the lesser of two independent causes, and a fix addressing only it would not work.
(a) The already-cloned shortcut.
Resolve-DependencyGraph.ps1:91short-circuits before any ref resolution, so a dependency already present is never re-pointed.(b) The resolver cannot be asked for the base branch.
PR_BRANCHcomes fromgithub.event.pull_request.head.ref(resolve-dependencies/action.yml:132), which is constant for the whole job, and the action exposes no per-invocation override. The baseline leg is therefore structurally incapable of requesting the base branch. DeletingC:\bhom-depsbetween the legs would not fix item 4.Each link, with evidence
Links 1 and 2 — observed on a real run. Sandbox run 28089097355 (
XML_Toolkit) is the only run in sandbox history that traversed the baseline path end to end. It shows:Cloning intolines on the branch leg, 0 on the baseline leg. Every dependency took the already-cloned path, not some of them.depsasm-Windows-Release-354c6cb2...missed on the branch leg and hit on the baseline leg. That key is a SHA-256 over the sortedowner/repo@shaset (resolve-dependencies/action.yml:145-164), so an identical key proves identical resolved dependency SHAs across both legs, independently of what those SHAs happened to be. This is a stronger proof of the general claim than any single reproduction would be.What resets between legs.
ci-serialisation:199clearsProgramData\BHoM\Assemblies\*.resolve-dependencies' "Prepare folders" then removes that whole directory andUpgrades, and truncatesdeps/_shas.txtviaNew-Item -ItemType File -Force. Nothing anywhere touchesC:\bhom-deps. No other cleanup exists in the action or either script.Link 3 — demonstrated hermetically. The resolver honours
PR_BRANCHon a fresh root when the dependency carries that branch, and falls back to the base branch when it does not. The capability exists; ci-serialisation simply never invokes it for the baseline.Link 4, the one that matters — an explicit base-branch request on the second invocation is ignored while the clone is present. Both causes must be addressed.
BHoMBot comparison, sharpened.
LoadDependencies(repo, branchName, defaultBranch)(CodeBuild_Engine/Compute/LoadDependencies.cs:11,31-32) clones if absent and then unconditionally callsCheckoutBranch(dep, branchName, defaultBranch)on every call, with the branch as an explicit argument.ResetBuiltRepos()clears the in-memorym_BuiltReposmemo so the per-leg re-checkout is not skipped as "already built this run". CI_Toolkit has neither half.CleanProgramDataFolder()deletes all ofC:\ProgramData\BHoM, comparable to whatresolve-dependenciesalready does.The demonstration
.github/scripts/tests/Resolve-DependencyGraph.BaselineReuse.Tests.ps1, 6 Pester tests, all passing. Auto-discovered bylint-workflows.yml's existingpowershell-testsjob. Hermetic: a local bare repo reached via gitinsteadOf, no network and no BHoM install. Fixture is a fresh GUID temp dir per run and the job uses no caching action at all, so cold by construction.Validated on a bare
windows-latestrunner: 6 new tests pass alongside the 18 existing ones.Assertions describe current behaviour and are marked
INVERTS-ON-ITEM4where a fix would change them. Nothing presupposes an answer to Q2 through Q9.Why not an end-to-end sandbox reproduction. It needs a subject repo whose
dependencies.txtnames a dependency in the same org plus a matching branch name on both. Every sandbox repo'sdependencies.txtpoints at productionBHoM/orBuroHappoldEngineering/repos, so the end-to-end case cannot be built without creating branches in production. What it would take: repoint a sandbox subject'sdependencies.txtat the existing sandboxBHoM_Enginefork, overrideserialisation_engine_repoto the same fork to avoidGet-FolderName's repository-name collision guard, author a serialisation-affecting change on a matching branch in that fork, and open a sandbox PR. Happy to build that if you want the consequence shown as well as the mechanism.Findings register
Register lives outside this repository; quoting the amendments.
Item 4 — HOLDS, mechanism corrected. Appended:
Item 4a — new, context. Item 4 has effectively never fired.
Item 4b — new, Low.
ci-serialisation:199is dead code.U2 — CLOSED. It works.
U3 — CLOSED. It warns, it does not fail.