Skip to content

fix(mrl): bind training lineage construction identity - #305

Closed
TheHalfMoon wants to merge 6 commits into
mainfrom
fix/mrl-0601-lineage-identity-bf92dd
Closed

fix(mrl): bind training lineage construction identity#305
TheHalfMoon wants to merge 6 commits into
mainfrom
fix/mrl-0601-lineage-identity-bf92dd

Conversation

@TheHalfMoon

@TheHalfMoon TheHalfMoon commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Summary

Harden canonical MRL-0601 TrainingExampleLineageContract so an existing lineage remains bound to the exact TrainingExampleV1 identity present at lineage construction.

The canonical contract previously rebuilt its current example for every public view but preserved no construction identity. A post-construction mutation to a different syntactically valid training example could therefore turn one lineage object into a different valid lineage instead of failing closed. Downstream MRL-0602/MRL-0603 checks that rebuilt lineage.example and compared that rebuilt identity to lineage.content_sha256 could compare two values derived from the same mutated state and therefore fail to detect the drift.

Repair

  • make TrainingExampleLineageContract weak-referenceable without adding caller-supplied dataclass fields
  • bind the exact construction-time lineage content identity outside reachable object state through a private weak-reference registry
  • rebuild the complete TrainingExampleV1 before every public lineage trust/semantic/hash view
  • derive the current lineage semantics from that rebuilt example and compare them to the construction-bound identity
  • reject malformed mutation and coordinated mutation to a different valid source/example identity
  • preserve all metadata-only, no-source-access, no-training-authority, and no-promotion-authority semantics

Regression coverage

  • a newly built lineage from a different valid source identity receives a distinct valid lineage identity
  • mutating an existing lineage example from one valid source_sha256 to another valid SHA fails closed before semantic, training-example identity, or content-hash output
  • the construction identity is not a dataclass field and cannot be injected as caller-controlled object state
  • existing malformed-input and non-authoritative tests remain preserved

Canonical base

bf92dd2977d24aa597d2442decabc215f7bd3dbf

Exact candidate head

a77eef842e4523d1e90ade99839703773b724843

Live compare: behind_by=0, 2 commits ahead, exactly two intended files:

  • src/medscale/mesc/_mrl_training_example_lineage_v1.py
  • tests/test_mesc_mrl_training_example_lineage_v1.py

Current exact-head qualification blocker

Fresh automatic workflows terminate before any workflow step executes:

  • CI run 33301886994
    • Python 3.12 job 99231473372: failure, steps=null
    • Python 3.11 job 99231473464: failure, steps=null
  • CodeQL run 33301886954
    • analyze (python) job 99231472978: failure, steps=null

These are external pre-execution hosted-runner blocker results only. They are not Ruff, formatting, strict mypy, pytest/coverage, MRL machine-state, medscale check, or CodeQL-analysis results and do not authorize merge.

Downstream reconciliation

PR #299 (MRL-0602/MRL-0603/MRL-0605 hardening) must be reconciled after this MRL-0601 hardening becomes canonical so its contamination/transformation builders validate the original construction-bound lineage instead of rebuilding current lineage state and comparing it to another identity derived from that same live state.

PR #295 (MRL-0604/MRL-0606 feature work) remains downstream of that reconciliation and cannot reuse qualification evidence from a pre-reconciliation head.

Boundary

This is fail-closed lineage-metadata integrity hardening only. It reads no source bytes or corpora, accesses no model/provider/network/GPU/runtime, executes no generation or training, and grants no source/data access, training, promotion, deployment, release, or clinical authority.

Fresh exact-head Python 3.11/3.12 CI, Ruff lint/format, strict mypy, full pytest/coverage, MRL machine-state, medscale check, CodeQL/security qualification, exact intended scope, behind_by=0, mergeability, and zero unresolved material review findings/threads remain required before guarded merge. No force-push, rebase, destructive history rewrite, CI/CodeQL weakening, governance bypass, provider spend, or real-asset access is used.

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6fa52dcb-44b7-416a-8807-fe04f6be4946


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Owner Author

Superseded by canonical main. The construction-bound TrainingExampleLineageContract hardening carried here is present on current main, including the weakref-backed construction identity, revalidation path, and valid post-construction identity-drift rejection. This PR is therefore being closed without merge; its historical qualification evidence is not reused.

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.

1 participant