ReviewZome Workflow
Review existing zome code against Holochain best practices, HDK 0.6 patterns, and the project’s established conventions. Run proactively before implementing any zome changes, or explicitly when asked to audit code.
Step 1 — Load context files
Always load both:
Architecture.md— coordinator/integrity split, DNA roles, cross-DNA patternsPatterns.md— HDK 0.6 API, entry types, link types, CRUD, validation rules
Step 2 — Identify files in scope
If invoked proactively (PLAN phase), scope = files identified in the task plan. If invoked explicitly, scope = files provided or the current PR diff.
For each file determine: integrity zome, coordinator zome, shared types, tests.
Step 3 — Run the checklist
Work through each category. Flag every issue with severity: BLOCK (must fix before merge), WARN (should fix), NOTE (informational).
Entry Schema
- New fields on existing entry structs have
#[serde(default)]— required for schema evolution, prevents deserialization failures on existing entries - No
agent_pub_key,created_at, orupdated_atfields on entry structs (those are in the action header — access viarecord.action().author()/.timestamp()) - Status enums use a dedicated enum type, not a raw
String
Integrity / Validation
-
validate()usesop.flattened::<EntryTypes, LinkTypes>()?not deprecatedop.to_type() - No DHT reads inside
validate()— noget(),get_links(),agent_info(),sys_time() - New entry types are registered in the
#[hdk_entry_types]enum - New link types are registered in the
#[hdk_link_types]enum
Coordinator — HDK 0.6 API
-
delete_link(hash, GetOptions::default())— not the pre-0.6 single-arg form -
LinkQuery::try_new()used for link queries (not oldGetLinksInputBuilderunless specifically needed) -
GetStrategy::Localfor own-data queries;GetStrategy::Networkfor DHT queries -
must_get_valid_record()used for fail-fast gets in update/delete authorship checks
Cross-Zome / Cross-DNA Calls
-
CallTargetCell::OtherRole("hrea")role name matchesworkdir/happ.yamlexactly -
ZomeName(...)matches the coordinator cratenamein itsCargo.toml -
ZomeCallResponsematch is exhaustive (5 variants in HDK 0.6: Ok, Unauthorized, AuthenticationFailed, NetworkError, CountersigningSession) - No direct Cargo dependency on the remote DNA’s crate — use local mirror structs for serialization
- If using shared utility crates: verify intra-DNA and cross-DNA call helpers match the project’s established patterns (e.g., wrapper functions in a
utilscrate rather than rawcall()everywhere)
Error Handling
- All fallible operations use
ExternResult<T>; no.unwrap()or.expect()in zome functions -
wasm_error!(WasmErrorInner::Guest(...))used for domain errors (notWasmErrorInner::Host) - Custom error types implement
From<MyError> for WasmError
Tests (Sweettest)
-
await_consistency(&[&cell_a, &cell_b]).awaitcalled before any cross-agent read - Tests use
#[tokio::test(flavor = "multi_thread")]andholochaindev-dependency withtest_utilsfeature - New
#[hdk_extern]functions have at least one Sweettest test
Step 4 — Output findings
Group by severity:
## ReviewZome: {scope}
### BLOCK (must fix before merge)
- [ ] {file}:{issue} — {explanation}
### WARN (should fix)
- [ ] {file}:{issue} — {explanation}
### NOTE (informational)
- {file}:{observation}
### PASS
- {category}: no issues found
If no issues: “All checks pass. Ready to implement / merge.”
Step 5 — Offer to fix
If BLOCK items were found: “I can fix these now. Say ‘fix’ to proceed.” If only WARN/NOTE: “No blockers found. Suggestions above are optional improvements.”