Repository navigation
feat(maint): batch canonical dev-tool updates #2902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7f21073
feat(maint): batch canonical dev-tool updates
codex-automation cf5a7fa
fix(maint): address source lane review findings
codex-automation eddf5c6
fix(maint): clear remaining CodeRabbit source-lane nits
codex-automation 61245cc
chore(autofix): formatting/lint
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #!/usr/bin/env python3 | ||
| """Decide whether the canonical dev-tool source lane may propose an update. | ||
|
|
||
| Routine updates are batched into one Monday UTC window. A security-sensitive | ||
| update may bypass that window only when an operator explicitly requests it. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import argparse | ||
| from datetime import UTC, datetime | ||
|
|
||
| ROUTINE_WINDOW_WEEKDAY = 0 # Monday in ``datetime.weekday`` notation. | ||
|
|
||
|
|
||
| def should_propose_update(now: datetime, *, security_override: bool) -> bool: | ||
| """Return whether the canonical source lane may open or refresh its PR.""" | ||
| if now.tzinfo is None: | ||
| raise ValueError("now must be timezone-aware") | ||
| return security_override or now.astimezone(UTC).weekday() == ROUTINE_WINDOW_WEEKDAY | ||
|
|
||
|
|
||
| def main(argv: list[str] | None = None) -> int: | ||
| parser = argparse.ArgumentParser(description=__doc__) | ||
| parser.add_argument("--security-override", action="store_true") | ||
| parser.add_argument("--at", help="UTC ISO-8601 timestamp for deterministic checks") | ||
| args = parser.parse_args(argv) | ||
| now = datetime.fromisoformat(args.at.replace("Z", "+00:00")) if args.at else datetime.now(UTC) | ||
| allowed = should_propose_update(now, security_override=args.security_override) | ||
| reason = "security_override" if args.security_override else "weekly_window" | ||
| print(f"should_propose={'true' if allowed else 'false'}") | ||
| print(f"reason={reason}") | ||
|
stranske marked this conversation as resolved.
Resolved
|
||
| return 0 | ||
|
|
||
|
stranske marked this conversation as resolved.
Resolved
|
||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main()) | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.