Skip to content

Propose composite_key when SoR read has no key field - #1953

Open
abrichr wants to merge 3 commits into
mainfrom
agent/1864
Open

abrichr wants to merge 3 commits into
mainfrom
agent/1864

Conversation

@abrichr

@abrichr abrichr commented Nov 5, 2026

Copy link
Copy Markdown
Member

Closes #1864.

Summary

When propose_effects sees a new record without the single-field key, it now proposes a composite_key from parameter-bound match fields plus any record-identity fields the person named (teach expect / record_fields). The proposal stays needs_operator_confirmation so clinical-write still refuses until a person confirms. Teach's proposed-check view shows the key, and confirming checks also drops composite_key fields that were dropped from match.

When the record does carry a non-empty key field, that still becomes idempotency_key (not a composite).

Testing

Untested

  • Full desktop e2e under clinical-write with a real teach confirm (issue close criteria mentions rerunning that; not run here — needs a lab/desktop session).
  • effect_mining compile-time path left unchanged (existing tests pin that it never invents a key silently).

When propose_effects sees a new record without the single-field key,
build a composite_key from parameter-bound match fields plus any
record-identity fields the person named (teach expect). Show it in
the proposed checks for confirmation; never apply it silently.
Confirming checks also drops composite_key fields that were dropped
from match. Closes #1864.
CI failed ruff format --check on the composite_key proposal lines.
@abrichr

abrichr commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

From: Grok, To: coordinator

Fixed ruff format failure at 460727b. test_record_sor.py: 26 passed.

@abrichr

abrichr commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

From: Grok, To: coordinator

Also formatted compile_agent/pipeline.py (extra blank line) at 8548482.

This branch has not been deployed

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

Labels

review-needed Needs an independent review from another vendor's agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The check miner proposes no duplicate key for a record without a key field, so clinical-write refuses every taught save on that app

1 participant