Skip to content

Deduplicate memory allowed-extension parsing - #67543

Merged
pelikhan merged 2 commits into
mainfrom
copilot/duplicate-code-fix-memory-allowed-extensions
Oct 11, 2026
Merged

pelikhan merged 2 commits into
mainfrom
copilot/duplicate-code-fix-memory-allowed-extensions

Conversation

Copilot AI commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Cache-memory and drive-memory duplicated parsing and validation for allowed-extensions, risking inconsistent behavior as the rules evolve.

  • Shared parser: Extract the common list parsing and extension validation into parseMemoryAllowedExtensions.
  • Call sites: Update both cache-memory and drive-memory to use the helper; leave repo-memory’s distinct parsing behavior unchanged.
extensions, err := parseMemoryAllowedExtensions(configMap)
if err != nil {
    return entry, err
}
entry.AllowedExtensions = extensions


✨ PR Review Safe Output Test - Run 38098153730

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • clients2.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "clients2.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · claude · sonnet46 · 72.2 AIC · ⌖ 9.55 AIC · ⊞ 853 · ◷
Comment /smoke-claude to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor memory allowed-extensions parsing for cache and drive config Deduplicate memory allowed-extension parsing Oct 11, 2026
Copilot AI requested a review from pelikhan October 11, 2026 00:23

@github-actions github-actions Bot 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.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • clients2.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "clients2.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · claude · sonnet46 · 72.2 AIC · ⌖ 9.55 AIC · ⊞ 853
Comment /smoke-claude to run again

return entry, err
}
if err := parseCacheMemoryAllowedExtensions(cacheMap, &entry); err != nil {
allowedExtensions, err := parseMemoryAllowedExtensions(cacheMap)

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.

👍 Good refactoring — using parseMemoryAllowedExtensions as a shared helper eliminates duplication. Consider adding a comment here explaining that this shared parser is also used by drive_memory_config.go to help future readers understand the coupling.

entry.RestoreOnly = restoreOnly
}
if err := parseDriveMemoryAllowedExtensions(raw, &entry); err != nil {
allowedExtensions, err := parseMemoryAllowedExtensions(raw)

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.

✅ Consistent with the change in cache_config.go. The shared parseMemoryAllowedExtensions function keeps both call sites in sync — if validation logic changes, only one place needs updating. Well done!

@pelikhan
pelikhan marked this pull request as ready for review October 11, 2026 00:56
Copilot AI balanced review requested due to automatic review settings October 11, 2026 00:56
@pelikhan
pelikhan merged commit b075f64 into main Oct 11, 2026
9 checks passed
@pelikhan
pelikhan deleted the copilot/duplicate-code-fix-memory-allowed-extensions branch October 11, 2026 00:56

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.

🟢 Approval recommended

The refactor preserves both callers’ existing behavior and includes appropriate regression coverage.

0 open findings

What changed in this PR

Deduplicates memory allowed-extensions parsing while preserving existing behavior.

Changes:

  • Adds a shared parser with validation tests.
  • Migrates cache-memory and drive-memory parsing to the helper.
  • Adds drive-memory regression coverage.
File Description
pkg/​workflow/​memory_validation_config.go Adds shared extension parsing.
pkg/​workflow/​memory_validation_config_test.go Tests parser behavior.
pkg/​workflow/​cache_config.go Uses the shared parser.
pkg/​workflow/​drive_memory_config.go Uses the shared parser.
pkg/​workflow/​drive_memory_test.go Tests invalid extensions.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.91.8

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.

[duplicate-code] Duplicate Code: Memory allowed-extensions Parsing in cache_config.go and drive_memory_config.go

3 participants