Skip to content

Improve processor.go behaviour#51

Merged
Vladyslav-Kuksiuk merged 3 commits into
masterfrom
simplify-processor-logic
Jun 18, 2026
Merged

Improve processor.go behaviour#51
Vladyslav-Kuksiuk merged 3 commits into
masterfrom
simplify-processor-logic

Conversation

@Vladyslav-Kuksiuk

Copy link
Copy Markdown
Collaborator

This PR:

  • removes code duplication for check and embed modes in the processor.go;
  • extracts ProcessingError as typed error;
  • Divides SetEmbedding to StartEmbedding and FinishEmbedding methods.

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk self-assigned this Jun 8, 2026
@Vladyslav-Kuksiuk Vladyslav-Kuksiuk marked this pull request as ready for review June 8, 2026 20:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the embedding processor flow to reduce duplication between embed and check modes, improves error typing for downstream handling, and clarifies parser context state transitions around embedding lifecycle.

Changes:

  • Deduplicates per-doc processing loops via a shared processRequiredDocs helper used by both EmbedAll and up-to-date checking.
  • Introduces a typed embedding.ProcessingError that attaches doc path + line and preserves underlying parse/source-resolution error types via Unwrap.
  • Splits parsing context embedding lifecycle from SetEmbedding into explicit StartEmbedding / FinishEmbedding.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
embedding/processor.go Removes duplicated loops by introducing processRequiredDocs; wraps parsing errors with ProcessingError.
embedding/parsing/instruction_token.go Switches to Context.StartEmbedding when an instruction is successfully parsed.
embedding/parsing/context.go Replaces SetEmbedding with explicit StartEmbedding/FinishEmbedding embedding lifecycle methods.
embedding/parsing/code_fence_end.go Uses FinishEmbedding when closing an embedding at the end of a code fence.
embedding/error.go Adds ProcessingError typed error with user-facing formatting and Unwrap.
embedding/embedding_test.go Adds assertions for typed error preservation (ProcessingError, parse errors, and pattern errors).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Base automatically changed from improve-readability to master June 18, 2026 15:41
@Vladyslav-Kuksiuk Vladyslav-Kuksiuk merged commit b6e5824 into master Jun 18, 2026
4 checks passed
@Vladyslav-Kuksiuk Vladyslav-Kuksiuk deleted the simplify-processor-logic branch June 18, 2026 15:42
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.

4 participants