Skip to content

Update goldmaster to use filecache.replace() and remove explicit retrieve()#195

Open
jnspitale wants to merge 27 commits into
mainfrom
jns-145
Open

Update goldmaster to use filecache.replace() and remove explicit retrieve()#195
jnspitale wants to merge 27 commits into
mainfrom
jns-145

Conversation

@jnspitale
Copy link
Copy Markdown
Collaborator

@jnspitale jnspitale commented May 6, 2026

Addresses #145

Summary by CodeRabbit

  • Bug Fixes

    • Improved log and summary rotation to use atomic, timestamped backups based on stored file metadata, reducing failures and ensuring reliable archival of prior files.
  • Chores

    • No changes to public interfaces or exported signatures.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Review Change Stack

Warning

Rate limit exceeded

@jnspitale has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 12 minutes and 42 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: dc2fc2df-17f7-41c2-85ec-e2bc8eb9041a

📥 Commits

Reviewing files that changed from the base of the PR and between ce624f4 and a261676.

📒 Files selected for processing (1)
  • oops/gold_master/__init__.py

Walkthrough

Log and summary rotation in the gold master runner were changed to use local filesystem paths and timestamp-based replacement. Existing local files are detected via get_local_path() and atomically replaced with a timestamped name before creating file handlers or writing summaries.

Changes

Log and Summary File Rotation Simplification

Layer / File(s) Summary
Local-path detection
oops/gold_master/__init__.py (lines 1147–1164, 2313–2331)
Replace remote retrieve()-based flow with get_local_path() + os.path.exists() checks for both per-task logs and the summary file.
Timestamped rotation
oops/gold_master/__init__.py (lines 1147–1164, 2313–2331)
Compute timestamped destination names (using local file mtime) and perform log_path.replace(dated_logpath) / filepath.replace(dated_filepath) to rotate files atomically.
Handler / write sequencing
oops/gold_master/__init__.py (lines 1147–1164, 2313–2331)
Create logging.FileHandler or write summary after ensuring the original path has been replaced with the dated file; removes prior rename/upload steps.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating goldmaster to use filecache.replace() and removing explicit retrieve() calls, which directly matches the raw summary and PR objectives.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jnspitale jnspitale changed the title Jns 145 Update goldmaster to use filecache.replace() and remove explicit retrieve() May 6, 2026
@jnspitale
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@oops/gold_master/__init__.py`:
- Line 1154: Replace the naive local-time timestamp with a timezone-aware UTC
timestamp when building rotation suffixes: when calling
datetime.fromtimestamp(os.path.getmtime(localpath)) (the assignment to dt), pass
an explicit tz (e.g., datetime.timezone.utc) or use a UTC-based constructor so
dt is timezone-aware and not subject to DST repeats; also update the strftime
format used later for the rotated filename (the code that formats dt into the
filename suffix) to include a UTC-indicative format like '-%Y-%m-%dT%H-%M-%SZ'
so the filename shows UTC.
- Around line 1160-1162: The FileHandler is opened with default append mode
after rotating via log_path.replace(dated_logpath), which can leave localpath
present and cause silent appends; change creation of the handler in the rotation
code (the site that does log_path.replace(dated_logpath) and then sets handler =
logging.FileHandler(localpath)) to explicitly open with mode='w' (matching the
summary writer behavior) so a new file is written after rotation, and likewise
update any other FileHandler instantiation in this module to use mode='w' where
rotation or replacement may leave the file present; also fix the DTZ006 warnings
by replacing naive timestamp conversion calls with
datetime.datetime.fromtimestamp(timestamp, tz=datetime.timezone.utc) wherever
timestamps are converted (e.g., the conversion sites around the rotation logic
and the summary writer).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2eb0af3c-3c8c-47ca-bf25-d54ee0463bf9

📥 Commits

Reviewing files that changed from the base of the PR and between c9d8194 and 10dffb9.

📒 Files selected for processing (1)
  • oops/gold_master/__init__.py

Comment thread oops/gold_master/__init__.py Outdated
Comment thread oops/gold_master/__init__.py Outdated
@jnspitale jnspitale marked this pull request as ready for review May 6, 2026 22:19
Comment thread oops/gold_master/__init__.py Outdated
coderabbitai[bot]

This comment was marked as resolved.

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.

3 participants