GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: parseFrontmatter型バリデーション + repetition共有util抽出 by terisuke · Pull Request #70 · Cor-Incorporated/opencode

Conversation

@terisuke

@terisuke terisuke commented Apr 5, 2026

Copy link
Copy Markdown

What

PR #56 のレビュー残り2件を修正。

Why

  • parseFrontmatter() が invalid type を無検証でキャストしていた
  • repetition.test.ts が production コードを import せず独自実装していた

Closes #69

Changes

  1. memory/file.ts: Memory.TYPES に対するバリデーション追加
  2. session/repetition.ts: 新規共有util
  3. session/processor.ts: import に置換
  4. test 更新

Review

  • code-reviewer Agent: CRITICAL/HIGH 0
  • Codex CLI: No issues in PR A

Test plan

  • bun test test/memory/file.test.ts — 19 pass
  • bun test test/session/repetition.test.ts — 8 pass
  • typecheck 13/13 pass

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
terisuke and others added 2 commits April 5, 2026 19:28
@terisuke @claude
refactor(session): extract detectRepetition to shared util
7439e20
Move detectRepetition function and constants from processor.ts to
a dedicated repetition.ts module. Test now imports production code
instead of reimplementing the algorithm.

Closes #69 (partial)

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@terisuke @claude
fix(memory): validate frontmatter type against Memory.TYPES
cc485d3
parseFrontmatter() now checks fm.type is a valid Memory.Type value
before casting. Invalid types return undefined instead of silently
propagating through the system.

Closes #69 (partial)

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings April 5, 2026 10:47
@github-actions github-actions Bot added the needs:compliance label Apr 5, 2026
@github-actions

github-actions Bot commented Apr 5, 2026

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@terisuke
terisuke merged commit 45d8de3 into dev Apr 5, 2026
5 of 9 checks passed

Uh oh!

There was an error while loading. Please reload this page.

Copilot started reviewing on behalf of terisuke April 5, 2026 10:48
View session
Copilot AI reviewed Apr 5, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown

There was a problem hiding this 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 addresses remaining review items from PR #56 by adding runtime validation for user-editable memory frontmatter types and by extracting the repetition-detection logic into a shared production util that tests can import.

Changes:

  • Add validation in parseFrontmatter() to reject unknown type values (based on Memory.TYPES).
  • Extract detectRepetition (+ constants) into src/session/repetition.ts and reuse it from SessionProcessor and tests.
  • Update/add tests to cover valid/invalid/missing memory type parsing and to import the shared repetition util.

Reviewed changes

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

Show a summary per file
File Description
packages/opencode/src/memory/file.ts Validate frontmatter type against Memory.TYPES before casting.
packages/opencode/src/session/repetition.ts New shared repetition-detection util + exported constants.
packages/opencode/src/session/processor.ts Replace inlined repetition logic with imports from ./repetition.
packages/opencode/test/session/repetition.test.ts Switch test to import production detectRepetition + constants.
packages/opencode/test/memory/file.test.ts Add coverage for valid/invalid/missing frontmatter type.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/opencode/test/session/repetition.test.ts
Comment on lines +2 to +3
import { detectRepetition } from "../../src/session/repetition"
import { REPETITION_THRESHOLD, REPETITION_WINDOW } from "../../src/session/repetition"

Copilot AI Apr 5, 2026

Copy link

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

These two imports come from the same module; consider combining them into a single import to reduce redundancy and keep imports easier to maintain.

Suggested change
import { detectRepetition } from "../../src/session/repetition"
import { REPETITION_THRESHOLD, REPETITION_WINDOW } from "../../src/session/repetition"
import { detectRepetition, REPETITION_THRESHOLD, REPETITION_WINDOW } from "../../src/session/repetition"

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot uses AI. Check for mistakes.
This was referenced Apr 5, 2026
[Master Plan] OpenCode Claude Code Parity — 実装ロードマップ #51
Closed
perf: optimize repetition detection for high-frequency streaming #55
Closed
fix: memory type enum alignment with upstream PR #20344 #54
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

needs:compliance

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

fix: PR #56 残り — parseFrontmatter型バリデーション + repetition test重複

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@terisuke
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.