Skip to content

fix: resolve config fields by id fallback#146

Closed
kocaemre wants to merge 3 commits into
1Password:mainfrom
kocaemre:fix/load-field-id
Closed

fix: resolve config fields by id fallback#146
kocaemre wants to merge 3 commits into
1Password:mainfrom
kocaemre:fix/load-field-id

Conversation

@kocaemre

Copy link
Copy Markdown

Summary

  • Resolve load_dict and load opfield lookups by field label first, then by field ID as a fallback.
  • Preserve existing section label/ID matching behavior.
  • Document the label-first, ID-fallback lookup behavior in USAGE.md.
  • Add regression coverage for load_dict, load, and label-vs-ID collision precedence.

Why

opfield currently only matches field.label, so configurations cannot reference stable 1Password field IDs when labels differ or are user-facing. This adds the fallback requested in #50 while keeping label lookup precedence for backwards compatibility.

Fixes #50.

Test plan

  • Added regression tests and confirmed RED failures before the implementation:
    • test_load_dict_resolves_field_by_id_when_label_differs
    • test_load_resolves_field_by_id_when_label_differs
  • python3 -m pytest src/tests/test_config.py -q — 6 passed
  • python3 -m pytest src/tests -q — 55 passed, 1 existing pytest warning
  • python3 -m py_compile src/onepasswordconnectsdk/config.py src/tests/test_config.py
  • git diff --check

@github-actions

Copy link
Copy Markdown

⚠️ This PR contains unsigned commits. To get your PR merged, please sign those commits (git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}) and force push them to this branch (git push --force-with-lease).

If you're new to commit signing, there are different ways to set it up:

Sign commits with gpg

Follow the steps below to set up commit signing with gpg:

  1. Generate a GPG key
  2. Add the GPG key to your GitHub account
  3. Configure git to use your GPG key for commit signing
Sign commits with ssh-agent

Follow the steps below to set up commit signing with ssh-agent:

  1. Generate an SSH key and add it to ssh-agent
  2. Add the SSH key to your GitHub account
  3. Configure git to use your SSH key for commit signing
Sign commits with 1Password

You can also sign commits using 1Password, which lets you sign commits with biometrics without the signing key leaving the local 1Password process.

Learn how to use 1Password to sign your commits.

Watch the demo

@kocaemre

Copy link
Copy Markdown
Author

Closing this because this repository requires commits to be signed by a GitHub-recognized signing key, and I do not currently have a signing key registered for this account in this environment. I do not want to leave an unmergeable PR open. The implementation remains available on the branch if useful.

@kocaemre kocaemre closed this Jul 26, 2026
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.

load_dict and load work with field id and label

1 participant