Commit Graph
66 Commits
Author SHA1 Message Date
weichenandCursor 33ee59641f feat(trace): add the project trace ledger and bounded impact walk
Keep item revisions and edge decisions as records, and refuse to treat a missing index as no impact.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-20 15:35:07 +00:00
weichenandCursor 37fb1ba44e merge: feature/capability-enablement-impact-plan; renumber chat_summaries to 00058
Absorb stalled capability fixes and avoid goose out-of-order on schema 57 DBs by shipping chat_summaries as 00058.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-20 10:38:12 +00:00
weichenandCursor 28478bdca5 fix(db): enforce global unique project names across creators
Replace per-creator name uniqueness with a global index among
non-retired projects, and reject cross-user duplicate creates with 409.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-20 09:10:55 +00:00
weichenandCursor 5cd22c7327 fix(authz): harden permissions, chat gate, and project create idempotency
Add project:manage_members, CSP frame-src, task-run member view, CreateUser
tx error handling, ERR_NO_PROJECT chat gate, and creator-scoped project
name/client_key uniqueness to stop duplicate creates and auth gaps.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-20 07:04:57 +00:00
weichenandCursor 848a0457a0 fix(chat): stop treating failed summary writes as durable
新增 chat_summaries 迁移。数据库写失败会返回错误并标明仅本进程可见。test_manager 血缘改用文档版本,不再写死 1。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-20 04:02:41 +00:00
weichenandCursor c49637cbb5 fix(db): restore applied goose files so fresh migrate can parse
The checksum-immutable note inside 00001 contained a goose annotation and would fail a new database. Keep that warning out of files goose already applied.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-19 13:22:37 +00:00
weichenandCursor 952a94b6d5 fix(docrevision): ack content projection only after the fact source is written
The human ledger and the document body are different stores. Record the projection intent in the same transaction as the ledger, and clear it only when the body write succeeds so a retry cannot append a second revision.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-19 09:35:14 +00:00
weichenandCursor 265f09c1f2 fix(server): cache health probes, surface SSE marshal errors, fail closed on missing duties
Health checks reuse a two-second snapshot and bound the schema query. Task SSE writes an error frame when an event cannot be encoded. ResolveDocTask errors when the frozen plan has no duty row, while explicit none-duties stay zero. Drop the unwired semantic-summary replace env, record the intentional dev versus release model split, document the test/main cutover path, and archive pre-goose SQL.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-19 09:16:18 +00:00
weichenandCursor b65e8fb642 docs(db): mark baseline and seed migrations as checksum-immutable
Goose checksums forbid rewriting applied files. Document that 00001-00009
have no down migration and that 00012's unconditional DELETE is demo-only.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-19 07:49:01 +00:00
weichenandCursor 7d3474816b feat(db): add document_records duty_locked and duty_policy columns
Stamp instance-governed document duties at create time so heal/revoke can
skip locked rows without importing projectinstance.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 09:59:38 +00:00
weichenandCursor ba57c9a4de feat(db): bind activation tokens to author-only policy revision
Prevent preview tokens from activating after the governance switch
revision changes by storing the revision on each confirmation token.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 09:39:59 +00:00
weichenandCursor b4b300bb8a feat(db): add author-only approval policy revision and audit
Seed workflow.allow_author_only_approval closed, add monotonic
revision on system_settings, and a narrow policy audit table.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 09:15:15 +00:00
weichen f1404d5bd2 feat(sysadmin): add system admin aggregation API and system_settings store
- new internal/sysadmin package (overview/kb/features/settings) with small
  port interfaces; business packages stay unaware of sysadmin
- new routes /api/v1/admin/system/{overview,kb,features,settings} guarded
  by requireSystemAdmin
- goose 00049: system_settings table (key/jsonb value, updated_by/at)
- SettingSpec whitelist registry with DB > env > default precedence
- register sysadmin in module-boundaries.yaml (archtest rules)
2026-09-17 06:56:46 +00:00
weichenandCursor 4f2e5f013f fix(db): remove duplicate goose 00048 software-project-type migration
Two 00048 files made goose panic on CollectMigrations, blocking all
TEST_DATABASE_URL PG suites including FullNone and nightly.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 23:37:04 +00:00
weichenandCursor f0029dffed merge: origin/feature/software-project-bootstrap
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 15:46:45 +00:00
weichenandCursor 2b3302ece4 feat(workflow-design): SWBOOT ADR, project_type migration, patch deny stub
SWBOOT-10 remains stub-only pending secondary approval.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 15:40:56 +00:00
weichenandCursor d661af71d5 feat(db): SWBOOT-01 additive project type and compliance schema
Add project domain/governance fields, catalog tables, source bindings,
and repo allowlist stub table without backfilling legacy classification.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 15:36:13 +00:00
weichenandCursor c741d26eeb fix(db): add goose 00047 to retire demo project chat sessions
Dev already applied 00046 (projects only) before session retirement
was folded into that file; 00047 closes the gap idempotently.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 03:14:59 +00:00
weichenandCursor fbda195b7f fix(db): retire demo chat sessions with projects in 00046
Extend unapplied migration to mark 6001–6010 sessions demo_retired
and filter them (and retired projects) out of ListChatSessions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 03:12:25 +00:00
weichenandCursor bdc6415944 fix(db): retire goose-seeded demo projects from lists
Mark projects 6001–6010 as demo_retired and exclude them from default
project list queries so demo seeds no longer pollute real workspaces.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 02:50:34 +00:00
weichenandCursor cf063f5727 feat(db): add intent plan projection shadow tables
Store idempotent event outcomes and an only-forward shadow without replacing plan SSOT.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 00:46:09 +00:00
weichenandCursor 7dfd6d6f33 feat(db): add intent plan tables in goose 00044
Persist plans, steps, and append-only decisions with typed CAS, lease, and nonce columns.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 23:43:37 +00:00
weichenandCursor 21d7692c94 feat(db): record unique projection outcomes per envelope version
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 09:59:54 +00:00
weichenandCursor 28bb0b8356 feat(db): correlate stage-ready requests to envelope event_id
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 09:43:09 +00:00
weichenandCursor 6702b16249 feat(db): correlate notifications to envelope event_id for unique visible outcomes
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 09:26:36 +00:00
weichenandCursor 5fd5588a3f feat(db): add dispatcher attempts, consumer modes, and checkpoints
E0B needs an additive lease audit trail and a cluster-level off/shadow/live table before any worker can claim. FAV remains constrained to off.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 09:08:15 +00:00
weichenandCursor 97305d699e feat(db): add event inventory, repair audit, replay plans, and service principals
E0A needs additive tables for classification and per-consumer identities before any dispatcher can claim work. FAV principals are rejected at the schema check.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 08:52:19 +00:00
weichenandCursor 5ac14d649b feat(db): add goose 00038 dataset lifecycle tables
Registry、checkpoint queue 与 destroy 请求表属主 dataset;必须可 Down,不改历史 Goose。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 02:31:34 +00:00
weichenandCursor eb75f855a5 feat(db): add goose 00037 task_run_manifests
Persist typed RunManifest bytes and SHA per run, and allow a finalizing status so U8 can freeze a unique terminal without sharing env databases.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 02:05:33 +00:00
weichenandCursor c7e3e99303 feat(artifactvault): extract audited FAV with union-deny reads
Goose 00036 is a renumbered copy of the vault tables. Degraded read stays off by default and only runs after authorization; tombstones and unpublished artifacts fail closed.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-14 15:59:36 +00:00
weichenandCursor f27059b453 feat(events): add durable envelope delivery and drop commit OnOutbox
Agent commits append a validated envelope inside the command unit of work. SKIP LOCKED is only used to claim, and stale fencing plus integrity failures go to quarantine or dead-letter.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-14 15:59:24 +00:00
weichenandCursor 18ddd0f862 feat(workspace): add WorkspaceRef fencing and hide physical paths
Cross-module callers get an opaque ref plus rotating lease tokens so stale writers fail closed, and file I/O is refused inside a unit of work.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-14 15:59:14 +00:00
weichenandCursor 68fee06da4 feat(db): allow blocked_pending_governance task run status
Pre-activation 202 runs must persist without hitting chk_task_run_status.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-14 08:39:44 +00:00
weichenandCursor e7b46e92d2 feat(db): allow migration_repair snapshot and event kinds
00028 check constraints would reject a real PG apply. Add goose 00032
with Up/Down so repair snapshots can persist.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-14 02:21:44 +00:00
weichenandCursor 2f0a1b337c fix(docduty): treat assigned duty as authoritative on heal
Align document slots to project document_duty even when the wrong ID is
an active member, and fail generate/list instead of returning stale
placeholder duties. Owner author backfill now picks creator, else lowest ID.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 22:16:36 +00:00
weichenandCursor 6cd3991bad feat(db): store document duty on project members
Project access roles cannot carry reviewer. Persist a separate exclusive document_duty so later controlled docs can inherit the assigned reviewer.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 21:57:43 +00:00
weichenandCursor 76e2028761 fix(docgov): UI-03 post-task doc sync, claim idempotency, schema30
Restore controlled-doc merge after task terminal states, prioritize intake
template match, ClaimRun before chat writes, and extend chk for
pending_author_confirmation via goose 00030. Real volume migrate + UI
re-run remain pre-merge gates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 13:39:07 +00:00
weichenandCursor 1e364f17ab feat(db): add freeform client_key for idempotent upload registration
Persist owner-scoped client_key on freeform_documents so upload create
can retry safely without inventing local doc-upload orphans.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 11:12:03 +00:00
weichenandCursor 7bbd6783fc feat(db): add document revision ledger schema 00028
Introduce immutable blobs/snapshots, versions, events, candidates,
change reports, and ledger_* root pointers; rename freeform
current_version_id to legacy_version_id.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 06:15:20 +00:00
weichenandCursor 1abafa3176 fix(chat): add message scope columns and write-path resolution
Persist workflow_instance_id, stage_instance_id, scope_kind on chat
messages and task runs; resolve scope from live instance for chat and
document tasks so refresh can apply consistent stage authorization.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 03:06:08 +00:00
weichenandCursor 8c5dd97d63 feat(db): 同步种子用户与项目序列避免冷启动主键冲突
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 543ca310da feat(db): add workflow schema v2 and catalog governance migrations
Introduce catalog governance tables and extend workflow schema v2 so only the three official workflows are selectable at runtime.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 90f77eac93 feat(authz): implement six-phase permissions, settings and workflow v2
Close P0 auth gaps for lineage/runs, stage ABAC fail-closed, and
project:create; add IAM migrations 00021-23, me settings APIs, schema v2
manifests, orchestrator skeleton, and gate A regression coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 72879c6e22 fix(db): enable test env cold-start migrations on empty database.
Use pgvector image with extensions-only init, seed legacy users before project/chat fixtures, and align test compose with goose-only schema bootstrap.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 3ade654256 feat(taskrun): add worker lease/heartbeat and Phase 5 fault injection tests
Introduce goose v20 lease columns with heartbeat loops so only expired
leases are marked interrupted on restart; add PG tests for concurrent
stage advance, active lease survival, and backup migration idempotency.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor aea391cdaf feat(taskrun): persist runs/events and fix finalize-before-done ordering
Add goose v19 task_runs/task_run_events tables with PG store for restart
replay, orphan interruption on startup, strict /ready checks, and strip
client work_dir from chat/SSE paths per P0 path sandbox requirements.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor ff81170f47 feat(db): add outbox, notifications and stage advance request tables.
Support transactional stage.ready_to_advance events with dedupe by stage instance and config revision.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 0f5bc426e8 feat(db): add project workflow instance tables for Phase 3 governance.
Introduce planning/active lifecycle, instance snapshots, duty assignments, and activation confirmation tokens with single-live-instance constraints.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichenandCursor edffe74009 feat(db): add workflow definitions, versions, and template asset tables
Introduce Phase 2 IAM-adjacent schema for versioned workflow definitions,
template assets/versions, and workflow_defs permissions seed.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichen 3b72503ec6 feat(db): add IAM core migration for users, sessions, and RBAC
Introduce goose migration 00015 to extend users with IAM columns and seed system roles/permissions for Phase 1 authorization.
2026-09-13 02:50:22 +00:00