216: Notion Factory Tasks DB → intake manifest generator - #280
216: Notion Factory Tasks DB → intake manifest generator#280agent-relay-code[bot] wants to merge 7 commits into
Conversation
🦕 Reviewsaur QuizA review comprehension quiz has been generated for this PR. Attempt 1 | (0/1 approval) | This link is unique to you and expires when the PR is closed. Tip: To require this quiz before merging, enable it as a required status check. |
|
Independent review environment (before review work): The spawn cwd is not |
Independent review — changes requestedReviewed head What this PR actually doesThe new The CLI branch reads The generator does not read Factory config. It runs before Findings
Mutation batteryEach mutation was applied alone to production code in the scratch worktree, the new test file was run by exit code, and the mutation was then reverted.
Final unmutated checks: CI and safety audit
Claim behavior remains fail-closed in the consumer: a failed claim write produces a blocked result before spawn/create, and the CLI maps Secret audit: the Notion token is trimmed into a private field and used only to construct the Authorization header. It is not interpolated into emitted JSON, paths, or errors; the query body contains no token. The generator never reads the Relay workspace key. I scanned the diff for token/workspace-key/connection-string values and found none committed. API errors include method, endpoint path, status, and bounded server response text, but not request headers. Residual UNKNOWN / not covered
Because findings 1 and 2 affect whether repo work can dispatch at all and whether the same work can dispatch twice, I do not consider this ready to merge. |
|
Worker start report for conflict/high-defect remediation:
The requested Veto MCP commands are not exposed in this worker session, so I cannot run |
Task 2 design decision (before implementation)Choice: (c). The authority is one immutable provider-native Notion work unit (
Mid-dispatch edit: the in-flight run is bound to the already-authorized manifest snapshot/digest and may finish the original destination. If the mounted snapshot changes, the existing byte/digest checks block it. Regenerating after a Notion Persisted-claim compatibility: migration/dual-read is required. I will not silently switch formats. When the stable page claim is absent, the claim store will discover legacy Required regression pair:
I will merge current |
# Conflicts: # src/__tests__/dist-entrypoints.test.ts
Conflict resolution and high-defect remediation completePushed head Merge/seam result
HIGH 1: mutable destination duplicate
Regression evidence:
HIGH 2: generated public-repository tasks
I also added the three missing fail-closed tests from the independent review: truncated markdown, mismatched markdown page ID, and duplicate provider page rows. Local verification by exit code
CI workflow Veto MCP remained unavailable in this worker session, as noted in the start report, so |
Final gate resultHead Per-workflow branch query (
Every CI job passed:
The isolated worktree is clean and matches the pushed PR head. I did not merge; the explicit gate ownership remains with Khaliq. |
Both original findings verified FIXED. One new defect in the migration blocks merge — and it is a five-line reorder.Verified at head
THE BLOCKER — the ambiguity check runs AFTER the write it is supposed to preventIn
When legacy claims disagree, you have already persisted a canonical claim under Why the throw does not save you: the failure is fail-closed once, then fail-open forever. On the next run, That is the exact shape I ruled against on #211 an hour ago: "if more than one alias has a live unexpired lease, migration refuses to choose and dispatch remains blocked for operator reconciliation. It must not abandon possibly live work by guesswork." Here the guess becomes durable. Fix: compute Tests required:
One more thing, and it is why I read the code at allThis PR has zero reviews — the reviews array is empty and no Do not treat green CI as the finish line here — CI passed on the version containing the defect above. |
|
@barryollama review requested on the hardened Notion claim-migration path. Please focus on Local verification: 4 focused seam files (50 tests), feature-map validation, build, full suite with two workers (1726 passed / 1 skipped), package dry-run, and a scoped TruffleHog diff scan with zero findings. |
|
@coderabbitai review |
❌ Action failedReview failed.
|
|
Caution Review failedAn error occurred during the review process. Please try again later. 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 |
Deliverable
A generator that queries the Factory Tasks Notion database and emits the Factory intake manifest (the
NotionIntakeManifestshape consumed bysrc/intake/notion.ts), so rows set to Ready for Agent become dispatchable Factory tasks.Context
src/intake/notion.ts, PR feat(intake): deliver private Notion specs across fleet nodes #215) reads a manifest of{page, bootstrap:{authorizedPageId, reason, status:"ready", title, recipe, summary, targets:[{repo,labels} | {projectPath,node}]}}, mounts each authorized page, and publishes a GitHub issue Factory then dispatches (idempotent by source key). It does not read a Notion database directly — this generator bridges that gap.collection://a7fb83ad-c667-4003-a1dc-132c6826aac1).Mapping (DB row → bootstrap)
page/authorizedPageId← the row's own Notion page idstatus: "ready")title← Task ·recipe← Recipe ·summary← page body (the brief) ·reason← Reasontargets← Repo + Labels →{repo, labels}OR Project Path + Node →{projectPath, node}labelsDefinition of done
manifestSchema(zod) validation from the live DB.Ready for Agentrows are included; re-runs are idempotent.runNotionIntaketo publish/refresh GitHub issues.projectPath/node) row.Safety gates
Do not merge; open a PR parked in human-review. Do not auto-flip any DB row's Status — humans move a row to Ready for Agent.
Recipe:
single. Filed from the Factory Tasks Notion DB.Fixes #216
Summary by cubic
Generates Factory intake manifests from the Factory Tasks Notion database and binds durable work‑unit claims to the provider‑native page identity. Previously each destination created its own claim; now claims use notion:, we migrate agreeing legacy destination claims, refuse migration and dispatch when legacy digests disagree, and still block dispatch if the mounted spec digest changes.
The new command factory intake notion generate emits a schema‑validated manifest in stable canonical page‑id order and never constructs a fleet. It selects only rows with Status = Ready for Agent, reads complete page markdown for the private summary, maps each ready row to exactly one target (repo with merged Labels + Route and optional Public Summary, or workspace via Project Path + optional Node), and fails closed on ambiguous/missing targets, missing required properties, truncated or wrong‑page markdown, or no ready rows. The read‑only Notion client uses NOTION_API_KEY, resolves the live data‑source schema to filter server‑side for Ready for Agent, paginates via next_cursor, and accepts collection:// overrides. Options: --data-source, --mount-root, --worker-mount-root, --worker-mount-transport (local | relay-channel), --state-path.
Durable claims now key work units by the provider identity and record destination deliveries separately. The system migrates existing destination claims discovered by page‑key prefix into the canonical notion: claim when digests agree; if multiple legacy claims disagree, it refuses dispatch and does not write a canonical claim. Claim discovery requires workspace‑global Relay channel listing.
Rollout
Written for commit 45053cc. Summary will update on new commits.