feat(drivers/github): 增加可选的准确修改时间增强#2388
Open
jiwangyihao wants to merge 1 commit intoOpenListTeam:mainfrom
Open
feat(drivers/github): 增加可选的准确修改时间增强#2388jiwangyihao wants to merge 1 commit intoOpenListTeam:mainfrom
jiwangyihao wants to merge 1 commit intoOpenListTeam:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
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_timeconfig option (defaultfalse) to enable accurate mtime backfill for small listings. - Implement GraphQL batched commit-history lookups and apply best-effort
Modifiedtimestamps duringList. - Add comprehensive behavior tests, including failure fallback, rate-limit stop, batching behavior, and
op.Listcache 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description / 描述
accurate_modified_time配置项。contents小目录列表中使用 GitHub GraphQL 以 best-effort 方式回填真实modified。created与treefallback 行为,并补齐 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.gogo test ./drivers/githubtreefallback 旧行为、op.List缓存命中不重复 GraphQL。Checklist / 检查清单
我已阅读 CONTRIBUTING 文档。
go fmtor prettier.我已使用
go fmt或 prettier 格式化提交的代码。我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
我已相应更新了相关仓库(若适用)。