Skip to content

refactor: stop carrying anything for older versions, and send the config version with the overview - #95

Merged
fylorn merged 1 commit into
mainfrom
refactor/drop-compat
Sep 22, 2026
Merged

fylorn merged 1 commit into
mainfrom
refactor/drop-compat

Conversation

@fylorn

@fylorn fylorn commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

The project has almost no users yet, so nothing is kept for older versions any more. This removes every piece of code whose only job was to cope with an older core, an older config file, or data written by an older version.

Request database

  • One schema (Db::create) instead of a chain of migrations. SCHEMA is 17.
  • A database written by any other version is not migrated and not read: tw_store::open deletes it together with blobs/ and starts over. The bodies have to go too, because request ids restart at 1 and old bodies would otherwise show up under new requests.
  • Every existing database is rebuilt once when this ships. They all still hold rows from before failure codes existed, which is what made the code fall back to an empty code.
  • A failure row always carries its code, and Msg::plain is gone. The enterprise repo does not call it.

Protocol

  • Response types no longer have a bare #[serde(default)] on fields that were added after their struct. Those only mattered when the desktop app parsed JSON from an older core, and the two always ship together. Defaults paired with skip_serializing_if, and defaults on request types, stay.
  • Overview.config_version is new. It carries the version an edit is based on, read from the file on disk, and it arrives with the data the edit is made from. The interface used to read it separately, once, at startup. If core was not listening yet, it never got one, and every edit failed with "config version not loaded" no matter how long you waited.
  • CONTROL_API_VERSION is 6.

Config

  • A built-in rule id that does not exist is now a validation error, like any misspelled field. It used to be a warning, justified by rules that might be renamed later.
    • The built-in rules file moves from tw-scan to tw-config so validation can see the ids (tw-scan depends on tw-config, not the other way round).
    • GuardDetail.unknown, Rules.warnings, and the gateway's warning loop are gone.
  • Removed:
    • the special error for bind: lan;
    • the hint for the old key: { oauth } shape;
    • the ext tag kept so old history file names stay readable;
    • lenient reading of takeover records (path and file_created_by_us no longer default);
    • the unused version in the rules file;
    • the dead schema_supported.
  • tests/listen.rs used bind: lan as its example of a malformed bind. Without the special case, lan is a well-formed interface name, so the test now uses 192.168.1.5@wifi.
  • The config's own version: 1 field and its "too new" check stay. It is a format marker with no migration machinery behind it, and removing it would make every existing config.yaml fail to load.

Checks

  • cargo fmt --check, cargo clippy --workspace --all-targets -D warnings, and cargo test --workspace (1519 passed) all pass.
  • scripts/smoke.sh: 51 passed, 0 failed. The memory figure over target was already there.
  • The desktop app builds and passes its tests against this branch.

🤖 Generated with Claude Code

@fylorn
fylorn force-pushed the refactor/drop-compat branch from 81c8cda to 8e06959 Compare September 22, 2026 03:55
…fig version with the overview

The project has almost no users yet, so nothing is kept for older versions:

- The request database has one schema instead of a chain of migrations.
  A database written by any other version starts over empty, together with
  the stored bodies: request ids restart at 1, and old bodies would otherwise
  show up under new requests. SCHEMA is 17, so every existing database is
  rebuilt once. A failure always carries its code now, and Msg::plain is gone.
- Response types no longer default fields that only an older core would leave
  out. CONTROL_API_VERSION is 6.
- A built-in rule id that does not exist is a config error, like a misspelled
  field, instead of a warning kept for rules that might be renamed. The
  built-in rules file moves to tw-config so validation can see the ids;
  GuardDetail.unknown and the gateway's warnings are gone.
- Removed: the special error for `bind: lan`, the hint for the old
  `key: { oauth }` shape, the `ext` tag kept for old history file names,
  lenient reading of takeover records, the unused `version` in the rules file,
  and the dead schema_supported.

Overview.config_version is the version an edit is based on, read from the file
on disk and sent with the data the edit is made from. The interface used to
read it once on its own at startup; when core was not listening yet, it never
got one, and every edit failed with "config version not loaded".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@fylorn
fylorn force-pushed the refactor/drop-compat branch from 8e06959 to 784fd54 Compare September 22, 2026 04:04
@fylorn
fylorn merged commit 29cf037 into main Sep 22, 2026
1 check passed
@fylorn
fylorn deleted the refactor/drop-compat branch September 22, 2026 04:11
@fylorn fylorn mentioned this pull request Sep 22, 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