Skip to content

chore: remove dead functions (phase 8) — parser import system#19246

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

chore: remove dead functions (phase 8) — parser import system#19246
dsyme merged 1 commit intomainfrom
dc-8

Conversation

@dsyme
Copy link
Contributor

@dsyme dsyme commented Mar 2, 2026

Removes 4 dead functions from the parser import system:

  • ImportError.Error() and ImportError.Unwrap() — struct is still used but never cast to error interface; methods were dead from production paths
  • ProcessImportsFromFrontmatter — thin wrapper now only needed in one test file, moved to local test helper
  • ProcessImportsFromFrontmatterWithManifest — thin wrapper; all 16 test call sites updated to call ProcessImportsFromFrontmatterWithSource directly

Part of systematic dead code cleanup (DEADCODE.md phase 8).

Copilot AI review requested due to automatic review settings March 2, 2026 15:16
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/unused functions from the parser import system and updates call sites (mostly tests) to use the remaining ProcessImportsFromFrontmatterWithSource API.

Changes:

  • Removed dead ImportError.Error() / ImportError.Unwrap() methods and deleted wrapper import-processing functions from production code.
  • Updated tests to call ProcessImportsFromFrontmatterWithSource directly (and introduced a local test helper where needed).
  • Deleted now-obsolete unit test that only exercised the removed ImportError.Error() behavior.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/parser/import_processor.go Removes the exported wrapper functions, leaving ProcessImportsFromFrontmatterWithSource as the entry point.
pkg/parser/import_error.go Removes dead ImportError methods (Error, Unwrap).
pkg/parser/import_error_test.go Removes unit test that only covered the deleted ImportError.Error() method.
pkg/parser/frontmatter_utils_test.go Adds a local test helper to preserve the old wrapper behavior for this test file.
pkg/parser/yaml_import_test.go Updates YAML-import tests to call ProcessImportsFromFrontmatterWithSource.
pkg/parser/yaml_import_e2e_test.go Updates E2E YAML-import tests to call ProcessImportsFromFrontmatterWithSource.
pkg/parser/yaml_import_copilot_setup_test.go Updates Copilot setup import test to call ProcessImportsFromFrontmatterWithSource.
pkg/parser/import_topological_test.go Updates topological ordering tests to call ProcessImportsFromFrontmatterWithSource.
pkg/parser/import_topological_contract_test.go Updates contract tests to call ProcessImportsFromFrontmatterWithSource.
pkg/parser/import_remote_nested_test.go Updates remote/nested import test to call ProcessImportsFromFrontmatterWithSource.
pkg/parser/agent_import_integration_test.go Updates agent import integration tests to call ProcessImportsFromFrontmatterWithSource.
pkg/cli/dependency_graph_test.go Updates dependency-graph contract test to call ProcessImportsFromFrontmatterWithSource.
Comments suppressed due to low confidence (1)

pkg/parser/frontmatter_utils_test.go:552

  • The test now calls the local helper processImportsFromFrontmatter, but several failure messages still refer to ProcessImportsFromFrontmatter() (which has been removed from production). Consider updating the strings to reference the helper / current API to avoid confusing test output.
			tools, engines, err := processImportsFromFrontmatter(tt.frontmatter, tempDir)

			if tt.wantErr {
				if err == nil {
					t.Errorf("ProcessImportsFromFrontmatter() expected error but got none")
				}

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

Comment on lines 134 to 141
// runImportProcessor processes the given top-level import list via
// ProcessImportsFromFrontmatterWithManifest and returns the ImportedFiles slice.
func runImportProcessor(t *testing.T, dir string, topImports []string) []string {
t.Helper()
fm := map[string]any{"imports": topImports}
result, err := parser.ProcessImportsFromFrontmatterWithManifest(fm, dir, nil)
result, err := parser.ProcessImportsFromFrontmatterWithSource(fm, dir, nil, "", "")
require.NoError(t, err, "ProcessImportsFromFrontmatterWithManifest must not fail")
return result.ImportedFiles
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The helper comment and assertion message still refer to ProcessImportsFromFrontmatterWithManifest, but the helper now calls ProcessImportsFromFrontmatterWithSource. Please update this comment/message so the contract test documentation and failure output remain correct.

See below for a potential fix:

// ProcessImportsFromFrontmatterWithSource and returns the ImportedFiles slice.
func runImportProcessor(t *testing.T, dir string, topImports []string) []string {
	t.Helper()
	fm := map[string]any{"imports": topImports}
	result, err := parser.ProcessImportsFromFrontmatterWithSource(fm, dir, nil, "", "")
	require.NoError(t, err, "ProcessImportsFromFrontmatterWithSource must not fail")

Copilot uses AI. Check for mistakes.
@dsyme dsyme merged commit 0a58394 into main Mar 2, 2026
48 checks passed
@dsyme dsyme deleted the dc-8 branch March 2, 2026 21:56
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