Skip to content

feat(driver_cfg): add DriverCfg base for tool config sections - #20

Merged
MrKevinWeiss merged 2 commits into
masterfrom
feat/driver-cfg
Sep 23, 2026
Merged

MrKevinWeiss merged 2 commits into
masterfrom
feat/driver-cfg

Conversation

@MrKevinWeiss

Copy link
Copy Markdown
Collaborator

A DriverCfg holds exactly one driver's constructor keyword arguments, so a config section can be declared next to the tool it describes and handed to that tool with as_kwargs(). None is dropped at every layer, keeping the "None means use the known default" contract the drivers rely on.

The extra dict is the escape hatch for driver options a config has not been taught yet and for one-off debugging sessions. It is merged key by key, so an unknown key raises TypeError from the driver constructor rather than being silently swallowed.

Lives in lob-hlpr because it has no install requirements, which keeps lob-cfg out of the driver repositories that will declare sections.

A DriverCfg holds exactly one driver's constructor keyword arguments, so a
config section can be declared next to the tool it describes and handed to
that tool with as_kwargs(). None is dropped at every layer, keeping the
"None means use the known default" contract the drivers rely on.

The extra dict is the escape hatch for driver options a config has not been
taught yet and for one-off debugging sessions. It is merged key by key, so an
unknown key raises TypeError from the driver constructor rather than being
silently swallowed.

Lives in lob-hlpr because it has no install requirements, which keeps lob-cfg
out of the driver repositories that will declare sections.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@MrKevinWeiss
MrKevinWeiss requested a lite review from Copilot September 21, 2026 13:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 2 Medium severity

Open (2)
What changed in this PR

Adds a reusable DriverCfg dataclass for representing driver constructor keyword arguments, filtering unset values, and exposing configuration through the package API.

Changes:

  • Adds DriverCfg.as_kwargs() with declared-field, extra, and override precedence.
  • Adds tests covering defaults, precedence, mutable defaults, and driver construction.
  • Exports DriverCfg from lob_hlpr.
File Description
src/​lob_hlpr/​driver_cfg.py Implements the driver configuration base class and keyword assembly.
src/​lob_hlpr/​__init__.py Makes DriverCfg part of the public package API.
tests/​test_driver_cfg.py Tests configuration serialization and precedence behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/lob_hlpr/driver_cfg.py Outdated
Comment thread src/lob_hlpr/driver_cfg.py Outdated
Review findings on #20, both real.

extra carried a default and came first, so a subclass could not declare a
driver argument without one: the dataclass raised "non-default argument
follows default argument". It is keyword only now, which is what Cfg already
does for its own extra and source.

The extra layer skipped the None filtering the other two layers apply, so
extra={"timeout": None} reached the driver and overrode its default or its
autodiscovery, which is exactly what the "None means use the known default"
contract exists to prevent.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@MrKevinWeiss
MrKevinWeiss merged commit 5244302 into master Sep 23, 2026
6 checks passed
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.

2 participants