fix(batch): reconcile pipeline.md inbox after batch runs#27
Conversation
batch-runner.sh records every evaluated offer in batch/batch-state.tsv but never writes back to data/pipeline.md. Offers processed via batch mode stay in the pipeline "Pendientes" inbox indefinitely -- the next scan and the next `/career-ops pipeline` run re-surface them, producing duplicate reports and tracker rows. For anyone running batch regularly the inbox never drains. Add reconcile-pipeline.mjs: for each completed/skipped entry in batch-state.tsv whose URL is still in pipeline.md "Pendientes", move the line to "Procesadas" with its report link, score and PDF flag. It is idempotent -- an already-moved entry is a no-op -- so it is safe to run after every batch. batch-runner.sh now calls it from merge_tracker(), between the tracker merge and the integrity check. Also exposed as `npm run reconcile` for standalone use, and covered by test-all.mjs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds a pipeline reconciliation workflow that synchronizes ChangesPipeline Reconciliation Feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@batch/README.md`:
- Line 74: Update the README line describing reconcile-pipeline.mjs to reflect
that the script reconciles both "completed" and "skipped" entries (not just
"completed") when report metadata exists: mention reconcile-pipeline.mjs (run as
npm run reconcile) moves every `completed` and `skipped` offer in
`batch-state.tsv` whose URL remains in pipeline "Pendientes" to "Procesadas"
with its report link and score, and note it is idempotent and safe to run after
every batch or manually.
In `@reconcile-pipeline.mjs`:
- Around line 42-48: User-supplied --pipeline/--state paths (used to read/write
files via PIPELINE_FILE and STATE_FILE) can perform path traversal or target
files outside the repository; validate and constrain them to the repo root
(CAREER_OPS) by resolving the provided argValue with path.resolve, then verify
the resolved path is inside CAREER_OPS (e.g., via path.relative or startsWith)
and reject or error if it escapes (absolute paths that are not under CAREER_OPS
or any path containing .. that resolves outside). Also ensure missing parent
directories are handled explicitly for writes (create or fail with a clear
error) and apply the same validation logic for other occurrences noted at lines
~262-263 where argValue is used.
- Around line 233-236: The added block always inserts the Spanish header '##
Procesadas' which mixes languages; change it to choose the processed-section
header based on the language already used in the document (inspect the existing
headers in the out array). Replace the hardcoded '## Procesadas' with a computed
header (e.g., processedHeader) determined by checking for English markers like
'## Pending' (use '## Processed') or Spanish markers like '## Pendientes' (use
'## Procesadas'); then push processedHeader, '' and ...movedProcLines instead of
the fixed string. Ensure you reference procStart, movedProcLines and out when
implementing this detection and insertion.
🪄 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: d990d6dd-b8c6-4b2c-b258-3b9c04a49b6a
📒 Files selected for processing (5)
batch/README.mdbatch/batch-runner.shpackage.jsonreconcile-pipeline.mjstest-all.mjs
- reconcile-pipeline.mjs: constrain user-supplied --state/--pipeline paths to the repository tree. A path that escapes via `..` or an absolute target outside the repo is now rejected before any read or write, closing a path-traversal vector. - reconcile-pipeline.mjs: when creating a missing processed section, match the pending section's language -- `## Processed` for English pipelines, `## Procesadas` for Spanish -- instead of always writing the Spanish header. - batch/README.md: note the script reconciles `skipped` entries too (not just `completed`), and that entries without a report file on disk are left in place. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Empty commit to fire a `pull_request` (synchronize) event so the file-based workflows — Tests and Dependency Review — run now that workflows are enabled on the fork. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
|
Closing — this fork PR served as the pre-merge check stage (CodeRabbit, CodeQL, and the test suite all passed here). The fix is now submitted upstream as santifer#712, and any further review feedback will be handled there. |
Problem
batch-runner.shrecords every evaluated offer inbatch/batch-state.tsv, but it never writes back todata/pipeline.md. Offers processed via batch mode therefore stay in the pipeline "Pendientes" inbox indefinitely.On the next
scanor/career-ops pipelinerun those entries get re-surfaced and evaluated a second time — producing duplicate reports and duplicate tracker rows. For anyone running batch regularly, the inbox never drains.Fix
New script
reconcile-pipeline.mjs:batch-state.tsv; for everycompleted/skippedentry whose URL is still inpipeline.md"Pendientes", moves that line to "Procesadas" with its report link, score and PDF flag.failedentries stay in "Pendientes" (they were not evaluated); if a report file is missing on disk the entry is left in place rather than writing a dead link.**Score:**header whenbatch-state.tsvhas no parsed score.batch-runner.shcalls it frommerge_tracker(), between the tracker merge and the integrity check. Also exposed asnpm run reconcilefor standalone/manual use.Testing
test-all.mjsnow covers the new script (syntax + graceful-run on empty data); full suite green (73 passed, 0 failed).batch-state.tsv+pipeline.md→ the matching entry moves to "Procesadas" with the correct report link/score/PDF; a second run reports "already in sync".Notes
pipeline.mdtopipeline.md.pre-reconcile.bakbefore writing.Pendientes/ProcesadasandPending/Processedsection headers.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
npm run reconcilecommand available for manual pipeline synchronization.Documentation
Tests