-
Notifications
You must be signed in to change notification settings - Fork 0
fix(pkg): support multi-version transitive package graphs #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
62c9db8
docs(cf-11): specify multi-version package graph
TheHalfMoon 4702e8d
docs(cf-11): plan multi-version resolver correction
TheHalfMoon a065925
docs(cf-11): define foundation correction tasks
TheHalfMoon ecda037
docs(cf-11): record package graph study sources
TheHalfMoon bbfd7b4
fix(pkg): resolve transitive packages by exact identity
TheHalfMoon c5cbe02
test(pkg): cover multi-version package graph semantics
TheHalfMoon 7411ceb
ci(pkg): prove real multi-version FHIR package graph
TheHalfMoon d0bd71c
docs(cf-11): reconcile completed foundation tasks
TheHalfMoon 21b159e
docs(cf-11): record multi-version foundation evidence
TheHalfMoon 6f1fa55
docs(cf-11): reconcile reviewer truth
TheHalfMoon 9c1fa72
docs(cf-11): close reviewer reconciliation task
TheHalfMoon 08695e8
fix(ci): compare semantic lock identity in CF-11 proof
TheHalfMoon 68d5a3c
fix(ci): harden CF-11 reproducibility evidence
TheHalfMoon 744a64c
docs(cf-11): tighten proof and ambiguity requirements
TheHalfMoon 0c25192
docs(cf11): reconcile final proof and reviewer truth
TheHalfMoon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,185 @@ | ||
| name: cf11-multi-version-proof | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - .github/workflows/cf11-multi-version-proof.yml | ||
| - Cargo.toml | ||
| - Cargo.lock | ||
| - crates/commandf-pkg/** | ||
| - crates/commandf-cli/** | ||
| - specs/011-cf-11-multi-version-package-graph/** | ||
| - donors/cf-11-multi-version-package-graph.yaml | ||
| push: | ||
| branches: | ||
| - fix/cf-11-multi-version-package-graph | ||
| paths: | ||
| - .github/workflows/cf11-multi-version-proof.yml | ||
| - Cargo.toml | ||
| - Cargo.lock | ||
| - crates/commandf-pkg/** | ||
| - crates/commandf-cli/** | ||
| - specs/011-cf-11-multi-version-package-graph/** | ||
| - donors/cf-11-multi-version-package-graph.yaml | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| CF11_PROOF_CONTAINER: docker.io/library/rust@sha256:9146b0f62e1939989aa96fc8d89699a43c5635bf212819235a773e1a9e71a98f | ||
|
|
||
| jobs: | ||
| real-package-graph: | ||
| runs-on: ubuntu-24.04 | ||
| container: | ||
| # Docker Official Image rust:1.97.1-trixie, pinned to the linux/amd64 manifest. | ||
| image: rust@sha256:9146b0f62e1939989aa96fc8d89699a43c5635bf212819235a773e1a9e71a98f | ||
| timeout-minutes: 20 | ||
| steps: | ||
| - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5 / Node 24 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Assert pinned execution toolchain | ||
| run: | | ||
| set -euo pipefail | ||
| rustc --version --verbose | ||
| cargo --version | ||
| test "$(rustc --version | awk '{print $2}')" = "1.97.1" | ||
|
|
||
| - name: Build commandF resolver | ||
| run: cargo build --locked -p commandf | ||
|
|
||
| - name: Resolve previously blocked frozen IPS state twice | ||
| run: | | ||
| set -euo pipefail | ||
| rm -rf /tmp/cf11-multiversion | ||
| mkdir -p /tmp/cf11-multiversion | ||
|
|
||
| for pass in a b; do | ||
| root="/tmp/cf11-multiversion/$pass" | ||
| mkdir -p "$root" | ||
| cargo run --locked --quiet -p commandf -- \ | ||
| pkg resolve hl7.fhir.uv.ips@2.0.1 \ | ||
| --cache "$root/cache" \ | ||
| --lock "$root/commandf.lock" | ||
| cargo run --locked --quiet -p commandf -- \ | ||
| pkg verify \ | ||
| --cache "$root/cache" \ | ||
| --lock "$root/commandf.lock" | ||
| done | ||
|
|
||
| - name: Prove multi-version identity and deterministic semantic lock identity | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| python3 - <<'PY' | ||
| import json | ||
| import os | ||
| import platform | ||
| import subprocess | ||
| from pathlib import Path | ||
|
|
||
| first = json.loads(Path('/tmp/cf11-multiversion/a/commandf.lock').read_text()) | ||
| second = json.loads(Path('/tmp/cf11-multiversion/b/commandf.lock').read_text()) | ||
|
|
||
| def package_evidence(package): | ||
| source = package.get('source') | ||
| assert isinstance(source, str) and source, package | ||
| return { | ||
| 'name': package['name'], | ||
| 'version': package['version'], | ||
| 'source': source, | ||
| 'sha256': package['sha256'], | ||
| 'dependencies': dict(sorted(package.get('dependencies', {}).items())), | ||
| } | ||
|
|
||
| def semantic_identity(lock): | ||
| packages = [] | ||
| for package in lock['packages']: | ||
| item = package_evidence(package) | ||
| item.pop('source') | ||
| packages.append(item) | ||
| return { | ||
| 'schema': lock['schema'], | ||
| 'roots': sorted(lock['roots']), | ||
| 'packages': sorted(packages, key=lambda package: (package['name'], package['version'])), | ||
| } | ||
|
|
||
| first_semantic = semantic_identity(first) | ||
| second_semantic = semantic_identity(second) | ||
| assert first_semantic == second_semantic, ( | ||
| 'independent resolutions produced different package identities, digests, or declared dependencies' | ||
| ) | ||
|
|
||
| roots = [ | ||
| package for package in first['packages'] | ||
| if package['name'] == 'hl7.fhir.uv.ips' and package['version'] == '2.0.1' | ||
| ] | ||
| assert len(roots) == 1, roots | ||
|
|
||
| by_name = {} | ||
| for package in first['packages']: | ||
| by_name.setdefault(package['name'], set()).add(package['version']) | ||
|
|
||
| multi = { | ||
| name: sorted(versions) | ||
| for name, versions in by_name.items() | ||
| if len(versions) > 1 | ||
| } | ||
| assert multi, 'expected at least one same-name multi-version dependency' | ||
|
|
||
| terminology = by_name.get('hl7.terminology.r4', set()) | ||
| assert {'7.1.0', '7.2.0'} <= terminology, terminology | ||
|
|
||
| first_packages = sorted( | ||
| (package_evidence(package) for package in first['packages']), | ||
| key=lambda package: (package['name'], package['version']), | ||
| ) | ||
| second_packages = sorted( | ||
| (package_evidence(package) for package in second['packages']), | ||
| key=lambda package: (package['name'], package['version']), | ||
| ) | ||
| first_sources = [(p['name'], p['version'], p['source']) for p in first_packages] | ||
| second_sources = [(p['name'], p['version'], p['source']) for p in second_packages] | ||
|
|
||
| evidence = { | ||
| 'schema': 3, | ||
| 'frozen_state': 'C002-ips-after', | ||
| 'package': 'hl7.fhir.uv.ips', | ||
| 'version': '2.0.1', | ||
| 'independent_resolutions': 2, | ||
| 'semantic_lock_identity_identical': True, | ||
| 'transport_provenance_identical': first_sources == second_sources, | ||
| 'execution_environment': { | ||
| 'container': os.environ['CF11_PROOF_CONTAINER'], | ||
| 'machine': platform.machine(), | ||
| 'rustc': subprocess.check_output(['rustc', '--version'], text=True).strip(), | ||
| 'cargo': subprocess.check_output(['cargo', '--version'], text=True).strip(), | ||
| }, | ||
| 'multi_version_packages': multi, | ||
| 'resolution_a': { | ||
| 'roots': sorted(first['roots']), | ||
| 'packages': first_packages, | ||
| }, | ||
| 'resolution_b': { | ||
| 'roots': sorted(second['roots']), | ||
| 'packages': second_packages, | ||
| }, | ||
| } | ||
| out = Path('/tmp/cf11-multiversion/evidence.json') | ||
| out.write_text(json.dumps(evidence, indent=2, sort_keys=True) + '\n') | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| print(out.read_text()) | ||
| PY | ||
|
|
||
| - name: Assert repository remains clean | ||
| run: test -z "$(git status --porcelain)" | ||
|
|
||
| - name: Upload foundation evidence | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | ||
| with: | ||
| name: cf11-multi-version-proof | ||
| path: /tmp/cf11-multiversion/evidence.json | ||
| if-no-files-found: error | ||
| retention-days: 3 | ||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| schema: commandf.donor-manifest/v1 | ||
| updated: 2026-08-15 | ||
|
|
||
| standards: | ||
| - id: hl7-fhir-npm-packages | ||
| reference: https://hl7.org/fhir/packages.html | ||
| mode: PROTOCOL_STANDARD | ||
| adopted_patterns: | ||
| - FHIR implementation-guide dependencies are NPM package dependencies | ||
| - dependency identity includes package id and version constraint | ||
| - production package dependencies should use explicit versions or supported patch wildcards | ||
|
|
||
| - id: npm-dependency-tree | ||
| reference: https://docs.npmjs.com/cli/v11/commands/npm-dedupe | ||
| mode: STUDY | ||
| adopted_patterns: | ||
| - a dependency tree can legitimately contain multiple concrete versions of the same package name | ||
| - deduplication is valid only when one concrete version satisfies the relevant dependency requirements | ||
| exclusions: | ||
| - no npm hoisting algorithm copied | ||
| - no npm source code copied | ||
| - no arbitrary npm semver/range semantics imported into CF-11 | ||
|
|
||
| commandf_constraints: | ||
| - resolver identity is exact package name plus concrete version | ||
| - exact identity dedup only | ||
| - request-local exact and patch-wildcard selection remain deterministic | ||
| - no last-writer-wins or silent global version coercion | ||
| - schema-v1 lockfile remains an ordered package closure, not an explicit resolved-edge graph | ||
| - downstream name-only ambiguity remains fail-closed | ||
|
|
||
| rules: | ||
| - standards and public behavior are STUDY/PROTOCOL inputs, not code-copy authority | ||
| - CF-10 frozen corpus is not modified to fit the pre-CF-11 resolver |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.