Skip to content

refactor(engine): integration tests and related fixes#59

Open
martsokha wants to merge 7 commits intomainfrom
feat/config-toml
Open

refactor(engine): integration tests and related fixes#59
martsokha wants to merge 7 commits intomainfrom
feat/config-toml

Conversation

@martsokha
Copy link
Member

No description provided.

…xecutor

- Extract `ResourceLimits` struct (run_timeout_ms, channel_buffer)
  from `EngineSection` with `[engine.limits]` TOML nesting
- Move `build_petgraph` to `Graph::to_petgraph()` method
- Remove `retry`/`timeout` from `ResolvedNode` — policy resolution
  now happens at execution time via `NodeExecutor::effective_retry()`
  and `effective_timeout()` (node-level falls back to engine default)
- `compile()` takes `&Graph` (no mutation) and only `channel_buffer`
- Remove `default_retry`/`default_timeout` from `EngineInner`
- Update `Nvisy.example.toml` with `[engine.limits]` and concurrency

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@martsokha martsokha self-assigned this Mar 24, 2026
@martsokha martsokha added the feat request for or implementation of a new feature label Mar 24, 2026
martsokha and others added 4 commits March 24, 2026 18:09
…llback

Split pipeline/config.rs into pipeline/config/ module:
- mod.rs: RuntimeConfig, merge(), tests
- engine.rs: EngineSection, ResourceLimits with validator derive
- subsystem.rs: OcrSection, LlmSection, SttSection, TtsSection
- validate.rs: RuntimeConfig::validate() and resolve_env()

Other changes:
- Replace version: u32 with semver::Version (default 0.1.0)
- Remove dead `enabled` fields from all subsystem sections
- Add #[validate(range(min = 1))] on channel_buffer
- Add #[validate(nested)] on EngineSection retry/timeout/limits
- Add RuntimeConfig::resolve_env() for NVISY_*_API_KEY env fallback
- Call validate() and resolve_env() in Cli::load()
- Update Nvisy.example.toml with semver, env var docs, no enabled

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace monolithic tests/pipeline.rs with focused test modules:

- fixtures/mod.rs: shared helpers (engine, actor, upload_text, graph builders)
- engine.rs: construction and config lifecycle (3 tests)
- config.rs: TOML parsing, example file, validation, merge (6 tests)
- content.rs: CRUD, bulk delete, nonexistent errors, actor isolation (8 tests)
- context.rs: CRUD, bulk delete, nonexistent errors, actor isolation (7 tests)
- compilation.rs: graph validation — empty, duplicate IDs, dangling edges,
  self-loops, backward edges, concurrency policy (8 tests)
- runs.rs: run listing, get/delete/cancel nonexistent, failed run lifecycle,
  bulk delete, actor isolation, analytics (10 tests)

All tests use Result<()> return type instead of .unwrap() panics.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ContentData is now pure bytes + source identity. All descriptive
attributes (supplied MIME, detected MIME, filename) live on
ContentMetadata, which the registry persists separately. This fixes
the round-trip bug where text content lost its MIME type through the
registry, causing Document::decode to fail.

Changes across 6 crates:

nvisy-core:
- ContentData: remove supplied_mime, detected_mime, filename fields;
  remove with_content_type(), with_filename(), content_type(),
  infer_document_type(); add detect_mime() method; simplify constructors
- ContentMetadata: add content_type, detected_content_type, filename
  fields; add builder methods and content_type()/infer_document_type()
- Content: add infer_document_type() combining metadata + magic bytes;
  add content_type(), metadata_mut()

nvisy-codec:
- Document::decode takes &Content instead of &ContentData

nvisy-engine:
- DocumentEnvelope carries ContentMetadata through the pipeline
- ImportFile operation accepts Content, preserves metadata through
  decompression/decryption
- Registry auto-detects MIME on store via ContentData::detect_mime();
  ContentHandle::content() returns full Content from both keyspaces
- Executor passes Content to import; audio extraction reads filename
  from envelope metadata
- EncryptedContent: remove filename field (was always None)
- Tests: add 4 successful Engine::run tests; use anyhow::Result

nvisy-server:
- File upload sets MIME/filename on ContentMetadata instead of ContentData

nvisy-python:
- ExifModule takes Content instead of ContentData

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ContentBytes was a thin wrapper around bytes::Bytes with helpers for
text conversion (as_hipstr, is_likely_text). These are now methods
directly on ContentData. No external consumers existed.

Removes: ContentBytes struct, content_bytes.rs, with_content_bytes(),
content_bytes() accessor, prelude re-export.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@martsokha martsokha changed the title refactor(engine): extract ResourceLimits, move policy resolution refactor(engine): integration tests and related fixes Mar 24, 2026
@martsokha martsokha added the bug something isn't working as intended label Mar 24, 2026
martsokha and others added 2 commits March 24, 2026 20:41
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Standardize all tracing target constants to follow the
`nvisy_engine::<module>::<name>` convention:

- registry::content, registry::context: rename COMPONENT → TARGET,
  prefix with nvisy_engine::
- nvisy_engine::crypto → nvisy_engine::op::encryption
- nvisy_engine::compression → nvisy_engine::op::compression
- nvisy_engine::op::audial_extraction → nvisy_engine::op::speech
- Add TARGET to pipeline/default.rs and pipeline/runs/state.rs
- Add target: TARGET to all tracing calls that were missing it

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug something isn't working as intended feat request for or implementation of a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant