feat: add context and implement automated subtree synchronization wor… - #14
feat: add context and implement automated subtree synchronization wor…#14kpj2006 wants to merge 5 commits into
Conversation
|
Warning Review limit reached
Next review available in: 51 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughAdds scheduled and manual repository context synchronization, a Markdown context loader, and integration that supplies full target-repository context to the main workflow instead of a local ChangesRepository context synchronization
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant GitHubActions
participant update_subtrees.py
participant GitHubRawFiles
participant reposDirectory
participant main.py
GitHubActions->>update_subtrees.py: run scheduled or manual synchronization
update_subtrees.py->>GitHubRawFiles: fetch configured context files
GitHubRawFiles-->>update_subtrees.py: return file contents
update_subtrees.py->>reposDirectory: write repository context
GitHubActions->>reposDirectory: commit and push repos/** changes
main.py->>reposDirectory: load Markdown context for REPO
reposDirectory-->>main.py: return aggregated repository context
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
|
@CodeRabbit review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 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 @.github/workflows/sync-subtrees.yml:
- Around line 3-7: Add a fixed concurrency configuration to the workflow’s
top-level trigger settings so scheduled and workflow_dispatch runs share one
concurrency group. Set cancel-in-progress to false, ensuring overlapping
synchronization runs wait rather than canceling or executing concurrently.
- Around line 9-14: Harden the sync-context job by declaring only contents:
write permissions, configuring actions/checkout@v4 with persisted credentials
disabled, and updating the workflow’s commit/push step to use explicit
authentication so repository changes can still be pushed.
- Line 14: Update the scheduled write workflow to pin all executable
dependencies: replace mutable GitHub Action tags, including actions/checkout and
the other actions used by the workflow, with immutable commit SHAs, and install
httpx through a pinned, hash-checked constraints or lock file rather than an
unpinned package specification. Keep the existing workflow behavior unchanged.
In `@context.py`:
- Around line 31-43: Bound Markdown loading in the recursive scan around
repo_dir.rglob and the file-reading block by enforcing explicit per-file and/or
total context limits before appending to context_parts. Truncate oversized
content and report the truncation, or restrict loading to a curated allowlist,
while preserving hidden-directory filtering and the loaded_files accounting.
In `@repo_metadata.py`:
- Around line 11-13: Align the repository metadata key with the canonical
directory name derived by main.py: update the Template-Repo-Main entry in
repo_metadata.py to use Template-Repo, or apply a shared canonical-name mapping
consistently in the sync job and main.py loader so both read and write
repos/Template-Repo/.
In `@scripts/update_subtrees.py`:
- Around line 65-84: Make repository context synchronization transactional in
scripts/update_subtrees.py around the KNOWN_CONTEXT_FILES download loop: stage
downloads in a temporary location, validate that every expected file succeeds,
remove stale destination content, atomically publish the complete set, and fail
on unexpected sync errors. In context.py lines 23-26, report missing repository
context as an error rather than returning header-only content; in lines 38-45,
propagate file read failures or return an explicit incomplete-context status so
main.py cannot analyze incomplete context.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 17b911ba-57fb-4657-8bb3-0b3621da70a5
📒 Files selected for processing (6)
.github/workflows/sync-subtrees.ymlcontext.mdcontext.pymain.pyrepo_metadata.pyscripts/update_subtrees.py
💤 Files with no reviewable changes (1)
- context.md
|
Please resolve the merge conflicts before review. Your PR will only be reviewed by a maintainer after all conflicts have been resolved. 📺 Watch this video to understand why conflicts occur and how to resolve them: |
There was a problem hiding this comment.
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 @.github/workflows/sync-subtrees.yml:
- Around line 36-38: Update update_subtrees.py so synchronization is
authoritative: when a source file is confirmed absent, remove its corresponding
file under repos/**, or stage each repository download and atomically replace
the existing repository directory only after the complete download succeeds.
Preserve existing files when synchronization fails or responses are not
confirmed absent, and ensure the workflow’s Run subtree context sync script uses
the corrected behavior.
In `@context.py`:
- Around line 65-68: Update the section assembly around context_parts.append and
total_chars so MAX_TOTAL_CHARS accounts for the complete rendered section: the
path header, content, newline separators, and optional truncation suffix.
Compute the section’s full length before appending it, then add that length to
total_chars while preserving loaded_files behavior.
🪄 Autofix
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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: bd886137-75f7-4ea6-ba46-a4b6096a2e05
📒 Files selected for processing (4)
.github/workflows/sync-subtrees.ymlcontext.pymain.pyrepo_metadata.py
…prove section handling
…kflow
Addressed Issues:
Fixes #(issue number)
Screenshots/Recordings:
Additional Notes:
Checklist
We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.
Summary by CodeRabbit
New Features
Chores