Repository navigation
Conversation
Move the pure part of the backup library's model (scrubbing, ids, labels, grouping, the policy, plan and status wording, the settings payload and the target field sets) out of admin_backups.js into a new static script, admin_backup_model.js. The new file works as a browser script (window.AdminBackupModel) and as a CommonJS module. admin_backups.js takes the names it uses from it, so the library's exports, its model object and its behaviour are unchanged. base.html loads the model before the library. The URL builders artifactUrl and targetUrl and the API root stay in admin_backups.js beside the requests that use them, so the read-reach generator still resolves every backup request on the admin page. The new file is added to the lists of UI sources, occupancy-read exemptions, admin static routes in the draft-target spec and reference-count files, and qa/ui-read-reach.json is regenerated. Refs #1328
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
What moved where
The pure part of the backup library's model moves from
admin_service/static/admin_backups.jsinto a new static script,admin_service/static/admin_backup_model.js:scrubText,validId, the provider, location and state labels,isRestorable,canDownload,groupArtifacts,humanKey,describePolicy,humanizePlanReason,normalizePlan,verifiedDetailText,lastRunSummary,lastCheckSummary,cleanupSummary,shortHash,secretStateText,buildPolicyPayload, their private helpers, and the constants they read (ID_PATTERN,CLASSES,PROVIDER_LABELS,STATE_LABELS,SENSITIVE_KEY, the secret labels and the target field sets).The new file has the same wrapper as the library: a browser script that sets
window.AdminBackupModel, and a CommonJS module under Node.admin_backups.jstakes the names it uses from it with one destructuring statement. Its exports (createBackupLibrary,model) and itsmodelobject keep every key.base.htmlloads the model script before the library.The URL builders
artifactUrlandtargetUrlandAPI_ROOTstay inadmin_backups.js, beside the requests that use them. The read-reach generator resolves a path builder only inside the file that calls it, so moving them would drop the backup requests from the admin page's reach.Behaviour is unchanged. All 343 removed lines appear verbatim in the new file. The only new lines are the wrapper, a header comment, blank lines, a section marker and the returned name list.
Lists that name static files
The new file is added beside
admin_backups.jsinqa/ui-crawl/controls.js(UI sources),tests/test_ses_unknown_occupancy_consumers.py(occupancy-read exemptions, same reason),qa/admin-draft-target-ownership.spec.js(static routes) andtests/js/admin_reference_count.test.js(files scanned for unreferenced functions).qa/ui-read-reach.jsonis regenerated withnode scripts/generate_ui_read_reach.js, and--checkpasses. In the generated file the admin page's script list gains the model first. The reads, classes and paths are identical. Two/api/admin/backups/policysites are now labelled(top level)instead ofcreateBackupLibrary, because the extractor treats a function body longer than 80% of its file as the module wrapper.One existing assertion (
tests/js/admin_backup_library.test.js, the "no require or import" check) now ignores the library's singlerequire("./admin_backup_model.js").Tests
New cases in
tests/js/admin_backup_library.test.jscheck four things: the model loads alone as a browser script and as a module (no library loaded); the library'smodelkeeps every key, and the moved ones are the model script's own functions; in a page the library binds whichever model script the page loaded before it, andbase.htmlloads it first; and the model file keeps the library's source rules. All four failed before the move because the file did not exist (ENOENT).node --test tests/js/admin_backup_library.test.js: 102 passnode --test tests/js/admin_backup_state_ownership.test.js: 17 passnode --test tests/js/admin_reference_count.test.js: 7 passnode scripts/generate_ui_read_reach.js --check: okpython -m unitteston the occupancy, backup-retention, source-shape, shard, identity, dev_check, CI-contract, changelog-fragment and container-contract modules: 365 run, 0 failed, 1 skippedThe browser specs (
qa/ui-coverage.spec.js,qa/admin-draft-target-ownership.spec.js) are covered by CI.Refs #1328