Skip to content

fix(vprogram): check store dependencies of V-PROGRAM messages at processing time - #1234

Open
odesenfans wants to merge 1 commit into
mainfrom
fix/vprogram-check-dependencies
Open

fix(vprogram): check store dependencies of V-PROGRAM messages at processing time#1234
odesenfans wants to merge 1 commit into
mainfrom
fix/vprogram-check-dependencies

Conversation

@odesenfans

Copy link
Copy Markdown
Collaborator

Problem

V-PROGRAM messages had no dependency existence check: VProgramMessageHandler did not override check_dependencies, and find_missing_volumes only branches on ProgramContent / InstanceContent. A V-Program referencing store files unknown to the node was processed successfully and then parked invisibly at the scheduler, whose hard lookup was the only guard.

This is the pyaleph phase-2 work item recorded in the #1222 review notes (the forget-protection half already landed there via get_vms_dependent_volumes).

Fix

Add check_dependencies to VProgramMessageHandler. It checks the file pins for the five store references of the content:

  • runtime.ref (runtime manifest)
  • workload.ref and workload.hash_tree
  • each verified volume's ref and hash_tree

V-Program references are direct store item hashes (there is no use_latest / file tag mechanism for measured content), so the pin check is sufficient. Missing refs raise VmVolumeNotFound, giving the same retry-then-reject behavior as programs with missing volumes (VM_VOLUME_NOT_FOUND).

Out of scope: the balance-removal/GC path not consulting get_vms_dependent_volumes for any executable type is a separate, pre-existing gap.

Tests

  • New test_process_vprogram_missing_refs: a V-Program with no seeded refs is rejected with VM_VOLUME_NOT_FOUND and the error details list all five missing refs (written first, watched fail against main).
  • Existing processing and API tests now seed the referenced file pins (mirroring insert_volume_refs in the program tests) so they still exercise their original paths (processing, cost persistence, credit rejection, forget blocking).
  • tests/message_processing/, tests/api/test_vprogram_api.py, tests/db/test_vprograms_db.py, tests/services/test_cost_service_vprogram.py, tests/test_repair.py, tests/jobs/test_check_removing_messages.py: all passing.

…essing time

V-PROGRAM messages were processed without any existence check on the
store files they reference, unlike programs and instances which go
through find_missing_volumes. A V-Program referencing nonexistent
stores was accepted and then parked silently at the scheduler, whose
hard lookup was the only guard.

Add check_dependencies to VProgramMessageHandler, checking the file
pins for the five store references of the content: the runtime
manifest, the workload image and its hash tree, and each verified
volume and its hash tree. V-Program refs are direct store item hashes
(no use_latest / file tag mechanism), so the pin check is sufficient.
Missing refs raise VmVolumeNotFound, giving the same retry-then-reject
behavior as programs with missing volumes.

@foxpatch-aleph foxpatch-aleph left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR correctly adds a check_dependencies override to VProgramMessageHandler that validates all store references (runtime, workload, hash trees, verified volumes) exist as file pins before processing, mirroring the existing pattern in vm.py. The implementation is straightforward, uses the existing find_file_pins accessor and VmVolumeNotFound exception, and is consistent with the codebase conventions. All tests exercising the processing pipeline are updated to seed the required file pins, and a new test validates the rejection path when refs are missing. No correctness, security, or quality issues found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants