Skip to content

SOW-0047: reduce adapter mapper complexity#57

Merged
ktsaou merged 1 commit into
masterfrom
codex/sow-0047-adapter-ops-refactor
Jun 6, 2026
Merged

SOW-0047: reduce adapter mapper complexity#57
ktsaou merged 1 commit into
masterfrom
codex/sow-0047-adapter-ops-refactor

Conversation

@ktsaou

@ktsaou ktsaou commented Jun 6, 2026

Copy link
Copy Markdown
Member

Summary

  • Split the adapter mapper user, assistant, and snapshot paths into focused helpers.
  • Added characterization tests for tool-result payload ownership, mixed op ordering, and snapshot metadata updates.
  • Corrected the adapter behavior spec for historical assistant op ordering and recorded validation/review evidence in the active SOW.

Validation

  • ./scripts/gates.sh
  • local file-scoped static analysis: 0 issues on changed mapper files
  • external review converged

Summary by cubic

Reduced complexity in the internal/adapters/claude_code mapper by splitting user, assistant, and snapshot mapping into focused helpers while keeping behavior, event order, and performance unchanged. Added characterization tests and corrected the adapter spec to reflect the historical assistant op ordering.

  • Refactors
    • Decomposed mapper into ops_user.go, ops_assistant.go, and ops_snapshot.go with focused helpers; trimmed ops.go.
    • Preserved event order: LLM → all thinking ops → all tool_use ops; kept tool-result finalization and payload ref ownership (one ref per record on the first match).
    • Kept Agent tool_use as session ops with toolUseId stashed and child-session linking unchanged.
    • Added tests for tool-result payload ownership, mixed assistant op ordering, and snapshot metadata updates.
    • Corrected .agents/sow/specs/adapter-claude-code.md to document the real ordering; no API/schema/runtime changes; benchmarks unchanged.

Written for commit 3396721. Summary will update on new commits.

Review in cubic

Split the adapter mapper user, assistant, and snapshot paths into focused helpers while preserving event order, metadata updates, tool result payload ownership, and benchmark behavior.

Add focused characterization tests for tool-result payload ownership, mixed op ordering, and snapshot metadata updates. Correct the adapter behavior spec for historical assistant op ordering and record validation/review convergence in the SOW.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 75 complexity · 1 duplication

Metric Results
Complexity 75
Duplication 1

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

Re-trigger cubic

@ktsaou ktsaou merged commit e7c5d23 into master Jun 6, 2026
14 checks passed
@ktsaou ktsaou deleted the codex/sow-0047-adapter-ops-refactor branch June 6, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant