Skip to content

docs(dev): fix stale structure.md and document drapi client conventions - #879

Draft
ajalon1 wants to merge 9 commits into
datarobot-oss:mainfrom
ajalon1:aj/update-agents-and-bugbot-for-workload
Draft

docs(dev): fix stale structure.md and document drapi client conventions#879
ajalon1 wants to merge 9 commits into
datarobot-oss:mainfrom
ajalon1:aj/update-agents-and-bugbot-for-workload

Conversation

@ajalon1

@ajalon1 ajalon1 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

RATIONALE

workload and auth have absorbed most of the last two months' commit volume, but the dev docs a new contributor actually browses hadn't kept up — structure.md still showed a directory tree and a config.GetAPIKey()/SetAPIKey()/SaveConfig() code sample that no longer exist (and contradicts the correct pattern already documented in configuration.md), and internal/drapi's conventions (timeout clamping, the HTTPError/errors.As contract, origin-safety before attaching credentials to a server-supplied URL) lived only in a package doc comment, unlinked from docs/development/.

This closes that gap with pure documentation — no code changes.

A dedicated internal/workload architecture doc is being drafted separately for the Workload API team to review and own, so this intentionally leaves that package's structure.md subsection as a placeholder pending that PR.

CHANGES

  • docs/development/structure.md: add workload/ and auth/ to the directory trees, fix the auth/ worked example to match the current one-subdirectory-per-verb layout, replace the stale Configuration code sample with the real viperx/UpdateConfigFile pattern.
  • New docs/development/drapi-client.md: verb-function convention, timeout clamping, the HTTPError/errors.As contract (including a known Get() vs Post/Patch/Delete detail asymmetry, flagged not fixed), and the origin-safety check before attaching credentials to a server-supplied URL.
  • Cross-link the new doc from authentication.md, docs/development/README.md's Advanced topics, AGENTS.md's new Auth & API Client Conventions section, and a one-line worked-example pointer in .cursor/bugbot-security.md.

- structure.md: add workload/ and auth/ to the directory trees (both were
  missing despite being two of the largest packages in the repo), fix the
  auth/ worked example to match the current one-subdirectory-per-verb
  layout, and replace the Configuration code sample's nonexistent
  config.GetAPIKey/SetAPIKey/SaveConfig calls with the real viperx/
  UpdateConfigFile pattern already documented in configuration.md.
- Add docs/development/drapi-client.md: the dev-doc mirror of
  internal/drapi/doc.go covering the verb-function convention, timeout
  clamping, the HTTPError/errors.As contract (including the known Get()
  vs Post/Patch/Delete detail asymmetry), and the origin-safety check
  before attaching credentials to a server-supplied URL.
- Cross-link the new doc from authentication.md, docs/development/README.md's
  Advanced topics, AGENTS.md's new Auth & API Client Conventions section,
  and a one-line worked-example pointer in .cursor/bugbot-security.md.

A dedicated internal/workload architecture doc is being drafted separately
for review by the Workload API team, so this change intentionally leaves
that package's structure.md subsection as a placeholder pending that PR.
…erns

- Terminal Errors Must Name the Exact Recovery Command
- Retry Safety Must Be Classified by Response Shape, Not Status Code Alone
- Heuristic Detection Must Degrade, Never Refuse
- Duplicated Constants Need a Canonical-Source Comment
- Document Intentional Asymmetry Between Look-Alike Siblings

Each generalizes a pattern observed in real workload/auth/drapi code during
the docs audit for datarobot-oss#879, kept domain-agnostic per the existing bugbot rule
style.
Today's countflags migration (CFX-7834, datarobot-oss#858/datarobot-oss#859/datarobot-oss#860) is documented in
docs/development/flags.md but had no reviewer-facing rule — a new count-like
flag validated in RunE instead of at parse time would sail through review.
Adds the parse-time-validation rule plus its documented exception (0 as a
"use default" sentinel, per the workload config --port/--replicas precedent).
Broadens "count-like flags validate at parse time" to any flag shape that
recurs across commands or shares a validation requirement wherever it
appears — not just counts. countflags and pollflags are cited as the two
existing precedents (counts, durations); the point is catching a third
command re-implementing the same check by hand instead of reusing one of
these or adding a new shared pflag.Value.
Codifies the pattern already present in the codebase: internal/drapi/filesapi
and internal/workload/apiclient are thin typed wrappers built entirely on
drapi's verb functions, while internal/auth/browserflow.go (local OAuth
handshake) and internal/plugin/remote.go (plugin downloads) correctly build
their own plain http.Client because they aren't DataRobot API calls. Adds
both directions of the boundary so a reviewer catches a wrapper duplicating
drapi's plumbing and an unrelated call wrongly forced through it.
Comment thread docs/development/drapi-client.md Outdated
Comment on lines +15 to +17
Worked example: `docs/development/drapi-client.md` — before attaching a bearer token to
a server-supplied URL (pagination cursor, live endpoint), verify it with
`drapi.URLMatchesConfiguredBase()` first.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure I need or want worked examples in the bugbot cursor rules.

Comment thread .cursor/bugbot-cmd.md Outdated
Comment thread .cursor/bugbot-cmd.md Outdated
Comment thread docs/development/structure.md Outdated
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.

1 participant