Skip to content

refactor: remove over-defensive fallbacks and consolidate duplicated helpers - #259

Merged
BerryUIKI merged 6 commits into
mainfrom
refactor/reduce-over-defensive-code
Nov 7, 2026
Merged

BerryUIKI merged 6 commits into
mainfrom
refactor/reduce-over-defensive-code

Conversation

@BerryUIKI

Copy link
Copy Markdown
Owner

Summary

Implements the P1/P2 cleanup tracked in #258.

  • Unify AgentService task transitions; repository writes return the updated row via UPDATE ... RETURNING.
  • Replace ExecutionResult's boolean/error fields and the duplicate FinalState with a single enum.
  • Reject unknown persisted enum values instead of silently defaulting to Created / TaskCreated / Pending.
  • Keep the OpenAI HTTP timeout when reqwest::Client construction fails.
  • Make UpdateWorkspaceInput.name required.
  • Consolidate required_text / truncate, status/event string mappings, and the in-memory SQLite test setup.
  • Replace the format!-built purge SQL and check NotFound before committing.

Verification

  • cargo fmt --all -- --check
  • cargo test -p domain — 5 passed
  • cargo check -p investment-os --all-targets — exit 0
  • cargo check -p alphaforge-cli --all-targets — exit 0

cargo test -p investment-os --lib and clippy did not complete because several concurrent cargo builds on the workstation kept the target directory locked; no failures were observed before the run was stopped.

Stacking

This branch is based on feature/research-context-tools (#257) because the refactor touches files introduced there. It should be merged after #257; GitHub will retarget this PR to main once #257 lands.

Closes #258

- add kind/format/summary/archived_at via migration 0005
- archive documents by default and purge explicitly with cascaded sources/notes
- include recent document summaries in agent context with a 4k-character budget
- add search_research and get_research_document tools
- accept validated citations in research output
- cover repository, service, context, tools, and runtime tests
- render sanitized Markdown with raw HTML skipped and links as text
- add an editor preview toggle and document kind labels
- show stored citations in the task detail view
- add tests for preview rendering and citation parsing
- add docs/AGENT_MEMORY.md covering memory layers, context budget, tools, citations, and write policy
- document Markdown/metadata/soft-delete conventions in DATA_MODEL.md
- update AGENT_PROTOCOL, ARCHITECTURE, CLAUDE.md, roadmap, and changelog
EmptyContextProvider keeps the task's workspace id, not the task id.
- unify AgentService transitions; repository writes return updated rows
- replace ExecutionResult fields with an enum
- reject unknown persisted enum values instead of defaulting
- keep the OpenAI HTTP timeout when the client build fails
- make UpdateWorkspaceInput.name required
- share text helpers, enum string mappings, and test database setup
- add regression tests for enum parsing and workspace trimming

Refs #258
@BerryUIKI
BerryUIKI changed the base branch from feature/research-context-tools to main November 7, 2026 06:44
@BerryUIKI
BerryUIKI merged commit f3baf81 into main Nov 7, 2026
4 checks passed
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.

refactor: remove over-defensive fallbacks and consolidate duplicated helpers

1 participant