Skip to content

feat: add account script step coverage (Batch 1)#183

Merged
bc-m merged 2 commits intobc-m:mainfrom
petrowsky:feat/batch1-account-steps
Mar 19, 2026
Merged

feat: add account script step coverage (Batch 1)#183
bc-m merged 2 commits intobc-m:mainfrom
petrowsky:feat/batch1-account-steps

Conversation

@petrowsky
Copy link
Contributor

Summary

Resolves the remaining ⚠️ NOT PARSED ⚠️ warnings for account script steps and
adds a --obfuscate-passwords CLI flag for sanitized output.

New enum variants (constants.rs):

  • ChangePassword = 83
  • AddAccount = 134
  • DeleteAccount = 135
  • ResetAccountPassword = 136
  • EnableAccount = 137
  • ReLogin = 138

New dedicated sanitizers (accounts.rs):

All six account steps are implemented in a single accounts.rs module with
per-step sanitizer functions rather than one file per step. Each function
produces output matching the FileMaker Script Workspace label/format exactly:

Step Key formatting
Add Account Authenticate via:, Account Name:, Password:, Privilege Set:, conditional Expire password
Change Password Old Password:, Password:, With dialog: On|Off
Delete Account Account Name:
Enable Account Account Name:, Activate or Deactivate
Re-Login Account Name:, Password:, With dialog: (DataSourceReference omitted; params reordered from SaXML)
Reset Account Password empty [], or Account Name:, Password:, conditional Expire password

New parameter parser (privilege_set_reference.rs):

  • Reads <PrivilegeSetReference name="..."> with XML-entity unescaping
  • Handles both known sets ([Data Entry Only]) and unknown (<unknown>)

Extended parameter dispatch (parameter_values.rs):

  • AccountType → reuses List parser (inner <List name="...">)
  • Password, Old, New → extended named-calc arm (same as Name, Title, etc.)
  • PrivilegeSetReference → new parser above

New CLI flag (--obfuscate-passwords):

  • Replaces any password calculation value with •••••••• in sanitized output
  • Implemented via calc_or_obfuscated() helper in accounts.rs: returns None
    when no calculation is present, •••••••• when the flag is set and a
    calculation exists, or the real value otherwise
  • Threaded through config::Flagsscript_sanitizersanitizer → account
    sanitizer functions

Before / after (Ooe — Accounts script):

Before: Add Account [ ⚠️ PARAMETER "AccountType" NOT PARSED ⚠️ ; ⚠️ PARAMETER "PrivilegeSetReference" NOT PARSED ⚠️ ; Expire password: OFF ]
After:  Add Account [ Authenticate via: FileMaker ; Account Name: <unknown> ; Privilege Set: <unknown> ; Expire password ]

Before: Change Password [ ⚠️ PARAMETER "Old" NOT PARSED ⚠️ ; ⚠️ PARAMETER "New" NOT PARSED ⚠️ ; With dialog: ON ]
After:  Change Password [ Old Password: $old ; Password: $new ; With dialog: On ]

All unit + snapshot tests pass. cargo fmt and cargo clippy -Dwarnings clean.

Fixes #28

Add enum variants for all 6 account script steps (Add Account, Change
Password, Delete Account, Enable Account, Re-Login, Reset Account
Password) and implement dedicated sanitizers in a single accounts.rs
module. Also adds --obfuscate-passwords CLI flag and fixes three
previously unparsed parameter types:

- AccountType: reuses the existing List parser (<List name="...">)
- PrivilegeSetReference: new parser, reads name attr with XML unescaping
- Password, Old, New: extend the named-calc dispatch arm

All six steps share a single accounts.rs file containing dedicated
per-step sanitizer functions (sanitize_add_account, sanitize_change_
password, etc.) rather than one file per step. Each sanitizer produces
output that matches the FileMaker Script Workspace label/format
exactly, including: "Authenticate via:", "Account Name:", "Old
Password:", "Privilege Set:", Activate/Deactivate mapping for Enable
Account, On/Off for "With dialog", conditional "Expire password" flag,
and empty [] brackets for Reset Account Password.

Re-Login parameters are reordered from SaXML order (DataSourceReference,
With dialog, Name, Password) to Script Workspace order (Account Name,
Password, With dialog); DataSourceReference is omitted from output.

The new --obfuscate-passwords flag replaces any password calculation
value with •••••••• in sanitized output. The flag is implemented via
a calc_or_obfuscated() helper in accounts.rs: returns None when no
calculation is present (regardless of flag), •••••••• when obfuscate
is true and a calculation exists, or the real value otherwise.

Five of the six steps already produced correct output via the generic
handler; this patch eliminates the remaining ⚠️ NOT PARSED ⚠️ markers
from Add Account, Change Password, Re-Login, and Reset Account Password.

Fixes bc-m#28
@petrowsky
Copy link
Contributor Author

If you pull the PR and look at the code you'll probably need to make a decision about whether you want to obfuscate the raw XML as well.

Also, the shared function for obfuscating is within accounts.rs. This might need to be moved to utils so that it could be used for steps like Send Email where you would also want to obfuscate the passwords there.

It's also an architectural decision if you want each step to be it's own file. Using an agent, it just shoved all these into the one accounts.rs file.

@petrowsky
Copy link
Contributor Author

Looks like we could also add a few more of the default items to privilege_set_reference.rs

@bc-m bc-m merged commit df547de into bc-m:main Mar 19, 2026
1 check 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.

☂️ FileMaker script steps

2 participants