Skip to content

refactor(coordinator): give state archive downloads an HTTP owner - #1032

Closed
Gajesh2007 wants to merge 11 commits into
refactor/coordinator-release-apifrom
refactor/coordinator-state-archive
Closed

Gajesh2007 wants to merge 11 commits into
refactor/coordinator-release-apifrom
refactor/coordinator-state-archive

Conversation

@Gajesh2007

@Gajesh2007 Gajesh2007 commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

The state archive endpoint mixed authentication, environment gates and streaming in api.Server. api/statearchive.Controller now owns that HTTP operation, with separate configuration and byte-counting code. api/state_archive.go supplies current admin credentials, logger and bearer parsing. The existing stateexport package still owns snapshot consistency, ZIP generation and age encryption.

Stacked on #1031 (refactor/coordinator-release-api).

Before

flowchart TD
  A[GET state-export] --> B[Server.handleAdminStateExport]
  B --> C{Feature, admin key and output protection}
  C -->|reject| D[404, 403 or 412 before archive bytes]
  C -->|allow| E[Validate recipient; Archiver.Stage]
  E -->|failure| F[500 before headers]
  E -->|ready| G[200; ZIP through age and counting writer]
  G --> H[Flush encryption; log result; clean staging]
Loading

After

flowchart TD
  A[Same GET state-export] --> B[statearchive.Controller.Download]
  B --> C{Same gates with current API credentials}
  C -->|reject| D[Same 404, 403 or 412]
  C -->|allow| E[Same recipient validation and Archiver.Stage]
  E -->|failure| F[Same 500 before headers]
  E -->|ready| G[Same 200 and streaming ZIP/age pipeline]
  G --> H[Same flush, logging and deferred cleanup]
Loading

The feature switch precedes authentication. Only the admin key passes the fixed-length digest comparison. Recipient validation and staging finish before committing HTTP headers; cancellation, staged-file cleanup and encryption flush retain their existing order. No route, response, environment name, default, archive format or Server state changes.

The HTTP fixtures stay in api/state_archive_test.go with the same assertions and exact environment values. The pure root-precedence fixture follows the configuration owner. Private production environment constants do not become public APIs for tests.

Validation:

  • All four moved production functions and the moved test match original tokens under explicit dependency bindings. Eighteen renamed API fixture functions preserve their operations after expanding environment constants to their existing values. All 3,514 prior test entries remain; Server fields and five type/value declarations match.
  • All ten API/configuration race cases pass, including actual ZIP extraction, age decryption and a live BoltDB writer. The entire stateexport race suite passes: 13 top-level / 16 including subtests.
  • Pinned golangci-lint 2.1.6: zero issues. Production build and documentation checks pass. Independent source review is clean.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@Gajesh2007

Copy link
Copy Markdown
Member Author

@codex review

@vercel

vercel Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference Ready Ready Preview Sep 14, 2026 7:19pm UTC
d-inference-console-ui-dev Ready Ready Preview Sep 14, 2026 7:19pm UTC
d-inference-landing Ready Ready Preview Sep 14, 2026 7:19pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-14T18:56:22.877799Z b694174 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 71acd3e488

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Gajesh2007

Copy link
Copy Markdown
Member Author

@codex review

Parent refresh at 08730bc171 includes the reviewed #1017 test race fix: retry delays remain at their existing production values, and four tests no longer override shared timing variables. The trust-reuse race suite passes (46 top-level tests; 60 including subtests), plus 40 repeated executions of the failing pair across CPU settings. The propagation was checked against the exact four-file patch. This refresh also carries the already-reviewed #1031 size-specific rejection assertion and release authorization source references.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 08730bc171

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/developer/test.md Resolved
@Gajesh2007

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 53f3097101

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/developer/test.md Resolved
@Gajesh2007

Copy link
Copy Markdown
Member Author

@codex review

Please review current head 57814037a. The reviewed documentation corrections and dependent source maps are published; all 280 documentation checks pass. This follow-up changes current documentation only.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 57814037ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Gajesh2007

Copy link
Copy Markdown
Member Author

@codex review

Please review current head b6941749e. Runtime-manifest threat coverage and the concrete release code map are corrected and propagated. The CI provider-deletion fixture now uses distinct historical/live reconnect IDs: the original setup deterministically failed 403 instead of 409, the fixed ordering passes, and all seven deletion cases pass under the race detector. Production source is unchanged by this follow-up; all 280 documentation files pass lint.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6941749e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/operations/state-export.md Resolved
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Gajesh2007

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Gajesh2007

Copy link
Copy Markdown
Member Author

Consolidated into #1056 for review and merge after #1094, #1095 and #1096. #1056 contains this branch's exact head (0ee62d67b2e7140d1444aee4f444cdcbd3844714), including its reviewed fixes, with implementations and regressions reconciled into the coordinator subsystem owners. Closing the component PR to collapse the stack; its branch, commits and review history are retained. Follow #1056 for combined validation and merge status.

@Gajesh2007 Gajesh2007 closed this Sep 16, 2026

This branch had an error being deployed

1 failed and 3 active deployments
Preview – d-inference — 0ee62d67 Deployed Sep 14, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — 0ee62d67 Deployed Sep 14, 2026 by vercel[bot]
Preview – d-inference-landing — 0ee62d67 Deployed Sep 14, 2026 by vercel[bot]
benchmarks — 0ee62d67 Deployed Sep 14, 2026 by Gajesh2007 via E2E Benchmarks #1328
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