Skip to content

feat(config): add partial watcher and notification policy edits - #1158

Merged
scttbnsn merged 6 commits into
dev/v1.8from
feat/v1.8-config-editor-api
Sep 9, 2026
Merged

scttbnsn merged 6 commits into
dev/v1.8from
feat/v1.8-config-editor-api

Conversation

@scttbnsn

@scttbnsn scttbnsn commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • Fix existing Config API provider-credential redaction before flattened environment keys are nested.
  • Resolve private candidates like startup, including interpolation, environment precedence and secret files. Keep secret-reference ownership correct across repeated reloads, and sanitize failures before saving.
  • Add session-only GET and admin PATCH /api/v1/config/editor/watchers for cron, maintenancewindow, maintenancewindowtz and maintenancewindowscope.
  • Add GET/PATCH /api/v1/config/editor/triggers for notification threshold, once, mode, securitymode, digestcron and resolvenotifications.
  • Keep environment-owned and referenced fields read-only. Reference and agent fields omit values; MQTT's forced mode stays read-only. Action providers are excluded.
  • Reuse the shared write queue, candidate validation, atomic writer and reload lifecycle. Recheck the revision after asynchronous validation. Report file saved separately from runtime applied, 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

  • After merging reviewed dev/v1.8 at 79de6c3caa1d98d333debf267ee37ce0bf793900, 611 focused tests passed across 13 suites. Affected runtime coverage is 100%: 832 statements, 612 branches, 167 functions and 801 lines.
  • Tests use real temporary YAML and candidate/Joi validation. They cover all ten fields, secret/reference preservation and omission, set/remove/default behavior, environment/agent/provider restrictions, stale and concurrent edits, cross-editor and legacy queue serialization, external edits during validation, filesystem failures, saved-but-unapplied outcomes, auth scopes, request limits and OpenAPI contracts.
  • Backend build passed on 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.
  • Real authenticated HTTP QA on ed176be1d998d3242011d7e3ca6c75d2a97a82c4 passed 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.
  • The normal full push gate passed on a1831a83b78cef5435ecd1de8422392666abe91d in 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.
  • Exact-head CI Verify 34302740593 and Playwright 34302738353 passed. 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.
  • CodeRabbit posted a substantive first-pass source review with no actionable findings in comment 5594980438. The separate automatic review remains quota-limited, and the bot did not run tests. Greptile was requested once on this head; no review output has arrived.
  • The separate, non-required fleet soak 34302738293 passed 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.

@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown

Deployment failed for project drydock-website with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/codeswhat?upgradeToPro=build-rate-limit

@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
drydockdemo-website Ready Ready Preview Sep 9, 2026 2:19am UTC

@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 17 minutes.

Check out review usage here.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 7ca9cfd1-4716-444a-978f-00ef53854934

📥 Commits

Reviewing files that changed from the base of the PR and between 79de6c3 and a1831a8.

📒 Files selected for processing (20)
  • app/api/config-validate.integration.test.ts
  • app/api/config.test.ts
  • app/api/config.ts
  • app/api/openapi/paths/config.test.ts
  • app/api/openapi/paths/config.ts
  • app/api/route-scope-completeness.test.ts
  • app/configuration/file/candidate.test.ts
  • app/configuration/file/candidate.ts
  • app/configuration/file/diff.test.ts
  • app/configuration/file/diff.ts
  • app/configuration/file/editor-snapshot.ts
  • app/configuration/file/editor-trigger-snapshot.ts
  • app/configuration/file/editor-triggers.test.ts
  • app/configuration/file/editor.test.ts
  • app/configuration/file/editor.ts
  • app/configuration/file/reload.test.ts
  • app/configuration/file/reload.ts
  • app/configuration/file/write.test.ts
  • app/configuration/file/write.ts
  • app/configuration/index.ts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@scttbnsn

scttbnsn commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai Review exact head a1831a83b78cef5435ecd1de8422392666abe91d. Threat model: an authenticated Docker/fleet manager editing an existing controller-owned YAML file. Review session/admin boundaries, secret/reference omission, exact writable paths, stale and serialized writes, startup-equivalent candidate validation, and saved versus applied/audit outcomes. Hostile local maintainers attacking their own process/filesystem and new subsystems are out of scope. This is the first review pass.

@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttbnsn

scttbnsn commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@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.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
🧩 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
fi

Length 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/store

Length 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.ts

Length of output: 40752


@scttbnsn No actionable findings in the bounded watcher and notification policy editor API.

The GET routes reject API keys, including admin keys. The PATCH routes require the admin API-key scope. The editable paths come only from file-owned snapshot descriptors. Referenced, environment-owned, agent-owned, ambiguous, and provider-forced fields cannot be edited.

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 saved independently from applied. It sanitizes validation, reload, write, and audit failures.

I did not execute tests because the sandbox policy prohibits execution of repository code.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@scttbnsn
scttbnsn merged commit 78d7cc9 into dev/v1.8 Sep 9, 2026
31 of 34 checks passed
@scttbnsn
scttbnsn deleted the feat/v1.8-config-editor-api branch September 9, 2026 02:48
scttbnsn added a commit that referenced this pull request Nov 2, 2026