Skip to content

fix: resolve code quality issues from simplify review#59

Merged
philoserf merged 3 commits intomainfrom
fix/simplify-code-quality
Mar 5, 2026
Merged

fix: resolve code quality issues from simplify review#59
philoserf merged 3 commits intomainfrom
fix/simplify-code-quality

Conversation

@philoserf
Copy link
Owner

Summary

  • resolveUpdateMethod now delegates to isEmptyValue instead of duplicating a partial empty-check (fixes array inconsistency)
  • truncateHeadTail guards ellipsis separator like other truncation functions
  • truncateHeading guards empty body when remainingTokens is 0
  • getContent early-returns when limit <= 0, avoiding unnecessary tokenization
  • Remove dead error-check branch in generateMetadata

Test plan

  • All 88 tests pass
  • Typecheck + Biome lint clean
  • Build succeeds
  • Deployed to test vault

🤖 Generated with Claude Code

philoserf and others added 2 commits March 4, 2026 22:50
- resolveUpdateMethod now delegates to isEmptyValue instead of
  duplicating a partial empty-check (fixes array inconsistency)
- truncateHeadTail guards ellipsis separator like other truncation fns
- truncateHeading guards empty body when remainingTokens is 0
- getContent early-returns when limit <= 0, avoiding unnecessary tokenization
- Remove dead error-check branch in generateMetadata

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

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 refactors/cleans up truncation and metadata-generation helpers to make behavior more consistent (especially around “empty” values and token limits) and removes redundant logic.

Changes:

  • Adjusts truncation helpers (truncateHeadTail, truncateHeading) to better handle edge cases around separators and empty bodies.
  • Optimizes getContent by early-returning when limit <= 0 to avoid unnecessary tokenization.
  • Simplifies resolveUpdateMethod by delegating to isEmptyValue, and simplifies generateMetadata error handling.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/utils.ts Updates truncation logic and adds limit <= 0 fast-path in getContent.
src/utils.test.ts Tweaks truncateHeadTail expectations to align with updated separator behavior.
src/metadata.ts Uses isEmptyValue in resolveUpdateMethod; simplifies generateMetadata catch branch.
main.js Rebuilt bundle reflecting the TypeScript source changes.

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

…g tests

- truncateHeadTail early-returns joinTokens(tokens) when limit >= length,
  preventing overlap and spurious separator insertion
- Add tests: truncateHeadTail with limit > token count,
  truncateHeading with outline consuming full budget,
  getContent with limit=0 and limit=-1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@philoserf
Copy link
Owner Author

@copilot code review[agent] look now

Copy link

Copilot AI commented Mar 5, 2026

@philoserf I've opened a new pull request, #60, to work on those changes. Once the pull request is ready, I'll request review from you.

@philoserf
Copy link
Owner Author

@copilot we addressed the items you raised. how does it look now?

Copy link

Copilot AI commented Mar 5, 2026

@philoserf I've opened a new pull request, #61, to work on those changes. Once the pull request is ready, I'll request review from you.

@philoserf philoserf merged commit 611412c into main Mar 5, 2026
1 check passed
@philoserf philoserf deleted the fix/simplify-code-quality branch March 5, 2026 04:07
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.

3 participants