Skip to content

fix(member-fields): treat referenceName as exact identity - #159

Merged
2000game merged 2 commits into
eqrm:mainfrom
bwl21:fix/issue-158-exact-reference-name
Aug 28, 2026
Merged

fix(member-fields): treat referenceName as exact identity#159
2000game merged 2 commits into
eqrm:mainfrom
bwl21:fix/issue-158-exact-reference-name

Conversation

@bwl21

@bwl21 bwl21 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep the local ct-cli member-field key separate from ChurchTools referenceName
  • compare referenceName exactly, preserving punctuation and case (foo-bar and foo_bar are distinct)
  • preserve explicitly configured referenceName on create and during adoption
  • mark existing identity mismatches as an incomplete plan with an actionable explicit-replacement diagnostic instead of silently PATCHing or duplicating the field
  • resolve ruleset member-field references through the declared exact API identity

Safety semantics

referenceName is identity-bearing because dynamic rulesets address it verbatim. ct-cli therefore never renames it during update. A mismatch blocks apply before writes and directs the operator to the existing explicit member-field destroy/recreate workflow.

Tests

  • regression: local key stand_bewerbung, API reference stand-bewerbung, ruleset assignment stand-bewerbung
  • state-bound and unbound punctuation mismatch diagnostics
  • exact foo-bar versus foo_bar matching and duplicate-identity validation
  • adoption preserves exact referenceName
  • full CI gate: format, lint, typecheck, 1,075 tests passed (5 integration tests skipped), build
  • disposable integration branch with Issue feat: support read-only external references across ct projects #143 merged conflict-free; combined CI passed with 1,133 tests, and a read-only plan against a version-2 production state converged

Closes #158

@2000game
2000game merged commit 50d4609 into eqrm:main Aug 28, 2026
3 checks passed
2000game added a commit that referenced this pull request Aug 28, 2026
* fix(member-fields): reconcile rows that carry no referenceName

Review follow-up to #159. Making `referenceName` the exact identity left the
documented name fallback unreachable and pointed several diagnostics at a
remedy that did not work.

- A live row with no `referenceName` was matched by name and then rejected by
  every consumer, so it could be neither updated nor created: the plan went
  INCOMPLETE and apply aborted the whole run. Only a row carrying a DIFFERENT
  reference name is a contradiction now (`conflictingReferenceName`).
- The actual side reports the declared reference name for such a row, since ct
  never PATCHes one onto it and diffing it would never converge.
- A declared field whose live row has no reference name is no longer reported
  as a DELETE CANDIDATE; the pass now skips rows a declaration claimed.
- Identity-mismatch messages offer the non-destructive fix (declare the live
  `referenceName`) beside `ct destroy`, and `ct destroy --member-field` resolves
  the STATE-BOUND row — it previously matched on the local key alone, reported
  "already absent", dropped the binding and let the next apply POST a duplicate.
- A live field that only shares a declaration's display name now warns and
  creates instead of failing the run; a near-identity (same string up to
  punctuation/case) is still refused.
- A ref into a group that is adopted but declares no `memberFields` states no
  exact identity, so it keeps matching on the normalised local key.
- The duplicate-match error no longer claims no row carries the exact reference
  name when the matches are the rows that do.

Claude-Session: https://claude.ai/code/session_01PNmsG3pmvxQNA9sNmnAvYJ

* style: apply prettier to the member-field review fixes

Claude-Session: https://claude.ai/code/session_01PNmsG3pmvxQNA9sNmnAvYJ
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.

Treat group member field referenceName as exact identity

2 participants