🧹 Refactor DatabaseWriter to use Dependency Injection - #10
🧹 Refactor DatabaseWriter to use Dependency Injection#10alfieprojectsdev wants to merge 1 commit into
Conversation
Co-authored-by: alfieprojectsdev <11991855+alfieprojectsdev@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Understood. Acknowledging that this work is now obsolete due to ongoing refactoring and conflicts. Stopping work on this task. |
…(RH-002) LinuxBPEBackend hardcoded PCF_FILE=RNX2SNX / CPU_FILE=PCF, so it could only drive the stock demo PCF — never PAGENET, the real workflow proven headless in the NAMRIA training week. Closes readiness gaps #3 and #10. - Constructor: pcf_file (RNX2SNX), cpu_file (USER — the shipping USER.CPU, not the phantom PCF.CPU), driver_script, max_par. run() exports the parameterized PCF_FILE/CPU_FILE/BPE_CAMPAIGN and passes the PCF as argv[2] for pagenet_pcs.pl-style drivers; stock rnx2snx_pcs.pl ignores it. Defaults preserve the previous stock contract. - compute_maxpar(n_sta) = max(1000, n_sta*4 + 500) + _count_crd_stations(); run() auto-sizes MAXPAR from the campaign CRD (or max_par override) and exports it as a BPE variable. Left unset when uncomputable so the panel default stands. Panel-template wiring is RH-004 / readiness task B. - test_backends.py +10 (maxpar bounds, CRD count, env-var flow, default preservation). 75 pass, ruff + mypy clean.
🎯 What:
Refactored
DatabaseWriterinservices/vadase-rt-monitorto use dependency injection for configuration.DatabaseConfigclass insrc/config.pyusingpydantic.DatabaseWriterto acceptDatabaseConfiginstance.scripts/run_ingestor.pyandscripts/replay_events.pyto instantiate and pass config.tests/test_database_config.pyto verify behavior.💡 Why:
To improve testability and decouple the database writer from environment variables. This makes it easier to mock configuration during tests and supports different configurations (e.g. for testing vs production) without relying on global state.
✅ Verification:
tests/test_database_config.py.ruffto ensure code style.✨ Result:
The
DatabaseWriteris now more testable and follows the dependency injection pattern.PR created automatically by Jules for task 3487589831144081028 started by @alfieprojectsdev