CXH-3522: set manager, department, location on Ramp account creation #56
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #56"
general
weight: 0.35
c1-squire-dev[bot]
CXH-3522: set manager, department, location on Ramp account creation
Linear: CXH-3522
What was asked
When C1 creates a Ramp account, the connector sent only email, first name, last
name and role — so new Ramp users got no manager, department or location, and
admins filled these in by hand in Ramp after every creation. Location matters
most: in Ramp it decides which entity the user belongs to, so without it users
could not be placed in the right entity at creation time.
This PR lets C1 account creation set the new Ramp user's direct manager,
department, and location — the three optional fields Ramp's
POST /developer/v1/users/deferredaccepts asdirect_manager_id,department_id, andlocation_id(each a Ramp ID, not a name or email).What changed
The approach: human-facing values flow in as three optional account-creation
profile fields (
direct_manager_email,department,location), and theconnector resolves each to a Ramp-validated ID before the create call, so a
value that matches nothing fails creation instead of producing a half-populated
user. Resolution is table-driven in one place (
pkg/connector/account_attributes.go),so the next creation attribute is one table entry, not another hand-rolled block.
pkg/client/org.go(new) +pkg/client/models.go—ListDepartments/GetDepartment/ListLocations/GetLocation(one page per call,page.nexttoken,page_size=100,ramp-client:error prefix) and theirmodel structs, following the existing
ListUsers/ListVendorsshapes.pkg/connector/account_attributes.go(new) — the resolver: manager byemail via the existing
FindUserByEmail(nil → clearInvalidArgument);department/location by Ramp-ID probe (escaped path;
NotFound/InvalidArgumentfalls through to a bounded, ctx-checked, case-insensitive name walk with a
50-page cap; >1 exact name match → ambiguous-value error listing candidates);
one
unresolvedAttrErrorhelper gives every failure the same shape — field,value, what was tried, what to do — at
codes.InvalidArgumentwith theramp-connector:prefix. Upstream 403/5xx propagate with their own gRPCcodes (a missing scope is never misreported as "no match"), and rate-limit
metadata from resolution lookups reaches the annotations on success and
error paths.
pkg/connector/users.go—CreateAccountresolves attributes after theunchanged
AlreadyExistsResultshort-circuit and beforeCreateUser; theuserBuildercarries the flag viaWithProvisioningAttributes.pkg/client/users.go—CreateUserRequestgainsdepartment_id/direct_manager_id/location_idas*string+omitempty: absentfields marshal out of the JSON body entirely, so creations without these
values send a byte-identical request to today's.
pkg/config/config.go+ regeneratedconf.gen.go/config_schema.json—opt-in
provisioning-attributesbool field (both auth-method groups,default off),
WithDisplayNameper repo rules.cmd/baton-ramp/main.go—departments:read/locations:readareappended to the OAuth scope request only when the flag is on (the repo's
own
audit-log-eventsprecedent; keeps every existing install's tokenrequest unchanged — new required scopes would be a breaking change).
baton_capabilities.jsonregenerated unchanged.specs/openapi.json+specs/openapi-provenance.json— the six touchedoperations copied verbatim from the official Ramp developer API spec
(accessed 2026-10-28) with a provenance table.
README.md(scopes + flag + the three profile keys),docs/connector.mdx(scope tables for both auth methods + account-creationattributes section),
docs/api-support-matrix.md(the three deferred-createrows flipped to Exposed; four GET departments/locations rows added).
pkg/client/org_test.go(pagination throughpage.next,page_size=100, 404 error paths), resolver table tests (flag-off zero calls,page cap, 400-probe fall-through, ambiguity, 403 propagation, non-string
values), and 8 new
CreateAccountintegration cases asserting the decodedPOST body carries the resolved IDs and that every fail-closed path performs
zero calls to
users/deferred.Acceptance criteria
1. An admin can configure account creation to set manager, department and
location — three optional profile fields, documented, plus the opt-in
provisioning-attributesflag that requests the read scopes. ✅2. The new Ramp user is created with those values — resolved Ramp IDs are
asserted in the decoded
POST /developer/v1/users/deferredbody. ✅3. A value that matches nothing fails creation with a clear error — every
unresolvable/ambiguous/flag-off-but-set path returns
codes.InvalidArgumentnaming field and value, with zero create calls asserted by test. ✅
4. Accounts created without these values keep working as today — flag
defaults off, absent fields are omitted from the wire body, zero lookup
calls,
AlreadyExistsResultshort-circuit unchanged. ✅5. The connector docs describe the new fields and the extra Ramp setup —
README + connector.mdx + api-support-matrix updated, including the
departments:read/locations:readscope grant the feature needs. ✅How far this is verified
fix-now items applied as commits, re-reviewed to SHIP) and the connector
rulebook's mechanical checks are clean.
go build/go vet/ targetedgo testare green on all changed packages(
pkg/client,pkg/connector,pkg/config,cmd/baton-ramp); the builtbaton-rampbinary builds and starts (smoke: PASS, partial — the repodeclares no mock of its own, so the smoke gate did not exercise a sync).
mock of the Ramp API authored from the official docs — sync output identical
to
main(0 lost / 0 gained resources, entitlements, grants), no new staticfindings.
findings, sync replayed against the batch-authored Ramp mock.
pass addressed its lint findings and implemented both of its suggestions:
the account-creation schema fields are now added only when the flag is on,
and the new scopes have their own documented lead-in).
work) read the PR cold, raised 1 docs-only nit (README flag ordering), which
was fixed; its second cold pass found 0 findings and verified the fix. All
of its review threads are answered and resolved.
branch, verdicts all five of the issue's acceptance criteria WORKS —
including a live probe of account creation against a mock Ramp API (values
resolved by name and by Ramp ID; a value matching nothing fails creation
with a clear error and creates no user).
a missing department/location ID is taken from the official OpenAPI spec
(400 on invalid item GETs) rather than a live Ramp response — the resolver
treats both
NotFoundandInvalidArgumentfrom the ID probe as "try it asa name", so either vendor behavior lands in the same fail-closed path.
What to look at hardest
pkg/connector/account_attributes.go— the resolution contract(flag-off guard, probe-then-name-walk, ambiguity, page cap) is where every
acceptance criterion lives; the tests assert it path by path.
cmd/baton-ramp/main.go— confirm the flag-off pathleaves
baseRampOAuthScopesuntouched.pkg/connector/users.goordering —AlreadyExistsResultmust staybefore resolution so a re-run for an existing user never re-resolves
attributes.
specs/openapi.json— copied from docs.ramp.com; confirm the sixoperations match what Ramp serves today.
present on the base commit (vendored; no delta introduced by this PR).