The independent daily for Salesforce admins, developers and architects

Curated by Abhinav (opens in a new tab)

Must-read

Seven bugs that passed a 113-test Salesforce suite and the fix for each (opens in a new tab)

You will learn seven ways Apex and LWC code can pass its tests yet fail in a real org, including keyset paging, retried saves, restricted picklists and cacheable methods.

Why read this

Each comes with a concrete fix and a check you can run on your own code.

Recursion guard (bug 2)

  • Static Id set skips retried records
  • Silent skip with all-or-none off
  • Compare old and new values instead

Cacheable refresh (bug 5)

  • cacheable=true returns stale rows
  • Mocked Jest tests cannot catch it
  • Drop cacheable or use refreshApex()
The author's fixes for two of the seven bugs, set side by side

The author’s starter kit had 113 passing tests, 68 Apex and 45 Jest, and deployed cleanly to a real org. A tester clicking through the data table and a reviewer reading the code together found seven bugs that no test had caught. The gaps lay between what the tests checked and what a live org did.

The first bug was a paged table that kept showing page one. The server used a keyset cursor, and a cached browser component sent only a page number, so the server treated every request as page one. The tests called each version with the arguments it expected, so an old client against a new server was never tested. The fix is to fall back to offset paging when a later page arrives without a cursor, and to check what an old client would receive after changing an @AuraEnabled contract. The second bug was a static Id-based recursion guard that silently skipped retried records when a save ran with all-or-none off. The fix is to compare old and new values and recalculate for work that is safe to repeat, keeping an Id guard only for work that must happen exactly once.

The third bug was a logger whose Platform Event carried any LoggingLevel name, while the Log__c picklist allowed only ERROR, WARN, INFO and DEBUG. Logs finer than DEBUG failed silently in the subscriber trigger. The fix is to store anything finer as DEBUG, and to test every restricted picklist with a value outside its list. The fourth was an example Account trigger shipped switched on, which changed the data of anyone who deployed the kit. Example code should ship disabled, and the tests should enable handlers only while they run.

The fifth bug was a refresh() method that could show stale rows, because the backing Apex method was cacheable. Jest mocks cannot catch this, so it appears only in a real browser. The fix is to drop cacheable=true where current data matters, or to use @wire with refreshApex(). The sixth was a no-CLI zip, built by hand, that still held six older files. The fix is to build the zip from the source folder in one script, compare every file, and deploy the zip as the final test. The seventh was an offset calculation that overflowed for very large page numbers before the row-limit check ran. The fix is to compare before multiplying.

The author groups the bugs into gaps between versions, between code and platform, between the developer’s org and the buyer’s, and at input edges nobody types on purpose. The closing advice is that passing tests cover only what the developer thought of, so manual testing and fresh review are needed before calling code production-ready.

Read the original at dev.to (opens in a new tab)

Worth reading?

Must-read

Running Apex tests in CI without a Scratch Org, with gated deploys (opens in a new tab)

You will see how Apex tests can run on a CI runner against a local runtime, what a gated deploy with a check-only validation looks like, and the trade-offs of keeping the org only for the final deploy.

Why read this

The piece is also a product pitch for renmy, so weigh its benchmark claims accordingly.

  1. Run local runtime gates on the bundle
  2. Check-only validation of the same bytes
  3. Deploy to the target org
The gated deploy sequence renmy deploy follows before any metadata reaches the org

The piece argues that most Salesforce CI pipelines waste time and reliability on provisioning a Scratch Org or shared sandbox just so Apex tests have somewhere to run. Its proposed alternative is renmy runtime, a local Apex runtime that executes Apex, SOQL, DML and Salesforce Flows on the CI runner itself, backed by an embedded PostgreSQL database. The author says this removes the need for a JWT certificate, a Dev Hub allocation or a Scratch Org for the unit-test job, and that tests finish in seconds with JUnit XML and Cobertura coverage output. The runtime is presented as an interpreter that enforces governor limits and platform rules, not a mock framework or a transpiler. The piece includes a GitHub Actions example in which the only secret needed is a license key, and it notes that tests can keep running during a Salesforce incident even though deploys cannot.

The piece also describes a gated deploy command, renmy deploy. It snapshots the source into a content-addressed bundle, runs the local test and coverage gates against those exact bytes, then runs a real check-only validation of the same bytes in the target org, and deploys only after that succeeds. A coverage floor can be set with a minimum-coverage flag. For teams that need an approval step, a release command validates and writes a receipt containing the bundle digest, git revision, org fingerprint, gate results and validation job id. After approval, a deploy step quick-deploys the validated job within Salesforce’s 10-day window, or resends the stored bundle, and rejects changed, expired or wrong-org receipts. The author also covers pinning the Salesforce CLI version and recovering deploys stuck in the org’s Pending queue.

The author is candid that the org still matters for anything a person inspects, for integration tests against real endpoints, and for the final validation and deployment. The main claim to weigh carefully is the vendor’s own benchmark: about 1 minute 46 seconds to deploy and run 837 tests in an org against 2.4 seconds locally, roughly 45 times faster, with all tests passing in both. The method is published by the vendor and has not been independently verified in the piece. Branch coverage is reported locally but not by the org, so the two coverage figures are not directly comparable. The piece also notes that the Team tier, which covers CI runner use, is free during the public beta, with a listed price of $49 per developer per month, and that an individual Free tier exists.

Read the original at dev.to (opens in a new tab)

Worth reading?

Must-read

Catching AI-Generated Apex that breaks governor Limits with budget tests in CI (opens in a new tab)

You will learn how to measure governor limit consumption in Apex tests, set per-context budgets, and close the loop so AI agents fix limit-heavy code before it merges.

Why read this

The post includes a snapshot class pattern, a limits table and a retry-and-escalation design.

  1. Agent pushes code with bulk tests
  2. CI measures limit consumption
  3. Breach sends feedback to agent
  4. Up to two refactor attempts
  5. Human architect review if still failing
How the CI loop handles a governor limit breach in agent-written code

The article argues that AI-generated Apex can be functionally correct and fully unit-tested yet still exhaust shared transaction budgets, because agents build each feature in isolation and small additions compound until a governor limit is breached. Standard small-data tests rarely expose this, and since governor limits are platform capacity ceilings, the author recommends treating them as architectural contracts and enforcing them automatically before code merges. It illustrates the compounding with a sprint-by-sprint example where SOQL consumption climbs from 15% to 59% through individually harmless changes.

The proposed approach has several parts. Teams should supply a shared, immutable GovernorLimitSnapshot test utility, require agents to write bulk tests of 200 records that capture before and after snapshots, and have CI verify that these test conventions are present. A table compares synchronous and asynchronous limits, and a budget-allocation table recommends consumption thresholds by execution context: roughly 40 to 50% for trigger code, 60 to 70% for service classes, 80 to 85% for isolated asynchronous jobs, and 20 to 30% for Scheduled Apex. Snapshots should be taken just before Test.stopTest() so the synchronous footprint is measured separately from asynchronous work, which is tested in its own method.

The article then describes a closed feedback loop in CI. When a test breaches its budget, a structured prompt containing the metric, consumption, threshold and required optimization steps goes back to the agent, which gets up to three attempts, with the delta between attempts supplied on later tries. If the third attempt fails, the merge is blocked and a human architect is asked to review, possibly moving the logic to Queueable. Agents must not be allowed to weaken tests or thresholds, and the author notes that some limits, such as callouts and Platform Event publishing, need production monitoring as well. Thresholds should start generous, use warning and violation tiers, and be tightened over time, with a closing checklist for rolling the pattern out.

Read the original at Salesforce Architects (opens in a new tab)

Worth reading?

Must-read

Sharding Apex tests across CI jobs with renmy runtime (opens in a new tab)

You will learn how to split one Apex test suite into parallel slices across CI runners, how classes are balanced by recorded duration, and when sharding is not worth the overhead.

Why read this

The article gives a working GitHub Actions matrix and explains how to merge the JUnit results.

  1. Balance classes by recorded duration
  2. Run each slice on its own CI job
  3. Merge the shard JUnit XML results
Sharding assigns each test class to exactly one runner, then the results are merged

The article explains how to split one Apex test suite into parallel slices across CI runners using renmy runtime, a local Salesforce Apex runtime from Renmy UG that runs tests on the CI machine against an embedded PostgreSQL instead of in a Scratch Org or sandbox. The author argues that sharding was impossible in an org-based workflow, because every extra runner would need its own org, deploy and place in the org’s test queue. With a local runtime, the command renmy test –shard N/M runs one slice of the suite, and the wall-clock time falls to roughly the slowest shard plus setup, though total compute rises slightly. The runtime was previously called Nimbus, and the author notes that this is the same tool under a new name.

Sharding works at the level of whole test classes, so each class’s @testSetup runs once and its records remain consistent with an unsharded run. Classes are balanced using durations recorded in .nimbus/test-durations.json, and projects without that history fall back to an even split by class name. Because each shard computes the partition independently, every job must see the same durations file, which the author recommends committing or restoring from a cache. The article supplies a GitHub Actions matrix with fail-fast disabled, a per-shard JUnit file, and an always-run publishing step. It also shows how to merge results either through the shard attribute that the JUnit XML carries or by uploading artifacts and publishing them from a job that runs after the matrix.

The piece also covers coverage and caching. A shard measures coverage only for the tests it runs, so whole-suite coverage needs a single process, and the article points to renmy deploy –min-coverage and renmy coverage diff for gating. Shards can share a cache of parsed ASTs and the binary to reduce cold-start time.

Finally, the author warns that sharding is not worth its overhead for suites that finish within about a minute, since each shard repeats checkout, installation and database startup. Alternatives suggested first are parallel workers within one job, caching, and an external PostgreSQL service container. Sharding is recommended when the test step alone runs for several minutes. A slow class sets a floor on its shard’s time, and order-dependent tests can surface when classes move between shards. Running on a CI runner belongs to the Team tier, which is free during the public beta, and JUnit and Cobertura output are Pro features.

Read the original at dev.to (opens in a new tab)

Worth reading?

Must-read

Running Apex tests locally so AI coding agents can iterate on them (opens in a new tab)

You will learn why coding agents stall on Apex when every test run needs a Salesforce org, and how a local Apex runtime exposed through an MCP server gives an agent a fast write-run-fix loop.

Why read this

You will also see the boundary the article draws around deployment.

Against an org

  • Deploy class to an org
  • Wait, then start test run
  • Poll until finished
  • Minutes per cycle

Against a local runtime

  • Run tests on the machine
  • Read structured results
  • Fix and rerun
  • Seconds per cycle
Agent loop against a Salesforce org versus against a local Apex runtime

The article argues that AI coding agents stall on Salesforce Apex because Apex only runs inside a Salesforce org, so each test cycle means deploying, waiting, polling and parsing logs, which can take minutes and requires org credentials. Agents then either stop iterating and hand back untested code, or keep going at a high cost in time and tokens. The author’s published benchmark puts four open-source Apex suites, 837 tests in total, at about 1 minute 46 seconds to deploy and run in an org, against 2.4 seconds locally. The piece also notes that Nimbus was renamed renmy runtime in October 2026, with the same binary and the MCP server name nimbus kept.

The proposed fix is renmy runtime, a local Apex runtime that executes classes, triggers, SOQL, DML and Salesforce Flows against an embedded PostgreSQL, with no org, sandbox, Docker or JVM. The author says it enforces governor limits and mirrors platform behaviour such as Test.startTest and Test.stopTest, and that it is not a mock or a transpiler, though it does not achieve perfect parity. Its renmy mcp command runs as a stdio child process of the agent, so no port or credential is needed. The exposed tools include run_apex_tests, explain_failure, get_coverage, get_execution_trace, execute_anonymous and list_test_classes, which return structured results rather than logs to parse. Setup is a one-line install, a test run in the project, and registration with Claude Code, Cursor or GitHub Copilot.

A worked example shows an agent adding a discount rule to an invoice service: it lists existing tests, writes a method and test, runs the suite, uses the failure explanation to find a status filter bug, fixes it, and uses coverage to add a boundary test, all within seconds and without touching an org. The author also connects this to Salesforce Headless 360, where Apex hooks such as InvocableMethod and RestResource become tools for Agentforce or external agents, and says the runtime can test that underlying Apex offline.

The article draws a firm boundary around deployment. A green local run is necessary but not sufficient, because the org holds Permission Sets, managed packages, Validation Rules and other teams’ automation that a repository does not contain. The agent should not deploy on its own. renmy deploy runs local gates, then a real check-only validation in the org before deploying, while renmy release validate and renmy release deploy add a human approval step and an immutable receipt between the two. The Free tier covers unlimited local test runs, and the MCP server is a Pro feature that is free during the public beta.

Read the original at dev.to (opens in a new tab)

Worth reading?

Recommended

Running Apex tests on a local runtime, without an Org round trip (opens in a new tab)

You will learn what renmy runtime does, how it runs Apex and Flows locally against an embedded PostgreSQL, and which commands cover testing, debugging, AI agent integration and gated deploys.

Why read this

You will also see what the benchmark claims and what sits behind the Pro tier.

  1. Snapshot selected source into a bundle
  2. Run local validation and test gates
  3. Check-only validation in the target org
  4. Deploy the validated bundle
The gated deploy path from local source to the Salesforce org

Nimbus has been renamed renmy runtime, with the same tool and the same binary. It is a local Salesforce Apex runtime that executes real Apex, SOQL, DML and Salesforce Flows on a developer’s machine against an embedded PostgreSQL database. The runtime enforces platform rules such as governor limits, order of execution across triggers and flows, and per-test transaction isolation. It ships as a single binary for macOS, Linux and Windows and needs no org, Scratch Org, Docker or JVM.

The article’s benchmark compares four open-source Apex suites containing 837 tests. Run in a Salesforce org, they took about 1 minute 46 seconds, and locally they took about 2.4 seconds, roughly 45 times faster, with every test passing in both places. Around the runtime sit a language server that serves editors such as VS Code, Cursor, Neovim, Zed and JetBrains IDEs, a live debugger that supports breakpoints and stepping, and line and branch coverage reporting. Pro adds mutation testing, which the author says is the first of its kind for Apex, and watch mode. The toolkit also includes failure explanation and triage tools, a browser-based Dev UI, and a flaky-test finder.

For AI coding agents, renmy provides an MCP server with tools for running tests, executing anonymous Apex, reading coverage and explaining failures, so agents can verify Apex locally before anything reaches an org. The deployment path is gated: renmy deploy is free and snapshots the source, runs local tests and coverage gates, validates the same bytes in the target org with a check-only validation, and then deploys. The Pro renmy release commands split validation from deployment and produce a receipt that records the bundle digest, Git revision, gate results and the validation job ID, so a team can approve and deploy the validated payload from another machine. The article stresses that Sandboxes remain useful for end-to-end checks and user-facing testing.

The Free tier costs nothing without a card and covers unlimited local test runs, gated deploys, Salesforce CLI pass-through and IDE integrations on one machine. Pro, which adds the daemon, parallel runs, debugger stepping, mutation testing and the MCP server across three machines, and Team are both free during the public beta. Their list prices are $19 per month and $49 per developer per month, and Enterprise starts at $20,000 per year.

Read the original at dev.to (opens in a new tab)

Worth reading?

Must-read

A local Apex runtime and debugger now runs inside IntelliJ IDEA (opens in a new tab)

You will learn how the renmy runtime JetBrains plugin runs Apex tests and debugs Apex locally in IntelliJ IDEA, what it needs, and how it fits alongside an org-based workflow and Illuminated Cloud.

Org-based workflow

  • Save and deploy to an org
  • Wait for the test to run
  • Download and read a debug log
  • No breakpoints to stop on

