Skip to content

add-bank/add-user: add check for existing DB structure when trying to add a bank or association#810

Merged
mergify[bot] merged 4 commits intoflux-framework:masterfrom
cmoussa1:issue#809
Jan 28, 2026
Merged

add-bank/add-user: add check for existing DB structure when trying to add a bank or association#810
mergify[bot] merged 4 commits intoflux-framework:masterfrom
cmoussa1:issue#809

Conversation

@cmoussa1
Copy link
Member

Problem

As noted in #809, flux-accounting requires a bank hierarchy structure in which sub-banks cannot be added to a parent bank that already has associations in it (and vice versa; associations cannot be added to a bank that
already has sub-banks in it), but there is no check for this hierarchy structure when calling add-bank or add-user.


This PR adds a check in add_bank() and add_user() that the bank or association being added is valid and complies with the hierarchy structure for flux-accounting; if not, it raises an error. Existing tests that did not follow this structure have also been adjusted to comply and are adjusted in the first commit. Documentation has also been updated to leave a warning to readers about the assumptions of the structure of banks and associations in flux-accounting.

Fixes #809

Problem: There are tests in the test suite that assume a database
hierarchy that is invalid (i.e. sub-banks that exist at the same level
as associations and vice versa).

Adjust the unit tests in t1002_user_cmds.py (namely, the structure of
sub-banks) and t1017-update-db.t to comply with restrictions on how a
database hierarchy can be structured in flux-accounting.
Problem: flux-accounting requires a bank hierarchy structure in which
sub-banks cannot be added to a parent bank that already has associations
in it (and vice versa; associations cannot be added to a bank that
already has sub-banks in it), but there is no check for this hierarchy
structure when calling add-bank or add-user.

Add a check in add_bank() and add_user() that the bank or association
being added is valid and complies with the hierarchy structure for
flux-accounting; if not, raise an error.
Problem: There are no tests that check an error is raised when trying to
add a bank or association in a way that violates the flux-accounting
bank hierarchy structure.

Add some tests.
Problem: There is no mention of how flux-accounting assumes a certain
structure regarding its assumed arrangement of banks, sub-banks,
associations, and their relation with each other.

Add a warning to the "Database Administration" section that mentions how
banks cannot be added to a parent which already has associations, and
vice versa.
@cmoussa1 cmoussa1 added documentation improvements or additions to documentation improvement upgrades to an already existing feature commands related to the flux-accounting commands/bindings labels Jan 27, 2026
Copy link
Member

@jameshcorbett jameshcorbett left a comment

Choose a reason for hiding this comment

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

nice!

@cmoussa1
Copy link
Member Author

Thanks @jameshcorbett! Setting MWP

@mergify mergify bot added the queued label Jan 28, 2026
@mergify mergify bot merged commit 7f0c0a4 into flux-framework:master Jan 28, 2026
15 of 16 checks passed
@mergify
Copy link
Contributor

mergify bot commented Jan 28, 2026

Merge Queue Status

✅ The pull request has been merged at 6c7cfff

This pull request spent 7 seconds in the queue, with no time running CI.
The checks were run in-place.

Required conditions to merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = coverage
    • check-neutral = coverage
    • check-skipped = coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = el8 - distcheck
    • check-neutral = el8 - distcheck
    • check-skipped = el8 - distcheck
  • any of [🛡 GitHub branch protection]:
    • check-success = el8 - py3.6
    • check-neutral = el8 - py3.6
    • check-skipped = el8 - py3.6
  • any of [🛡 GitHub branch protection]:
    • check-success = jammy - py3.6
    • check-neutral = jammy - py3.6
    • check-skipped = jammy - py3.6
  • any of [🛡 GitHub branch protection]:
    • check-success = spelling
    • check-neutral = spelling
    • check-skipped = spelling
  • any of [🛡 GitHub branch protection]:
    • check-success = python format
    • check-neutral = python format
    • check-skipped = python format
  • any of [🛡 GitHub branch protection]:
    • check-success = python lint
    • check-neutral = python lint
    • check-skipped = python lint
  • any of [🛡 GitHub branch protection]:
    • check-success = validate commits
    • check-neutral = validate commits
    • check-skipped = validate commits

@mergify mergify bot removed the queued label Jan 28, 2026
@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.93%. Comparing base (3bc9503) to head (6c7cfff).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #810   +/-   ##
=======================================
  Coverage   82.93%   82.93%           
=======================================
  Files          27       27           
  Lines        2479     2479           
=======================================
  Hits         2056     2056           
  Misses        423      423           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands related to the flux-accounting commands/bindings documentation improvements or additions to documentation improvement upgrades to an already existing feature merge-when-passing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support for banks that have users and banks as children

2 participants