Repository navigation
fix(core): accept-time publication marker; PUT renames announce moves; real-DB runner tests - #1668
Conversation
…action An accepted note generation is now never visible without its pending publication marker. The marker used to be written by the post-commit publisher in its own transaction, so a reader between the accept commit and that step saw an accepted generation with no marker, and a hosted runtime that needed one had to write its own after the fact. The publisher's begin step reuses a marker already pending for its generation instead of adding a second one, so a successful publication leaves exactly one unit of refresh work. A failed publication still leaves the marker pending, which keeps change detection's repair path. Closes #1661 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T8wjd6HrtSA2LN9ssC4NzF Signed-off-by: phernandez <paul@basicmachines.co>
The create-runner tests drove the runner with a stand-in session and fake repositories, so they could not see what the accept transaction writes. They now run the production mutation dependencies in a real transaction and assert the persisted note, project change, graph publication, pending marker, path conflicts and directory casing from the database. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T8wjd6HrtSA2LN9ssC4NzF Signed-off-by: phernandez <paul@basicmachines.co>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 37a3348d82
ℹ️ 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".
| is accepted; the post-commit publisher converts it once the graph is written, and a | ||
| publication that fails leaves it pending for change detection to repair. | ||
| """ | ||
| session.add( |
There was a problem hiding this comment.
Update the fake sessions for the new marker write
When the unit suite exercises persist_accepted_note_snapshot() or persist_accepted_note_move(), four existing tests pass either a plain object() or _FlushSession, neither of which implements add(), so this new call raises AttributeError before their assertions run. uv run pytest -q tests/indexing/test_accepted_note_write_runner.py now reports 4 failures; route this persistence through the repository protocol or update those fake sessions so the required unit suite remains green.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 4afe067. The marker now goes through the repository protocol: RelationRepository.record_pending_relation_publication is the single writer, used by the accept transaction (via relation_repository(project_id)) and the publisher's begin step. The fake-session runner tests are replaced by real-DB tests in test-int/test_accepted_note_mutation_runner_db.py rather than teaching the fakes the new method.
…ository The accept transaction recorded its pending marker with a bare session.add, the only accept-time write that bypassed the repository capabilities. The marker now has one writer, RelationRepository.record_pending_relation_publication, used by both the accept transaction and the publisher's begin step. The accepted-note runner tests drove every mutation with a stand-in session and fake repositories, so they could not see what a transaction actually writes. They now run the production mutation dependencies against a real database: create, update, edit, move and delete, including base-checksum conflicts, relay supersession, materialization states, directory casing, graph policy, pending markers and inbound-link cleanup. Races are injected at the note lock and say so. Only pure mapping tests remain as unit tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T8wjd6HrtSA2LN9ssC4NzF Signed-off-by: phernandez <paul@basicmachines.co>
A PUT whose destination differs from the note's path records the change as a move, but its materialization carried no previous path, so runtimes that announce moves from the materialization could only report an update and left readers holding the old path. The project change already records what the mutation did; the materialization now takes its previous path from it, so a PUT rename and an explicit move carry the same move evidence and the planners no longer accept a second, independent value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T8wjd6HrtSA2LN9ssC4NzF Signed-off-by: phernandez <paul@basicmachines.co>
Both tests built their engine without a config, so the database backend came from the developer's home config. On a machine configured for Postgres they ran SQLite-only SQL against Postgres and failed. They now pass an explicit SQLite config. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T8wjd6HrtSA2LN9ssC4NzF Signed-off-by: phernandez <paul@basicmachines.co>
…s match Text mode on Windows writes CRLF, so a seeded source object no longer hashed to the accepted Markdown and the move-cleanup cases failed only there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T8wjd6HrtSA2LN9ssC4NzF Signed-off-by: phernandez <paul@basicmachines.co>
Summary
Closes #1661.
Publication marker in the accept transaction
relation_search_refreshmarker for the accepted generation, throughRelationRepository.record_pending_relation_publication(the single writer, also used by the publisher'sbegin). An accepted note is never visible without it.beginreuses a marker already pending for its generation, so a successful publication leaves exactly one unit of refresh work. A failed publication leaves it pending, which keeps change detection's repair path.PUT renames announce the move
previous_file_pathfrom the project change inattach_accepted_project_note_change, so a PUT rename and an explicit move carry the same evidence. The planners no longer accept an independent second value.Tests
test-int/test_accepted_note_mutation_runner_db.py): create, update, edit, move, delete, base-checksum conflicts, relay supersession, materialization states, directory casing, graph policy, pending markers, inbound-link cleanup, PUT-rename move evidence. Races are injected at the note lock and say so. Only pure mapping tests remain as unit tests. Net −2,100 lines.test-int/test_note_write_outcomes.py: a published write leaves nothing pending; the accepted generation is pending before post-commit publication starts.🤖 Generated with Claude Code
https://claude.ai/code/session_01T8wjd6HrtSA2LN9ssC4NzF