Repository navigation
feat(config): add partial watcher and notification policy edits - #1158
Conversation
|
Deployment failed for project drydock-website with the following error: |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedNext included review available in 17 minutes. View limit detailsLimit details: You’ve used all 2 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (20)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@greptileai Review exact head |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@coderabbitai review First review on exact head a1831a8. Please review the bounded watcher and notification policy editor API, especially session/admin enforcement, the writable-field allowlist, secret-safe snapshots and errors, optimistic revisions, and atomic persistence versus runtime reload outcomes. Threat model: a Docker administrator editing their own controller configuration, with untrusted API requests and config values in scope; a maintainer attacking their own checkout is not. Local full checks and hosted coverage, build, and Playwright passed. The separate fleet soak reported all six assertions passing but stayed alive afterward until runner shutdown; that liveness issue is under investigation. |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== HEAD =='
git rev-parse HEAD
git status --short
echo '== branches / merge-base =='
git branch --show-current
base="$(git merge-base HEAD origin/dev/v1.8 2>/dev/null || git merge-base HEAD origin/main 2>/dev/null || true)"
printf 'BASE=%s\n' "$base"
echo '== changed files =='
if [ -n "$base" ]; then
git diff --name-status "$base"...HEAD
else
git show --stat --oneline --decorate HEAD
fi
echo '== config/editor candidates =='
fd -t f . | rg -i '(config|watcher|trigger|notification|route|api|audit|reload|queue)' | sed -n '1,240p'
echo '== diff summary =='
if [ -n "$base" ]; then
git diff --stat "$base"...HEAD
fiLength of output: 122451 🏁 Script executed: #!/bin/bash
set -euo pipefail
files=(
app/api/config.ts
app/api/config.test.ts
app/api/openapi/paths/config.ts
app/configuration/file/editor.ts
app/configuration/file/editor-snapshot.ts
app/configuration/file/editor-trigger-snapshot.ts
app/configuration/file/editor.test.ts
app/configuration/file/editor-triggers.test.ts
app/configuration/file/candidate.ts
app/configuration/file/reload.ts
app/configuration/file/write.ts
app/configuration/file/loader.ts
app/api/auth.ts
app/api/audit.ts
)
for file in "${files[@]}"; do
if [ -f "$file" ]; then
echo "== OUTLINE $file =="
ast-grep outline "$file" --items all 2>/dev/null || true
fi
done
echo '== editor-related calls and declarations =='
rg -n -C 3 --glob '*.ts' \
'(editor/watchers|editor/triggers|write.*config|ConfigEditor|editorSnapshot|editorTrigger|revision|maintenancewindow|resolvenotifications)' \
app/api app/configuration app/log app/store
echo '== source: config route =='
nl -ba app/api/config.ts | sed -n '1,620p'Length of output: 105620 🏁 Script executed: #!/bin/bash
set -euo pipefail
show() {
local file="$1"
local start="$2"
local end="$3"
echo "== $file:$start-$end =="
sed -n "${start},${end}p" "$file" | awk -v n="$start" '{printf "%5d %s\n", n++, $0}'
}
show app/api/config.ts 1 540
show app/configuration/file/editor.ts 1 280
show app/configuration/file/editor-snapshot.ts 1 230
show app/configuration/file/editor-trigger-snapshot.ts 1 180
show app/configuration/file/candidate.ts 1 160
show app/configuration/file/write.ts 1 290
show app/configuration/file/reload.ts 1 230
echo '== audit event implementation and editor audit call sites =='
rg -n -C 5 --glob '*.ts' \
'(function recordAuditEvent|const recordAuditEvent|export.*recordAuditEvent|config-write|config-read)' \
app/api app/storeLength of output: 76052 🏁 Script executed: #!/bin/bash
set -euo pipefail
show() {
local file="$1" start="$2" end="$3"
echo "== $file:$start-$end =="
sed -n "${start},${end}p" "$file" | awk -v n="$start" '{printf "%5d %s\n", n++, $0}'
}
show app/api/route-scopes.ts 1 430
show app/configuration/file/diff.ts 1 300
show app/configuration/index.ts 1 460
show app/configuration/index.ts 460 760
show app/configuration/file/interpolate.ts 1 260
show app/configuration/file/flatten.ts 1 380
show app/api/audit-events.ts 1 150
show app/api/config.test.ts 105 285
show app/configuration/file/editor.test.ts 75 510
show app/configuration/file/editor-triggers.test.ts 75 520
echo '== relevant commits, limited to editor paths =='
git log --format='%H %s' --all -- app/api/config.ts app/configuration/file/editor.ts app/configuration/file/editor-snapshot.ts app/configuration/file/editor-trigger-snapshot.ts | sed -n '1,80p'Length of output: 135279 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== target privacy follow-up patch =='
git diff a1831a83b78cef5435ecd1de8422392666abe91d^ a1831a83b78cef5435ecd1de8422392666abe91d -- \
app/api/config.ts \
app/configuration/file/editor.ts \
app/configuration/file/editor-snapshot.ts \
app/configuration/file/editor-trigger-snapshot.ts \
app/configuration/file/editor.test.ts \
app/configuration/file/editor-triggers.test.ts
echo '== notification-editor feature patch, implementation only =='
git show --format=fuller --find-renames --find-copies --stat ed176be1d998d3242011d7e3ca6c75d2a97a82c4
git diff ed176be1d998d3242011d7e3ca6c75d2a97a82c4^ ed176be1d998d3242011d7e3ca6c75d2a97a82c4 -- \
app/api/config.ts \
app/configuration/file/editor.ts \
app/configuration/file/editor-trigger-snapshot.ts \
app/api/openapi/paths/config.ts
echo '== trigger category implementation and all notification category use sites =='
sed -n '1,220p' app/triggers/trigger-category.ts | awk '{printf "%5d %s\n", NR, $0}'
rg -n -C 3 --glob '*.ts' \
'(getTriggerCategoryForType\(|NOTIFICATION_TRIGGER_TYPES|notification.*category)' \
app/triggers app/configuration app/registry app/api
echo '== editor response and audit data origins =='
rg -n -C 3 --glob '*.ts' \
'(changedKeys|restartRequired|orphanedRules|errors: validation\.errors|errors: reload\.errors|recordAuditEvent)' \
app/configuration/file/editor.ts app/api/config.ts app/configuration/file/reload.tsLength of output: 40752
The GET routes reject API keys, including admin keys. The PATCH routes require the The implementation validates request paths and values. It serializes editor and legacy writes. It checks the revision before and after asynchronous validation. It uses atomic file replacement. It reports I did not execute tests because the sandbox policy prohibits execution of repository code.
|
Summary
Add safe partial edits for existing file-owned watcher schedules and notification policies. The browser sends changed leaves with an opaque revision; credentials, destinations, references and unrelated YAML stay on the server.
/api/v1/config/editor/watchersforcron,maintenancewindow,maintenancewindowtzandmaintenancewindowscope./api/v1/config/editor/triggersfor notificationthreshold,once,mode,securitymode,digestcronandresolvenotifications.savedseparately from runtimeapplied, including sanitized reload errors and audit outcomes.Existing Config API routes and watcher editor contracts remain compatible. This is an API foundation, not completion of the full configuration editor. UI panels, action settings, templates, static-list support and label-owned editing remain separate work.
Verification
dev/v1.8at79de6c3caa1d98d333debf267ee37ce0bf793900, 611 focused tests passed across 13 suites. Affected runtime coverage is 100%: 832 statements, 612 branches, 167 functions and 801 lines.ed176be1d998d3242011d7e3ca6c75d2a97a82c4. Baseline reconciliation left the Config API runtime byte-identical; a subsequent Knip fix only removed an unused export from the internal watcher-field list. Its 73 editor tests and Knip passed.ed176be1d998d3242011d7e3ca6c75d2a97a82c4passed 22 requests: four watcher fields and six notification fields saved and applied live, stale/invalid/env/reference edits refused without changing bytes, explicit removal restored the default, and legacy contracts remained intact. All 22 SQLite audit entries excluded private values. The isolated empty Docker fixture received reads only, with no denied requests or outbound notification traffic.a1831a83b78cef5435ecd1de8422392666abe91din 331.43 seconds: clean tree, directive guard, Biome, Knip, Qlty, script/workflow tests, UI typecheck, website script tests, backend/UI 100% coverage, both builds and Zizmor.34302740593and Playwright34302738353passed. Ten required checks passed; the website check was correctly skipped by its path filter. Hosted coverage passed 16,265 backend and 5,209 UI tests at 100%; Playwright passed 36 and skipped one.34302738293passed all six assertions, then stayed alive after cleanup until runner shutdown. Its cleanup/lifecycle investigation remains open. This PR changes none of the agent, bridge, or fleet-soak source. A later inventory-branch fleet soak passed; that does not turn this failed run into a pass.Review scope
Threat model: an authenticated Docker/fleet manager editing an existing controller-owned configuration file. Check session/admin boundaries, omission of private/reference values, exact writable paths, stale and concurrent writes, startup-equivalent validation and honest saved/applied/audit outcomes. Hostile local maintainers editing their own process or filesystem are out of scope. No new configuration subsystem or label-override policy is part of this PR. Substantive review pass one is complete.