stemedb/.agentive-remediation/unnecessary-cloning/state.yaml
jordan c59066949a feat: Add quickstart "Beyond Hello World" sections with Skeptic and Layered endpoints
- Add Layered() method to Go SDK for per-source-class consensus queries
- Add LayeredQueryParams, LayeredResult, TierResolution types to Go SDK
- Create conflict example demonstrating Skeptic and Layered endpoints
- Update quickstart.md with sections 6 (conflict detection) and 7 (authority tiers)
- Remove tracked Go binary and add data/ to .gitignore

The new quickstart sections demonstrate Episteme's differentiating features:
- Skeptic endpoint shows "Trust but Verify" conflict analysis
- Layered endpoint shows per-tier resolution (Clinical vs Anecdotal)

Note: Pre-existing large files flagged by pre-commit hook (technical debt from prior sessions)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 21:00:59 -07:00

49 lines
1.8 KiB
YAML

# Remediation: Unnecessary Cloning
task: unnecessary-cloning
created: 2026-02-01
phase: AUDIT
status: NO_ACTION_REQUIRED
# Analysis Summary
total_clones: 237
breakdown:
test_code: 160 # Files in tests/ + test modules in src
arc_store_cloning: 45 # Arc::clone is O(1), correct pattern
path_error_cloning: 7 # Required for error messages
api_dto_cloning: 12 # Required for response construction
lens_resolution: 13 # Required: resolve() returns owned Assertion from borrowed slice
# Conclusion
avoidable_clones: 0
justification: |
All clone() calls in the codebase fall into justified categories:
1. TEST CODE (160): Clones in test assertions and setup. Necessary.
2. ARC/STORE CLONING (45): Arc::clone() is O(1) atomic increment.
This is the correct pattern for sharing ownership.
3. LENS RESOLUTION (13): The Lens trait signature is:
fn resolve(&self, candidates: &[Assertion]) -> Resolution
Resolution owns its winner Assertion. Since input is borrowed,
we must clone to transfer ownership. This is the correct design.
4. DECAY FUNCTIONS (6): apply_decay() creates modified copies of
assertions with adjusted confidence. Cloning is semantically correct.
5. API HANDLERS (12): Building response DTOs requires owning the data.
String parameters must be cloned into response structs.
6. ERROR CONSTRUCTION (7): PathBuf cloning for error messages.
# Recommendation
action: CLOSE_NO_FIX
reason: |
The codebase has no unnecessary cloning debt. All clones serve legitimate
purposes. The Rust compiler would warn about truly redundant clones.
Potential future optimization (not debt):
- Lens trait could use Cow<'_, Assertion> to avoid clones when winner
is already owned. But this would complicate the API significantly
for marginal gain (assertions are ~500 bytes, cloned at query time).