[
  {
    "name": "security-utils-2",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls"
    ],
    "branch": "ascent/security-utils-2",
    "report": "ascents/security-utils-2/report.html?refresh=off",
    "retro": {
      "ascent": "security-utils-2",
      "at": "2026-11-12T08:09:06.205Z",
      "base": "f296360208903e68948be73f68fbb1237d6c9e58",
      "head": "0cbeb5c703a54dc2b1ca96cf28b20b6b034fb4fe",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 87006,
        "costUsd": 0.7356368
      },
      "summary": "Only fflib_SecurityUtils.cls changed. PMD (23.8→100) came from adding braces (#1), Graph Engine (67.6→100) from an explicit null-check throw in fieldTokenFor (#10), and Limit headroom (51.6→100) mostly from caches, especially the verified-list Set<List<String>> cache (#16), which skips work only because headroomBulkFieldChecks sends identical lists 120 times. Allow/deny results for the tested cases are unchanged, but the evolved code now caches permission outcomes for the whole transaction and resolves error labels once at class load, which no test covers. Resource efficiency (fflib_SObjectSelectorTest, 98.8) did not move.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "Passed field lists skip FLS re-checks for the rest of the transaction",
          "detail": "Once checkRead/checkInsert/checkUpdate(SObjectType, List<String>) passes for a list, an equal list for the same user, operation and type returns right after the CRUD check, without any per-field FLS evaluation. Revoking permissions mid-transaction (for example deleting a PermissionSetAssignment or PermissionSet field permission inside the same runAs) would be seen by the baseline, which describes again on every call, but not by the evolved code. Only a change of UserInfo.getUserId() invalidates the cache.",
          "evidence": "fflib_SecurityUtils.cls verifiedListsFor/resetCachesIfUserChanged (~lines 174-200), checkInsert/checkRead/checkUpdate early return (~241-243, 281-283, 321-323)",
          "iterations": [
            16
          ],
          "severity": "medium",
          "caughtByTests": false,
          "proposedTest": "In System.runAs(user holding a permission set with FLS on a field): call checkRead(type, [field]) and expect a pass; delete the field permission; call checkRead again and assert FlsException. (First confirm the platform itself re-evaluates within one transaction; if it doesn't, document the cache as matching platform behaviour.)"
        },
        {
          "code": "B2",
          "title": "DescribeFieldResult cached per type and field name for the transaction",
          "detail": "The list methods reuse a DescribeFieldResult cached under the type and field name, cleared only when the user changes. Within one user, any permission refresh the platform would show is masked. The single-field and SObjectField overloads still describe fresh each time, so list and single-field calls can disagree after a permission change.",
          "evidence": "fflib_SecurityUtils.cls fieldDescribesFor/fieldDescribeFor (~lines 202-228)",
          "iterations": [
            15
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Same as the revoked-permission test, comparing checkRead(type, List<String>) with checkFieldIsReadable(type, String) after the change."
        },
        {
          "code": "B3",
          "title": "Exception labels resolved at class load, not at throw time",
          "detail": "CRUD_MESSAGES and FLS_MESSAGES are static finals initialised when the class first loads, under the user running at that moment. A later System.runAs user with a different language gets messages in the first user's language. The baseline read System.Label inside the exception constructor, so it used the throwing user's language.",
          "evidence": "fflib_SecurityUtils.cls:43-54; CrudException/FlsException constructors ~81-86, ~106-113",
          "iterations": [
            10
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Load the class as the admin (call checkObjectIsReadable on Account), then System.runAs a user with LanguageLocaleKey set to another language and a translated label; trigger a CrudException and assert the message equals that user's System.Label value."
        },
        {
          "code": "B4",
          "title": "Unbounded heap growth from cloned verified lists",
          "detail": "Every distinct passing list is cloned into a per-type, per-operation Set and kept for the transaction. Callers that build many different dynamic lists (selectors with varying field sets, large batch jobs) keep growing heap with no eviction. Each call also hashes the whole list for contains(), which is O(n) even on a hit.",
          "evidence": "fflib_SecurityUtils.cls verified.add(fieldNames.clone()) ~252, ~292, ~332",
          "iterations": [
            16
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Call checkRead with 5,000 distinct one-field lists and assert Limits.getHeapSize() stays under a chosen budget, or check the growth is acceptable."
        },
        {
          "code": "B5",
          "title": "Unchanged: null, unknown-field and bypass behaviour",
          "detail": "A null objType still throws NullPointerException (CRUD describe when bypass is off, the fieldTokenFor guard when it is on). An unknown field name still ends in null.getDescribe(), even with bypass on, as in the baseline. Lists are recorded only when bypass is off, and failures are never cached. Recorded here as checked, not as a change.",
          "evidence": "fflib_SecurityUtils.cls fieldTokenFor ~155-170; fieldDescribeFor ~221-228",
          "iterations": [
            10,
            15,
            16
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Assert NullPointerException for checkRead(null, ['Name']) with bypass on and off, and for checkRead(Account.SObjectType, ['NoSuchField__c']) with bypass on."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Verified-list result cache",
          "detail": "A big CPU win on the headroom test, which repeats identical lists 120 times, but it is shaped to the benchmark. Real callers seldom repeat identical lists, and it turns a stateless permission check into a stateful one. Storing a clone and clearing on user change are sound precautions.",
          "evidence": "iteration 16; fflib_SecurityUtilsTest.cls:373-379",
          "verdict": "questionable"
        },
        {
          "code": "P2",
          "title": "Layered caches (single-entry describe, token map, field-describe map)",
          "detail": "Three overlapping caches plus the fflib_SObjectDescribe cache below them. Once the verified-list cache exists, most of their benefit is redundant. They add state and code size for small gains.",
          "evidence": "iterations 6, 7, 9, 15; fflib_SecurityUtils.cls ~126-228",
          "verdict": "questionable"
        },
        {
          "code": "P3",
          "title": "Static label maps replacing if/else chains",
          "detail": "Shorter and easier to read, but it moves label resolution to class load (see the language behaviour change).",
          "evidence": "iteration 10; fflib_SecurityUtils.cls:43-54",
          "verdict": "questionable"
        },
        {
          "code": "P4",
          "title": "Shared throw helpers requireObjectAccess / requireFieldAccess",
          "detail": "Removing duplication is good. The field variant's 'pass the describe only when access is denied, else null' argument exists to satisfy coverage and PMD, and reads oddly compared with passing a boolean.",
          "evidence": "iterations 17, 19; fflib_SecurityUtils.cls ~490-510",
          "verdict": "questionable"
        },
        {
          "code": "P5",
          "title": "Splitting statements into locals for coverage",
          "detail": "Adds lines only to raise coverage, with no readability gain. Harmless.",
          "evidence": "iteration 13",
          "verdict": "questionable"
        },
        {
          "code": "P6",
          "title": "Braces on all if bodies",
          "detail": "Plain style improvement, no behaviour change.",
          "evidence": "iteration 1",
          "verdict": "good"
        },
        {
          "code": "P7",
          "title": "Explicit null guard in fieldTokenFor",
          "detail": "Keeps the NullPointerException behaviour and satisfies Graph Engine. It is the one line no test runs.",
          "evidence": "iteration 10; fflib_SecurityUtils.cls ~162-165",
          "verdict": "good"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "Cache invalidation across System.runAs",
          "detail": "No test calls the same list check as one user and then as a less-privileged user in the same transaction, so a broken resetCachesIfUserChanged would go unnoticed.",
          "proposedTest": "As the admin, checkUpdate(Account.SObjectType, ['Name']) passes; then System.runAs(read-only user) the same call must throw a CrudException or FlsException."
        },
        {
          "code": "T2",
          "title": "READ failures",
          "detail": "No test fails a read CRUD or FLS check, so the READ message labels and the READ throw path are pinned only indirectly.",
          "proposedTest": "Use a user with no Account read access: assert checkRead(Account.SObjectType, ['Name']) throws a CrudException with getOperation()==READ and the message equal to the formatted fflib_security_error_object_not_readable label; do the same for a read FLS failure on a restricted field."
        },
        {
          "code": "T3",
          "title": "Null objType or unknown field",
          "detail": "The guard's throw line is uncovered, and nothing pins the exception type for bad input.",
          "proposedTest": "Assert NullPointerException for checkFieldIsReadable(null, 'Name') and checkRead(Account.SObjectType, ['Bogus__c']), with bypass on and off."
        },
        {
          "code": "T4",
          "title": "Caller changes a list after it passed",
          "detail": "The stored clone is meant to stop this case passing wrongly, but no test exercises it.",
          "proposedTest": "As the read-only user, checkRead(Account, fields) passes; add a non-readable field to the same list; the next call must throw FlsException."
        },
        {
          "code": "T5",
          "title": "Bypass toggled between calls",
          "detail": "No test checks that a list passed while bypass was on is not recorded.",
          "proposedTest": "As the read-only user with bypass=true, checkUpdate(Account, ['Name']); set bypass=false; the same call must throw."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Headroom test is overfit",
          "detail": "headroomBulkFieldChecks sends identical lists 120 times, so Limit headroom 100 mainly measures the verified-list cache hit rate. It does not show real per-call cost. Add a variant with fresh or varied lists if headroom should drive future climbs."
        },
        {
          "code": "X2",
          "title": "Dimensions that did not move",
          "detail": "Resource efficiency (fflib_SObjectSelectorTest, 98.8) did not change: its cost is selector SOQL outside this class. Run-time attempts (#23, #24) were discarded. Coverage is capped at 99.5 by the Graph Engine-required throw unless a null-objType test is added."
        }
      ]
    }
  },
  {
    "name": "unit-of-work-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls",
      "sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls"
    ],
    "branch": "ascent/unit-of-work-1",
    "report": "ascents/unit-of-work-1/report.html?refresh=off",
    "retro": {
      "ascent": "unit-of-work-1",
      "at": "2026-11-12T09:21:26.256Z",
      "base": "550ed4f58db713b02b63aa40b552ddfbcb0d3637",
      "head": "05aea65402bb7e356ca7f2b433ecdafa3df622fa",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 101153,
        "costUsd": 0.6528502
      },
      "summary": "Only fflib_SObjectUnitOfWork.cls changed, so it drove every gain. PMD reached 100 through braces and deferred describes (iteration 1), Limit headroom rose 15.4 from skipping redundant resolve passes and removing isResolved() (iterations 5 and 11), and Code coverage rose 4.1 only by deleting untested statements (iterations 3, 8, 10 and 11), with no new paths tested. Tests passing, Graph Engine and Resource efficiency did not move. The main behaviour risk is in the untested external-id relationship path: resolve() now overwrites a parent reference that is already set, and building and validating that reference moved from commit time to register time.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "External-id relationship now overwrites an existing parent reference",
          "detail": "The baseline only called putSObject when Record.getSObject(RelationshipName) was null, so a parent reference the caller set, or an earlier registration for the same field, was kept (first wins). Without the isResolved guard, resolve() always writes the reference stored at registration, so the last registration wins and a manual reference is replaced. Resolve runs in the insert, upsert and update passes, so the overwrite repeats.",
          "evidence": "fflib_SObjectUnitOfWork.cls:1037-1040, :1116-1118; baseline RelationshipByExternalId.isResolved",
          "iterations": [
            11
          ],
          "severity": "medium",
          "caughtByTests": false,
          "proposedTest": "Use a mock IDML. Register a Contact as new, register an external-id relationship to Account, then set contact.Account to an Account reference with a different key before commitWork. Assert which reference reaches dmlInsert. Also register the same relationship twice with different ids and assert the first one wins."
        },
        {
          "code": "B2",
          "title": "External-id reference built and filled at register time, not commit time",
          "detail": "relatedObject.newSObject() and put(externalIdField, externalId) now run in Relationships.add. A type-mismatched externalId (for example a String into a number external-id field) throws SObjectException from registerRelationship, outside commitWork's savepoint and onCommitWorkFinished(false), instead of inside the commit. One reference instance is now shared across all resolve passes instead of a fresh one per pass. The new object's type comes from externalIdFieldDescribe.getSObjectType(), which the check just above proves equal to getReferenceTo()[0].",
          "evidence": "fflib_SObjectUnitOfWork.cls:1053-1083",
          "iterations": [
            8,
            10
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Register an external-id relationship with an externalId of the wrong type. Assert the exception is thrown by registerRelationship (new behaviour) or by commitWork (baseline), and fix the intended contract."
        },
        {
          "code": "B3",
          "title": "Update pass no longer resolves relationships for types without dirty records",
          "detail": "In the baseline the update pass re-resolved every type. A new child whose parent type was registered later got the parent Id written into the in-memory record (never saved, because the child was not dirty). Now that write is skipped unless the child's type has dirty records, so callers that read the child record's lookup field after commitWork may see null where the baseline showed the Id. Saved data is unchanged.",
          "evidence": "fflib_SObjectUnitOfWork.cls:908-920",
          "iterations": [
            5
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Create the UoW with types [Contact, Account], registerNew(contact, Contact.AccountId, account) and registerNew(account), commit with a mock DML that assigns Ids, and assert contact.AccountId after commit."
        },
        {
          "code": "B4",
          "title": "No 'field not queried' exception for dirty records missing the lookup field",
          "detail": "Baseline isResolved() called Record.get(RelatedToField) whenever the parent had an Id. On a SOQL record without that field this throws SObjectException. Evolved code only calls put, so such records now commit successfully.",
          "evidence": "fflib_SObjectUnitOfWork.cls:1121-1131; baseline Relationship.isResolved",
          "iterations": [
            11
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Query an Opportunity without AccountId, call registerDirty(opp, Opportunity.AccountId, existingAccount) and commit; assert there is no exception and AccountId is set."
        },
        {
          "code": "B5",
          "title": "Same Id written again to already-resolved records",
          "detail": "Relationship.resolve() and EmailRelationship.resolve() now run on every pass with no guard. Already-inserted records get the same Id written again in the upsert pass, and in the update pass when their type has dirty records. The result is identical; it only costs CPU proportional to links times passes.",
          "evidence": "fflib_SObjectUnitOfWork.cls:1037-1040",
          "iterations": [
            11
          ],
          "severity": "low",
          "caughtByTests": true,
          "proposedTest": ""
        },
        {
          "code": "B6",
          "title": "Single-record permanent delete delegates to the list overload",
          "detail": "registerPermanentlyDeleted(SObject) now wraps the record in a list and calls the list overload, which still calls emptyRecycleBin then registerDeleted. The methods are non-virtual, so a subclass cannot change the dispatch. Behaviour is equivalent, but the single-record path is untested.",
          "evidence": "fflib_SObjectUnitOfWork.cls:737-750",
          "iterations": [
            10
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Call registerPermanentlyDeleted(singleRecord) with a mock DML and assert the record reaches both dmlDelete and emptyRecycleBin."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Brace-wrapping single-statement ifs",
          "detail": "Clears PMD violations with no semantic change.",
          "evidence": "fflib_SObjectUnitOfWork.cls:381-394, 497-501, 542-544, 706-710, 1169-1171; iteration 1",
          "verdict": "good"
        },
        {
          "code": "P2",
          "title": "Mixed DEFERRED and full describes",
          "detail": "Commit-time loops and handleRegisterType use getDescribe(DEFERRED), but every per-record register path still uses the full getDescribe(). Both give the same name, so map keys match, but the inconsistency is confusing. Iteration 14 showed switching the register paths lost headroom. Caching the name per type would be cleaner.",
          "evidence": "fflib_SObjectUnitOfWork.cls:283-286 vs 386, 411, 457, 502, 711, 756",
          "verdict": "questionable"
        },
        {
          "code": "P3",
          "title": "Coverage raised by deleting untested statements",
          "detail": "Coverage rose by shrinking the denominator: locals, fields and statements were removed from the external-id path and the single-record overloads. The untested external-id and publish paths are still untested, so the 83.3% overstates confidence.",
          "evidence": "iterations 3, 8, 10, 11",
          "verdict": "questionable"
        },
        {
          "code": "P4",
          "title": "Shared registerPublish helper",
          "detail": "Removes duplicated code across the three single-record publish methods with no behaviour change.",
          "evidence": "fflib_SObjectUnitOfWork.cls:752-813; iteration 3",
          "verdict": "good"
        },
        {
          "code": "P5",
          "title": "Removing isResolved idempotency guards",
          "detail": "Behaviour-preserving and a real CPU saving for Relationship and EmailRelationship, but it silently changed the first-wins/no-overwrite semantics of RelationshipByExternalId.",
          "evidence": "fflib_SObjectUnitOfWork.cls:1037-1040, 1107-1140; iteration 11",
          "verdict": "questionable"
        },
        {
          "code": "P6",
          "title": "Eager construction of the external-id reference",
          "detail": "Building the reference in add() mainly served coverage. It moves the failure point and reuses a mutable SObject across passes.",
          "evidence": "fflib_SObjectUnitOfWork.cls:1080-1083; iterations 8 and 10",
          "verdict": "questionable"
        },
        {
          "code": "P7",
          "title": "Emptiness guard before resolve in the update pass",
          "detail": "Cheap and clear, and matches the upsert pass, which already checks for records before resolving.",
          "evidence": "fflib_SObjectUnitOfWork.cls:914-919; iteration 5",
          "verdict": "good"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "External-id registerRelationship path is entirely untested",
          "detail": "The NOTE says no standard object has a usable external Id, but the validation branches and the resolve wiring can still be tested.",
          "proposedTest": "Assert each validation message: null relatedToField; Contact.LastName (not a relationship field); Contact.AccountId with Opportunity.Name (wrong object); Contact.AccountId with Account.Name (not an external id). If a test-only custom object with an external-id field can be added, use a mock IDML to assert the Account reference with the external-id value reaches dmlInsert."
        },
        {
          "code": "T2",
          "title": "Overwrite and first-wins semantics of external-id relationships",
          "detail": "Iteration 11 changed these and no test pins them.",
          "proposedTest": "Register two external-id relationships for the same record and field, commit with a mock DML, and assert which external-id value is used."
        },
        {
          "code": "T3",
          "title": "Single-record publish and permanent-delete overloads",
          "detail": "registerPublishBefore/AfterSuccess/AfterFailureTransaction(SObject) and registerPermanentlyDeleted(SObject) are not run by any test.",
          "proposedTest": "Use a mock IDML with a platform-event type: register one event through each single-record method and assert eventPublish receives it in the right phase. For a single record, assert registerPermanentlyDeleted puts it in both the delete and empty-recycle-bin lists."
        },
        {
          "code": "T4",
          "title": "Relationship resolution across type order and passes",
          "detail": "Nothing tests a child type registered before its parent type, or what the records hold in memory after commit.",
          "proposedTest": "Use types [Contact, Account] with a Contact-to-Account relationship and no dirty records. Commit through a mock DML that assigns Ids, then assert contact.AccountId and the contents of the dmlInsert lists."
        },
        {
          "code": "T5",
          "title": "Dirty records queried without the lookup field",
          "detail": "This removed failure mode is not pinned by any test.",
          "proposedTest": "Query an Opportunity without AccountId, call registerDirty(opp, Opportunity.AccountId, account) and commit successfully."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Headroom may now be limited by something other than CPU in resolve",
          "detail": "Iterations 12 and 13 show per-link savings in Relationships.resolve() are giving less and less. Remaining CPU cost is register-time work (about 31k full getDescribe().getName() calls) and the unavoidable put. A per-SObjectType name cache (iteration 2 bundled one with semantic changes that broke tests) is still worth trying on its own."
        },
        {
          "code": "X2",
          "title": "Reformatting inflated the line count",
          "detail": "The DEFERRED changes were split over 3-4 lines (for example :283-286, :899-902). This does not affect coverage, which counts statements, but it hurts readability. Consider a private helper or a single-line form."
        }
      ]
    }
  },
  {
    "name": "query-factory-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls"
    ],
    "branch": "ascent/query-factory-1",
    "report": "ascents/query-factory-1/report.html?refresh=off",
    "retro": {
      "ascent": "query-factory-1",
      "at": "2026-11-12T21:24:01.598Z",
      "base": "2532f4cb0f45fde2dbbedeb1a7104acc777d57e3",
      "head": "e9abff15ac2cc4ad443a4361c35afb1efed48655",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 84803,
        "costUsd": 0.6835456
      },
      "summary": "Only fflib_QueryFactory.cls changed, so it drove every score change. PMD (43.9→100) came from brace additions (#1) and suppressing OverrideBothEqualsAndHashcode on equals (#8). Graph Engine (75.8→100) came from a null-safe getFieldForType helper (#5). Limit headroom (57.3→88.1) came from a static field-path cache (#6) and a NONE-mode fast path in selectStringField (#11). Code coverage barely moved (93.1→93.5) because #10 and #15 reshaped code into ternaries instead of adding tests, and #10 assumed fflib_SObjectSelectorTest was deleted when it exists and covers USER_MODE/SYSTEM_MODE. Resource efficiency (98.8) did not move. No regression shows on tested paths; the risks are an unbounded static cache, a fast path that copies addField, one changed exception type, and code that is harder to read.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "Static cross-instance cache of resolved field paths in NONE mode",
          "detail": "RESOLVED_FIELD_PATHS is a static Map that lives for the whole transaction, keyed by '<table>:<relatedType>:<fieldName>' with the field name in its original case. In NONE mode, a later factory gets the cached canonical path and skips fflib_SObjectDescribe. The result is the same because describe results are fixed within a transaction and NONE mode does no per-call checks. Failed resolutions are never cached, so invalid fields still throw each time. Side effects: the map never shrinks, so heap grows with every distinct table, field and casing seen in a long transaction or batch. Each casing variant gets its own entry. fflib_SObjectDescribe.flushCache() does not clear this map. LEGACY, USER_MODE and SYSTEM_MODE never read it.",
          "evidence": "fflib_QueryFactory.cls:103, 117-123",
          "iterations": [
            6
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "In NONE mode, select 'name', 'NAME' and 'Owner.Name' on one factory, then build a second factory on the same table and select the same names. Assert that both give the same fields and SOQL, and that a later selectField('bogus__c') still throws InvalidFieldException."
        },
        {
          "code": "B2",
          "title": "NONE-mode fast path bypasses addField",
          "detail": "In NONE mode, selectStringField writes straight to fields.add(...) and builds the cache key itself (table + ':null:'), so it copies both addField's NONE-mode rule and getFieldPath's key format. Both copies are equivalent today. If addField starts normalising paths, or the key format changes, the fast path will drift silently: it will either always miss the cache or add paths that addField would have changed. selectField(String), selectFields(Set) and selectFields(List) all take this path. selectFieldSet, selectSObjectFields and selectField(String, SObjectType) still go through addField.",
          "evidence": "fflib_QueryFactory.cls:358-372 vs 117 and 449-461",
          "iterations": [
            11
          ],
          "severity": "medium",
          "caughtByTests": false,
          "proposedTest": "In NONE mode, select the same field through selectField('Name'), selectFields(Set{'name'}), selectField(Account.Name) and a field set. Assert that getSelectedFields() contains exactly one 'Name' entry, so all entry points produce the same path."
        },
        {
          "code": "B3",
          "title": "Ordering(String sobjType, ...) with an unknown or blank SObject name now throws InvalidFieldException instead of NullPointerException",
          "detail": "Before, fflib_SObjectDescribe.getDescribe(sobjType) returned null and .getField threw a NullPointerException. Now getFieldForType returns null, and getFieldTokenPath(null) throws InvalidFieldException('Invalid field: null'). This is arguably better, but the exception type changed, and the message no longer names the bad SObject type. Callers that catch NullPointerException will no longer catch it.",
          "evidence": "fflib_QueryFactory.cls:213-222, 1019; getFieldTokenPath at 206-211; fflib_SObjectDescribe.cls:237-245",
          "iterations": [
            5
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Construct new fflib_QueryFactory.Ordering('NotAnObject__x', 'Name', ASCENDING) and assert that it throws fflib_QueryFactory.InvalidFieldException."
        },
        {
          "code": "B4",
          "title": "Polymorphic relationship resolution rewritten as ternaries",
          "detail": "The old code used relatedObjs[0] when there was one target or relatedSObjectType was null. Otherwise it looped to the first match and left lastSObjectType unchanged if nothing matched. The new code uses contains() and two ternaries and is logically equivalent, including the old quirk where a non-matching relatedSObjectType leaves lastSObjectType as the current object. Nothing in the suite runs the non-null relatedSObjectType path on a dotted field, so an error here would not be caught. The cache key includes relatedSObjectType, so caching this path is safe.",
          "evidence": "fflib_QueryFactory.cls:169-179",
          "iterations": [
            15
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "On Task, call selectField('What.Name', Account.SObjectType) and assert that the path is 'What.Name'. Call selectField('Owner.Username', User.SObjectType) on Lead and assert that it resolves, and that selectField('Owner.Username', Group.SObjectType) throws InvalidFieldException."
        },
        {
          "code": "B5",
          "title": "USER_MODE/SYSTEM_MODE handling restructured but equivalent",
          "detail": "getFieldPath's early return, addField's lowercasing and the WITH USER_MODE/SYSTEM_MODE clause in toSOQL are now always-evaluated ternaries. The output is unchanged for all four modes, and subselects still get no mode clause. Every call in the hot path now pays for the extra evaluation; #10's own learning measured about -2.5 headroom.",
          "evidence": "fflib_QueryFactory.cls:109-116, 457-461, ~952-958",
          "iterations": [
            10
          ],
          "severity": "low",
          "caughtByTests": true,
          "proposedTest": "Already covered by fflib_SObjectSelectorTest.cls:453,469,483-486 and the USER_MODE assertion at 873."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Braces on every if/else/for",
          "detail": "A mechanical PMD fix that does not change behaviour.",
          "evidence": "#1; fflib_QueryFactory.cls:185-194, 427-443, ~960-974",
          "verdict": "good"
        },
        {
          "code": "P2",
          "title": "Memoizing deterministic describe resolution, gated by FLS mode",
          "detail": "A sound optimisation that keeps LEGACY's per-call readable checks. Weaknesses: the cache is unbounded, it is keyed by the raw caller-supplied case, and its key format exists as two separate string literals.",
          "evidence": "fflib_QueryFactory.cls:103, 117, 364",
          "verdict": "good"
        },
        {
          "code": "P3",
          "title": "Duplicated fast path that skips addField",
          "detail": "It copies addField and getFieldPath behaviour into selectStringField, so there are now two code paths to keep in step.",
          "evidence": "fflib_QueryFactory.cls:358-372",
          "verdict": "questionable"
        },
        {
          "code": "P4",
          "title": "Folding if-bodies into always-run ternaries to game line coverage",
          "detail": "These edits make the code harder to read, do work on every call even when the branch is irrelevant, and produced little or no coverage gain. Iteration 10 was also justified by a test class 'being deleted' when it exists.",
          "evidence": "#10, #15; fflib_QueryFactory.cls:109-116, 171-179, 457-461, ~952-958",
          "verdict": "bad"
        },
        {
          "code": "P5",
          "title": "@SuppressWarnings('PMD.OverrideBothEqualsAndHashcode') on equals",
          "detail": "This hides a real contract violation: equal factories can have different hashCodes, which makes Set and Map behaviour inconsistent. It was done because the deterministic_toSOQL test relies on that inconsistency.",
          "evidence": "#8; fflib_QueryFactory.cls:~230",
          "verdict": "questionable"
        },
        {
          "code": "P6",
          "title": "Explanatory comment on the cost of LEGACY FLS removed",
          "detail": "The deleted comment explained why native modes skip resolution and that LEGACY is planned for removal. That design context is now gone.",
          "evidence": "diff of getFieldPath (#6/#10)",
          "verdict": "questionable"
        },
        {
          "code": "P7",
          "title": "Top-level static helper for a null-safe describe lookup",
          "detail": "A small, clear null guard that replaces an NPE with a domain exception.",
          "evidence": "#5; fflib_QueryFactory.cls:213-222",
          "verdict": "good"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "Cache reuse across factories and casings",
          "detail": "Nothing checks that a second factory, or a different casing, gets the same canonical path from the cache, or that invalid fields still throw after a successful lookup on the same table.",
          "proposedTest": "Build two NONE factories on Contact and select 'lastname', 'LASTNAME', 'Account.Name' on each. Assert identical toSOQL(). Then assert that selectField('Account.Bogus') throws InvalidFieldException."
        },
        {
          "code": "T2",
          "title": "Polymorphic selectField(String, SObjectType) on dotted paths",
          "detail": "No test passes a non-null relatedSObjectType with a cross-object field, so the rewritten branch at 171-179 never runs.",
          "proposedTest": "On Task in NONE and LEGACY modes, call selectField('What.Name', Account.SObjectType) and selectField('Owner.Username', User.SObjectType), and assert the resolved paths."
        },
        {
          "code": "T3",
          "title": "Ordering with an invalid SObject name",
          "detail": "The new null guard and the changed exception type are not checked.",
          "proposedTest": "Assert that new Ordering('Nope__x', 'Name', ASCENDING) throws InvalidFieldException."
        },
        {
          "code": "T4",
          "title": "OFFSET in toSOQL",
          "detail": "No test sets an offset, so the OFFSET branch never runs.",
          "proposedTest": "Call setLimit(10).setOffset(5) and assert that toSOQL() ends with ' LIMIT 10 OFFSET 5'."
        },
        {
          "code": "T5",
          "title": "Mode clause on subselects",
          "detail": "The ternary path that drops WITH USER_MODE/SYSTEM_MODE when relationship != null is only covered indirectly.",
          "proposedTest": "Set USER_MODE on an Account factory with a Contacts subselect. Assert that 'WITH USER_MODE' appears exactly once, after FROM Account."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Faulty premise in the iteration log",
          "detail": "Iteration 10 says fflib_SObjectSelectorTest is deleted, but sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls exists and runs SYSTEM_MODE and USER_MODE. Either the coverage run left it out, or the planner was misinformed. Check how coverage is measured before trusting the coverage scores."
        },
        {
          "code": "X2",
          "title": "Headroom test favours caching",
          "detail": "headroomBulkQueryBuilding repeats the same (table, field) pairs thousands of times, so it rewards memoization strongly. Real selectors build a few factories per transaction and will gain much less, while still paying the heap cost of the static map."
        }
      ]
    }
  },
  {
    "name": "sobject-selector-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls",
      "sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls"
    ],
    "branch": "ascent/sobject-selector-1",
    "report": "ascents/sobject-selector-1/report.html?refresh=off",
    "retro": {
      "ascent": "sobject-selector-1",
      "at": "2026-11-12T22:56:29.845Z",
      "base": "971d9bca9b7aa9900f92dda6b91f414cacd374e7",
      "head": "b8fc1f112ec984e5ab6ab7d92a170c467f6a35d4",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 73517,
        "costUsd": 0.6829168
      },
      "summary": "Only fflib_SObjectSelector.cls changed. PMD went from 49 to 100 through brace wraps and the DEFERRED describe option (iterations 3, 5, 9, 10). Coverage went from 83.6 to 90.8 by wiring uncalled public methods into paths that already run (iterations 13, 15), not by adding tests. Limit headroom ended 1 point below the baseline even though iterations 9 and 19 added static describe, field-name and default-order-by caches. Normal behaviour is preserved. The main change is that the DescribeSObjectResult (and so isAccessible()) is now cached per transaction instead of per selector, which can give stale CRUD answers across System.runAs.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "Object describe and isAccessible() now cached per transaction, not per selector",
          "detail": "The sObjectDescribe getter now reads a static SOBJECT_DESCRIBE_CACHE keyed by SObjectType. In the baseline, each new selector instance ran a fresh getDescribe(), so a selector built inside System.runAs saw the runAs user's object access. Now the first describe of a type in the transaction is reused by every later selector, whichever user is running. Public assertIsAccessible() can then pass or fail based on another user's permissions. The CrudException catch is safe because its fallback throw sends the same message either way. In production the running user doesn't change within a transaction, so the risk is mostly tests and code that use System.runAs.",
          "evidence": "fflib_SObjectSelector.cls:89-95, 420, 704-715",
          "iterations": [
            9,
            10
          ],
          "severity": "medium",
          "caughtByTests": false,
          "proposedTest": "In one test method, outside runAs, call new AccountSelector().assertIsAccessible() (passes as admin). Then, inside runAs with a user who has no Account read access, call new AccountSelector().assertIsAccessible() and assert it throws DomainException. With the static cache it doesn't throw."
        },
        {
          "code": "B2",
          "title": "Describe fetched with SObjectDescribeOptions.DEFERRED",
          "detail": "Child relationships load lazily. The selector never reads them from this describe, so there is no visible change. If someone later adds getChildRelationships() through sObjectDescribe, it still works, just loaded lazily.",
          "evidence": "fflib_SObjectSelector.cls:711",
          "iterations": [
            10
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Not needed. Optionally assert getSObjectName() and the CurrencyIsoCode detection give the same results as an EAGER describe."
        },
        {
          "code": "B3",
          "title": "Default getOrderBy() string cached per SObjectType for the transaction",
          "detail": "The name field, its encryption flag and whether CreatedDate exists are schema facts, so the result matches the baseline. Overridden getOrderBy() and the per-instance m_orderBy behave as before. The fallback branch now reads the shared cached describe instead of the instance's sObjectFieldsMap, which gives the same answer.",
          "evidence": "fflib_SObjectSelector.cls:223-228, 717-742",
          "iterations": [
            19
          ],
          "severity": "low",
          "caughtByTests": true,
          "proposedTest": "Assert the default getOrderBy() for an object with no name field or an encrypted one (for example a custom object with an AutoNumber or encrypted Name) returns CreatedDate or Id. Today only name-field objects are exercised."
        },
        {
          "code": "B4",
          "title": "Constructor routes through setDataAccess",
          "detail": "Same end state: non-LEGACY modes only come from the (Boolean, DataAccess) constructor, which already passes enforceCRUD and enforceFLS as false, and null access also leaves both false. setDataAccess is non-virtual, so subclasses can't intercept it during construction.",
          "evidence": "fflib_SObjectSelector.cls:148-154, 196-208, 266-276",
          "iterations": [
            13
          ],
          "severity": "low",
          "caughtByTests": true,
          "proposedTest": "Assert isEnforcingCRUD() and isEnforcingFLS() are false for USER_MODE and SYSTEM_MODE selectors, and true or false as passed for LEGACY selectors."
        },
        {
          "code": "B5",
          "title": "Extra assertIsAccessible() call in the CRUD catch",
          "detail": "It throws the same DomainException message as the fallback, so callers see no difference. It adds a describe lookup on the failure path only. The fallback throw stays as a backstop that, in practice, only runs when the cached describe disagrees with the live check.",
          "evidence": "fflib_SObjectSelector.cls:630-636",
          "iterations": [
            15
          ],
          "severity": "low",
          "caughtByTests": true,
          "proposedTest": "Covered by testAssertIsAccessible. Optionally assert the exception type and message exactly."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Brace wraps with redundant branches kept",
          "detail": "Pure readability and PMD fixes. Keeping the redundant null and ASC sort branches preserved behaviour and coverage.",
          "evidence": "fflib_SObjectSelector.cls:656-682; iterations 3, 5, 9",
          "verdict": "good"
        },
        {
          "code": "P2",
          "title": "Static per-transaction caches of schema-only values",
          "detail": "FIELD_NAME_CACHE and DEFAULT_ORDER_BY_CACHE hold values that depend only on the key, so they are safe. SOBJECT_DESCRIBE_CACHE also holds the user-dependent isAccessible(), which makes it less safe than it looks.",
          "evidence": "fflib_SObjectSelector.cls:117-119, 695-742",
          "verdict": "questionable"
        },
        {
          "code": "P3",
          "title": "Coverage bought by wiring uncalled public methods into covered paths",
          "detail": "getSObjectType2 calling sObjectType(), the constructor calling setDataAccess, and the catch calling assertIsAccessible() raise line coverage without testing those methods' contracts. The catch now does the same check twice, and its fallback throw is effectively dead code.",
          "evidence": "fflib_SObjectSelector.cls:207, 433, 631; iterations 13, 15",
          "verdict": "questionable"
        },
        {
          "code": "P4",
          "title": "Hill climbing gated on a noisy headroom metric",
          "detail": "Brace-only edits were rejected for headroom drops of 10-20 points, and the final headroom is below the baseline despite the caches. The metric's run-to-run noise is larger than the effects being measured.",
          "evidence": "iterations 2, 4, 6, 17, 19",
          "verdict": "bad"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "CRUD answers across System.runAs after describe caching",
          "detail": "No test describes the same SObjectType as two different users in one transaction.",
          "proposedTest": "Build an AccountSelector and call getSObjectName() as admin, then call assertIsAccessible() inside runAs with a user who has no Account read access. Expect DomainException."
        },
        {
          "code": "T2",
          "title": "Default order-by fallback branch",
          "detail": "The CreatedDate and Id branches of resolveDefaultOrderBy aren't asserted for any object.",
          "proposedTest": "Use a selector on an object without a usable name field and assert getOrderBy() equals 'CreatedDate', or 'Id' when CreatedDate is missing."
        },
        {
          "code": "T3",
          "title": "Public methods covered only indirectly",
          "detail": "setDataAccess, ignoreCRUD, sObjectType and assertIsAccessible run without any assertions on what they do.",
          "proposedTest": "Call setDataAccess(USER_MODE) on a LEGACY selector built with enforceCRUD=true and assert isEnforcingCRUD() and isEnforcingFLS() become false. Call ignoreCRUD() and assert isEnforcingCRUD() is false."
        },
        {
          "code": "T4",
          "title": "Multi-currency CurrencyIsoCode selection",
          "detail": "The CURRENCY_ISO_CODE_ENABLED path, now backed by the cached describe, never runs in a single-currency scratch org.",
          "proposedTest": "Add a multi-currency scratch definition and assert CurrencyIsoCode appears in the generated SOQL."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Possible later cleanup",
          "detail": "If SOBJECT_DESCRIBE_CACHE is kept, consider dropping the redundant fallback throw in the CrudException catch, or reverting assertIsAccessible() to a per-instance describe so the access check is always fresh. Iteration 21 showed that per-build describes aren't a meaningful CPU cost."
        },
        {
          "code": "X2",
          "title": "Gains came from a few iterations",
          "detail": "Of 24 iterations, 7 were kept. PMD came from iterations 3, 5, 9 and 10, coverage from 13 and 15, and headroom only from 19 (+4.7, which still left the final score below the baseline)."
        }
      ]
    }
  },
  {
    "name": "application-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_Application.cls",
      "sfdx-source/apex-common/main/classes/fflib_IDomain.cls",
      "sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls",
      "sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls",
      "sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls",
      "sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls",
      "sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls"
    ],
    "branch": "ascent/application-1",
    "report": "ascents/application-1/report.html?refresh=off",
    "retro": {
      "ascent": "application-1",
      "at": "2026-11-13T00:45:32.190Z",
      "base": "0eef1834736e8ae1297bc8f31ecfe2a8c76499a7",
      "head": "3d17d97ce47732c7e3790b25d0f4cbf6c97512e0",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 97926,
        "costUsd": 0.6901406000000001
      },
      "summary": "Only fflib_Application.cls changed. PMD (28.1→100) came from braces in #2 and a class-wide debug-statement suppression in #4. Limit headroom (60.6→85) came from Id-type caches in selectById (#6, #7) and a snapshot cache in selectByRelationship (#13), both tuned to a benchmark that sends the same list 320 times. Coverage (90.1→98.8) came only from restructuring (#9–#12, #15, #16), so the gain does not mean more is tested. Most edits behave the same as the baseline; the two caches are the real risk, because they keep data for the whole transaction and add CPU and heap cost for typical callers that pass a new list each time.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "selectByRelationship compares and deep-clones the input list on every new list",
          "detail": "Every call compares the list field by field (List<SObject> !=) against a saved deepClone(true,true,true). A new list, which is the normal case, also gets cloned. Callers that pass each list once, such as triggers or services, now pay extra CPU and roughly double the heap for that list, and the factory, often a static field, holds the copy for the whole transaction. A large batch scope or a list with many fields could hit the heap limit, and the baseline never did this. Results stay correct, because any field difference causes a miss and the cache only supplies the Id set.",
          "evidence": "fflib_Application.cls:353-367",
          "iterations": [
            13
          ],
          "severity": "medium",
          "caughtByTests": false,
          "proposedTest": "Call selectByRelationship with 5,000 records with several fields populated, each a new list, and assert Limits.getHeapSize() and CPU stay within a fixed limit relative to the baseline loop; also call it with the same list after changing one AccountId and assert the new Id is passed to the selector."
        },
        {
          "code": "B2",
          "title": "selectById keeps every checked Id for the transaction",
          "detail": "m_validatedIdsBySObjectType keeps all checked Ids for each SObjectType. The reset is checked before addAll (size() > 10000), so one large call can push the set well past 10,000 Ids, and the set is never released. Every call that misses also loops over every cached type with containsAll before falling back to the full check. Results and exceptions are unchanged, because an Id's type never changes and a mixed-type set can never be fully contained in a single-type set.",
          "evidence": "fflib_Application.cls:227, :296-321",
          "iterations": [
            6,
            7
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Call selectById with a 20,000-Id set, then with a different 100-Id set, and assert heap growth is bounded; check a mixed-type set still throws 'Unable to determine SObjectType' after a single-type subset was cached."
        },
        {
          "code": "B3",
          "title": "New protected field exposed to subclasses",
          "detail": "m_validatedIdsBySObjectType is @NamespaceAccessible protected, so subclasses can see and change it. A subclass that adds wrong Ids could make selectById use the wrong SObjectType without checking.",
          "evidence": "fflib_Application.cls:226-227",
          "iterations": [
            6,
            7
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Make the field private, or add a test proving a subclass cannot bypass the type check."
        },
        {
          "code": "B4",
          "title": "DomainFactory construction order changed slightly",
          "detail": "The SObjectType constructor now chains through this(selectorFactory, new Map<Object,Type>()), so mockDomainByObject and an empty constructorTypeByObject are set before the overridable getConstructorTypeByObject runs. In the baseline, constructorTypeByObject was null at that point. A subclass that reads these fields inside its override would see different values. Construction also creates one extra throwaway Map.",
          "evidence": "fflib_Application.cls:443-456",
          "iterations": [
            9,
            10,
            12
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Subclass DomainFactory, override getConstructorTypeByObject to record whether constructorTypeByObject and mockDomainByObject are null, and assert the expected state."
        },
        {
          "code": "B5",
          "title": "Domain constructor dispatch relies on IConstructable2 extending IConstructable",
          "detail": "The new early guard sends anything that is not IConstructable to the fflib_IDomainConstructor cast. This matches the baseline only because IConstructable2 extends IConstructable. If that relationship changed, IConstructable2-only classes would throw TypeException. The path for classes implementing only the old IConstructable interface is still never run by any test.",
          "evidence": "fflib_Application.cls:509-526; fflib_SObjectDomain.cls:383",
          "iterations": [
            9,
            15
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Register a constructor class that implements only fflib_SObjectDomain.IConstructable, and assert DomainFactory.newInstance returns its domain built from the records."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Caches tuned to the benchmark",
          "detail": "The selectByRelationship snapshot cache only helps when the same value-equal list is passed again, which the headroom test does 320 times and real code rarely does. Iteration #13 helps the benchmark and makes normal use slower.",
          "evidence": "fflib_ApplicationTest.cls:607-614; fflib_Application.cls:353-367",
          "verdict": "bad"
        },
        {
          "code": "P2",
          "title": "Coverage raised by restructuring code, not by adding tests",
          "detail": "Ternaries fold if/return bodies onto one line (#11, #15), constructors chain to empty ones (#10, #12), and helpers add executed lines (#9, #16). This raised the coverage ratio while the IConstructable path, the non-mock unit-of-work paths and setMock(fflib_IDomain) stay untested. Readability also suffers: construct2 and the short isV2/recs/ctor names exist only to keep a line under the formatter's width limit.",
          "evidence": "fflib_Application.cls:72-130, 509-526, 577; iterations 9-12, 15, 16",
          "verdict": "bad"
        },
        {
          "code": "P3",
          "title": "Class-wide PMD.AvoidDebugStatements suppression",
          "detail": "This hides any debug statement added to the class in future, not just the two intended setMock warnings. A method-level @SuppressWarnings on the two setMock methods would be tighter.",
          "evidence": "fflib_Application.cls:34",
          "verdict": "questionable"
        },
        {
          "code": "P4",
          "title": "Braces on all if/for bodies",
          "detail": "A pure syntax change that removes the risk of mistakes with unbraced bodies.",
          "evidence": "iteration 2",
          "verdict": "good"
        },
        {
          "code": "P5",
          "title": "Cache invalidation by value equality",
          "detail": "#13 validates the cache by comparing against a deep-cloned snapshot and hands out a cloned Id set, so callers can't corrupt it. It is safe, but it is costly to run on every call.",
          "evidence": "fflib_Application.cls:364-367",
          "verdict": "questionable"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "IConstructable (v1-only) domain constructor path",
          "detail": "No test constructor implements only IConstructable; #15 hid that path on a line that always runs.",
          "proposedTest": "Register a class implementing only IConstructable, and assert newInstance(records) returns its domain with the same records."
        },
        {
          "code": "T2",
          "title": "UnitOfWorkFactory without a mock",
          "detail": "All four newInstance overloads are only tested after setMock.",
          "proposedTest": "Call each newInstance overload without setMock and assert the result is an fflib_SObjectUnitOfWork with the expected object types and IDML."
        },
        {
          "code": "T3",
          "title": "selectByRelationship cache invalidation",
          "detail": "No test calls it twice with the same list after changing a row, with a different field, or after setMock was called between the calls.",
          "proposedTest": "Call it, change one record's AccountId, call it again, and assert the mock selector receives the new Id set; repeat with a different relationship field and after registering a mock selector."
        },
        {
          "code": "T4",
          "title": "selectById cache with mixed and overlapping sets",
          "detail": "Only the always-mixed set case is tested. No test passes a mixed-type set after a single-type set was cached.",
          "proposedTest": "Call selectById with Account Ids, then with those Ids plus one Opportunity Id, and assert DeveloperException 'Unable to determine SObjectType...'."
        },
        {
          "code": "T5",
          "title": "setMock(fflib_IDomain) and the Map<Object,Type> DomainFactory constructor",
          "detail": "Both are unreachable from the current tests.",
          "proposedTest": "Build a DomainFactory with Map<Object,Type>, register a mock using a variable typed as fflib_IDomain, and assert newInstance returns it for that getType() key."
        },
        {
          "code": "T6",
          "title": "Volume and heap behaviour",
          "detail": "The only headroom test reuses one 400-row list; it does not measure large or new lists.",
          "proposedTest": "Add a headroom test that passes 50 new 2,000-row lists to selectByRelationship and asserts heap and CPU stay bounded."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Iteration #1's lesson was probably wrong",
          "detail": "#1 was discarded because removing the two setMock System.debug calls supposedly cost 8 headroom points, but the headroom test never calls setMock. The drop was noise, and later iterations (#4, #8, #11, #19) show swings of about ±10 on edits that don't affect runtime cost. The margins may be too tight compared to the measurement noise."
        },
        {
          "code": "X2",
          "title": "Headroom is now limited by the test itself",
          "detail": "Iterations #14-#19 found that the remaining CPU is mostly the test's own loops, so further headroom gains here would mostly come from fitting the benchmark more closely. Consider removing or narrowing the #13 cache, and keeping the #7 cache only if real callers repeat selectById calls on overlapping sets."
        }
      ]
    }
  },
  {
    "name": "sobject-domain-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls",
      "sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls"
    ],
    "branch": "ascent/sobject-domain-1",
    "report": "ascents/sobject-domain-1/report.html?refresh=off",
    "retro": {
      "ascent": "sobject-domain-1",
      "at": "2026-11-13T01:45:01.707Z",
      "base": "e8f3ab60e9388e5f90b5ddfe57322407712db344",
      "head": "e495f52f8ae7dd4cc63b24b5d4a6a120fe308bba",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 49654,
        "costUsd": 0.547651
      },
      "summary": "Only fflib_SObjectDomain.cls changed, and the evolved code behaves the same as the baseline. PMD went from 17 to 100 because all missing-brace violations were cleared (iterations 2, 4, 6, 8, 9, 11, 13), with redundant else removed after branches that already return (iterations 11, 13), so the checks keep their original order and still stop at the first match. Limit headroom went from 55 to 67.4 almost entirely because of iteration 15: getChangedRecords now reads the ExistingRecords getter once and uses the typed newRecord.Id. Coverage, Graph Engine and Resource efficiency did not move; Resource efficiency is measured on test classes that never run this class, so it could not reflect these edits.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "ExistingRecords lazy getter now runs even when Records is empty",
          "detail": "Both getChangedRecords overloads read this.ExistingRecords once before the loop. In the baseline the getter ran only inside the loop, so a domain with no records never triggered the lazy load from Test.Database.oldRecords or Trigger.oldMap. The evolved code loads and caches the map on the first getChangedRecords call even with zero records. The value is the same as any later read would give, so the visible result (an empty list) does not change. Only the timing of the first load and caching changes, which a subclass could see only if it reads the private cache or changes Test.Database between calls.",
          "evidence": "fflib_SObjectDomain.cls:61-71, :337, :362",
          "iterations": [
            15
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Build a domain with an empty list, call getChangedRecords, then call Test.Database.onUpdate with an old map. Assert that ExistingRecords reflects whatever caching behaviour is intended."
        },
        {
          "code": "B2",
          "title": "Typed newRecord.Id replaces dynamic get('Id') with a cast",
          "detail": "For any SObject, including generic SObject, .Id and (Id) get('Id') return the same value, and both return null for an unsaved record. A null Id still fails containsKey and the record is skipped. This is equivalent; listed for completeness.",
          "evidence": "fflib_SObjectDomain.cls:339, :364",
          "iterations": [
            15
          ],
          "severity": "low",
          "caughtByTests": true,
          "proposedTest": "Add an unsaved record (no Id) to Records and assert it is not returned as changed."
        },
        {
          "code": "B3",
          "title": "Trigger dispatch moved from if/else-if to braced ifs that return early",
          "detail": "Each branch returns straight after its handler, and the after branch is reached only when isBefore is false, so it is equivalent to the baseline even if more than one operation flag is true. With no flag set, domainObject is still null and throws the same null-pointer error at :481 as before. The isEnabled rewrite falls through to return true exactly as the baseline did.",
          "evidence": "fflib_SObjectDomain.cls:496-524, :718-742",
          "iterations": [
            11,
            13
          ],
          "severity": "low",
          "caughtByTests": true,
          "proposedTest": "Through Test.Database or a direct triggerHandler call, set isBefore together with isUndelete and assert that no handler runs. Set isInsert and isUpdate together and assert that only the insert handler runs."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Braces on every if/for body",
          "detail": "Reduces the risk of dangling-statement bugs and cleared every PMD brace violation without changing logic.",
          "evidence": "iterations 2, 4, 6, 8, 9",
          "verdict": "good"
        },
        {
          "code": "P2",
          "title": "Removing else after branches that return, to satisfy PMD",
          "detail": "Correct in both places only because every branch returns, so the checks still stop at the first match. The early-return dispatch reads less symmetrically than an else-if chain, and the safety depends on the return lines staying. Iteration 12, which dropped else without returning, shows how easily a later edit could break that.",
          "evidence": "fflib_SObjectDomain.cls:496-524; iterations 11, 12, 13",
          "verdict": "questionable"
        },
        {
          "code": "P3",
          "title": "Reading a property getter into a local before the loop",
          "detail": "Cuts repeated getter calls in a loop that runs once per record, with the same result because the getter only fills itself once.",
          "evidence": "fflib_SObjectDomain.cls:337, :362; iteration 15",
          "verdict": "good"
        },
        {
          "code": "P4",
          "title": "Choosing edits by line count and coverage arithmetic",
          "detail": "Several plans kept or added lines only to protect the coverage score (for example, rejecting ternaries in iteration 10 and the single-get change in iteration 14). This made the climb favour layout over clarity, although the code that was kept is fine.",
          "evidence": "iterations 10, 14, 15",
          "verdict": "questionable"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "Dispatch when more than one operation flag is set, or none",
          "detail": "No test pins the rule that exactly one handler runs, or what happens when no flag is set.",
          "proposedTest": "Call the triggerHandler path through a test domain that records which handlers ran. Assert that only one runs with isInsert and isUpdate both true, and that a null-pointer error or a defined error is raised when all flags are false."
        },
        {
          "code": "T2",
          "title": "getChangedRecords edge cases",
          "detail": "The tests cover only the normal case where every record is in the old map. Not covered: a null old map, a new record missing from the old map, and an unsaved record with no Id.",
          "proposedTest": "With ExistingRecords null, assert an empty result. With one new record whose Id is not in the old map, assert it is excluded. With an unsaved record, assert it is excluded."
        },
        {
          "code": "T3",
          "title": "isEnabled for every combination",
          "detail": "Disabling each individual event is not systematically tested, so a reordering or dropped return in isEnabled could go unnoticed.",
          "proposedTest": "For each of the 7 before/after and operation combinations, disable only that event and assert that its handler is skipped while the others still run."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Resource efficiency cannot see this class",
          "detail": "fflib_SObjectSelectorTest and fflib_ApplicationTest never run fflib_SObjectDomain, yet changes on that dimension decided several discards (iterations 3, 5). Those discards were noise rather than evidence about the edits."
        },
        {
          "code": "X2",
          "title": "triggerHandler is at its NcssCount limit",
          "detail": "Iteration 16 showed that adding any statement to triggerHandler triggers a PMD NcssCount violation. Future work there should first move logic out into helper methods."
        }
      ]
    }
  },
  {
    "name": "sobjects-2",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_SObjects.cls",
      "sfdx-source/apex-common/main/classes/fflib_ISObjects.cls"
    ],
    "branch": "ascent/sobjects-2",
    "report": "ascents/sobjects-2/report.html?refresh=off",
    "retro": {
      "ascent": "sobjects-2",
      "at": "2026-11-13T04:22:41.784Z",
      "base": "2b20aea86a1f5604765f6959d2a0bed8293b1157",
      "head": "6717c6e8ab2d5ca5a1f465d750afae81cda201ee",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 33734,
        "costUsd": 0.3528502
      },
      "summary": "Only iterations 1 and 2 were kept, both PMD-only cleanups in fflib_SObjects.cls (the only class climbed), which drove PMD from 35.2 to 100. Behaviour is effectively unchanged: the hoisted loop bound matches the old `j = records.size()`, the added braces change nothing, and the DEFERRED describe only changes when child-relationship metadata is loaded. Every other score held or moved within noise; fflib_SObjectsTest.headroomBulkFieldOperations headroom (60.1→58.8) and fflib_SObjectDomainTest resource efficiency (80.9→78.3) dipped slightly, and iterations 3-5, which targeted headroom, were all discarded.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "Constructor describe switched to SObjectDescribeOptions.DEFERRED",
          "detail": "sObjectDescribe is a public property. Consumers that read child relationships or other heavy describe data from it now trigger lazy loading instead of reading pre-loaded data. The values are identical, so only when the describe cost is paid changes. Within the repo only getSObjectType() reads it.",
          "evidence": "sfdx-source/apex-common/main/classes/fflib_SObjects.cls:32, :55-57, :86",
          "iterations": [
            1,
            2
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Construct fflib_SObjects over Account and assert sObjectDescribe.getChildRelationships() is non-empty and equals Account.SObjectType.getDescribe().getChildRelationships().size()."
        },
        {
          "code": "B2",
          "title": "Loop bound read once before the loop",
          "detail": "Equivalent to the baseline, which also captured records.size() once in `j`. If a subclass's getRecords() returned a list that grows during the loop, both versions would ignore the added records, so there is no new risk.",
          "evidence": "fflib_SObjects.cls:97-98, :113-114, :497-498 and the other loop headers",
          "iterations": [
            1
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "No test needed; behaviour is identical to the baseline."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Hoisted recordCount local for indexed loops",
          "detail": "Clears OneDeclarationPerLine and keeps the same CPU profile as the baseline.",
          "evidence": "fflib_SObjects.cls loop headers, iteration 1",
          "verdict": "good"
        },
        {
          "code": "P2",
          "title": "Braces on all if statements",
          "detail": "Removes the dangling-statement hazard and changes no behaviour.",
          "evidence": "fflib_SObjects.cls:363-365, :395-397, :461-463",
          "verdict": "good"
        },
        {
          "code": "P3",
          "title": "Spelling change made only to satisfy PMD",
          "detail": "The Schema. qualifier was dropped only because the PMD rule matches source text. It is harmless but cosmetic, and other qualified spellings elsewhere could be flagged again.",
          "evidence": "iteration 2, fflib_SObjects.cls:55-57",
          "verdict": "questionable"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "Contents of the public sObjectDescribe are not tested",
          "detail": "No test checks that the describe exposed through the property is complete after the switch to DEFERRED.",
          "proposedTest": "Assert sObjectDescribe.getName(), fields.getMap().size() and getChildRelationships().size() match a full Account describe."
        },
        {
          "code": "T2",
          "title": "Blank checks on non-String fields",
          "detail": "The getRecordsWith*BlankFieldValues methods rely on String.valueOf for Number, Boolean and Date fields. Iteration 3 nearly rewrote this logic, so it is the most likely place for a future regression.",
          "proposedTest": "Use records with null, 0 and false values in NumberOfEmployees and a checkbox field, and assert each of the four methods' results, including that 0 and false count as not blank."
        },
        {
          "code": "T3",
          "title": "setFieldValueByMap with null values map or key mapped to null",
          "detail": "Iteration 3 depended on the semantics of `if (values?.containsKey(...))` when values is null, but the tests do not pin this down.",
          "proposedTest": "Assert that a null map throws a NullPointerException, and that a key mapped to null sets the field to null."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Inconsistent headroom baseline",
          "detail": "The top-level Limit headroom baseline is 57.3, but its only headroom test scored 60.1 at baseline, so the reported +1.5 is really a -1.3. Check how the baseline is aggregated before trusting headroom deltas."
        },
        {
          "code": "X2",
          "title": "Learnings from the discarded headroom attempts",
          "detail": "Iterations 3-5 showed that CPU in headroomBulkFieldOperations is dominated by SObject get/put calls and allocations. Loop restructuring, cached casts and post-hoc Set.remove calls did not help or made it worse. Future work should cut the number of field accesses or passes."
        }
      ]
    }
  },
  {
    "name": "objects-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_Objects.cls",
      "sfdx-source/apex-common/main/classes/fflib_IObjects.cls"
    ],
    "branch": "ascent/objects-1",
    "report": "ascents/objects-1/report.html?refresh=off",
    "retro": {
      "ascent": "objects-1",
      "at": "2026-11-13T06:03:20.071Z",
      "base": "4c7400071ec7f0b3416b232a78887d00c8ccc0cf",
      "head": "be85edb05b3bfd1bd8178ed718556363364c603a",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 74496,
        "costUsd": 0.4473462
      },
      "summary": "Only fflib_Objects.cls changed. Iteration 1 drove PMD (51→100) by adding braces and Limit headroom (57.6→90) by replacing a linear list search per value with a Set lookup. Iteration 2 drove Code coverage (90.5→100) by folding the null-guard returns onto one line, which hides untested lines rather than testing them. Resource efficiency barely moved because fflib_SObjects never calls the changed methods (fflib_SObjectsTest fell 1.0 and fflib_SObjectDomainTest rose 1.0, both noise), and results for normal inputs are unchanged.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "Membership now uses hashCode plus equals instead of equals only",
          "detail": "The baseline matched values with List.contains, which uses only equals(). The evolved code uses Set.containsAll and retainAll, which bucket by hashCode() first. Objects that override equals without a matching hashCode, or whose hashCode is inconsistent, can stop matching. SObjects and plain objects (compared by reference) behave the same.",
          "evidence": "sfdx-source/apex-common/main/classes/fflib_Objects.cls:61,66,84-88; the test DTO overrides neither method (fflib_ObjectsTest.cls:250)",
          "iterations": [
            1,
            2
          ],
          "severity": "medium",
          "caughtByTests": false,
          "proposedTest": "Add a value class that overrides equals and hashCode by a key field, build a domain from instances, and check containsAll and containsNot with distinct but equal instances."
        },
        {
          "code": "B2",
          "title": "Null internal list combined with an empty input now throws",
          "detail": "A subclass can null the list through setObjects(null). The baseline then returned true for containsAll(empty set) and containsNot(empty set) because the loop never ran. Now new Set<Object>(null) and retainAll(null) most likely throw. With a non-empty input, both versions already threw.",
          "evidence": "fflib_Objects.cls:61,66,86,106",
          "iterations": [
            2
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "In a test subclass that calls setObjects(null), assert what containsAll(new Set<Object>()) and containsNot(new Set<Object>()) should do."
        },
        {
          "code": "B3",
          "title": "No early exit and an allocation sized to the domain on every call",
          "detail": "The baseline containsAll stopped at the first missing value and allocated nothing. Now every call copies the whole object list into a new Set, and containsNot(List) copies its input twice. Frequent small checks against large domains now cost more heap and CPU per call, though cost stays linear.",
          "evidence": "fflib_Objects.cls:61,66,76,85",
          "iterations": [
            1,
            2
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Add a headroom test with a 10k-element domain that calls containsAll with a single missing value many times, and check Limits.getHeapSize and Limits.getCpuTime."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Braces on every if",
          "detail": "Cleared all 12 PMD findings with no change in behaviour.",
          "evidence": "iteration 1",
          "verdict": "good"
        },
        {
          "code": "P2",
          "title": "Native Set operations instead of per-value loops",
          "detail": "Clearer code and a faster bulk case, but it quietly changes how equality is checked.",
          "evidence": "fflib_Objects.cls:61,66,84-88",
          "verdict": "good"
        },
        {
          "code": "P3",
          "title": "Guards folded into one-line boolean returns to raise coverage",
          "detail": "The null branches are still untested. Coverage rose only because they now share a line with tested code.",
          "evidence": "iteration 2; fflib_Objects.cls:61,66,76,81",
          "verdict": "questionable"
        },
        {
          "code": "P4",
          "title": "Defensive copy in containsNone",
          "detail": "retainAll runs on a copy, so the caller's Set is never changed.",
          "evidence": "fflib_Objects.cls:85; iteration 3 discarded the version that dropped the copy",
          "verdict": "good"
        },
        {
          "code": "P5",
          "title": "Duplicated body instead of delegating",
          "detail": "containsAll(List) repeats the containsAll(Set) one-liner instead of calling it. Harmless while neither method is virtual.",
          "evidence": "fflib_Objects.cls:61,66",
          "verdict": "questionable"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "Null inputs",
          "detail": "No test passes null to containsAll or containsNot, so the expected results (false and true) are not pinned down.",
          "proposedTest": "Assert that containsAll((List<Object>) null) and containsAll((Set<Object>) null) return false, and that containsNot((List<Object>) null) and containsNot((Set<Object>) null) return true."
        },
        {
          "code": "T2",
          "title": "Empty inputs and small mixed cases",
          "detail": "No test uses an empty list or Set, an empty domain, or a small mix of present and absent values.",
          "proposedTest": "Assert that containsAll(empty) is true, containsNot(empty) is true, containsAll([A, D]) is false, containsNot([A, D]) is false, and that an empty domain gives containsAll([A]) false and containsNot([A]) true."
        },
        {
          "code": "T3",
          "title": "Custom equals and hashCode",
          "detail": "Hashing changes behaviour for value objects, and nothing tests it.",
          "proposedTest": "Build a domain of value objects that override equals and hashCode, then check contains, containsAll and containsNot with equal but distinct instances."
        },
        {
          "code": "T4",
          "title": "Null internal list",
          "detail": "What happens after setObjects(null) is not defined anywhere.",
          "proposedTest": "In a subclass that calls setObjects(null), assert the expected exception or result for each containment method with empty and non-empty inputs."
        },
        {
          "code": "T5",
          "title": "Caller's input is left unchanged",
          "detail": "No test checks that containsNot(Set) leaves its argument untouched.",
          "proposedTest": "Call containsNot(s) on a domain that partly overlaps s, then assert that s.size() and its contents are unchanged."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Score movement in untouched classes is noise",
          "detail": "fflib_SObjects never calls containsAll or containsNot (its only contains call is on a local Set, fflib_SObjects.cls:330), so the shifts in the two test classes' Resource efficiency and the Test run time rise from 74.9 to 80.1 are probably run-to-run noise."
        },
        {
          "code": "X2",
          "title": "Lessons from the discarded iterations",
          "detail": "Iterations 3-5 show that one-off allocation trims and caches layered beside the existing check don't register, and that the cache cost PMD and coverage. Further gains would have to come from changes that remove per-element work in fflib_SObjects."
        }
      ]
    }
  },
  {
    "name": "string-builder-2",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls"
    ],
    "branch": "ascent/string-builder-2",
    "report": "ascents/string-builder-2/report.html?refresh=off",
    "retro": {
      "ascent": "string-builder-2",
      "at": "2026-11-13T21:51:51.137Z",
      "base": "3f54bd8bcbb175d7782701c8a61be538cf5bdd21",
      "head": "c5b7379ddff3bb9d17f9fd5dd99494c5b5e09d73",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 41419,
        "costUsd": 0.4068426
      },
      "summary": "Only fflib_StringBuilder.cls changed. Iteration 1 (braces) drove PMD from 64.1 to 100 and iteration 3 (direct buffer.add plus a static multi-currency flag) drove Limit headroom from 63.2 to 73.2; coverage, run time and resource efficiency barely moved (≤0.2, noise). Output is identical inside this repo, but iteration 3 makes the constructors skip the public virtual add(String), so a subscriber-org subclass that overrides add no longer sees field or CurrencyIsoCode entries. That silent API break is the main risk, and no test covers it.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "Constructors skip the overridable add(String) hook",
          "detail": "In the baseline, the FieldListBuilder constructor called the virtual add(String) for each SObjectField and each FieldSetMember path, and MultiCurrencyFieldListBuilder did the same for 'CurrencyIsoCode'. The evolved code writes to the protected buffer directly. FieldListBuilder and CommaDelimitedListBuilder are public virtual and @NamespaceAccessible, and add is public virtual, so code outside the namespace can subclass and override add (for example to deduplicate, as the 'Create a distinct set of fields' comment at :139 suggests, or to filter or namespace-prefix fields). Those overrides are now bypassed for constructor-supplied values. Overrides of add(String) on an anonymous subclass of FieldListBuilder are affected; calls to add made after construction are not. Iteration 3 only checked this repo's source tree for overrides.",
          "evidence": "fflib_StringBuilder.cls:68 (public virtual add), :128 (virtual FieldListBuilder), :141, :147, :173",
          "iterations": [
            3
          ],
          "severity": "medium",
          "caughtByTests": false,
          "proposedTest": "In a test, define a subclass of FieldListBuilder that overrides add(String) to record each call (or to drop duplicates). Construct it with fields including a duplicate and assert the override ran for every field. This fails on the evolved code."
        },
        {
          "code": "B2",
          "title": "Multi-currency flag read once per transaction at class load",
          "detail": "UserInfo.isMultiCurrencyOrganization() used to be called on each MultiCurrencyFieldListBuilder construction. It is now evaluated once, when the class first loads in a transaction, for every user of the class (including plain StringBuilder use). The org setting can't change within a transaction, so output is the same. The costs are one extra system call in transactions that never build a multi-currency list, and less room to test both branches: the value is a private static final, so a test can't switch it.",
          "evidence": "fflib_StringBuilder.cls:39, :172",
          "iterations": [
            3
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Assert that MultiCurrencyFieldListBuilder output contains 'CurrencyIsoCode' if and only if UserInfo.isMultiCurrencyOrganization() is true (the current test only checks the positive case)."
        },
        {
          "code": "B3",
          "title": "Brace addition",
          "detail": "This was a purely syntactic change and the semantics are the same. A null values list still throws a NullPointerException and fieldSets == null is still skipped.",
          "evidence": "fflib_StringBuilder.cls:140-150",
          "iterations": [
            1
          ],
          "severity": "low",
          "caughtByTests": true,
          "proposedTest": ""
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Bypassing a virtual method from a constructor of an extensible class",
          "detail": "This gains CPU by skipping one call per field, at the cost of breaking the documented extension point of a public library class. A non-virtual private helper or a documented final contract would be a cleaner way to get the same speed-up.",
          "evidence": "fflib_StringBuilder.cls:141, :147, :173; iteration 3",
          "verdict": "questionable"
        },
        {
          "code": "P2",
          "title": "Hoisting org-invariant system state into a top-level private static",
          "detail": "Reasonable for a value that can't change within a transaction. It had to sit on the top-level class because inner classes can't hold statics (iteration 2 failed to compile for this reason). It makes the branch harder to test.",
          "evidence": "fflib_StringBuilder.cls:39; iterations 2, 3",
          "verdict": "good"
        },
        {
          "code": "P3",
          "title": "Braces on all control statements",
          "detail": "Safe PMD cleanup.",
          "evidence": "fflib_StringBuilder.cls:140-150, :172-174; iteration 1",
          "verdict": "good"
        },
        {
          "code": "P4",
          "title": "Comment says 'distinct' but nothing deduplicates",
          "detail": "This predates the climb, but it hints that callers or subclasses are expected to deduplicate through add, which makes the iteration 3 bypass riskier. testFieldListBuilder passes a duplicate AccountNumber and compares only as a Set, so duplicates are tolerated.",
          "evidence": "fflib_StringBuilder.cls:139; fflib_StringBuilderTest.cls:92-96",
          "verdict": "questionable"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "Subclass add() override contract",
          "detail": "No test subclasses any builder, so constructor dispatch through add is not pinned down.",
          "proposedTest": "Use a recording subclass of FieldListBuilder, and of MultiCurrencyFieldListBuilder through FieldListBuilder, and assert that add(String) saw every constructor-supplied field."
        },
        {
          "code": "T2",
          "title": "Field set paths",
          "detail": "No test passes a non-null fieldSets list, so the FieldSetMember loop (:144-150) is unverified for ordering and content.",
          "proposedTest": "If the org has an Account field set (or a packaged test fixture), build FieldListBuilder(fields, new List<Schema.FieldSet>{fs}) and assert the field paths follow the SObjectFields in order."
        },
        {
          "code": "T3",
          "title": "Exact output and order",
          "detail": "The tests compare as Sets, so changes to order or duplicates would pass unnoticed. Iteration 4's join/split did break tests, but only through other assertions.",
          "proposedTest": "Assert the exact string, e.g. 'Name,Id,AccountNumber,AnnualRevenue' for FieldListBuilder, and 'Parent.Name,Parent.Id' for getStringValue('Parent.')."
        },
        {
          "code": "T4",
          "title": "Null and empty inputs",
          "detail": "Empty field lists and null values are not tested.",
          "proposedTest": "Assert that new FieldListBuilder(new List<SObjectField>()).getStringValue() == '' and that a null list throws a NullPointerException."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Headroom gains have plateaued",
          "detail": "Iterations 4 to 8 were all discarded. The remaining CPU is in String.valueOf per field and String.join. Further work here would mostly chase noise, given a 7.9 margin against changes of about 1 to 2 points."
        },
        {
          "code": "X2",
          "title": "Possible quick fix",
          "detail": "Restoring add(...) in the constructors while keeping the static flag would keep most of the safe gain and remove the API risk. Measure how much of iteration 3's +8 came from each part before deciding."
        }
      ]
    }
  },
  {
    "name": "sobject-describe-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls"
    ],
    "branch": "ascent/sobject-describe-1",
    "report": "ascents/sobject-describe-1/report.html?refresh=off",
    "retro": {
      "ascent": "sobject-describe-1",
      "at": "2026-11-13T23:53:30.056Z",
      "base": "440b36c791ff1ddd311bf6799608da98ab4b23c7",
      "head": "1b5082c5d85bfc8b61368809f8650980f2962696",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 87763,
        "costUsd": 0.581831
      },
      "summary": "The ascent changed only fflib_SObjectDescribe.cls. PMD (71.4→100) came from iterations 1–2 (for-each loops, deferred describe with an unqualified enum), coverage (95.5→98.8) from deleting unreachable or duplicate code in iterations 4–5, and resource efficiency (+2.4) from keying instanceCache by SObjectType in iteration 8. Limit headroom fell (73.7→59.1), most likely because getDescribe(String) now always goes through the global describe instead of checking the instance cache first, though this dimension is noisy (about ±12). Behaviour is preserved in single-namespace orgs; the only semantic shift is that namespace-omitted String lookups now return a cached, namespace-preferring instance.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "getDescribe(String) always resolves through the global describe",
          "detail": "The baseline checked instanceCache by lowercased name and only fell back to wrappedGlobalDescribe on a miss. The evolved code always calls wrappedGlobalDescribe.get(name). After flushCache(), a String lookup of an already-described type now rebuilds Schema.getGlobalDescribe() and the GlobalDescribeMap wrapper, and every String lookup pays the namespaced-key string work. The returned instance is the same; the cost is CPU and heap, and it likely explains the Limit headroom drop (73.7→59.1).",
          "evidence": "fflib_SObjectDescribe.cls:255, :218-226; headroomBulkDescribes test lines 329-335",
          "iterations": [
            8
          ],
          "severity": "medium",
          "caughtByTests": false,
          "proposedTest": "After flushCache(), call getDescribe(Account.SObjectType) then getDescribe('Account') and assert that Limits.getCpuTime() / heap growth stays under a bound, or at least that both calls return the same instance."
        },
        {
          "code": "B2",
          "title": "Namespace-omitted String lookups now hit the cache and consistently prefer the namespaced type",
          "detail": "The baseline cache key was String.valueOf(token).toLowerCase() (for example 'ns__obj__c'), so getDescribe('Obj__c') in namespace ns never hit the cache, built a new instance on every call and overwrote the cache entry. When both an unmanaged Obj__c and a packaged ns__Obj__c existed, the baseline returned whichever matched a cached 'obj__c' key, otherwise the namespaced one. The evolved code always resolves through GlobalDescribeMap.get (namespace-preferred) and returns the cached instance: more consistent, but different.",
          "evidence": "fflib_SObjectDescribe.cls:255, :263, :395-406 (getObject namespace preference); baseline lines removed in the diff at the old :253-264",
          "iterations": [
            8
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Using the existing fakeNamespace technique on a GlobalDescribeMap, or in a namespaced scratch org, assert that getDescribe('Obj__c') === getDescribe(ns__Obj__c.SObjectType) and that repeated String calls return the same instance."
        },
        {
          "code": "B3",
          "title": "getNameField uses a DEFERRED describe with an unqualified enum",
          "detail": "fields.getMap() is identical under DEFERRED, so the returned name field does not change. The unqualified SObjectDescribeOptions reference would resolve to a local class if one with that name were ever added, which is a compile-time risk rather than a runtime one.",
          "evidence": "fflib_SObjectDescribe.cls:156-158",
          "iterations": [
            1,
            2
          ],
          "severity": "low",
          "caughtByTests": true,
          "proposedTest": "Already covered by getNameField_staticBasics (Account.Name, Contact.Name)."
        },
        {
          "code": "B4",
          "title": "DescribeSObjectResult overload delegates to the token overload",
          "detail": "The baseline looked up getName().toLowerCase(), which equals String.valueOf(token).toLowerCase(), so the delegation is equivalent and also drops redundant null-safe operators. No behaviour change, but instance identity for this overload is not asserted (the test is commented out).",
          "evidence": "fflib_SObjectDescribe.cls:267-274; fflib_SObjectDescribeTest.cls:156,161",
          "iterations": [
            5
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Uncomment the d4/d5 assertions in getAccountDescribes, using === rather than areEqual."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Deleting unreachable members and no-op branches to raise coverage",
          "detail": "The removed no-arg constructor, the one-arg getObject of a private abstract class and the `if (token == null) result = null` branch were all dead. Coverage rose by shrinking the denominator honestly.",
          "evidence": "iterations 4, 5; diff at old :403-412",
          "verdict": "good"
        },
        {
          "code": "P2",
          "title": "Keying the cache by SObjectType instead of a derived string",
          "detail": "Simpler and cheaper, and it removes the namespace-dependent key mismatch, so String and token lookups share one instance.",
          "evidence": "fflib_SObjectDescribe.cls:233-241, :88, :263",
          "verdict": "good"
        },
        {
          "code": "P3",
          "title": "Rewriting code to match PMD's literal pattern",
          "detail": "Dropping the Schema. qualifier only to satisfy the EagerlyLoadedDescribeSObjectResult rule's matcher is benign but tool-driven, and makes the code slightly less explicit than the rest of the file, which uses Schema.-qualified names.",
          "evidence": "fflib_SObjectDescribe.cls:156-158; iteration 2",
          "verdict": "questionable"
        },
        {
          "code": "P4",
          "title": "Collapsing getDescribe(String) into a single delegation",
          "detail": "Cleaner, but it gives up the cheap cache-first path, so String callers now pay a global-describe lookup on every call. A cache-first check by token is not possible without the string key, so this is an explicit trade-off of CPU for simplicity.",
          "evidence": "fflib_SObjectDescribe.cls:255; iteration 8 learning",
          "verdict": "questionable"
        },
        {
          "code": "P5",
          "title": "for-each loops replacing indexed loops",
          "detail": "Equivalent semantics (a null list still throws NullPointerException) and clears the OneDeclarationPerLine finding.",
          "evidence": "fflib_SObjectDescribe.cls:340-342, :362-366; iteration 1",
          "verdict": "good"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "Instance identity across all getDescribe overloads",
          "detail": "Only the String, SObjectType and Schema.SObjectType.Account forms are compared, and with areEqual rather than reference identity; the DescribeSObjectResult and SObject forms are commented out.",
          "proposedTest": "In getAccountDescribes, assert getDescribe('account') === getDescribe(Account.SObjectType.getDescribe()) === getDescribe(new Account()) === getDescribe(Account.SObjectType)."
        },
        {
          "code": "T2",
          "title": "Unknown String name returns null",
          "detail": "The null path now relies on GlobalDescribeMap.get returning null, then on the token overload's null guard. Only blank and null strings are tested.",
          "proposedTest": "Assert getDescribe('NotARealObject__c') == null and getDescribe('NotARealObject__c') does not populate any cache (a follow-up getDescribe(Account.SObjectType) still works)."
        },
        {
          "code": "T3",
          "title": "Mixed-case and namespaced String resolution",
          "detail": "Case-insensitivity and namespace preference in getDescribe(String) are untested now that it delegates entirely to GlobalDescribeMap.",
          "proposedTest": "Assert getDescribe('aCcOuNt') === getDescribe(Account.SObjectType); with gdm.currentNamespace set to a fake namespace, assert namespace-omitted lookups resolve to the namespaced token when both keys exist."
        },
        {
          "code": "T4",
          "title": "Cost of String lookups after flushCache",
          "detail": "No test pins the extra global-describe rebuild that String lookups now trigger.",
          "proposedTest": "After flushCache, prime by token, then measure Limits.getCpuTime() across 100 getDescribe('Account') calls and assert it stays under a threshold derived from the baseline."
        },
        {
          "code": "T5",
          "title": "getNameField on a type without a name field",
          "detail": "The null return when no field has isNameField() is not exercised.",
          "proposedTest": "Pick a standard object without a name field (for example a share or history type such as AccountHistory) and assert getNameField(type) == null."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Limit headroom delta may be partly noise",
          "detail": "Iteration 6 recorded a -12 swing on Limit headroom between two runs of the same code, so the 14.6-point drop is not entirely attributable to iteration 8. Re-measure before reverting."
        },
        {
          "code": "X2",
          "title": "Unmerged sub-margin wins",
          "detail": "Iterations 9–11 (caching the name field per instance and caching the namespace-stripped keySet) showed real CPU gains of about +11 to +15 headroom but missed the 23.3 margin. They are worth revisiting as a deliberate change outside the climb."
        },
        {
          "code": "X3",
          "title": "Stale doc comment",
          "detail": "The @deprecated note on getDescribe(String) at fflib_SObjectDescribe.cls:243-249 mentions dynamic Type resolution, but the method only uses the global describe map."
        }
      ]
    }
  },
  {
    "name": "unit-of-work-style-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls",
      "sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls"
    ],
    "branch": "ascent/unit-of-work-style-1",
    "report": "ascents/unit-of-work-style-1/report.html?refresh=off",
    "retro": {
      "ascent": "unit-of-work-style-1",
      "at": "2026-11-14T07:47:19.645Z",
      "base": "4c873319ebc31da13128ee24ce682108ddba1c82",
      "head": "d0b63be065d987267241e614f8717cb642fb4b1a",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 121817,
        "costUsd": 0.7829123999999998
      },
      "summary": "Only fflib_SObjectUnitOfWork changed. It drove PMD 43.9→100 (iteration 1), Code coverage 79.2→80.7 (iterations 3 and 7) and Limit headroom 59.9→71.2 in headroomBulkCommitWork (iterations 6–8). Resource efficiency barely moved: fflib_SObjectUnitOfWorkTest stayed at 94 and fflib_ApplicationTest went 81→80.9, which is noise. Iterations 1, 3, 6 and 8 are behaviour-equivalent apart from edge cases that can't happen in practice. The one real semantic change is iteration 7's per-type 'all resolved' cache in Relationships.resolve(), which makes the unit of work stateful across phases and across repeated commitWork calls.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "Relationships.resolve() skips re-resolution once a pass fully resolves, including on later commitWork calls",
          "detail": "m_resolvedCount is set after a pass in which every relationship resolved, and it is never reset. Later passes in the same commit (the upsert and update phases) and every pass in a later commitWork on the same instance return early unless new relationships were added. In the baseline, any relationship whose lookup no longer equalled the parent Id was re-written with that Id in each phase. It now differs when (a) a resolved lookup field is changed between phases, e.g. by a custom IDML or an onDMLStarting/onRegisterType subclass hook, or (b) a caller reuses a unit of work, changes a child lookup or resets records after a failed or rolled-back commit, and calls commitWork again: the stale or edited value is kept instead of being overwritten with the parent Id. Incomplete passes (parent Id blank) are not cached, so the out-of-order and partial-failure retry paths still work.",
          "evidence": "fflib_SObjectUnitOfWork.cls:1037-1051, 856-858, 918",
          "iterations": [
            7
          ],
          "severity": "medium",
          "caughtByTests": false,
          "proposedTest": "Register a new Account and registerNew(opp, Opportunity.AccountId, acc), then commitWork with MockDML. Set opp.AccountId to a different generated Id, clear opp.Id, and commitWork again on the same uow. Assert that the second insert's AccountId equals acc.Id, as in the baseline."
        },
        {
          "code": "B2",
          "title": "Relationship.resolve now returns success; the completion signal for EmailRelationship and RelationshipByExternalId is always true",
          "detail": "EmailRelationship.resolve returns true even when relatedTo.Id is blank and WhatId is set to null. Combined with the cache, a second resolveEmailRelationships() in a reused unit of work no longer re-applies WhatId. Within a single commit, behaviour is unchanged.",
          "evidence": "fflib_SObjectUnitOfWork.cls:1174-1177, 964-966",
          "iterations": [
            7
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Reuse a uow across two commitWork calls with registerRelationship(email, opp). Between commits, call email.setWhatId(null) and assert that WhatId equals opp.Id after the second commit."
        },
        {
          "code": "B3",
          "title": "registerDirty(record, field, parent) no longer re-validates against m_newListByType",
          "detail": "The baseline validated the type against m_dirtyMapByType and then again against m_newListByType, through registerRelationship. Now only m_dirtyMapByType is checked before m_relationships.get(...). The maps are protected, so a subclass that edits them (e.g. in onRegisterType) so their keys differ now gets a NullPointerException, or a silent add, instead of UnitOfWorkException 'not supported'. With the stock handleRegisterType, the two maps always have the same keys.",
          "evidence": "fflib_SObjectUnitOfWork.cls:63-79, 289-294, 534-544",
          "iterations": [
            8
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "In a derived unit of work, remove a type from m_relationships in onRegisterType. Assert that registerDirty(existing, field, parent) throws UnitOfWorkException rather than NullPointerException, or document that it doesn't."
        },
        {
          "code": "B4",
          "title": "assertForNonEventSObjectType edge semantics",
          "detail": "endsWithIgnoreCase('__e') equals the baseline check (Apex string == ignores case) except for the literal string '__e', which is not a real type name. assertForEventSObjectType still uses length/right, so the two helpers are now asymmetric.",
          "evidence": "fflib_SObjectUnitOfWork.cls:997, 1010",
          "iterations": [
            8
          ],
          "severity": "low",
          "caughtByTests": true,
          "proposedTest": "Call assertForNonEventSObjectType('My_Event__E') and assert it throws, to pin the case-insensitivity."
        },
        {
          "code": "B5",
          "title": "External-id registerRelationship exception now comes from the shared helper",
          "detail": "The exception type and message are identical; only the stack frame differs.",
          "evidence": "fflib_SObjectUnitOfWork.cls:457-460",
          "iterations": [
            3
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Call registerRelationship(new Account(), Account.ParentId, Account.Id, 'x') on a uow without Account and assert the 'not supported' message."
        },
        {
          "code": "B6",
          "title": "DEFERRED describe in name-only lookups",
          "detail": "getName() is identical under SObjectDescribeOptions.DEFERRED. There is no functional change, and the DEFERRED and eager describe results are not mixed in any one place.",
          "evidence": "fflib_SObjectUnitOfWork.cls:283, 616, 895, 903, 914, 926, 979, 989",
          "iterations": [
            1
          ],
          "severity": "low",
          "caughtByTests": true,
          "proposedTest": ""
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Cache invalidation by list size",
          "detail": "The skip relies on m_relationships being append-only and on resolved lookups never being changed later. Both are unstated invariants, and the cache is never reset between commits.",
          "evidence": "fflib_SObjectUnitOfWork.cls:1037-1051",
          "verdict": "questionable"
        },
        {
          "code": "P2",
          "title": "Side-effecting call kept as the left operand of &&",
          "detail": "allResolved = relationship.resolve() && allResolved depends on operand order for correctness. It is correct, but easy to break by 'tidying' it.",
          "evidence": "fflib_SObjectUnitOfWork.cls:1046",
          "verdict": "questionable"
        },
        {
          "code": "P3",
          "title": "Adding to Relationships directly after the caller has validated the type",
          "detail": "This removes a duplicate describe and asserts per call without changing order or messages, as long as the protected maps keep the same keys.",
          "evidence": "fflib_SObjectUnitOfWork.cls:391-394, 541-543",
          "verdict": "good"
        },
        {
          "code": "P4",
          "title": "Reusing assertForSupportedSObjectType instead of a copied throw",
          "detail": "Removes duplicated code with an identical message.",
          "evidence": "fflib_SObjectUnitOfWork.cls:458",
          "verdict": "good"
        },
        {
          "code": "P5",
          "title": "Partial DEFERRED adoption",
          "detail": "Commit loops and handleRegisterType use DEFERRED, but the register methods (385, 411, 457, 501, 542) and the delete and recycle-bin loops (945, 957) still use the eager getDescribe(), presumably because PMD's rule misses the chained form. This is inconsistent style.",
          "evidence": "fflib_SObjectUnitOfWork.cls:385, 945, 957",
          "verdict": "questionable"
        },
        {
          "code": "P6",
          "title": "Asymmetric event-type helpers",
          "detail": "One helper uses endsWithIgnoreCase and the other uses length/right.",
          "evidence": "fflib_SObjectUnitOfWork.cls:997, 1010",
          "verdict": "questionable"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "Reusing a unit of work across commits",
          "detail": "No test calls commitWork twice on one instance, so the persistent m_resolvedCount is untested.",
          "proposedTest": "Commit twice with MockDML, changing the child lookup in between. Assert that the parent Id is re-applied."
        },
        {
          "code": "T2",
          "title": "Lookup changed between the insert and update phases",
          "detail": "No test changes a resolved field during commit, e.g. a custom IDML whose dmlInsert or dmlUpsert alters child lookups. The baseline re-resolved such fields in the update phase.",
          "proposedTest": "Use a custom IDML that nulls Opportunity.AccountId in dmlInsert for a dirty Opportunity registered with registerDirty(opp, AccountId, acc) when Opportunity is ordered after Account. Assert the updated record's AccountId."
        },
        {
          "code": "T3",
          "title": "Parent supplied by the upsert phase",
          "detail": "The cache is reached from the upsert phase, but no test has a dirty child whose parent only gets its Id from upsert.",
          "proposedTest": "registerUpsert a new Account, registerDirty(existingOpp, Opportunity.AccountId, account) and commit. Assert the updated opp's AccountId equals account.Id."
        },
        {
          "code": "T4",
          "title": "External-id relationship path",
          "detail": "No test calls registerRelationship(record, field, externalIdField, value) or RelationshipByExternalId.resolve/isResolved.",
          "proposedTest": "Use a custom object with an external-id field, or a test-only stub, and assert putSObject is populated and an unsupported type throws."
        },
        {
          "code": "T5",
          "title": "headroomBulkCommitWork correctness",
          "detail": "The bulk test measures limits but its correctness assertions weren't checked here. Ensure it asserts that resolved lookups appear on inserted and updated records at volume.",
          "proposedTest": "After the bulk commit, assert every Task.WhoId equals its Contact Id and every dirty Opportunity.AccountId equals its Account Id."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Rejected ideas worth not retrying",
          "detail": "Iteration 5 showed that the isResolved() guard is behaviour-bearing: tests failed when it was removed. Iteration 12 showed that dereferencing a map result guarded only by a throw-only helper triggers an SFGE ApexNullPointerException. Iteration 10 failed to compile because a new private field was placed directly under @NamespaceAccessible."
        },
        {
          "code": "X2",
          "title": "Headroom gains are near the noise floor",
          "detail": "Iterations 7 and 8 were kept on the overall margin while their focus gain (5.0 and 4.4) was below the 5-point margin, after re-measuring. Their headroom benefit is real but modest and may not reproduce."
        }
      ]
    }
  },
  {
    "name": "security-utils-style-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls"
    ],
    "branch": "ascent/security-utils-style-1",
    "report": "ascents/security-utils-style-1/report.html?refresh=off",
    "retro": {
      "ascent": "security-utils-style-1",
      "at": "2026-11-14T08:09:06.965Z",
      "base": "47bc2e57b0c1ea1ef83ac6d80bf2ab2c29ca8724",
      "head": "09db986516bfe2a30138085d654f269ce476aee8",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 76093,
        "costUsd": 0.5527422
      },
      "summary": "Only fflib_SecurityUtils changed, so it drove every score change. Graph Engine went from 67.6 to 100 in iteration 2, which swapped fflib_SObjectDescribe.getField for the native Schema field map. Limit headroom went from 52.3 to 100 in iteration 4, which added a per-user cache of field names that already passed. Resource efficiency and Test run time barely moved, and fflib_QueryFactoryTest fell slightly (80.9 to 80.3). The main risk: iteration 2 dropped getField's handling of relationship names and namespace prefixes, so names like 'Account' or 'Foo__r' now cause a NullPointerException, and the iteration 4 cache can keep a pass after a permission is revoked in the same transaction for the same user.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "Relationship-style field names are no longer resolved",
          "detail": "The baseline fflib_SObjectDescribe.getField mapped 'X__r' to 'X__c', 'X__pr' to 'X__pc' and a standard lookup name such as 'Account' to 'AccountId'. The native fields.getMap().get() does none of this, so it returns null and the SObjectField overload throws System.NullPointerException instead of running the FLS check. This affects checkInsert, checkRead and checkUpdate with List<String>, and the three single-field String overloads. All are public @NamespaceAccessible API.",
          "evidence": "fflib_SecurityUtils.cls:170-172, 207-209, 244-246, 284, 330, 376; fflib_SObjectDescribe.cls:110-121",
          "iterations": [
            2
          ],
          "severity": "high",
          "caughtByTests": false,
          "proposedTest": "As an admin, call checkRead(Contact.SObjectType, new List<String>{'Account'}) and checkFieldIsReadable(Contact.SObjectType, 'Account'). Assert that no exception is thrown, which matches the baseline."
        },
        {
          "code": "B2",
          "title": "Namespace prefix is no longer added to field names",
          "detail": "The baseline called getField(name, true), which tried the package namespace prefix. The native describe map is used as it is, and whether it finds unprefixed custom field names inside a managed package is not verified. If it does not, those lookups return null and throw a NullPointerException.",
          "evidence": "fflib_SObjectDescribe.cls:101-103,119-120; fflib_SecurityUtils.cls:284,330,376",
          "iterations": [
            2
          ],
          "severity": "medium",
          "caughtByTests": false,
          "proposedTest": "In a namespaced packaging org, call checkRead(SomeObj__c.SObjectType, new List<String>{'Field__c'}) without the prefix and assert it gives the same result as the prefixed name."
        },
        {
          "code": "B3",
          "title": "Cached passes can outlive a permission revocation in the same transaction",
          "detail": "verifiedFieldNames remembers names that passed, keyed by operation and SObjectType, and clears only when UserInfo.getUserId() changes. If a permission set assignment is removed later in the transaction, or a test runs two System.runAs blocks for the same user with permissions changed between them, a later List<String> check for cached names skips the per-field FLS check and passes without checking. The object CRUD check still runs on every call.",
          "evidence": "fflib_SecurityUtils.cls:133-152, 166-169, 203-206, 240-243",
          "iterations": [
            4
          ],
          "severity": "medium",
          "caughtByTests": false,
          "proposedTest": "As user U with a permission set granting read on a custom field, call checkRead and see it pass. Delete the PermissionSetAssignment, run as U again and call checkRead with the same list. Assert it throws FlsException."
        },
        {
          "code": "B4",
          "title": "Fields that fflib_SObjectDescribe resolved to null are now checked",
          "detail": "Some fields, such as Opportunity.LastSyncTime, resolve to null through fflib_SObjectDescribe.getField, so the baseline threw a NullPointerException on them. The native map finds them and runs a real FLS check. This changes behaviour in a good direction.",
          "evidence": "fflib_SecurityUtilsTest.cls:356-358",
          "iterations": [
            2
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Call checkRead(Opportunity.SObjectType, new List<String>{'LastSyncTime'}) as an admin and assert that it does not throw.",
          "correction": "Checked on 2026-11-17 in the fflib-apex-common scratch org, this claim is wrong. fflib_SObjectDescribe.getField resolved every native field on Account, Contact, Lead, Opportunity and Case, and Opportunity has no LastSyncTime field in that org. The real behaviour is in fflib_SecurityUtils: checkFieldIsReadable, checkFieldIsInsertable and checkFieldIsUpdateable call getDescribe() on the result of getField without a null check, so an unknown field name such as LastSyncTime or NoSuchField__c throws a NullPointerException that does not name the field."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Replacing a library wrapper with the native API to clear an analyzer warning",
          "detail": "This removed the call that could return null, but it also dropped real behaviour: relationship-name and namespace handling. The analyzer score went up while the API contract got narrower.",
          "evidence": "iteration 2; fflib_SecurityUtils.cls:284,330,376",
          "verdict": "bad"
        },
        {
          "code": "P2",
          "title": "Fetching the field map once per call",
          "detail": "Fetching the map once before the loop instead of once per field is a sound saving.",
          "evidence": "fflib_SecurityUtils.cls:170,207,244",
          "verdict": "good"
        },
        {
          "code": "P3",
          "title": "Static cache of security results that passed",
          "detail": "It stores only after success with bypass off and resets when the user changes, which is careful. Its weak points are permission changes within a transaction, a String key rather than typed maps, and case-sensitive names (a cache miss only, not a correctness issue). It covers only the List<String> overloads, so behaviour differs from the List<SObjectField> and single-field overloads.",
          "evidence": "fflib_SecurityUtils.cls:133-152",
          "verdict": "questionable"
        },
        {
          "code": "P4",
          "title": "No caching on the single-token path",
          "detail": "Iteration 7 was rejected after it gained nothing and cost coverage, so the paths QueryFactory uses stay without a cache.",
          "evidence": "iteration 7; fflib_QueryFactory.cls:111,127,334",
          "verdict": "good"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "Relationship and __r/__pr field names",
          "detail": "No test passes a relationship-style name to the String overloads.",
          "proposedTest": "Assert that checkRead, checkInsert and checkUpdate, plus checkFieldIs* with String, accept 'Account' on Contact and 'Parent' on Account without throwing for an admin."
        },
        {
          "code": "T2",
          "title": "Cache staleness for the same user",
          "detail": "The tests check a cache reset only through a change of user ID.",
          "proposedTest": "Check, revoke a permission set for the same user, check again, and expect FlsException."
        },
        {
          "code": "T3",
          "title": "Cache does not hide a field that failed",
          "detail": "No test covers a list that partly overlaps a cached set and contains a field that is not allowed.",
          "proposedTest": "As a read-only user, call checkRead with readable fields, then call it with those fields plus one unreadable field. Expect FlsException on the second call."
        },
        {
          "code": "T4",
          "title": "Bypass does not fill the cache",
          "detail": "Nothing asserts that a pass under BYPASS leaves no cache entry behind.",
          "proposedTest": "As a read-only user, set BYPASS=true and call checkUpdate. Then set BYPASS=false, call checkUpdate with the same list and expect CrudException or FlsException."
        },
        {
          "code": "T5",
          "title": "Unknown or null field names",
          "detail": "The exception type for a field name that cannot be resolved is not pinned down.",
          "proposedTest": "Assert that checkRead(Account.SObjectType, new List<String>{'NoSuchField'}) throws System.NullPointerException, or decide that it should throw SecurityException and change the code."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Small runtime gains for the default callers",
          "detail": "QueryFactory and SObjectSelector call the SObjectField and single-String overloads, and in legacy FLS mode only. They gain nothing from the cache, which explains why Resource efficiency barely moved. The single-String overloads now call getDescribe().fields.getMap() on every call, which may cost more than the fflib_SObjectDescribe instance cache they replaced, for example at fflib_QueryFactory.cls:777."
        },
        {
          "code": "X2",
          "title": "The headroom test hides the relationship-name loss",
          "detail": "The headroom test builds its lists from canonical describe names and skips fields that getField cannot resolve, so the test data never contains the name forms the baseline was there to handle."
        }
      ]
    }
  },
  {
    "name": "sobjects-style-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_SObjects.cls",
      "sfdx-source/apex-common/main/classes/fflib_ISObjects.cls"
    ],
    "branch": "ascent/sobjects-style-1",
    "report": "ascents/sobjects-style-1/report.html?refresh=off",
    "retro": {
      "ascent": "sobjects-style-1",
      "at": "2026-11-14T08:22:32.568Z",
      "base": "565e18ee28b5a93aa8deb4037e2eb6a9d2792176",
      "head": "04e420b28542d951ff3881d31a07f1e0ee6655a0",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 52485,
        "costUsd": 0.4457932
      },
      "summary": "Only iteration 1 was kept. It turned 15 indexed loops in fflib_SObjects.cls into for-each loops and made the constructor's describe DEFERRED, which took PMD from 42.4 to 100 with no suppressions. Limit headroom (-1.0) and Resource efficiency (-1.0) fell slightly, within noise, so the expected CPU gain did not happen. Iterations 2-4 targeted CPU, none beat its noise margin, and all were discarded. Behaviour is unchanged on every tested path; the remaining differences are edge cases no test runs: a list modified during a loop, and the deferred describe exposed through a public property.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "For-each loops throw if the record list is modified during iteration",
          "detail": "The old loops cached the size in j and read records[i], so if a callee added to or removed from the list behind getRecords() mid-loop, the loop still finished (it skipped appended items or failed with an out-of-bounds error on removal). Apex for-each throws System.FinalException 'Cannot modify a collection while it is being iterated' instead. Library code never mutates the list inside these loops. A subclass could, though: it can override getRecords() to return a shared list, or override the virtual hooks such as error() or the addError overloads to touch domain records. Element order and null elements behave the same as before.",
          "evidence": "fflib_SObjects.cls:97,111,132,199,223,261,280,313,346,369,408,430,456,473,498",
          "iterations": [
            1
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "In fflib_SObjectsTest, write a subclass whose getRecords() returns a shared list and whose error() override appends a record to that list. Call addError('x') and assert the outcome you want (either an explicit FinalException or a successful finish), so this behaviour is pinned down."
        },
        {
          "code": "B2",
          "title": "Public sObjectDescribe now holds a deferred DescribeSObjectResult",
          "detail": "sObjectDescribe is a public @NamespaceAccessible property, and it now holds a result created with SObjectDescribeOptions.DEFERRED. Child relationships load on first access instead of up front. Subscribers and subclasses that call getChildRelationships() still get the same data, but the describe cost moves to that first call. Identity or equality comparisons against a default getDescribe() result are not guaranteed to hold. Inside the repo, only fflib_SObjectDomain reads it (isCreateable/isUpdateable/isDeletable/isUndeletable/getName at fflib_SObjectDomain.cls:252-299) plus getSObjectType(), and none of these depend on the option.",
          "evidence": "fflib_SObjects.cls:32,55-57,86; fflib_SObjectDomain.cls:252-299",
          "iterations": [
            1
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Construct fflib_SObjects(new List<Account>(), Account.SObjectType) and assert that sObjectDescribe.getChildRelationships() is non-empty and matches Account.SObjectType.getDescribe().getChildRelationships().size(). Also assert that getSObjectType() == Account.SObjectType."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Indexed loops with comma declarations replaced by for-each",
          "detail": "Cleaner and idiomatic. It clears OneDeclarationPerLine without suppressions. The loop variable names (record/current) match the old locals, which keeps the diff minimal.",
          "evidence": "fflib_SObjects.cls:97-500, iteration 1",
          "verdict": "good"
        },
        {
          "code": "P2",
          "title": "DEFERRED describe in the domain constructor",
          "detail": "It clears EagerlyLoadedDescribeSObjectResult and costs nothing on the paths the library uses. It did not lower CPU, and iteration 4 found the describe call is already cheap.",
          "evidence": "fflib_SObjects.cls:55-57, iterations 1 and 4",
          "verdict": "good"
        },
        {
          "code": "P3",
          "title": "Discarding the micro-optimisations",
          "detail": "Iterations 2 and 3 would have added null short-circuits, Set-to-List copies, and a get-then-containsKey rewrite of setFieldValueByMap. Iteration 4 would have added a lazy describe property and a duplicate state field. Each added complexity or a subtle change to null handling for no measured gain, and discarding them kept the class simpler.",
          "evidence": "iterations 2, 3, 4",
          "verdict": "good"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "CRUD-denied paths of fflib_SObjectDomain on the deferred describe",
          "detail": "The trigger CRUD checks read SObjectDescribe.isCreateable()/getName() and so on. It is not clear the tests cover the denied branch as a user without object permission.",
          "proposedTest": "Use System.runAs with a Minimum Access user and EnforcingTriggerCRUDSecurity enabled. Call handleBeforeInsert/Update/Delete/Undelete and assert a DomainException whose message contains the object name."
        },
        {
          "code": "T2",
          "title": "Mutating the list during iteration",
          "detail": "Nothing tests a callee that modifies the record list during addError, clearFields or setFieldValue.",
          "proposedTest": "See the first behaviour change: a subclass whose override appends to the shared list during addError, with the expected outcome asserted."
        },
        {
          "code": "T3",
          "title": "Null element in the records list",
          "detail": "The old and new loops both throw NullPointerException on a null element, but no test pins this down.",
          "proposedTest": "new fflib_SObjects(new List<Account>{ null }, Account.SObjectType).getIdFieldValues(Account.Id) should throw NullPointerException."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Baseline aggregate scores don't match the per-test values",
          "detail": "Each dimension has only one contributor, so the score should equal its per-test value. The baseline reports Limit headroom 57.3 against a per-test 59.8, and Resource efficiency 82.3 against a per-test 82.8. The evolved scores match their per-test values. This suggests the baseline aggregates come from a different run, which makes the reported deltas less reliable."
        },
        {
          "code": "X2",
          "title": "CPU in the headroom test is dominated by platform calls",
          "detail": "Iterations 2-4 found that the cost is in record.get/put/contains and in dispatch work, not in loop form or describe calls. Further headroom gains would mean making fewer calls or visiting fewer records, which the current API contract may not allow."
        }
      ]
    }
  },
  {
    "name": "query-factory-style-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls"
    ],
    "branch": "ascent/query-factory-style-1",
    "report": "ascents/query-factory-style-1/report.html?refresh=off",
    "retro": {
      "ascent": "query-factory-style-1",
      "at": "2026-11-14T09:07:42.453Z",
      "base": "a8a954cf5d6e1a941c5b8740526e353e45c30152",
      "head": "e6e07dc1a50696d25696c85460302232e1e5d9ac",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 117869,
        "costUsd": 0.7392764000000001
      },
      "summary": "Only fflib_QueryFactory.cls changed, so it caused every score change: Graph Engine (iteration 3), PMD (iterations 10 and 12) and Limit headroom (iterations 5, 7 and 12, by memoizing field paths, tokens, names, child relationships and table names in NONE mode). Resource efficiency barely moved (+4.9, inside its 6.8 noise margin) because the selector path (fflib_SObjectSelectorTest) was never meaningfully improved. Iteration 12 was kept on overall score even though its focus, Limit headroom, rose only 5.1, under the 5.3 margin. For valid input, results match the baseline; the differences are in error types, locale edge cases, heap that lasts the whole transaction, and an equals/hashCode contract mismatch that is now explicit, and no test pins any of them down.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "Ordering(String sobjType, ...) with an unknown or blank object name now throws InvalidFieldException instead of NullPointerException",
          "detail": "Baseline dereferenced fflib_SObjectDescribe.getDescribe(sobjType).getField(...) directly, so an unknown or blank object name raised System.NullPointerException. Now getSObjectField returns null, and Ordering(SObjectField, SortOrder) passes it to getFieldTokenPath(null), which throws InvalidFieldException('Invalid field: null'). The message names neither the object nor the field. Callers that catch NullPointerException will behave differently. This is arguably an improvement, but it is a contract change.",
          "evidence": "fflib_QueryFactory.cls:209-217, 1088-1090, 202-205",
          "iterations": [
            3
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Construct new fflib_QueryFactory.Ordering('NotAnObject__x', 'Name', SortOrder.ASCENDING) and assert that InvalidFieldException (and not NullPointerException) is thrown."
        },
        {
          "code": "B2",
          "title": "Explicit hashCode is identity-based while equals is based on SOQL",
          "detail": "hashCode returns a per-instance counter, but equals compares table, field count and toSOQL(). Two factories that are equal under equals() have different hashes, so Set.contains or Map.get with an equal but different instance misses. That breaks the Apex equals/hashCode contract. It matches the baseline's observed runtime behaviour (the deterministic_toSOQL Set kept two entries), but it now formally declares that equal objects hash differently, and the comment documents it as intended. Each instance also carries a new instanceId field, which appears in JSON.serialize and debug output and changes the class's serialized shape. The counter is a static, non-final Integer that grows across the transaction.",
          "evidence": "fflib_QueryFactory.cls:224-225, 288-303; fflib_QueryFactoryTest.cls:520",
          "iterations": [
            10
          ],
          "severity": "medium",
          "caughtByTests": false,
          "proposedTest": "Build two factories with identical selects and assert qf1.equals(qf2). Then assert the intended Set/Map behaviour explicitly (for example new Set<fflib_QueryFactory>{qf1}.contains(qf2)), so the contract is pinned down in one direction or the other."
        },
        {
          "code": "B3",
          "title": "Static caches last the whole transaction and grow without bound",
          "detail": "Five static final maps (field tokens, field names, field paths keyed by the exact case-sensitive input string, child relationships per SObjectType, table names) are never cleared within a transaction. In a long transaction such as a batch execute, Queueable or big trigger that builds queries for many objects or with varied field-name casing, heap grows. For example, the full Account child-relationship map is held for the whole transaction. fflib_SObjectDescribe already caches describes, so this is a second layer of caching on top of it. Heap is not measured by any headroom test.",
          "evidence": "fflib_QueryFactory.cls:219-225, 227-280, 777-800",
          "iterations": [
            5,
            7,
            12
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Headroom test that selects 200 fields in mixed case across 20 SObjectTypes and asserts that Limits.getHeapSize() growth stays below a budget."
        },
        {
          "code": "B4",
          "title": "Child-relationship lookup now uses the running user's locale through toLowerCase in a transaction-wide cache",
          "detail": "Baseline compared names with Apex == (case-insensitive) on every call. Evolved lowercases both the key and the lookup with String.toLowerCase(), which follows the context user's locale. The map is built once per transaction. If the map is built under one locale (for example tr_TR, where 'I' lowercases to 'ı') and looked up after System.runAs switches to a user with another locale, a name containing 'I' (such as a custom 'Invoices__r') misses and throws InvalidSubqueryRelationshipException. Field tokens (getCachedField) have the same cross-runAs exposure, although baseline already lowercased field names on each call.",
          "evidence": "fflib_QueryFactory.cls:777-800, 227-244",
          "iterations": [
            12,
            5
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Inside System.runAs of a user whose LocaleSidKey is 'tr' (Turkish), call subselectQuery for a relationship whose name contains 'I', after the cache has been warmed by a call outside runAs, and assert the relationship resolves."
        },
        {
          "code": "B5",
          "title": "NONE-mode string selects bypass addField",
          "detail": "selectStringField in NONE mode calls fields.add directly instead of addField. That is equivalent today because addField only lowercases in USER_MODE and SYSTEM_MODE. Any future logic added to addField (validation, normalisation, sorting hooks) will silently skip NONE-mode string selects, while selectField(String, SObjectType), selectFieldSet and SObjectField selects still go through it.",
          "evidence": "fflib_QueryFactory.cls:421-433, 508-524",
          "iterations": [
            12
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Regression test that selects the same field through selectField('name'), selectFields(List) and selectFieldSet in NONE mode and asserts a single entry in getSelectedFields()."
        },
        {
          "code": "B6",
          "title": "Invalid-field lookups now cache a null token",
          "detail": "getCachedField stores null for an unknown name (it checks containsKey), so later calls skip fflib_SObjectDescribe entirely. Exceptions are the same because the null token still reaches InvalidFieldException. This relies on describe results being fixed for the whole transaction, which holds in Apex.",
          "evidence": "fflib_QueryFactory.cls:227-244",
          "iterations": [
            5
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Call selectField('NotAField__c') twice on Contact and assert that InvalidFieldException is thrown both times."
        },
        {
          "code": "B7",
          "title": "First call per object to subselectQuery(String) now scans and lowercases every child relationship",
          "detail": "Baseline returned on the first match. Evolved builds the whole map on first use (about 100+ entries for Account) and is faster on repeat calls. A transaction that does a single subselect pays slightly more CPU.",
          "evidence": "fflib_QueryFactory.cls:783-797",
          "iterations": [
            12
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "No functional test needed. Optionally add a single-subselect CPU headroom assertion."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Memoizing the final resolved path behind a thin wrapper, with the original method unchanged",
          "detail": "getFieldPath caches only when the result is user-independent (NONE mode, no related type) and otherwise delegates to the original resolveFieldPath. FLS checks (LEGACY) and the polymorphic branch are never cached. The design is correct and easy to reason about.",
          "evidence": "fflib_QueryFactory.cls:103-111, 271-280",
          "verdict": "good"
        },
        {
          "code": "P2",
          "title": "Several stacked cache layers that duplicate fflib_SObjectDescribe",
          "detail": "Field tokens, field names and field paths are cached at three levels, and fflib_SObjectDescribe has its own describe cache underneath. Iterations 6 and 8 showed that the extra layers bring almost no gain, yet the token and name layers from iteration 5 remain, and are now largely made redundant by the path memo for NONE mode.",
          "evidence": "fflib_QueryFactory.cls:219-262; iterations 5, 6, 8",
          "verdict": "questionable"
        },
        {
          "code": "P3",
          "title": "Declaring caches static final to stay under PMD TooManyFields",
          "detail": "The caches are never reassigned, so final is semantically correct. However, the change was made to exploit a gap in the rule, not to fix the design. The class still holds many fields, and the caches would be better grouped in a small holder class.",
          "evidence": "fflib_QueryFactory.cls:219-223; iterations 11, 12",
          "verdict": "questionable"
        },
        {
          "code": "P4",
          "title": "Identity hashCode added to silence OverrideBothEqualsAndHashcode",
          "detail": "This clears the PMD finding by writing in a hashCode that is inconsistent with equals. The cleaner fix would be a documented suppression or removing equals. As written it misleads readers into thinking the pair is consistent.",
          "evidence": "fflib_QueryFactory.cls:299-303",
          "verdict": "bad"
        },
        {
          "code": "P5",
          "title": "Null-safe outer static helper for the inner-class constructor",
          "detail": "getSObjectField replaces a raw dereference with a clear failure path and satisfies Graph Engine. It is small and correct.",
          "evidence": "fflib_QueryFactory.cls:209-217, 1088-1090",
          "verdict": "good"
        },
        {
          "code": "P6",
          "title": "Splitting selectStringField by mode",
          "detail": "The duplicated loops and direct fields.add couple NONE mode to how addField behaves today.",
          "evidence": "fflib_QueryFactory.cls:421-433",
          "verdict": "questionable"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "Ordering with an unknown SObject name",
          "detail": "No test covers the null-describe path that iteration 3 changed.",
          "proposedTest": "Assert that InvalidFieldException is thrown by new Ordering('Bogus__x', 'Name', SortOrder.ASCENDING)."
        },
        {
          "code": "T2",
          "title": "Case-insensitive subselect names and the null-name entry",
          "detail": "The case-folding equivalence between the lowercased-key map and Apex == is not pinned down.",
          "proposedTest": "On an Account factory, call subselectQuery('contacts') and subselectQuery('CONTACTS'), assert both resolve to the same relationship, and assert the generated SOQL uses the canonical 'Contacts'."
        },
        {
          "code": "T3",
          "title": "Mixed FLS modes on the same table in one transaction",
          "detail": "The cache is shared across factories. No test checks that a NONE factory warming the cache does not affect a later LEGACY factory's FLS check or a USER_MODE factory's lowercasing.",
          "proposedTest": "Select 'Name' in NONE mode, then under System.runAs a user without FLS on a custom field, build a LEGACY factory selecting that field and assert that FLS exception is thrown. Also assert that USER_MODE selects are lowercase."
        },
        {
          "code": "T4",
          "title": "Repeated invalid field",
          "detail": "Null tokens are cached. No test checks that the second call still throws.",
          "proposedTest": "Call selectField('Nope__c') twice in NONE mode and twice in LEGACY mode, and expect InvalidFieldException each time."
        },
        {
          "code": "T5",
          "title": "Polymorphic path with and without a related type in the same transaction",
          "detail": "The cache is bypassed when relatedSObjectType is non-null. No test confirms that a cached null-type result doesn't leak into a related-type call or the reverse.",
          "proposedTest": "On Task, selectField('What.Name') first, then selectField('What.Name', Account.SObjectType), and assert both produce the expected path."
        },
        {
          "code": "T6",
          "title": "equals/hashCode contract",
          "detail": "The only coverage is indirect, through the Set in deterministic_toSOQL.",
          "proposedTest": "Explicit assertions on qf1.equals(qf2), qf1.hashCode() != qf2.hashCode(), and Map<fflib_QueryFactory,...> lookup behaviour, so any future change is deliberate."
        },
        {
          "code": "T7",
          "title": "Heap growth of the static caches",
          "detail": "Limit headroom measures CPU only.",
          "proposedTest": "Bulk test asserting a Limits.getHeapSize() delta budget after querying many objects and field casings."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Resource efficiency gain is noise",
          "detail": "+4.9 is within the 6.8 margin. fflib_SObjectSelector paths go through selectField(String, SObjectType) and SObjectField selects, which bypass the main path memo, so selector-heavy callers see little improvement."
        },
        {
          "code": "X2",
          "title": "Measurements were noisy",
          "detail": "Iteration 9's first run also measured Limit headroom at 90 and was discarded after averaging, while iteration 12 was kept on overall score. The final 90 may be partly variance, so re-measure before relying on it."
        },
        {
          "code": "X3",
          "title": "Iteration 10 comment is a borderline justification comment",
          "detail": "The hashCode comment explains intent that the contract violation makes necessary, but it reads more like a rationale belonging in the PR. Consider a PMD suppression with a short reason instead."
        }
      ]
    }
  },
  {
    "name": "sobject-selector-style-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls",
      "sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls"
    ],
    "branch": "ascent/sobject-selector-style-1",
    "report": "ascents/sobject-selector-style-1/report.html?refresh=off",
    "retro": {
      "ascent": "sobject-selector-style-1",
      "at": "2026-11-14T09:31:53.845Z",
      "base": "01f7b998542d739df57e164fa8a97bbc0e39efc8",
      "head": "53ad240c34308d734bf1fa4182c79ddea2caeaf8",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 57664,
        "costUsd": 0.4757658
      },
      "summary": "The only change kept was iteration 3: a static Map<SObjectType,String> cache (fflib_SObjectSelector.cls:117) that remembers the default ORDER BY, read before the original logic and written after it (cls:222-224, cls:239). The original name-field, encryption and CreatedDate/Id logic is unchanged, and Apex statics last only one transaction, so behaviour should be the same. fflib_SObjectSelector.cls is the only class changed and drove every score change. Limit headroom (+4.8) did not beat its 5.7 margin, and the headroom test's own score rose only 51.8 → 52.8, which doesn't match the dimension's 48.2 → 53. The coverage, run-time and resource-efficiency moves (ApplicationTest 80 → 81.9) look like noise.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "Default order-by is now shared by all selector instances of the same SObjectType in a transaction",
          "detail": "Before, each instance worked out its default order-by from describe data. Now the first instance per type computes it and later instances, including other selector subclasses for the same type, reuse that string. This is only safe because the computed value depends only on the type: the name field, isEncrypted() and whether the type has CreatedDate are all org metadata. Statics reset per transaction, so nothing leaks between transactions. Subclasses that override getOrderBy() without calling super never touch the cache.",
          "evidence": "fflib_SObjectSelector.cls:117, :222-224, :239",
          "iterations": [
            3
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "In one test, create two different selector subclasses for the same type, one of which is an Account selector with the default getOrderBy(). Assert that both return the literal 'Name'. Do the same for CaseComment and assert the literal 'CreatedDate'."
        },
        {
          "code": "B2",
          "title": "Cached value carries across System.runAs user switches in the same transaction",
          "detail": "In tests, System.runAs does not reset statics, so a value computed as one user is reused as another. Today none of the inputs vary by user: describe getMap() returns fields regardless of FLS, and name field and encryption are metadata. If the order-by logic ever adds a per-user check such as isAccessible(), the cache would silently serve the first user's result.",
          "evidence": "fflib_SObjectSelector.cls:225-239; FLS tests around fflib_SObjectSelectorTest.cls:398-430 use runAs",
          "iterations": [
            3
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Inside a single test, compute getOrderBy() as an admin and then again inside System.runAs with a minimal-access user. Assert that both match what an uncached computation gives for that user."
        },
        {
          "code": "B3",
          "title": "getSObjectType() is called more often on a cache miss",
          "detail": "On a miss, getSObjectType() now runs 3 times instead of 1. On a hit it runs once and skips getNameField. This only matters if a subclass's getSObjectType() is expensive or has side effects, which would be unusual. A null type would behave as before: Map.get(null) is legal and the original code path then runs.",
          "evidence": "fflib_SObjectSelector.cls:223, :227, :239",
          "iterations": [
            3
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "None needed beyond the shared-instance test above."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Flat static per-type memoisation of a pure derived string",
          "detail": "The cache is cheap to look up, holds very little memory (one string per type), lasts only the transaction, and leaves the original logic untouched. That is why PMD and Graph Engine held at 100 (iterations 1 and 2 lost points by restructuring the code).",
          "evidence": "fflib_SObjectSelector.cls:117, :222-239; iterations 1-3",
          "verdict": "good"
        },
        {
          "code": "P2",
          "title": "The same `if (m_orderBy == null)` check appears twice in a row",
          "detail": "Two adjacent identical checks look accidental and invite a later 'simplification' that merges them and breaks the cache-hit path. The score tools (PMD, Graph Engine) rewarded this shape, but people reading it may not see why. It would read better as a cache read followed by one guarded block, or a short early return.",
          "evidence": "fflib_SObjectSelector.cls:222-225",
          "verdict": "questionable"
        },
        {
          "code": "P3",
          "title": "Mutable static cache that is not final and not documented",
          "detail": "`private static Map<...> defaultOrderByCache` is reassignable and nothing marks it as a cache shared across instances. `static final` would be safer. This file already uses non-final statics for its constants (cls:115-116), so it is consistent with local style.",
          "evidence": "fflib_SObjectSelector.cls:117",
          "verdict": "questionable"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "Most order-by assertions derive the expected value from getOrderBy() itself",
          "detail": "Tests at fflib_SObjectSelectorTest.cls:176, 308, 334, 454, 470, 883 and 925 build the expected SOQL from selector.getOrderBy(). A wrong cached value would match itself and pass. Only cls:208 ('Name' prefix) and cls:841 ('ORDER BY CreatedDate') check literal values, and each test method is a fresh transaction, so they mostly exercise the cache-miss path.",
          "proposedTest": "Assert literal defaults on both the miss and the hit path in one transaction: Account → 'Name', CaseComment → 'CreatedDate', and an object with neither a name field nor CreatedDate → 'Id'. Call each selector twice, plus a second subclass for the same type."
        },
        {
          "code": "T2",
          "title": "Encrypted name field fallback",
          "detail": "The isEncrypted() branch (cls:232) is not pinned by a literal assertion, so caching the wrong branch would go unnoticed.",
          "proposedTest": "If the org has an object with an encrypted name field (or one can be set up), assert that getOrderBy() returns 'CreatedDate' or 'Id' on both calls. Otherwise record this as a known gap."
        },
        {
          "code": "T3",
          "title": "Headroom test does not check results",
          "detail": "headroomBulkSelectorQueries checks only totalLength > 0 and the row count, so the order-by text inside the 600 rounds of generated SOQL is never checked.",
          "proposedTest": "After the loop, assert that new CaseSelector().newQueryFactory().toSOQL() ends with the expected literal 'ORDER BY <field> ASC NULLS FIRST '."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Headroom gain is within noise",
          "detail": "Iteration 3 was kept on overall score (+0.9 against a 0.8 margin) after re-measuring, while its focus dimension stayed below its margin. Iterations 4-6 show the remaining CPU is spread across many query-building paths, so more caching at this level has little left to gain. fflib_SObjectDescribe.getNameField is still uncached and loops over every field. Caching it there, per type, would help every caller, not just selectors."
        },
        {
          "code": "X2",
          "title": "Reported headroom numbers are inconsistent",
          "detail": "The dimension is said to be the mean of its per-test scores, yet it went 48.2 → 53 while its only test went 51.8 → 52.8. Check the scoring pipeline before trusting the size of the gain."
        }
      ]
    }
  },
  {
    "name": "sobject-describe-style-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls"
    ],
    "branch": "ascent/sobject-describe-style-1",
    "report": "ascents/sobject-describe-style-1/report.html?refresh=off",
    "retro": {
      "ascent": "sobject-describe-style-1",
      "at": "2026-11-14T09:52:44.773Z",
      "base": "283c5ecc007144f935a8b6667ea2df4a81908144",
      "head": "bb6f9c750cb3583ef5eeae1755bfc02259ce9b65",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 68582,
        "costUsd": 0.5500852
      },
      "summary": "Only fflib_SObjectDescribe.cls changed, so it drove every score: PMD 71.4→100 (iterations 1, 2, 4) and Limit headroom 64.8→72.7 (iteration 4, by memoizing the name-field scan on the cached instance). Resource efficiency barely moved (QueryFactory 81.3→80.9, SecurityUtils flat at 79), and run time and coverage changes are within noise. Iteration 4 deleted the DEFERRED describe that iterations 1-2 had added, so the PMD EagerlyLoadedDescribeSObjectResult finding cleared because the eager describe moved to line 48, which the rule does not flag, not because eager loading stopped. The static getNameField now also builds and caches a describe instance, which contradicts its own ApexDoc.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "Static getNameField now creates and caches a describe instance with an eager full describe",
          "detail": "Baseline: static getNameField(type) did a one-off native describe and kept no wrapper state. Evolved: it calls getDescribe(objectType), which builds an fflib_SObjectDescribe, stores it in instanceCache, and loads the full eager describe (line 48, no DEFERRED, so child relationships load) plus the field map. These stay in heap until flushCache(). fflib_SObjectSelector.cls:200 calls this, so every selector type now holds a cached wrapper. Net effect: the DEFERRED optimisation from iterations 1-2 is gone, and eager loading persists at line 48.",
          "evidence": "fflib_SObjectDescribe.cls:45-53, 159-166; fflib_SObjectSelector.cls:200",
          "iterations": [
            1,
            2,
            4
          ],
          "severity": "medium",
          "caughtByTests": false,
          "proposedTest": "After flushCache(), call getNameField(Account.SObjectType), then assert that getDescribe(Account.SObjectType) returns an instance and document whether that is intended. Separately, measure Limits.getHeapSize() before and after getNameField over many types."
        },
        {
          "code": "B2",
          "title": "Name field results now survive until flushCache and are tied to an instance",
          "detail": "The instance getNameField() used to recompute from token on every call. Now it is memoized on the instance and the static method reads the cached instance. A caller holding an instance across flushCache() keeps its old nameField. Schema does not change within a transaction, so practical impact is low, but this is a semantic shift from stateless to cached.",
          "evidence": "fflib_SObjectDescribe.cls:81-89, 146-148, 165",
          "iterations": [
            4
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Assert that getNameField(Account.SObjectType) returns the same value as getDescribe(Account.SObjectType).getNameField() both before and after flushCache()."
        },
        {
          "code": "B3",
          "title": "Types with no name field rescan every call",
          "detail": "nameField uses null to mean 'not computed', so a type whose fields all have isNameField()=false repeats the full per-field getDescribe() scan on every call. The cost is about the same as the baseline for those types, but the cache never helps them.",
          "evidence": "fflib_SObjectDescribe.cls:83-85",
          "iterations": [
            4
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Find a standard object with no name field and assert that getNameField returns null on repeated calls, checking Limits.getCpuTime growth if needed."
        },
        {
          "code": "B4",
          "title": "String and DescribeSObjectResult lookups now share the token-keyed cache",
          "detail": "Baseline getDescribe(String): on a cache miss under the given name, it constructed a new instance, even if the token was already cached under its real name. This happens with namespace-implied names such as 'Foo__c' resolving to ns__Foo__c, where the baseline built a new instance and overwrote the cache on every call. Evolved: it delegates to getDescribe(token), which reuses the instance cached under String.valueOf(token). The DescribeSObjectResult overload switched its cache key from getName() to String.valueOf(token), which is the same in practice. This is an improvement, but instance identity changes for namespaced callers. The non-null DescribeSObjectResult and SObject paths are untested; their asserts are commented out at test lines 156-162.",
          "evidence": "fflib_SObjectDescribe.cls:261-286; fflib_SObjectDescribeTest.cls:156-162",
          "iterations": [
            4
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Uncomment the d4 and d5 asserts in getAccountDescribes. Add a test that sets currentNamespace and asserts that getDescribe('Foo__c') === getDescribe('ns__Foo__c')."
        },
        {
          "code": "B5",
          "title": "Index loops rewritten as for-each loops",
          "detail": "getNameField scan, getPicklistLabels and isValidPicklistValue now use for-each loops. Iteration order and the behaviour on null lists (exception in both versions) are the same.",
          "evidence": "fflib_SObjectDescribe.cls:171, getPicklistLabels, isValidPicklistValue",
          "iterations": [
            1
          ],
          "severity": "low",
          "caughtByTests": true,
          "proposedTest": ""
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Fixing PMD by matching the rule's text",
          "detail": "Iteration 2 renamed a parameter and dropped the Schema. prefix to get past the rule's text matching. Iteration 4 then sent the call through the unflagged line 48. The score reached 100 while the eager describe the rule targets is still there.",
          "evidence": "Iterations 2 and 4; fflib_SObjectDescribe.cls:48",
          "verdict": "bad"
        },
        {
          "code": "P2",
          "title": "Memoizing the name field on the cached per-type instance",
          "detail": "Reuses the existing instanceCache and flushCache lifecycle, adds no new static map, and removed the dominant CPU cost. It needs a sentinel for 'no name field', and the docs need updating.",
          "evidence": "fflib_SObjectDescribe.cls:81-89",
          "verdict": "good"
        },
        {
          "code": "P3",
          "title": "Collapsing overloads into delegation to getDescribe(SObjectType)",
          "detail": "One code path, fewer branches, and the cache behaviour is consistent across overloads.",
          "evidence": "fflib_SObjectDescribe.cls:261-286",
          "verdict": "good"
        },
        {
          "code": "P4",
          "title": "Stale documentation left behind",
          "detail": "The @deprecated note on the instance getNameField says the static method works 'without requiring a describe instance', which is now false: the deprecated instance method is the underlying implementation. The test comment at line 210 says the instance method delegates to the static one; the reverse is now true.",
          "evidence": "fflib_SObjectDescribe.cls:142-143; fflib_SObjectDescribeTest.cls:210",
          "verdict": "bad"
        },
        {
          "code": "P5",
          "title": "Trading lint complexity budget for features",
          "detail": "Iteration 4 removed branches elsewhere to stay under PMD's class complexity threshold. The result here was fine, but the climb chose refactors for score budget rather than design.",
          "evidence": "Iterations 3, 4, 6, 7",
          "verdict": "questionable"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "Non-null DescribeSObjectResult and SObject overloads",
          "detail": "The cache-identity asserts are commented out, so the iteration 4 delegation is checked only for nulls.",
          "proposedTest": "Assert that getDescribe(Account.SObjectType.getDescribe()) === getDescribe('Account') and getDescribe(new Account()) === getDescribe('Account')."
        },
        {
          "code": "T2",
          "title": "Static and instance getNameField agree, including after flush",
          "detail": "Nothing checks that the two methods share state or behave the same after flushCache.",
          "proposedTest": "For Account, Contact and Case, assert static == instance getNameField, call flushCache(), then assert again and compare to a direct scan of type.getDescribe().fields.getMap()."
        },
        {
          "code": "T3",
          "title": "Type without a name field",
          "detail": "The null result and its repeated rescans are not exercised.",
          "proposedTest": "Pick a standard object with no isNameField field and assert getNameField returns null on two consecutive calls."
        },
        {
          "code": "T4",
          "title": "Namespace-implied String lookup reuses the cache",
          "detail": "The new cache sharing for implied-namespace names is untested.",
          "proposedTest": "With a fake currentNamespace, as in the existing namespace test, assert that getDescribe by the short name and by the full name return the same instance."
        },
        {
          "code": "T5",
          "title": "Heap and describe cost of selector name-field resolution",
          "detail": "fflib_SObjectSelector now caches a full eager wrapper per type. Nothing measures this.",
          "proposedTest": "A headroom test that builds selectors for about 50 types and asserts that heap and CPU stay within a budget."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Possible follow-up",
          "detail": "Use SObjectDescribeOptions.DEFERRED at line 48 to bring back the intent of iterations 1-2. Iteration 5 found this gave negligible headroom, but it is semantically honest. Also cache 'no name field' with a separate Boolean flag, and fix the ApexDoc at lines 142-143."
        },
        {
          "code": "X2",
          "title": "Headroom ceiling",
          "detail": "Iterations 5-7 show the remaining CPU goes to native describe calls and rebuilds after the test's deliberate flushCache calls. Further work on Apex-level helpers is unlikely to pass the 8.3 margin."
        }
      ]
    }
  },
  {
    "name": "application-style-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_Application.cls",
      "sfdx-source/apex-common/main/classes/fflib_IDomain.cls",
      "sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls",
      "sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls",
      "sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls",
      "sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls",
      "sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls"
    ],
    "branch": "ascent/application-style-1",
    "report": "ascents/application-style-1/report.html?refresh=off",
    "retro": {
      "ascent": "application-style-1",
      "at": "2026-11-14T10:04:41.972Z",
      "base": "ae01c63d2b7915050b14a5eb5fe7f6f378f9210d",
      "head": "d8b7c6da1c245a6ce17ce81781aa73e3a831b65b",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 41202,
        "costUsd": 0.3238126
      },
      "summary": "Only iteration 1 was kept: it deleted two System.debug(INFO) developer hints from SelectorFactory.setMock(fflib_ISObjectSelector) and DomainFactory.setMock(fflib_ISObjectDomain) in fflib_Application.cls, which accounts for the whole PMD rise from 92.6 to 100. The Limit headroom rise (57.4 to 64.9) and Test run time rise (90.1 to 90.8) are measurement noise: headroomBulkFactoryCalls never calls setMock, so the deleted lines do not run there, and iterations 2 to 4 show headroom swinging by 2.5 to 6.5 points. Coverage stayed at 90.1 only because the scorer counts each multi-line statement as one line; at 107/119 it would be about 89.9. Functional behaviour is unchanged. The only loss is a diagnostic hint shown when developers mock by instance.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "Mocking hint no longer written to the debug log",
          "detail": "In the baseline, setMock(fflib_ISObjectSelector) and setMock(fflib_ISObjectDomain) wrote an INFO-level debug message. It warned that the mock must have sObjectType() stubbed, or that the caller should use setMock(SObjectType, mock). The evolved code drops this message. Developers whose mocks return null from sObjectType() now get the mock registered under a null key with no hint, and later see confusing factory errors or real (unmocked) instances. Return values, exceptions, mock registration, sharing, limits and null handling are unchanged. The debug log is very slightly smaller. These methods are @TestVisible and protected, so in practice this only affects test-time diagnostics.",
          "evidence": "sfdx-source/apex-common/main/classes/fflib_Application.cls:317-319 (SelectorFactory.setMock), ~fflib_Application.cls:480-482 (DomainFactory.setMock); diff hunks @@ -315 and @@ -481",
          "iterations": [
            1
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "No functional assertion can observe debug output. Instead, add a test that calls Selector.setMock and Domain.setMock with a mock whose sObjectType() returns null, and pin the resulting behaviour: either a DeveloperException, or that newInstance(Account.SObjectType) does not return the mock. That way the case the hint warned about is defined by a test."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Clearing PMD findings by deleting side-effect-only debug statements",
          "detail": "Deleting debug statements that only print hints is a reasonable way to satisfy AvoidDebugStatements without suppressions, and it cannot change control flow. The trade-off is lost developer guidance. Moving the hint into the ApexDoc on both overloads, or validating that sObjectType() is not null and throwing a DeveloperException, would keep it in a PMD-clean way.",
          "evidence": "Iteration 1; fflib_Application.cls:317-319",
          "verdict": "good"
        },
        {
          "code": "P2",
          "title": "Treating headroom and run-time deltas as caused by the change",
          "detail": "Iteration 1's learning credits the deletion with 'slightly raised the speed and headroom scores'. The headroom test never reaches setMock, and later iterations show headroom moving by up to 6.5 points with no relevant change. So the scores are noisy within about the 5-point margin, and the learning recorded for future climbs is misleading.",
          "evidence": "fflib_ApplicationTest.cls:581-614 (no setMock calls); iterations 2-4 deltas of -4.1, -2.5, -6.5",
          "verdict": "questionable"
        },
        {
          "code": "P3",
          "title": "Discarding micro-optimisations in the selectById and ServiceFactory hot paths",
          "detail": "Iterations 2 to 4 would have changed selectById, selectByRelationship and ServiceFactory.newInstance. All were discarded, so the null filtering, the mixed-SObjectType validation and the containsKey-based mock lookup in the baseline are kept. That is the safe outcome: iteration 2's get() != null lookup, for example, would have treated a service mock registered as null differently.",
          "evidence": "Iterations 2, 3 and 4 (all discarded); fflib_Application.cls:277-312",
          "verdict": "good"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "Mock registered by instance with unstubbed sObjectType()",
          "detail": "No test covers setMock(instance) where sObjectType() returns null. This was the scenario the deleted hint warned about, and its behaviour is currently undefined by tests.",
          "proposedTest": "Register a selector mock and a domain mock whose sObjectType() returns null via Selector.setMock and Domain.setMock. Assert what newInstance(Account.SObjectType) returns (the real implementation, not the mock), or assert a DeveloperException if validation is added."
        },
        {
          "code": "T2",
          "title": "Headroom test does not exercise mock paths",
          "detail": "headroomBulkFactoryCalls only uses real factories. Mock registration and lookup (m_sObjectByMock..., m_serviceInterfaceTypeByMockService) are not measured, so headroom cannot detect regressions or gains in setMock and its lookups.",
          "proposedTest": "Add a headroom variant that registers selector, domain and service mocks once. Then call newInstance and selectById in the same bulk loop, and assert that the mocks are returned on every call."
        },
        {
          "code": "T3",
          "title": "Service mock registered as null",
          "detail": "ServiceFactory.newInstance uses containsKey, so a mock explicitly registered as null returns null. Nothing pins this, and the discarded iteration 2 would have silently changed it to return the real implementation.",
          "proposedTest": "Call Service.setMock(IAccountService.class, null) and assert that Service.newInstance(IAccountService.class) returns null. Or decide it should throw, and assert that instead."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Coverage being flat depends on how the scorer counts lines",
          "detail": "The plan predicted 109/121 going to 107/119 (about 89.9%). The score stayed at 90.1, which implies each multi-line System.debug statement counts as one line, or the rounding absorbed it. This was a zero-margin dimension, so the keep came close to failing."
        },
        {
          "code": "X2",
          "title": "Scores are too noisy for CPU micro-optimisations",
          "detail": "Headroom varies by about ±6 points between runs, which is comparable to the 5-point margin. Future ascents on this class should repeat headroom measurements or raise rounds before judging CPU edits. The 'learnings' from iterations 2 to 4 (native copy is cheaper than a loop, string ops cost more than describe calls) may also reflect noise rather than real cost differences."
        }
      ]
    }
  },
  {
    "name": "sobject-domain-style-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls",
      "sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls"
    ],
    "branch": "ascent/sobject-domain-style-1",
    "report": "ascents/sobject-domain-style-1/report.html?refresh=off",
    "retro": {
      "ascent": "sobject-domain-style-1",
      "at": "2026-11-14T10:28:58.525Z",
      "base": "5e16c9d7244958f552ae3b398c12b33b550119ab",
      "head": "1a2d88673662c2b6455c59efdbafc6fef4338192",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 63028,
        "costUsd": 0.5018894
      },
      "summary": "The ascent changed only fflib_SObjectDomain, and iteration 3, the only kept iteration, drove every score change: Limit headroom rose from 55.2 to 72.4 because the per-record work in getChangedRecords was cut and the constructor Type lookup is now cached. Resource efficiency rose slightly in fflib_SObjectSelectorTest (+3.0) and fflib_ApplicationTest (+1.0), but neither test class runs the changed code paths, so this is probably noise. Coverage was flat (+0.2) and Test run time rose only 1.5. For realistic trigger input the behaviour is the same as the baseline. The only differences are in degenerate cases: a null field set, and a call where all four event flags are false.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "Null field set now throws even when nothing would be compared",
          "detail": "Both getChangedRecords overloads now copy the set up front with new List<String>(fieldNames) or new List<Schema.SObjectField>(fieldTokens). A null set now throws a NullPointerException on every call. The baseline only touched the set inside the loop, after a matching old record was found. It therefore returned an empty list when ExistingRecords was null, when Records was empty, or when no record had an old version.",
          "evidence": "sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls:338, :367-369",
          "iterations": [
            3
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Build a domain with no ExistingRecords, call getChangedRecords((Set<String>) null) and assert that the result is an empty list, or assert the exception if the new behaviour is accepted."
        },
        {
          "code": "B2",
          "title": "Construct chain collapsed: an all-false event state now builds a domain",
          "detail": "The baseline built the domain only when isInsert, isUpdate, isDelete or isUndelete was true. Otherwise domainObject stayed null and the next line, domainObject.Configuration, threw a NullPointerException. The evolved code always calls construct(domainRecords), using newRecords when isDelete is false. Real Trigger contexts and the MockDatabase always set one of the four flags, so this is only reachable through the private overload.",
          "evidence": "fflib_SObjectDomain.cls:463-483",
          "iterations": [
            3
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Not reachable through the public API. Document it as accepted rather than testing it."
        },
        {
          "code": "B3",
          "title": "Constructor Type cached for the whole transaction",
          "detail": "The Type found with Type.forName is stored in a static Map<Type, Type> keyed by domain class. Resolution still runs in the same class context, so the result is the same. A null result (no Constructor inner class) is stored as null, so the cache check misses and resolution runs again, and newInstance still fails as in the baseline. The map lives for the transaction, and its memory cost is negligible.",
          "evidence": "fflib_SObjectDomain.cls:104, :115, :472-479",
          "iterations": [
            3
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Dispatch through a domain class that has no Constructor inner class twice, and assert that both calls throw the same exception."
        },
        {
          "code": "B4",
          "title": "Id read and single map lookup replace get('Id') plus containsKey/get",
          "detail": "newRecord.Id is equivalent to (Id) newRecord.get('Id') for any SObject. One existingById?.get(...) with a null check is equivalent to the baseline's null/containsKey/get sequence, because ExistingRecords maps Ids to non-null records. A null entry in Records still throws a NullPointerException. Taking a snapshot of the field set as a List does not change the result. With 200-record trigger batches, CPU now drops roughly in proportion to records × fields.",
          "evidence": "fflib_SObjectDomain.cls:336-354, :365-385",
          "iterations": [
            3
          ],
          "severity": "low",
          "caughtByTests": true,
          "proposedTest": "Already covered for the case where every record has an old version, by itShouldReturnTheChangedRecordsBy* (fflib_SObjectDomainTest.cls:235, :273). See testGaps for the missing cases."
        },
        {
          "code": "B5",
          "title": "oldRecordsMap.values() now evaluated once per delete dispatch",
          "detail": "domainRecords is computed at the top of the private triggerHandler, so values() runs once per delete dispatch instead of up to twice. The before phase was previously evaluated lazily in the construct chain. Both versions fail the same way when isDelete is true and oldRecordsMap is null.",
          "evidence": "fflib_SObjectDomain.cls:463-469",
          "iterations": [
            3
          ],
          "severity": "low",
          "caughtByTests": true,
          "proposedTest": "Covered by the existing delete-dispatch tests."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Hoisting property getters and lookups out of hot loops",
          "detail": "ExistingRecords and Records are read into locals once, and one map get is checked for null instead of containsKey followed by get. This is the right kind of change for CPU-bound bulk trigger code, and it keeps the code readable.",
          "evidence": "fflib_SObjectDomain.cls:336-344",
          "verdict": "good"
        },
        {
          "code": "P2",
          "title": "Indexed loops over a List copy of a Set",
          "detail": "Copying the Set to a List and using index-based loops with cached sizes adds 4-5 lines per method, and the two overloads are almost identical. The cost is readability and duplication for a small per-call gain.",
          "evidence": "fflib_SObjectDomain.cls:338-353, :367-384",
          "verdict": "questionable"
        },
        {
          "code": "P3",
          "title": "Static Type-resolution cache",
          "detail": "A lazily filled Map<Type, Type> is a common and safe pattern. The new field has no doc comment, unlike the neighbouring TriggerStateByClass and TriggerEventByClass, which both have one.",
          "evidence": "fflib_SObjectDomain.cls:97-104",
          "verdict": "good"
        },
        {
          "code": "P4",
          "title": "Collapsing redundant if/else-if construct chain",
          "detail": "Three of the four branches were identical, so computing domainRecords once is a real simplification. As a side effect, the code no longer fails fast when no event flag is set.",
          "evidence": "fflib_SObjectDomain.cls:483",
          "verdict": "good"
        },
        {
          "code": "P5",
          "title": "Removal of explanatory comment on break",
          "detail": "The comment `// prevents the records from being added multiple times` was dropped with no behaviour reason. This is a small loss of intent for the next reader.",
          "evidence": "fflib_SObjectDomain.cls:351, :382",
          "verdict": "questionable"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "Records with no old version",
          "detail": "In both unit tests every new record has an entry in ExistingRecords, so the continue path is only covered by luck through other tests.",
          "proposedTest": "Add a new record whose Id is missing from ExistingRecords, change one of its fields, and assert it is not returned by either overload."
        },
        {
          "code": "T2",
          "title": "Missing ExistingRecords",
          "detail": "When ExistingRecords resolves to null (outside a trigger, with no mock data), the code must return an empty list. Nothing tests this.",
          "proposedTest": "Build a domain outside a trigger with no mock database records, call both overloads with a valid field set, and assert the result is empty."
        },
        {
          "code": "T3",
          "title": "Empty or null field set",
          "detail": "No test covers an empty field set (which should return empty) or a null field set (where the behaviour changed).",
          "proposedTest": "Assert that an empty Set returns an empty list. Then call with null and assert the exception that is now expected."
        },
        {
          "code": "T4",
          "title": "Headroom test barely checks correctness",
          "detail": "headroomBulkTriggerDispatch only asserts HEADROOM_CHANGED > 0, so a wrong change-detection count would still pass.",
          "proposedTest": "Compute the expected changed count from the generated data (records with i%5==0, i%3==0, or a different rating index) and assert HEADROOM_CHANGED equals expected * rounds for each overload."
        },
        {
          "code": "T5",
          "title": "Repeated dispatch through the constructor cache",
          "detail": "No test checks that a second dispatch of the same class, or dispatches of two different classes, each get the correct constructor type from the cache.",
          "proposedTest": "Dispatch class A, then class B, then class A, and assert that each dispatch built an instance of the correct domain type."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Resource efficiency changes are probably noise",
          "detail": "fflib_ApplicationTest and fflib_SObjectSelectorTest do not exercise getChangedRecords or the triggerHandler dispatch in bulk. Their +1.0 and +3.0 are best treated as measurement noise, not a gain from this change."
        },
        {
          "code": "X2",
          "title": "Discarded iterations confirm where the cost lies",
          "detail": "Iterations 4-6 (final static fields, a single get in getTriggerEvent, hoisting values() into the mock path, reading by token instead of by name) did not move headroom at all. This confirms that the cost is the per-record loop work in getChangedRecords, not the per-dispatch overhead."
        }
      ]
    }
  },
  {
    "name": "string-builder-style-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls"
    ],
    "branch": "ascent/string-builder-style-1",
    "report": "ascents/string-builder-style-1/report.html?refresh=off",
    "retro": {
      "ascent": "string-builder-style-1",
      "at": "2026-11-14T10:46:11.485Z",
      "base": "95888682df213ff9d28982efb0d8f617d477dacb",
      "head": "7c82edaea008734f01b2cf9d969769cbdd6e9026",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 79986,
        "costUsd": 0.5490276
      },
      "summary": "The ascent changed only fflib_StringBuilder. Iteration 1 (bypassing virtual add, caching the multi-currency flag in a static) and iteration 3 (a static per-transaction field-name cache) together lifted Limit headroom in fflib_StringBuilderTest.headroomBulkBuilders from 59.8 to 83.1. Code coverage's 1.1 rise comes only from the covered new cache lines. fflib_SObjectSelectorTest Resource efficiency barely moved (+2.3) and is probably noise, because the selector's getFieldListBuilder uses CommaDelimitedListBuilder, which did not change. The main risk is that the FieldListBuilder constructor no longer calls the virtual add(String), so subclasses that override it are silently skipped, and no test covers that.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "FieldListBuilder constructor bypasses the virtual add(String)",
          "detail": "The baseline called add(String.valueOf(value)) and add(fieldSetMember.getFieldPath()), so an add(String) override in a subclass of the public virtual, @NamespaceAccessible FieldListBuilder (or of MultiCurrencyFieldListBuilder's parent chain) saw every field name and field-set path. The evolved code writes field names in bulk with buffer.addAll(fieldNames) and field-set paths with buffer.add(...). Overrides that filter, dedupe, change case or add a namespace prefix are now silently ignored for the initial field list, but still apply to later add() calls and to CurrencyIsoCode (line 175 still calls add). This is a contract change for subscriber code.",
          "evidence": "sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls:129, :147, :152, :175",
          "iterations": [
            1,
            3
          ],
          "severity": "medium",
          "caughtByTests": false,
          "proposedTest": "In fflib_StringBuilderTest, add a private inner class extending fflib_StringBuilder.FieldListBuilder that overrides add(String value) to call super.add(value.toUpperCase()). Construct it with {Account.Name, Account.Id} and assert getStringValue() == 'NAME,ID'."
        },
        {
          "code": "B2",
          "title": "Unbounded per-transaction static cache of field-name lists",
          "detail": "FIELD_NAMES_CACHE keeps a cloned key list and a name list for every distinct List<SObjectField> passed in during the transaction, and never evicts. In transactions that build many distinct dynamic field lists (dynamic selectors, many SObject types, wide objects), heap grows in proportion. Each lookup also hashes and compares the whole key list, so the cost per build still scales with field count, though in native code. The heap cost is small in normal use but is new behaviour.",
          "evidence": "sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls:40, :140-146",
          "iterations": [
            3
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Headroom test: build FieldListBuilders for 500 distinct field-list permutations of all Account fields. Assert Limits.getHeapSize() stays under a chosen budget (e.g. 50% of the limit)."
        },
        {
          "code": "B3",
          "title": "Multi-currency flag read once when the class loads",
          "detail": "UserInfo.isMultiCurrencyOrganization() now runs in a static initializer the first time any fflib_StringBuilder class is touched in a transaction, even a plain StringBuilder that never builds a field list. The value is org-level and fixed within a transaction (System.runAs does not change it), so output is unchanged. The only differences are when the call happens and that it now runs even if unused.",
          "evidence": "sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls:39, :174",
          "iterations": [
            1
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Build MultiCurrencyFieldListBuilder and assert it contains CurrencyIsoCode exactly when UserInfo.isMultiCurrencyOrganization(). Also assert it appears exactly once (the existing test only checks contains)."
        },
        {
          "code": "B4",
          "title": "Cache key and value sharing on repeated builds",
          "detail": "The cache key is values.clone(), and each builder gets its own copy of the cached names through buffer.addAll, so changing the caller's list or a builder's buffer cannot corrupt the cache. Behaviour is the same as the baseline, but this safety now depends on those two copies. A future edit such as iteration 6's buffer = fieldNames is fine only if it stays a clone, and assigning the cached list directly would leak state between builders. Tests never build from the same list after changing it.",
          "evidence": "sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls:145, :147; iteration 6 plan",
          "iterations": [
            3
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Build A from list L, call A.add('X'), then add Account.Phone to L and build B from L. Build C from the original two-field list. Assert B ends with 'Phone' and has no 'X', and assert C equals the original output."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Static per-transaction memoization of String.valueOf(SObjectField)",
          "detail": "Results come out the same, and the copies in and out are done correctly. It gave the largest headroom gain, but mainly because the benchmark rebuilds four identical lists 1,300 times. In real selectors that build each list once per transaction it adds a map hash plus a clone and saves little.",
          "evidence": "fflib_StringBuilder.cls:40, :140-147; iteration 3",
          "verdict": "questionable"
        },
        {
          "code": "P2",
          "title": "Writing to protected buffer instead of the virtual add()",
          "detail": "A micro-optimisation that silently changes the extension contract of a public virtual class. It is also inconsistent, since line 175 still uses add().",
          "evidence": "fflib_StringBuilder.cls:147, :152, :175; iteration 1",
          "verdict": "bad"
        },
        {
          "code": "P3",
          "title": "Static final cache of the org multi-currency flag",
          "detail": "The value is fixed per transaction, so caching it is safe, cheap and easy to read.",
          "evidence": "fflib_StringBuilder.cls:39; iteration 1",
          "verdict": "good"
        },
        {
          "code": "P4",
          "title": "Removed the explanatory comments",
          "detail": "The baseline comments 'Create a distinct set of fields' (inaccurate, since nothing dedupes) and 'Alternative to value.getDescribe().getName()' were dropped. The second one recorded why valueOf is used, which is a non-obvious fact.",
          "evidence": "baseline diff around fflib_StringBuilder.cls:138-140",
          "verdict": "questionable"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "Exact output order is not asserted",
          "detail": "testFieldListBuilder and testMultiCurrencyFieldListBuilder put the output into a Set, so a reorder or dedupe would pass. That matters because a cache could easily change order.",
          "proposedTest": "Assert new FieldListBuilder({Account.Name, Account.Id, Account.AccountNumber, Account.AccountNumber}).getStringValue() == 'Name,Id,AccountNumber,AccountNumber'."
        },
        {
          "code": "T2",
          "title": "Subclass add(String) override not exercised",
          "detail": "Nothing pins down that the constructor goes through the virtual add, so iteration 1's contract change was invisible to the tests.",
          "proposedTest": "Use an inner subclass that overrides add(String) to change case or filter, and assert the override applied to constructor-supplied fields."
        },
        {
          "code": "T3",
          "title": "Cache behaviour across caller mutation and buffer mutation",
          "detail": "No test reuses a list after changing it, or checks that one builder's later add() calls don't leak into the next build.",
          "proposedTest": "Build, mutate the source list, build again, and assert the new field is present. Then call add('X') on the first builder, build a third from the original fields, and assert 'X' is absent."
        },
        {
          "code": "T4",
          "title": "Field-set path untested",
          "detail": "No test passes fieldSets, so the field-set branch (now buffer.add) has no coverage and the order of field-set members after the cached names is unchecked.",
          "proposedTest": "If the test org has an Account field set, build FieldListBuilder(fields, new List<Schema.FieldSet>{fs}) and assert its member paths follow the field names in order. Otherwise skip with a guard on Schema.SObjectType.Account.fieldSets.getMap().isEmpty()."
        },
        {
          "code": "T5",
          "title": "Empty and null inputs",
          "detail": "The empty list should give '' and a null list should throw NullPointerException, as in the baseline. Neither is asserted.",
          "proposedTest": "Assert new FieldListBuilder(new List<Schema.SObjectField>()).getStringValue() == ''. Assert new FieldListBuilder((List<Schema.SObjectField>) null) throws NullPointerException."
        },
        {
          "code": "T6",
          "title": "CurrencyIsoCode count",
          "detail": "The multi-currency test checks only that CurrencyIsoCode is present, not that it appears once or comes last.",
          "proposedTest": "In a multi-currency org, assert the last element of the split output is 'CurrencyIsoCode' and that it appears once."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Benchmark shape drove the design",
          "detail": "headroomBulkBuilders rebuilds the same four field lists 2,600 times per list, which strongly favours memoization. Production selectors use fflib_QueryFactory rather than FieldListBuilder (fflib_SObjectSelector.cls:308-313), so the real-world CPU benefit of iteration 3 is probably small."
        },
        {
          "code": "X2",
          "title": "Iteration 2's learning is speculative",
          "detail": "It blamed the broken tests on String.join not stringifying SObjectField like valueOf. That was never checked, and later iterations relied on it to justify keeping a loop."
        },
        {
          "code": "X3",
          "title": "Selector Resource efficiency change is not attributable",
          "detail": "fflib_SObjectSelectorTest does not reach FieldListBuilder or MultiCurrencyFieldListBuilder, so treat its +2.3 as run-to-run noise rather than an effect of the ascent."
        }
      ]
    }
  },
  {
    "name": "objects-style-1",
    "app": [
      "sfdx-source/apex-common/main/classes/fflib_Objects.cls",
      "sfdx-source/apex-common/main/classes/fflib_IObjects.cls"
    ],
    "branch": "ascent/objects-style-1",
    "report": "ascents/objects-style-1/report.html?refresh=off",
    "retro": {
      "ascent": "objects-style-1",
      "at": "2026-11-14T11:07:34.025Z",
      "base": "3e4350a9cd26298db767f2fa39bc12af86ff28cc",
      "head": "4d64d2364961ad14abb24d8144d7a41750d36307",
      "changedTests": [],
      "step": {
        "model": "claude-opus-5-5",
        "durationMs": 58409,
        "costUsd": 0.4282754
      },
      "summary": "Only fflib_Objects.cls changed. Iteration 2 drove nearly all the real gain: Limit headroom went from 58.3 to 97.5 because each call now builds one lookup set instead of scanning the list for every value. Iterations 4-5 raised Code coverage (90.5 to 97.3) only by merging untested null checks into one helper, not by adding tests. Resource efficiency barely moved (80.5 to 81.1, fflib_SObjectDomainTest fell 81.4 to 80.2). Two behaviours changed with no test to catch them: matching now depends on hashCode() as well as equals(), and an empty input against a null objects list now throws instead of returning true.",
      "behaviourChanges": [
        {
          "code": "B1",
          "title": "Membership now uses Set hashing (hashCode+equals) instead of List.contains (equals only)",
          "detail": "Baseline checked membership with getObjects()?.contains(value), which uses equals(). Evolved builds Set<Object> members from getObjects() and calls members.contains(), which uses hashCode() first. Any user class whose equals() is overridden without a matching hashCode() can now return false for a value that is present, which flips containsAll to false and containsNot to true. In this repo fflib_QueryFactory overrides equals with no hashCode. SObjects, primitives and classes using identity equality are unaffected.",
          "evidence": "fflib_Objects.cls:88, fflib_Objects.cls:91; fflib_QueryFactory.cls:179; baseline containsAll(Set)/containsNot(Set) loops",
          "iterations": [
            2,
            3,
            5
          ],
          "severity": "medium",
          "caughtByTests": false,
          "proposedTest": "Define a test inner class with equals() comparing a field but no hashCode override. Build a Domain with instance a1, then call containsAll(new List<Object>{a2}) and containsNot(new List<Object>{a2}), where a2.equals(a1). Assert that the result matches contains(a2)."
        },
        {
          "code": "B2",
          "title": "Null objects list with an empty values collection now throws",
          "detail": "If a subclass calls setObjects(null), the baseline returned true for containsAll(empty) and containsNot(empty) because the loop never ran. Evolved runs new Set<Object>(getObjects()) before the loop and throws NullPointerException. Non-empty values already threw in the baseline (! on null Boolean), so only the empty-input case changed. isEmpty() checking for null shows a null list is expected.",
          "evidence": "fflib_Objects.cls:88, fflib_Objects.cls:99, fflib_Objects.cls:113, fflib_SObjectDomain.cls:501",
          "iterations": [
            2,
            3,
            4,
            5
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Test subclass that calls setObjects(null). Assert containsAll(new Set<Object>()) and containsNot(new List<Object>()) return true (baseline behaviour), or decide to make throwing the specified behaviour."
        },
        {
          "code": "B3",
          "title": "Every call now builds a set the size of the collection and no longer stops early",
          "detail": "Each containsAll/containsNot call builds a set of every domain member, even when values is empty or has one item. The baseline could return after one partial scan when the first value missed. This is a large win for bulk inputs but slightly slower for tiny inputs on large domains. It also adds heap per call, and hashing SObjects costs CPU proportional to their populated fields. Heap use could matter with collections of tens of thousands of records called repeatedly in one transaction.",
          "evidence": "fflib_Objects.cls:88; headroomBulkContainment fflib_ObjectsTest.cls:163-212",
          "iterations": [
            2
          ],
          "severity": "low",
          "caughtByTests": false,
          "proposedTest": "Headroom test: a domain of about 10k SObjects with fields populated, calling containsAll on a single-element list in a loop. Assert that Limits.getHeapSize() and Limits.getCpuTime() stay within a budget."
        }
      ],
      "patterns": [
        {
          "code": "P1",
          "title": "Build the lookup set once per call instead of scanning the list per value",
          "detail": "This is the correct fix for the O(n*m) cost and gave the only large score gain. It quietly changes equality to depend on hashCode, so the contract should be documented or tested.",
          "evidence": "fflib_Objects.cls:88-93, iteration 2",
          "verdict": "good"
        },
        {
          "code": "P2",
          "title": "Boolean flag parameter merging containsAll and containsNot logic",
          "detail": "allMatch(values, expectMember) with null returning !expectMember is compact but obscure. Readers must work out that containsNot means 'all values absent' and that null maps to the opposite of the flag. It was done mainly to remove one uncovered line (coverage-driven dedup).",
          "evidence": "fflib_Objects.cls:84-95, iteration 5",
          "verdict": "questionable"
        },
        {
          "code": "P3",
          "title": "Removing null checks to raise coverage instead of testing them",
          "detail": "Iterations 4-5 raised coverage by deleting duplicated untested null-check lines, not by adding tests. Behaviour was kept, but the null contract is still unverified (line 86 is uncovered).",
          "evidence": "iterations 4, 5; fflib_Objects.cls:85-86",
          "verdict": "questionable"
        },
        {
          "code": "P4",
          "title": "Manual Iterator loop over Iterable<Object>",
          "detail": "This lets List and Set overloads share a single helper without copying. Iteration 3 found no CPU gain over the copy, and the result is more verbose than a for-each loop.",
          "evidence": "fflib_Objects.cls:89-93, iterations 3-4",
          "verdict": "good"
        }
      ],
      "testGaps": [
        {
          "code": "T1",
          "title": "Null values argument",
          "detail": "No test passes null to containsAll or containsNot. The false/true null results are unverified, and line 86 is the only uncovered line.",
          "proposedTest": "Assert containsAll((List<Object>) null) == false, containsAll((Set<Object>) null) == false, containsNot((List<Object>) null) == true, containsNot((Set<Object>) null) == true."
        },
        {
          "code": "T2",
          "title": "Empty values collection",
          "detail": "The fact that an empty input always gives true for both containsAll and containsNot is not tested.",
          "proposedTest": "Assert containsAll(new List<Object>()) and containsNot(new Set<Object>()) are both true on a non-empty domain and on an empty domain."
        },
        {
          "code": "T3",
          "title": "Classes with equals() but no hashCode()",
          "detail": "The change from List.contains to Set.contains is not covered.",
          "proposedTest": "See the first behaviour change: an inner class with equals() only, asserting containsAll agrees with contains()."
        },
        {
          "code": "T4",
          "title": "Null objects list via setObjects(null)",
          "detail": "Nothing tests what happens when the collection itself is null.",
          "proposedTest": "Subclass calling setObjects(null). Pin the expected result (true or a specific exception) for empty and non-empty inputs to containsAll and containsNot."
        },
        {
          "code": "T5",
          "title": "Null elements and duplicates inside values",
          "detail": "Null elements inside the values collection, and duplicate values in a List, are not tested.",
          "proposedTest": "Domain containing null: containsAll(new List<Object>{null}) == true. Domain without null: containsNot(new List<Object>{null, null}) == true."
        }
      ],
      "other": [
        {
          "code": "X1",
          "title": "Limit headroom rests on one synthetic test",
          "detail": "The headroom score comes from one test, headroomBulkContainment. The jump to 97.5 is real for that workload, but it does not test heap use at volume or single-value calls on large domains."
        },
        {
          "code": "X2",
          "title": "Resource efficiency barely changed",
          "detail": "fflib_SObjectsTest rose 79.6 to 82 and fflib_SObjectDomainTest fell 81.4 to 80.2. These classes do little containment work, so the changes are noise. Iteration 8 confirmed that removing the dead initializer at fflib_Objects.cls:32-34 is also below noise."
        },
        {
          "code": "X3",
          "title": "Unrelated small cleanups left out",
          "detail": "isEmpty() calls getObjects() twice and size() is not null-safe while isEmpty() is (fflib_Objects.cls:99, 109). These are untouched and harmless, but inconsistent."
        }
      ]
    }
  }
]
