Skip to content

Allow isDirty checks for one attribute - #343

Open
elpete wants to merge 1 commit into
nextfrom
feat/51-is-dirty-attribute
Open

Allow isDirty checks for one attribute#343
elpete wants to merge 1 commit into
nextfrom
feat/51-is-dirty-attribute

Conversation

@elpete

@elpete elpete commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Closes #51

Issue review

Recommendation: 10/10 — implement. Callers frequently need to decide whether one field changed for auditing, conditional side effects, or targeted validation. Requiring a whole-entity dirty result forces manual comparison against internal state. This is a small, backward-compatible API improvement with little downside.

Implementation

  • adds an optional attribute argument to isDirty
  • accepts either Quick aliases (firstName) or physical columns (first_name)
  • uses the same case-sensitive hashing semantics as whole-entity dirtiness
  • retains the cached whole-entity hash path when no attribute is supplied
  • rejects unknown attributes through Quick’s normal attribute validation

Test-first evidence

The first regression showed that CFML accepted the extra argument but the old implementation ignored it: after changing username, isDirty("firstName") incorrectly returned true. The test now covers clean attributes, dirty aliases, dirty physical columns, reverting one field, and whole-entity state.

Validation

  • focused IsDirtySpec: 2 passed, 0 failed, 0 errors
  • full Lucee 6 suite: 496 passed, 0 failed, 0 errors, 3 skipped
  • box run-script format
  • git diff --check

Uses qb@14.0.0-beta.3.

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