Skip to content

fix(correlation): project-scope the synthetic tf- key (AIFactory#1972) - #1477

Merged
olafkfreund merged 3 commits into
devfrom
fix/1972-project-scoped-key
Oct 30, 2026
Merged

olafkfreund merged 3 commits into
devfrom
fix/1972-project-scoped-key

Conversation

@olafkfreund

@olafkfreund olafkfreund commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Artifacts (in AIFactory, pre-approved for the 2026-10-30 wave; spec revision 1 from the lead's review): intent · spec · plan.

TFactory's synthetic key was tf-<spec_id>. Spec ids repeat across projects, so two projects could share one CFactory work item (olafkfreund/AIFactory#1972). It is now tf-<project_id>:<spec_id>, where project_id comes from the TFactory layout workspaces/<project_id>/specs/<spec_id>.

  • One helper, triager._synthetic_key, is used by both the triager completion key and the hand-back key (handback/send.py), so they cannot drift. The precedence of contract, handoff and <repo>#<n> keys is unchanged.

  • A key over 128 characters logs a warning and becomes None; it is never truncated. The None case is typed through: CompletionEnvelope.correlation_key is str | None, docs_emit_trigger skips the emit, and tfactory_tasks omits the field. These three are the plan's step 4 deviations.

  • Prod (read-only, aggregate, 2026-10-30): 13 tf- work items, newest 2026-10-23, none in flight. No migration needed. The old rows stay as history.

  • Who did the work: plan step 4 was done by the coder agent (Sonnet) and reviewed by me.

  • Tests: test_correlation_sync.py (new tests: distinct keys across projects, and over-long gives None), test_triager_completion_webhook.py and test_docs_emit_341.py give 47 passed.

  • Ratchet: scripts/ratchet_lint.py passes with CI's ruff 0.15.17 and mypy 1.20.1.

Refs olafkfreund/AIFactory#1972 (fixed by the three PRs together). The AIFactory side is olafkfreund/AIFactory#1978.

Review follow-ups (Opus review): R1–R7 are fixed and recorded in the AIFactory plan (section "Review follow-ups"; spec revision 2). In short:

  • TFactory project id: comes from status/source; the directory name is used only in the workspaces layout, and otherwise no key is set.
  • Keyless events: skipped with a warning, not sent.
  • Spawn env: a subprocess spawn-env test for AIFACTORY_TASK_ID.
  • Stale docs: fixed.
  • Tests: they now fail on the base.
  • Logs: ids are sanitised (CFactory) or not logged (TFactory).

The follow-ups were done by the coder agent and reviewed by me.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L5j1hQCdA4NmA4jiKDNBX4

Plan step 4 (olafkfreund/AIFactory plan/2026-10-30-1972-project-scoped-synthetic-key.md):
tf-<project_id>:<spec_id> from one helper shared by the triager and the
hand-back; over 128 chars it logs and sets no key, never truncates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5j1hQCdA4NmA4jiKDNBX4
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

TFactory coverage

54.81% on this PR vs 54.71% on its base (+0.11 pts).

PASS - Coverage 54.81% (up 0.11 pts from 54.71%)

Measured by the TFactory coverage gate on both the PR head and its base.

olafkfreund and others added 2 commits October 30, 2026 21:28
…ctory#1972)

Review follow-ups R1, R2, R5, R6, R7 (olafkfreund/AIFactory plan/2026-10-30-1972-project-scoped-synthetic-key.md):
the project id comes from status/source, with the directory name only in the
workspaces layout; a keyless envelope is skipped with a warning, not sent;
logs carry no ids; stale docs fixed; tests use explicit project ids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5j1hQCdA4NmA4jiKDNBX4
@olafkfreund
olafkfreund merged commit 764efb8 into dev Oct 30, 2026
39 checks passed
@olafkfreund
olafkfreund deleted the fix/1972-project-scoped-key branch October 30, 2026 21:40
@olafkfreund olafkfreund mentioned this pull request Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant