Libra CodeHub

CedarCopilot/cedar-mail

Branch: staging

fix(config,sql): make the definition.id / fieldKey ambiguity actually unrepresentable

merged#2904CedarCopilot

CedarCopilot wants to merge 3 commits into staging from worktree-send-it-field-id-ambiguity

Potential production issues

custom field identifiers are disambiguated in the schema

A behavior previously repaired by PR #2897 passes on the current base and fails on this PR revision.

When the application executes the behavior implemented in apps/server/src/mastra/tools/config/config-tool-shared.ts.

Suggested fix: Restore the behavior preserved by PR #2897, then rerun this check against both revisions.

Technical evidence

A regression fixed by PR #2897 worked before this change and returned after it.

Observed difference: the list-fields id description warns that id is not a query key and directs callers to fieldKey

Related changed code: apps/server/src/mastra/tools/config/config-tool-shared.ts.

Verified behaviors

  • Field definitions expose rename tracking separately from the query key

    Libra ran this behavior against the change and confirmed the check detects when it breaks.

    Technical evidence
    • a custom field definition exposes renameTrackingId instead of id while its sibling fieldKey remains the query reference

    Changed code: config-tool-shared.ts.

  • Field identifier mismatches include organization and member definitions only

    Libra ran this behavior against the change and confirmed the check detects when it breaks.

    Technical evidence
    • the mismatch map includes distinct mismatches from the organization AOP and a user AOP belonging to that organization
    • the mismatch map excludes definitions belonging to a user in another organization

    Changed code: execute.ts.

run e2faf199-63ba-479c-ad48-b4ae9d42e74a, completed Sep 23, 2026, 3:17 AM