Skip to content

feat(core): order accepted project changes - #1382

Merged
phernandez merged 15 commits into
mainfrom
codex-1863-wiki-project-partition
Aug 30, 2026
Merged

feat(core): order accepted project changes#1382
phernandez merged 15 commits into
mainfrom
codex-1863-wiki-project-partition

Conversation

@phernandez

@phernandez phernandez commented Aug 30, 2026

Copy link
Copy Markdown
Member

Why

The deterministic Wiki projector needs a stable source watermark and durable, replayable accepted-change evidence. Timestamps, webhook arrival, and workspace activity cannot provide the strict project-local order required by SPEC-88 or the compatible future journal described by SPEC-83.

This is the second Core PR in the Spec 88 stack. It builds on #1381 and supports basicmachines-co/basic-memory-cloud#1863.

What Changed

  • Add an atomic Project.partition_position counter and Alembic migration.
  • Claim exactly one new partition position inside every successful canonical note create, update, edit, move, and delete transaction.
  • Persist each accepted project note change in a project-local journal in the same transaction as the note mutation.
  • Carry the same typed project-change evidence through accepted responses, materialization work, and file-delete cleanup.
  • Record operation, canonical paths, accepted revision checksum/version, source, actor, and timezone-aware acceptance time.
  • Track when each accepted revision reaches storage so a projector can defer incomplete source ranges safely.
  • Preserve rollback semantics so rejected or failed mutations consume neither positions nor journal rows.

Implementation Details

ProjectRepository.advance_partition_position() uses one SQL UPDATE ... SET partition_position = partition_position + 1 RETURNING partition_position, keeping the claim atomic on SQLite and PostgreSQL. The position claim and AcceptedProjectNoteChange row are written before the caller-owned transaction commits, so note state and ordering evidence succeed or roll back together.

The journal deliberately retains delete evidence after an entity is removed and exposes ordered range reads plus an idempotent materialization marker. RuntimeAcceptedProjectNoteChange remains runtime-neutral and storage-neutral; it is attached to existing materialization and cleanup requests instead of introducing a second queue or filesystem.

Testing

  • just fast-check
  • uv run pytest -q tests/repository/test_project_partition_repository.py tests/indexing/test_accepted_note_mutation_runner.py tests/api/v2/test_accepted_note_atomicity.py
  • uv run pytest -q tests/repository/test_project_partition_repository.py tests/indexing/test_accepted_note_mutation_runner.py tests/api/v2/test_accepted_note_atomicity.py tests/runtime/test_runtime_job_payloads.py tests/runtime/test_project_partition.py
  • BASIC_MEMORY_TEST_POSTGRES=1 uv run pytest -q tests/repository/test_project_partition_repository.py
  • uv run pytest -q tests/test_note_content_migration.py
  • Alembic reports s2p3e4c5w6k7 as the single head.
  • Load-bearing checks: changing the partition increment from +1 to +2 failed the ordering tests; removing the accepted-journal write failed the end-to-end API materialization-boundary test. Restoring each implementation returned the focused tests to green.

Risks / Follow-ups

  • This PR establishes Core's ordered accepted-evidence journal; durable Cloud scheduling and Wiki run-ledger state remain in the dependent Cloud stack.
  • Cloud scheduling, coalescing, projector execution, and canonical reserved-note writes land in the dependent Cloud PR.
  • No model calls, agent dependency, or mirrored Wiki filesystem are introduced.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-30T23:33:31.924588Z ac5b67f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@phernandez
phernandez force-pushed the codex-1863-wiki-project-partition branch from d723b19 to 5b9501a Compare August 30, 2026 01:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d723b197d7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/runtime/note_materialization_planning.py
@phernandez
phernandez force-pushed the codex-1863-wiki-project-partition branch from 5b9501a to 3897cc3 Compare August 30, 2026 01:51
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3897cc3918

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/indexing/accepted_note_mutation_runner.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c5d35ec7fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/models/project.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7bbafd3ce4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/repository/project_repository.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1985fb1b21

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/indexing/accepted_note_mutation_runner.py
@phernandez
phernandez force-pushed the codex-1863-wiki-project-partition branch from 8dfd16a to 1879452 Compare August 30, 2026 03:33
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 18794524ed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 03aa51441e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/indexing/accepted_note_mutation_runner.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bfe612fe8e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/models/project.py
@phernandez
phernandez force-pushed the codex-1863-wiki-project-partition branch from bfe612f to d82e23f Compare August 30, 2026 21:34

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d82e23f1a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/indexing/accepted_note_mutation_runner.py
@phernandez
phernandez force-pushed the codex-1863-wiki-project-partition branch from d82e23f to cda4a9c Compare August 30, 2026 21:39
@phernandez

Copy link
Copy Markdown
Member Author

@codex review\n\nExact-head review requested after fixing the two open findings: SQLite journal timestamps are normalized at the model boundary, and concurrent PUT replacements refresh the source entity after acquiring the note lock. This head also carries canonical permalinks through durable accepted-change evidence for the strict projector identity contract.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Unknown error
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e0f3452538

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/indexing/accepted_note_mutation_runner.py
Comment thread src/basic_memory/repository/project_repository.py Outdated
Base automatically changed from codex-1863-wiki-projector-core to main August 30, 2026 23:06
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez
phernandez force-pushed the codex-1863-wiki-project-partition branch from e0f3452 to 9a482fe Compare August 30, 2026 23:06
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5acb046563

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bab844a344

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac5b67f19f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/indexing/accepted_note_mutation_runner.py
@phernandez
phernandez merged commit a5fb68e into main Aug 30, 2026
29 checks passed
@phernandez
phernandez deleted the codex-1863-wiki-project-partition branch August 30, 2026 23:55
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