fix(8572): a reference holder whose shapes already speak is answered by the shape ledger at once, not at its next coverage refresh
CI & Build / Python lint (push) Successful in 2s
CI & Build / TypeScript typecheck (push) Successful in 12s
CI & Build / Plugin hooks (push) Successful in 15s
CI & Build / Python tests (push) Successful in 1m50s
CI & Build / integration (push) Successful in 2m46s
CI & Build / Build & push image (push) Successful in 24s
CI & Build / Python lint (push) Successful in 2s
CI & Build / TypeScript typecheck (push) Successful in 12s
CI & Build / Plugin hooks (push) Successful in 15s
CI & Build / Python tests (push) Successful in 1m50s
CI & Build / integration (push) Successful in 2m46s
CI & Build / Build & push image (push) Successful in 24s
answer_reference_holders stepped aside whenever the project's shapes spoke for the idea, leaving the row unassessed until the project's next coverage refresh synced the shapes. A lift makes the reference row new, so those shapes had never been synced onto the idea. It now asks the shape ledger to answer that holder straight away (sync_from_shapes for the reference snippet). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -238,6 +238,37 @@ async def test_a_snippet_stays_in_its_project_as_a_reference_and_its_project_is_
|
||||
assert answer.decided_via == "system" and answer.evidence["source"] == "reference"
|
||||
|
||||
|
||||
async def test_a_reference_the_shape_ledger_already_holds_is_answered_by_the_shapes_at_promotion(family):
|
||||
"""The project's own snippet is already stamped `canonical` in its shape
|
||||
ledger, so the shapes answer the idea the moment promotion makes that
|
||||
snippet a reference — not at the project's next coverage refresh."""
|
||||
from grimoire.models.code_shape import CodeShape
|
||||
from grimoire.services import family_adoption
|
||||
async with async_session() as s:
|
||||
snippet = Note(user_id=family["owner"], project_id=family["a"], note_type="snippet",
|
||||
title="ReleaseSigner", body="fun sign(apk: File) = ...",
|
||||
data={"language": "kotlin"})
|
||||
s.add(snippet)
|
||||
await s.flush()
|
||||
s.add(CodeShape(project_id=family["a"], repo_key="git.example.com/x/y",
|
||||
path="app/src/ReleaseSigner.kt", symbol="sign", kind="sym",
|
||||
status="canonical", snippet_id=snippet.id, classified_by="mechanical"))
|
||||
await s.commit()
|
||||
await s.refresh(snippet)
|
||||
out = await family_svc.promote(
|
||||
family["owner"], snippet.id, applies_when="any Android app that ships its own APK",
|
||||
platforms=["android-app"], criteria=CRITERIA, evidence=["CI green"], reason="proven",
|
||||
)
|
||||
lifted = out["idea"]["note_id"]
|
||||
assert (await _ledger(lifted))[family["a"]] == "adopted"
|
||||
assert [a["project_id"] for a in out["answered"]] == [family["a"]]
|
||||
async with async_session() as s:
|
||||
answer = (await s.execute(select(FamilyDecision).where(
|
||||
FamilyDecision.idea_id == lifted, FamilyDecision.project_id == family["a"]))).scalars().one()
|
||||
assert answer.decided_via == "system"
|
||||
assert answer.evidence["source"] == family_adoption.SHAPE_SOURCE
|
||||
|
||||
|
||||
async def test_an_answer_somebody_gave_is_not_overwritten_by_the_reference(family):
|
||||
from grimoire.services import family_adoption
|
||||
|
||||
|
||||
Reference in New Issue
Block a user