Local runtime workflow

  • Run icon beside each test
  • Tests run locally in under a second
  • Native debugger with breakpoints
  • Consoles run against local data
Apex work with and without a local runtime in IntelliJ IDEA

The JetBrains plugin formerly listed as “Nimbus - Local Apex Runtime” is now Renmy Runtime - Salesforce IDE, version 1.15.1, following the October 2026 rename of the underlying runtime to renmy runtime. The article presents it as a way to bring a local Apex runtime into IntelliJ IDEA Community or Ultimate. The runtime executes Apex, SOQL, DML and Salesforce Flows on the developer’s machine against an embedded PostgreSQL, without needing a Salesforce org, Scratch Org, Docker or a separate JVM. The author argues that Apex developers have never had the gutter run icons, breakpoints and local consoles that Java developers take for granted.

Setup is short. The plugin installs from the JetBrains Marketplace, and on first open of a project containing sfdx-project.json it installs its runtime into ~/.nimbus/bin. The Free tier needs no account. Each @IsTest class and method gets a run icon and Run, Debug, Coverage and Trace lenses, and results stream into IntelliJ’s test tree with time and SOQL and DML counts per method. The plugin uses the same backends as the CLI, so a test that passes in the IDE should pass under renmy test in a terminal or CI. Debugging uses a native session with breakpoints in .cls and .trigger files, and a replay mode that can step backwards through a recorded run. Recording is free, while stepping is Pro and free during the public beta. The article points to a public parity record and a benchmark, which reports 837 tests running in about 2.4 seconds locally against roughly 1 minute 46 seconds in an org.

The tool window groups features into six workspaces: Home, Develop, Org, Verify, Release and Admin. Develop holds Apex and SOQL consoles that can target the local runtime or any org the CLI is logged into, along with Run and Compare and Find in All Orgs. Org covers browsing, drift detection, debug-log replay and a Data Loader that simulates CSV loads locally and reports rejected rows before any upload. Editing adds sixteen inspections, refactorings, generators, live templates and metadata shown as forms. Previews render React, LWC and Visualforce, though only 25 of 77 Apex: components are drawn fully.

The plugin is described as working alongside Illuminated Cloud. Its shortcuts sit in the Alt+Shift namespace to avoid collisions, and a Tools → Renmy setting decides which Apex file types it keeps when Illuminated Cloud is installed. The article presents the local loop as complementing a sandbox rather than replacing it, with renmy deploy validating the same code in the org before deploying. The Free tier is $0 for one machine, while Pro is free during the beta and listed at $19 a month afterwards.

Read the original at dev.to (opens in a new tab)

Worth reading?

How to write effective Apex tests that pass deployment gates and avoid common pitfalls (opens in a new tab)

You will learn the exact platform requirements for Apex test coverage and how to structure tests that actually validate business logic instead of just inflating percentages.

Why read this

The piece also outlines practical patterns for bulk-safe test data and deployment troubleshooting.

The article explains that Salesforce enforces mandatory Apex test runs to protect multi-tenant reliability and prevent regression. Production deployments require at least seventy-five percent org-wide code coverage, complete trigger coverage, and zero failing methods, though test classes themselves are excluded from the calculation.

It emphasizes that coverage metrics alone do not guarantee quality, urging developers to replace empty test methods with explicit System.assert calls that verify business outcomes rather than implementation details. Writers are advised to cover both happy and unhappy paths, including validation failures and governor limit boundaries.

Practical guidance follows for building robust test suites, recommending the use of @TestSetup for shared fixtures, centralized test data factories, and inserting two hundred records to simulate bulk trigger behavior. The piece also clarifies how Test.startTest and Test.stopTest reset governor limits and synchronize asynchronous executions.

Finally, it lists common deployment hurdles such as coverage resetting after metadata edits, mixed DML errors when creating users alongside other objects, and the recommendation to target ninety percent coverage for safety margins. Individual class debugging is suggested to isolate failures quickly.

Read the original at dev.to (opens in a new tab)

Worth reading?