Repository navigation
test: use example account IDs and allow only example IDs in CI - #1528
LeeroyHannigan wants to merge 2 commits into
Conversation
…D tests The role ARNs of crates/auth/src/policy/arn_value/tests.rs held a non-example AWS account ID. #751 replaced the same ID with 444455556666 on 2 November 2026, and #692 added it again on 10 November. The tests now use 444455556666, and a comment above ROLE_ARN says so. The truncated ARN `arn:aws:iam::4444` replaces the one built from the old ID's first four digits, in the tests and in the doc comment of arn_value.rs. It is still a prefix of the role ARN. The Cassandra keyspace tests in crates/storage-cassandra/src/bootstrapper.rs and crates/storage-cassandra/tests/migrations.rs named an account keyspace with another non-example ID. They now use 111122223333. The "12 bare digits" case of the backup ID tests in crates/storage/src/util/backup_id.rs is now 123456789012.
devtools/check-account-ids fails when a file of the repository holds an AWS account ID that is not an example ID. The Account IDs workflow runs it on pull requests, merge groups and pushes to main, in the runner group of the required checks. An account ID is a run of exactly 12 digits with no letter or digit next to it, outside a UUID. Twelve digits in three groups of four also count. These IDs pass: - 123456789012, the example ID of the AWS documentation, and the other IDs in EXAMPLE_IDS that the tests use - twelve equal digits, three groups of four equal digits (the form of the other documented example IDs), and six leading zeros - the project's publishing account, in .github/workflows/ The check skips the data files that released builds and migration runs wrote under crates/*/tests/fixtures/released/ and golden/, which hold random account IDs. It prints only the last four digits of an ID that it refuses, so a CI log does not repeat the ID. Its self-test runs first. On origin/main the check finds 19 lines, all of which the previous commit changes. Of the open pull requests, it refuses an ID in #523.
LJMart11
left a comment
There was a problem hiding this comment.
Reviewed at 275405b. 1 finding: 1 Docs.
The change swaps three non-example account IDs in the ARN value, Cassandra keyspace and backup ID tests for example IDs, and adds devtools/check-account-ids with a workflow that runs it in CI. Confirmed: the check passes on this head (1,677 files) and refuses 19 lines on the base; its self-test passes on Python 3.7, 3.9 and 3.12; 11 of 13 forced mutations of its matching and allow rules fail the self-test, and the other 2 (the 100000000000 entry and --others) either make the check stricter or affect only untracked local files; the ARN value tests still compare against ROLE_ARN (pointing it at another account fails matcher_matches_what_the_service_matched at tests.rs:162). The auth and storage crates' tests pass (876), and so do the 4 changed Cassandra keyspace tests against a live node. The base has not moved since the branch point.
- Docs
PR description— The body and commit 275405b say one open PR (#523) fails the new check; #530 and #537 carry the same line, so three do.
Docs — outside the diff
PR description
Docs
The body says "Open PRs: of 227, the check refuses an ID in one", and commit 275405b says "it refuses an ID in #523". When the check's rules are applied to the lines each of the 227 open PR heads adds since its merge base, they refuse an ID in three: #523, #530 and #537. All three add the same line to docs/install-from-source.md (ID ending in 5100), because #530 and #537 contain #523's commit af9567b. So the three fail together and clear together once #523 uses an example ID.
Fix: name #530 and #537 next to #523 in the body.
Evidence: git merge-base --is-ancestor refs/reviewer/pr-523 refs/reviewer/pr-530 (and pr-537) both succeed; the per-PR scan printed pr-523, pr-530 and pr-537, each with ('docs/install-from-source.md', '5100').
navareamol
left a comment
There was a problem hiding this comment.
The check is correct on the cases the description lists. I ran it on the head, on the head merged with current main (1,692 files) and on main (19 findings, all in files this PR changes), and six deliberate breaks of the script each fail the self test. Three smaller things.
I think the check will fail a later PR that has no account ID in it. A test constant of 549755813888 (2^39) or 274877906944 is reported as "account ID ending in ... is not an example ID". The only ways out are to change the number or to add it to EXAMPLE_IDS. Could the check accept a marker on the line, or could the failure text say how to keep a number that is not an account ID?
A file with one byte that is not UTF-8 is skipped whole and is not counted in "Files checked". A text file with a latin-1 byte on one line and an ID on another gives no finding here. Could read_text decode with replacement characters, and keep skipping files that hold a NUL byte?
The comment above the measured rows in arn_value/tests.rs still says the patterns were measured with DescribeTable on 2026-10-30, but the strings are now 4444 and 444455556666, which were not sent. Could you add that the account digits were substituted?
I will approve once the second point is fixed or answered, and the first is handled or the failure text explains the way out.
What
This PR removes two non-example AWS account IDs from the tests. It also adds a check that fails CI when a tracked file holds an account ID that is not an example ID.
The tests:
crates/auth/src/policy/arn_value/tests.rsuses444455556666in its role ARNs, and a comment aboveROLE_ARNsays so. The truncated ARNarn:aws:iam::4444replaces the one built from the old ID's first four digits, in the tests and in the doc comment ofarn_value.rs. It is still a prefix of the role ARN.crates/storage-cassandra/src/bootstrapper.rsandcrates/storage-cassandra/tests/migrations.rsuse111122223333.crates/storage/src/util/backup_id.rsis123456789012.The check,
devtools/check-account-ids, with a self-test. The new Account IDs workflow runs it on pull requests, merge groups and pushes to main, in the runner group of the required checks. An account ID is a run of exactly 12 digits with no letter or digit next to it, outside a UUID. Twelve digits in three groups of four also count. These IDs pass:123456789012, the example ID of the AWS documentation, and the other IDs inEXAMPLE_IDSthat the tests use.github/workflows/The check skips the data files that released builds and migration runs wrote under
crates/*/tests/fixtures/released/andgolden/, which hold random account IDs. It prints only the last four digits of an ID that it refuses, so a CI log does not repeat the ID.Why
#751 replaced a non-example account ID with
444455556666on 2 November 2026. #692 added the same ID again on 10 November, in the ARN value tests. A check in CI stops the next occurrence before it merges.Testing done
devtools/check-account-ids --selftestpasses on Python 3.12 and 3.7. The check passes on this branch, on 1,677 files. On origin/main it finds 19 lines, all of which this PR changes.cargo test -p extenddb-auth --lib: 539 passed.cargo test -p extenddb-storage backup_id: 5 passed.cargo test -p extenddb-storage-cassandra --lib destroy_keeps: 1 passed. The Cassandra integration tests intests/migrations.rsneed a live node, so CI runs them.cargo fmt --all -- --check,actionlintanddevtools/check-actions-pinnedpass.initrun todocs/install-from-source.md. That PR needs an example ID before it can merge after this one.Checklist
cargo test --workspace)cargo fmt --check)cargo clippy -- -W clippy::pedantic)Storagetrait, auth model, on-diskformat, or public CLI surface, an RFC has been accepted or is linked
below. Otherwise, an ADR captures the decision (link below).
ADR / RFC: n/a
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.