Report a project's flag code references
Code Mode: praxis.devops.projects.flags.reportCodeRefs
HTTP: POST /devops/v1/projects/{project}/flags/code-refs
Store one code-reference scan for a project in a single call: send the commit the scan read (scannedCommit, the checkout’s git rev-parse HEAD) and, for every flag key the scan knows, the places code reads it ({path, line, snippet}). Send every key the checkout still expects to be referenced, including the ones found nowhere: a project flag with no entry in refs is stored with zero references, and zero is what lets archive see the code that named the flag is gone. A key that matches no live flag of the project — one already archived, or from another project — is returned in unknownKeys and stores nothing; reporting it is not an error. updated is how many flags were written, which is every live flag of the project because each gets a row. This is the write side of the archive gate: POST /v1/flags/{id}:archive refuses with FLAG_STILL_REFERENCED while the stored count is above zero, and the count it reads is exactly the one stored here. Staleness is not corrected for — the stored scannedCommit and count are used as they stand. At most 500 references are stored per flag; a longer list is truncated for storage while count still reports the true number. Reporting changes no flag’s runtime behaviour.
Signature
praxis.devops.projects.flags.reportCodeRefs(args:{path:{/** e.g. "dvp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ project:string};body:{/** The commit this scan read, from `git rev-parse HEAD` in the reporting checkout; it is stored as each flag's codeRefs.scannedCommit, so a value older than the cu e.g. "4f2a9c1d8e7b6a5c4d3e2f1a0b9c8d7e6f5a4b3c" */ scannedCommit:string;/** One entry per flag key this scan judged. */ refs:Array<{/** The flag key this entry counts, matched against the project's live flags by key; a key matching none is returned in the answer's unknownKeys and stores nothing. e.g. "run-page-v2" */ flagKey:string;/** The places this scan found the key read. */ items:Array<{/** Path of the file that reads the key, relative to the checkout root; it is what a later flag review opens to delete the reference. e.g. "services/agent/src/run-page.ts" */ path:string;/** One-based line number in path at which the key is read. e.g. 42 */ line:number;/** The trimmed text of that line, capped by the reporter, so a reviewer can tell which read this is without opening the file. e.g. "const runPageV2 = flags.bool(\"run-page-v2\");" */ snippet:string}>}>}}):Promise<{/** How many live flags of the project this call wrote; every live flag gets a row, including the ones written with zero references. e.g. 12 */ updated:number;/** Reported keys that match no live flag of the project — a key already archived, or one from another project. */ unknownKeys:Array<string>}>;Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| project | path | string | yes | Identifies the project whose data you are reading, from the project list or create answer. |
Request body
| Required | Content types | Description |
|---|---|---|
| yes | application/json |
Responses
| Status | Content types | Description |
|---|---|---|
| 200 | application/json | How many flags this call wrote (updated), and the reported keys that match no live flag of the project (unknownKeys). |
| 400 | application/json | INVALID_PARAMS or INVALID_ARGUMENT means a field, query value or identifier violates the documented format or range — an unknown enum value, a pageSize outside 1..100, an unsupported filter or orderBy field, or an id with the wrong prefix. Correct the named input; nothing was read or written. |
| 401 | application/json | The API key is missing or invalid; send a valid Praxis API key in the Authorization header before retrying. |
| 403 | application/json | The credential carries no organization, or that organization cannot reach this project; use a key belonging to the project’s organization. No cross-organization read is possible. |
| 404 | application/json | PROJECT_NOT_FOUND means no project with that id is visible to this organization; list the projects and use an id from that answer. |
| 500 | application/json | INTERNAL means the service could not complete the request; retry once, and if it repeats report the request id. A read is safe to repeat; a write that failed this way should be re-read before it is sent again. |