Skip to content

Migrate: remove article-ids - #796

Open
Deicyde wants to merge 4 commits into
mainfrom
removal/migrate-article-ids
Open

Deicyde wants to merge 4 commits into
mainfrom
removal/migrate-article-ids

Conversation

@Deicyde

@Deicyde Deicyde commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Premise

  • User: projects that once gave articles an article_id with autoform migrate article-ids, and maintainers of the code behind it.
  • Problem: 0.7.0 deprecated autoform migrate article-ids for removal in 0.8.0 (Read literature-links annotations as an article's Lean link #601). It still prints a warning[deprecated]: line on every run, and its plan, its frontmatter writer and its autoform-article-id-plan/v1 schema still ship.
  • Replaces: autoform links set BLUEPRINT ARTICLE gives an article its article_id, and autoform migrate links blueprint --write gives one to each annotation it writes. Nothing replaces the --check gate or the --json plan, as 0.7.0's notes said.
  • Deletes: the command, plan_article_ids, write_article_ids, ArticleIdWriteError, the entry and plan classes, IDENTITY_PLAN_SCHEMA and the frontmatter writer _with_article_id.

Line delta: +73/-552 in total.

  • code: +3/-240 (article_identity.py +1/-180, __main__.py +1/-59, links_migration.py +1/-1);
  • docs: +8 (CHANGELOG.md);
  • tests: +62/-312 (tests/test_article_identity.py +47/-284, tests/test_annotations.py -24, tests/test_links_migration.py +15/-4).

What changes

  • CLI. autoform migrate article-ids fails as an invalid choice, exit 2 from argparse. autoform migrate keeps links, which now dispatches directly.
  • Python. article_identity.py keeps only the three helpers links set and migrate links import: _proposed_id, the ID a new article is proposed; _read_regular, which reads a regular file and refuses anything else; and _replace_if_unchanged, which replaces a file unless it changed since it was read. They stay where they are: moving _proposed_id into links_migration.py would make links_set.py import it, and links_migration.py already imports links_set.py. The graph still reads article_id until 0.9.0, unchanged.
  • Generated files. No template, generated workflow or skills/setup file runs migrate article-ids, on main or in any release, so neither copy of autoform_audit.py changes. Their one article_id line validates the assumption contract, which the 0.9.0 removal of article IDs owns.
  • Tests.
    • The plan, write and command tests go: tests/test_article_identity.py's 17 plan, write and CLI tests, and tests/test_annotations.py's two tests of --write beside blueprint/links/.
    • The two graph tests of article_id stay.
    • Where a write test covered a helper that migrate links relies on, and no other test did, the helper now has a direct test: refusing a symlink, keeping the file mode with and without os.fchmod, and refusing a file changed before or during the replacement. A new test checks that the proposed ID is deterministic and well formed, as the deleted plan test did, and that it depends on both the path and the source hash.
    • The write tests of CRLF and CR frontmatter, the byte-order-mark refusal and the hash check against the plan tested only the removed writer. So did the write through an unreadable link, which tests/test_graph.py covers for loading.
    • tests/test_links_migration.py's two tests that took the expected ID from plan_article_ids take it from _proposed_id. A new CLI test checks that migrate article-ids exits 2 as an invalid choice.
  • CHANGELOG. Under Unreleased, an Upgrading from 0.7.0 entry and a Removed entry, the latter pairing with 0.7.0's Deprecated entry for Read literature-links annotations as an article's Lean link #601. They were added in a second commit once the PR had its number:
### Upgrading from 0.7.0

- **Article-ID gate.** Nothing replaces `autoform migrate article-ids
  --check`: a CI step you added that runs it exits 2 until you delete it. No
  generated workflow runs it (#796).

### Removed

- **`autoform migrate article-ids`**, deprecated in 0.7.0, is gone, with its
  `--check` gate, its `--write` and its `--json` plan.
  `autoform links set BLUEPRINT ARTICLE` gives an article its `article_id`,
  and `autoform migrate links blueprint --write` gives one to each annotation
  it writes (#796).

Checks

Posted by Claude Code, at Jack's request.

0.7.0 deprecated it for 0.8.0 (#601): links set gives an article its
article_id, and migrate links gives one to each annotation it writes.
Its plan, its write and the autoform-article-id-plan/v1 schema go,
and nothing replaces its --check gate. article_identity.py keeps the
three helpers links set and migrate links use: the proposed ID, the
regular-file read and the replacement that refuses a changed file.

The tests of the plan, the write and the command go. The helpers keep
direct tests of what migrate links relies on: the proposed ID's form,
the symlink refusal, the kept file mode with and without fchmod, and
the refusal of a file changed before or during the replacement.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 13, 2026
@Deicyde

Deicyde commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Review at 17271f3: no blocker. I checked it against path identity's next step and against migrate links.

  • Nothing the next path identity step needs is removed. That step switches the writers and re-keys articles in migrate links. It uses neither plan_article_ids and write_article_ids nor the autoform-article-id-plan/v1 JSON, all of which name articles by article_id. _proposed_id, _read_regular and _replace_if_unchanged stay, since links_migration.py and links_set.py import them. Their tests stay too: determinism, the symlink refusal, the file mode, the changed-file refusal and an edit made during the flush.
  • migrate links is unchanged. links_migration.py changes one docstring line. migrate now dispatches straight to _migrate_links, as _migrate did for links. That is its only subcommand, and argparse still requires it.
  • The removed command fails plainly. autoform migrate article-ids BLUEPRINT --check exits 2 with argparse's invalid-choice error, as test_cli_refuses_migrate_article_ids checks.
  • CHANGELOG. The Removed entry pairs with 0.7.0's Deprecated entry for autoform migrate article-ids (Read literature-links annotations as an article's Lean link #601) and names the same replacement, links set, plus migrate links --write for annotations. The Upgrading entry says a CI step that still runs --check exits 2, which matches argparse's exit for an invalid choice. Both go under the existing Unreleased headings, so no heading is duplicated.

Notes, none blocking:

  1. test_each_fact_reads_back_the_same_from_the_annotation and test_the_bundled_example_migrates_with_its_graph_unchanged now take the expected ID from node.article_id or _proposed_id(node.id, node.source_sha256), the same expression links_migration.py uses where it proposes one. plan_article_ids computed the same value, so the checks are unchanged.
  2. plan_article_ids was the only place that refused an authored article_id equal to the one proposed for another article, and its test goes with it. migrate links never had that check, and this PR leaves that as it was.

Checks: this PR's CI on 17271f3, every job passed (https://github.com/facebookresearch/autoform-bot/actions/runs/43363927528). The 6 mutants of the code commit were each caught (https://github.com/facebookresearch/autoform-bot/actions/runs/43190587234); the CHANGELOG commit changes no code.

Posted by Claude Code, at Jack's request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant