Skip to content

feat(drivers/github): 增加可选的准确修改时间增强#2388

Open
jiwangyihao wants to merge 1 commit intoOpenListTeam:mainfrom
jiwangyihao:opencode/github-accurate-mtime
Open

feat(drivers/github): 增加可选的准确修改时间增强#2388
jiwangyihao wants to merge 1 commit intoOpenListTeam:mainfrom
jiwangyihao:opencode/github-accurate-mtime

Conversation

@jiwangyihao
Copy link
Copy Markdown

@jiwangyihao jiwangyihao commented Apr 21, 2026

Description / 描述

  • 为 GitHub Driver 新增默认关闭的 accurate_modified_time 配置项。
  • contents 小目录列表中使用 GitHub GraphQL 以 best-effort 方式回填真实 modified
  • 保持 legacy createdtree fallback 行为,并补齐 helper、行为测试与 op.List 缓存回归测试。

Motivation and Context / 背景

GitHub 的 contents / git/trees 列表接口本身不返回真实修改时间,当前 GitHub Driver 会把 Modified 固定为 zero-time,导致下游看到 1970。这个 PR 采用默认关闭、显式开启的增强方式,只在小目录上补齐准确 mtime,同时保持失败回退和请求成本边界。

How Has This Been Tested? / 测试

  • gofmt -w drivers/github/meta.go drivers/github/types.go drivers/github/driver.go drivers/github/mtime.go drivers/github/mtime_test.go
  • go test ./drivers/github
  • 新增测试覆盖成功回填、disabled / missing token / 201 条目跳过、首批失败、第二批失败、rate-limit 止损、200 条目 4 个 batch、tree fallback 旧行为、op.List 缓存命中不重复 GraphQL。

Checklist / 检查清单

  • I have read the CONTRIBUTING document.
    我已阅读 CONTRIBUTING 文档。
  • I have formatted my code with go fmt or prettier.
    我已使用 go fmtprettier 格式化提交的代码。
  • I have added appropriate labels to this PR (or mentioned needed labels in the description if lacking permissions).
    我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
  • I have requested review from relevant code authors using the "Request review" feature when applicable.
    我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
  • I have updated the repository accordingly (If it’s needed).
    我已相应更新了相关仓库(若适用)。

@jiwangyihao jiwangyihao changed the title feat(drivers/github): add optional accurate modified time feat(drivers/github): 增加可选的准确修改时间增强 Apr 21, 2026
@jyxjjj jyxjjj requested a review from Copilot April 27, 2026 02:53
Copy link
Copy Markdown
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

This PR adds an opt-in enhancement to the GitHub driver to best-effort backfill accurate Modified timestamps for small directory listings via GitHub GraphQL, while preserving the legacy zero-time fallback behavior on failure and keeping created behavior unchanged.

Changes:

  • Add accurate_modified_time config option (default false) to enable accurate mtime backfill for small listings.
  • Implement GraphQL batched commit-history lookups and apply best-effort Modified timestamps during List.
  • Add comprehensive behavior tests, including failure fallback, rate-limit stop, batching behavior, and op.List cache regression coverage.

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
drivers/github/meta.go Registers new accurate_modified_time driver config (default disabled) with help text.
drivers/github/driver.go Hooks the mtime backfill into List for non-tree-fallback directory listings.
drivers/github/mtime.go Implements GraphQL batching, response parsing, and best-effort application of accurate mtimes.
drivers/github/types.go Uses a shared epoch sentinel (githubZeroTime) and sets Ctime to preserve legacy create-time behavior.
drivers/github/mtime_test.go Adds tests for eligibility, batching, failure modes, rate-limit stopping, tree fallback behavior, and cache hit behavior.

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

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