Skip to content

chore: remove dead functions (phase 6) — parser frontmatter#19232

Merged
dsyme merged 1 commit intomainfrom
dc-6
Mar 2, 2026
Merged

chore: remove dead functions (phase 6) — parser frontmatter#19232
dsyme merged 1 commit intomainfrom
dc-6

Conversation

@dsyme
Copy link
Contributor

@dsyme dsyme commented Mar 2, 2026

Remove 5 unreachable functions:

  • ExtractFrontmatterString (frontmatter_content.go)
  • ExtractYamlChunk (frontmatter_content.go)
  • ComputeFrontmatterHash (frontmatter_hash.go)
  • buildCanonicalFrontmatter (frontmatter_hash.go)
  • ComputeFrontmatterHashWithExpressions (frontmatter_hash.go)

Part of dead code cleanup — see DEADCODE.md

Remove 5 unreachable functions:
- ExtractFrontmatterString (frontmatter_content.go)
- ExtractYamlChunk (frontmatter_content.go)
- ComputeFrontmatterHash (frontmatter_hash.go)
- buildCanonicalFrontmatter (frontmatter_hash.go)
- ComputeFrontmatterHashWithExpressions (frontmatter_hash.go)

Also remove their exclusive tests from frontmatter_hash_test.go,
frontmatter_extraction_test.go, and frontmatter_hash_stability_test.go.
Copilot AI review requested due to automatic review settings March 2, 2026 14:29
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

Removes dead/unreachable frontmatter parsing and hashing helpers as part of the ongoing dead code cleanup (phase 6), and updates tests accordingly.

Changes:

  • Removed ExtractFrontmatterString and ExtractYamlChunk from frontmatter content extraction.
  • Removed ComputeFrontmatterHash and ComputeFrontmatterHashWithExpressions from frontmatter hashing.
  • Deleted/trimmed unit tests that exercised the removed functions and cleaned up now-unused imports.

Reviewed changes

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

Show a summary per file
File Description
pkg/parser/frontmatter_hash_test.go Removes tests that directly targeted deleted hash APIs/helpers.
pkg/parser/frontmatter_hash_stability_test.go Removes canonical-JSON verification that depended on deleted helpers; cleans up imports.
pkg/parser/frontmatter_hash.go Deletes dead exported hash entrypoints; leaves remaining hash-from-file implementation in place.
pkg/parser/frontmatter_extraction_test.go Removes tests for deleted YAML/frontmatter string extraction helpers; cleans up imports.
pkg/parser/frontmatter_content.go Deletes dead frontmatter/YAML string extraction helpers.
Comments suppressed due to low confidence (1)

pkg/parser/frontmatter_hash.go:44

  • buildCanonicalFrontmatter is still present, but after removing ComputeFrontmatterHash* there are no remaining references to it in the repo (only its definition remains). This contradicts the PR description (“remove … buildCanonicalFrontmatter”) and leaves dead code behind; either remove this helper entirely or reintroduce a caller that still needs it.
// buildCanonicalFrontmatter builds a canonical representation of frontmatter
// including all fields that should be included in the hash computation.
func buildCanonicalFrontmatter(frontmatter map[string]any, result *ImportsResult) map[string]any {
	canonical := make(map[string]any)

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

@dsyme dsyme merged commit 75f03da into main Mar 2, 2026
88 checks passed
@dsyme dsyme deleted the dc-6 branch March 2, 2026 14:33
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.

2 participants