Skip to content

fix: Restore tab support, fix service trait signatures, and remove resolve.sh#106

Merged
bashandbone merged 4 commits intofix-rule-not-found-deserialize-9177764991747379115from
copilot/sub-pr-103
Mar 10, 2026
Merged

fix: Restore tab support, fix service trait signatures, and remove resolve.sh#106
bashandbone merged 4 commits intofix-rule-not-found-deserialize-9177764991747379115from
copilot/sub-pr-103

Conversation

Copy link
Contributor

Copilot AI commented Mar 10, 2026

Several regressions and issues accumulated across prior commits that drifted from main: tab indentation support was dropped, service trait return types were hardcoded to String, batch_analyze discarded its results, and a resolve.sh script that mutated source files via sed was committed.

Indentation (ast-engine)

  • Restored indent.rs and template.rs to main-branch state (58e59d6) — re-adds get_tab, get_indent_at_offset_with_tab, and the is_tab: bool parameter to indent_lines for correct tab-indented replacement behavior

Service traits (thread-services)

  • analyzer.rs: find_pattern, find_all_patterns, and find_nodes_by_kind now correctly return ServiceResult<Vec<CodeMatch<'_, D>>> (not hardcoded String); batch_analyze returns Ok(results) instead of Ok(vec![])
  • parser.rs: postprocess_document restored to ServiceResult<ParsedDocument<D>> returning Ok(document); SupportLang import fixed to thread_language::SupportLang (self-referential thread_services::types::SupportLang path doesn't resolve)
  • lib.rs: Bare // comment inside a //! doc block changed to //!

Rule engine

  • test_rewrite test restored in trans.rs inside the existing mod test block with the correct Trans<String> type

Language trait

  • Language::from_path default restored to unimplemented!() (matching main); removes ambiguous TODO about whether to panic

Misc

  • _typos.toml: re-adds inout to extend-ignore-identifiers-re — identifier appears in classifications/_universal_rules.json
  • resolve.sh: removed — script was patching source files via sed and should never have been committed

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…raits, remove resolve.sh

Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix: Return explicit error when dependent rule is not found fix: Restore tab support, fix service trait signatures, and remove resolve.sh Mar 10, 2026
@bashandbone bashandbone marked this pull request as ready for review March 10, 2026 17:42
Copilot AI review requested due to automatic review settings March 10, 2026 17:42
Copy link
Contributor

Copilot AI left a comment

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 restores several behaviors that had regressed from main, spanning indentation handling in ast-engine, correct generic return types in thread-services traits, and cleanup of an unsafe repo script.

Changes:

  • Restores tab-aware indentation detection and re-indentation behavior in the AST replacer/template pipeline.
  • Fixes thread-services trait signatures to return generic CodeMatch<'_, D> results and ensures batch_analyze returns accumulated results.
  • Removes the committed resolve.sh that edited source files via sed, and restores a rule-engine rewrite test + small config/doc tweaks.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
resolve.sh Removes an unsafe script that mutates tracked source files.
crates/services/src/traits/parser.rs Fixes SupportLang import under feature flags and restores postprocess_document to return the parsed document via ServiceResult.
crates/services/src/traits/analyzer.rs Restores generic CodeMatch<'_, D> return types and fixes batch_analyze to return collected results.
crates/services/src/lib.rs Fixes a doc-comment formatting issue inside a //! block.
crates/rule-engine/src/transform/trans.rs Restores test_rewrite in the existing test module.
crates/ast-engine/src/replacer/template.rs Threads tab-awareness through template variable indentation and replacement generation.
crates/ast-engine/src/replacer/indent.rs Re-adds tab handling (get_tab, get_indent_at_offset_with_tab) and updates indentation logic + tests.
crates/ast-engine/src/language.rs Restores Language::from_path default to unimplemented!() with a clearer panic message.
_typos.toml Adds inout to ignored identifiers regex list.

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

Comment on lines 70 to +76
/// Return the file language from path. Return None if the file type is not supported.
fn from_path<P: AsRef<Path>>(_path: P) -> Option<Self> {
// TODO: throw panic here if not implemented properly?
None
unimplemented!(
"Language::from_path is not implemented for type `{}`. \
Override Language::from_path for this type if path-based detection is required.",
std::any::type_name::<Self>()
)
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

The docstring says this default implementation returns None when the file type is not supported, but the default body now panics via unimplemented!(). Please update the documentation to reflect that the default panics unless overridden (or restore a non-panicking default if the docstring is intended to be accurate).

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2026

👋 Hey @Copilot,

Thanks for your contribution to thread! 🧵

You need to agree to the CLA first... 🖊️

Before we can accept your contribution, you need to agree to our Contributor License Agreement (CLA).

To agree to the CLA, please comment:

I read the contributors license agreement and I agree to it.

Those exact words are important1, so please don't change them. 😉

You can read the full CLA here: Contributor License Agreement


✅ @Copilot has signed the CLA.


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Footnotes

  1. Our bot needs those exact words to recognize that you agree to the CLA.

Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>
@bashandbone bashandbone merged commit 37e8317 into fix-rule-not-found-deserialize-9177764991747379115 Mar 10, 2026
4 of 5 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants