Repository navigation
fix(automation): prevent duplicate local Reddit runs - #112
Merged
Merged
Conversation
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.
Summary
Root cause
Task Scheduler and the Startup catch-up launcher are independent authorities. Task Scheduler's
IgnoreNewpolicy does not protect the Startup path, and both converge on an unversioned guard without cross-process exclusion. The main runner also performed Git reset/checkout operations before its transaction snapshot, which could discard pre-existing local data.After
sync_assets, the runner restores final canonical non-Reddit bridges. Without regeneratingrun_manifest.jsonand checking canonical freshness after that restore, publication could retain pre-restore provenance and recreate the false-green freshness class fixed remotely by PR #111.Changes
automation/run_reddit_baseline_guarded.ps1automation/run_reddit_baseline.ps1automation/reddit_output_transaction.psm1tests/test_local_reddit_runner.pyFinal pre-push validation
python -m pytest tests/test_local_reddit_runner.py -q— 11 passed.python -m pytest— 247 passed; one existing PanderaFutureWarning.ruff check tests/test_local_reddit_runner.py— passed.bandit -r backend scripts -x **/__pycache__/** -ll— passed; 8,932 lines scanned, zero issues.detect-secrets-hook --baseline .secrets.baseline -- <candidate files>— passed.git diff --check— passed.Final metadata order
home_highlights.jsonfrom final bridges.frontend/assets/data/run_manifest.jsonwith the existing final-bridge generator.The local runner publishes only
frontend/assets/data; the remote aggregate root is not generated here.run_manifest.jsonwas already part of the existing exact-file transaction snapshot.Review-size exception
This is one atomic safety unit with 715 changed lines. The 261-line guarded runner must be versioned so the fix is reproducible, and the tests cover the required lock, data-preservation, provenance, freshness, and rollback boundaries. Separating the shared entry point from its caller, transaction boundary, or regression proof would leave an independently unsafe slice. No unrelated formatting or refactor is included.
Controlled post-merge operation
After merge, install the exact merged bytes of the three versioned automation files into the local automation clone without
git pull, reset, checkout, clean, or broad cleanup. Verify Task Scheduler still targetsautomation/run_reddit_baseline_weekly.cmd; only then remove%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\TechnologyTrend-RedditBaselineCatchupOnLogon.cmd. The ignored on-logon wrapper may remain inert.Out of scope