API Stability Matrix¶
This document enumerates the public API surface of dazzle_filekit that is
known to be imported by external callers. Any change to a name or
signature in the “Locked” section must be treated as a breaking change and
must include a migration commit in the downstream caller(s) listed below.
tests/test_import_stability.py is the automated canary for this document.
If you rename or remove a locked symbol, that test will fail.
Last audited: 2026-11-19 (filekit v0.5.3 – locking and portable.current_flavor added below; v0.5.0 – portable and batch_layout added below; no locked symbol renamed or removed since the v0.3.0 audit; one behaviour change, to how copy_tree_preserving_links treats junctions).
v0.3.0 (#15) is a deliberate clean break. Unlike the deprecation-shim migration procedure at the bottom of this doc, 0.3.0 removed/renamed locked symbols without shims and migrated every in-tree consumer in the same cycle. The rubric was coverage-completeness over backward-compatibility. 0.3.0 had not shipped to PyPI when these landed, so no released contract broke mid-stream.
v0.3.0 breaking changes (#15)¶
Old symbol |
Replacement |
Migrated consumer(s) |
|---|---|---|
|
|
dazzlecmd |
|
|
dazzlecmd |
|
|
(no external caller) |
|
one canonical def delegating to |
(behavior superset; no caller broke) |
|
|
(no caller; never exported) |
Locked top-level surface (from dazzle_filekit import ...)¶
v0.2.3 and earlier (locked since v0.2.3)¶
Symbol |
Callers |
|---|---|
|
claude-session-logger |
|
claude-session-logger |
|
claude-session-logger |
|
dazzlecmd |
|
github-traffic-tracker |
|
github-traffic-tracker |
|
preservelib workflows. v0.2.4 note: honors the new fields when present. v0.3.0: |
~~ |
Removed in 0.3.0 (clean break) -> |
|
README example |
|
README example |
|
README example. v0.3.0: platform-independent ( |
|
v0.3.0 (renamed from |
|
README example |
|
README example |
|
README example |
v0.5.3 additions (locking, current_flavor)¶
An exclusive lock on one dedicated lock file, and the flavor of the running interpreter for callers of the portable key. The first consumer of both is dz relaunch’s store (dazzlecmd).
Symbol |
Purpose |
|---|---|
|
The lock file |
|
Context manager: hold an exclusive lock on a dedicated lock file (Windows |
|
|
|
One non-blocking attempt / release on an open descriptor |
|
|
v0.5.0 additions (portable, batch_layout, two keywords)¶
One literal, runtime-neutral way to name an absolute path inside a store, and a planner that lays a batch of paths out so no two share a stored path. Both are pure: no file access, nothing expanded or resolved (0.5.3’s current_flavor is the one exception, and says so). The first consumer is safedel’s trash layout in dazzlecmd-lib.
Symbol |
Purpose |
|---|---|
|
The portable path key |
|
Absolute path -> |
|
Key -> native path for that runtime, or |
|
Join parts into a relative path that cannot climb and can exist on the target |
|
Raised for a path or key with no portable form (a |
|
The batch planner |
|
One base per root (the items’ common parent) and a |
|
The plan ( |
Behaviours that are part of the lock:
The same file has one key from Windows and from WSL (
C:\xand/mnt/c/xboth giveC/x); under"posix",/mnt/c/xis an ordinary folder (ROOT/mnt/c/x).Device paths, volume-GUID paths, drive-relative paths,
..above the root, and names that exist only under the\\?\prefix are refused, never guessed at.plan_batchnever returns two items with the same relative path; what it cannot place is an error in the plan, not an exception.
Two keywords added to locked functions, both with defaults that keep the 0.4.x call shape:
normalize_cross_platform_path(path, *, resolve=False, expand=True)–expand=Falsetakes the path literally (no whitespace strip, no~, no environment variables); only its format is normalized.copy_tree_preserving_links(src, dst, *, ..., links="keep")–"keep","follow"or"skip", for symlinks and junctions alike. Behaviour change: through 0.4.3 a junction insidesrcwas entered and its target copied, despite the name;"keep"now recreates it as a junction. Passlinks="follow"for the old result.
v0.4.0 additions (longpath)¶
Windows MAX_PATH shims via on-demand junctions – the remedy for the
condition utils.validation.is_valid_path already detected. Windows-only in
effect; a no-op where PATH_MAX is 4096/1024.
Not yet load-bearing. No external caller imports these today, so unlike the
rows elsewhere in this document they are not locked by an existing consumer.
The intended first consumer is dazzlecmd (dz longpath, plus a fixpath -o
branch), which is not built yet. Treat the surface as settled but young: if a
signature has to move, now is the cheap moment, and this section should be
re-audited once dazzlecmd depends on it.
Symbol |
Description |
|---|---|
|
The long-path shim domain module |
|
One-call entry point; returns an openable path and never raises for a path-shaped input (falls back to the original) |
|
The trigger. |
|
Pure decision, no filesystem writes; anchors at the shallowest ancestor that fits |
|
|
|
Shortest writable root, probed at runtime |
|
The ordered candidates, shortest first |
|
Longest filename a shim under |
|
Materialise the junction; verifies an existing one points at the requested anchor and lengthens the id on hash collision. Mutates |
|
Remove a shim, target untouched; re-checks junction-ness immediately before |
|
Age-based reaper; considers only junctions |
|
Constants |
Behavioural contracts worth pinning – each has a regression test, and each was a real defect first:
shim_pathnever raises for a path-shaped input. The guard coversOSError,ValueErrorandctypes.ArgumentError, because an embedded NUL surfaces as a different type per interpreter: 3.12+ raisesValueErrorviaos.path.isjunction, while 3.9-3.11 raisectypes.ArgumentErrorfrom the DeviceIoControl fallback – which is not aValueError.create_shimnever reports success for a junction pointing at a different anchor. Anchor ids are truncated hashes and do collide.remove_shim/reap_shimsnever touch a target’s contents, and refuse anything that is not a junction.
v0.3.0 additions (locked as of v0.3.0)¶
Restored from unctools’ 0.2.0 split (STACK-MAP D7), as the Option D resolver edge.
Symbol |
Description |
|---|---|
|
Fallback-aware |
|
Path-variant fallback (R2 / |
|
Flat batch-apply over a glob set (R3 / unctools |
|
Read-modify-write text replace (R4) |
|
Case-sensitivity helpers (R6) |
Intrinsic link primitives (#15 Phase A):
Symbol |
Description |
|---|---|
|
Intrinsic link analysis (no destination param); |
|
Link kind ( |
|
PowerShell junction + |
|
Detach a symlink/junction/hardlink without deleting its target (v0.3.2) |
|
|
|
Junction target via the reparse buffer |
Cross-layer schemas consumed (#15 Phase D): collect_file_metadata -> dazzle_lib.FileMetadataDict, collect_timestamp_info -> TimestampsDict, LinkInfo.to_dict -> LinkTargetDict (STACK-MAP D10).
Dependency change (0.3.0): dazzle-lib>=0.2.0 and unctools>=0.2.2 are now required (the PathVariantResolver seam + the V9 drive-map fold); the optional [unctools] extra is removed.
v0.3.3 additions (locked as of v0.3.3)¶
Declared-platform PATH-environment-value helpers (pathenv module) –
homed from dazzlecmd-lib’s self-setup work (dazzlecmd#103). Pure string
logic; the platform keyword is "windows" / "posix" / None (host).
Symbol |
Description |
|---|---|
|
The declared-platform PATH-value domain module |
|
Platform tokens for the |
|
The running host’s PATH dialect |
|
Split on the DECLARED platform’s separator ( |
|
Identity-normalize one entry (quotes, |
|
Normalized membership |
|
Pure string append; no-op when present under normalized identity |
v0.2.4 additions (locked as of v0.2.4)¶
Symbol |
Description |
|---|---|
|
Atomic text file write via tmp+rename |
|
Atomic JSON write; |
|
Tree copy in which the caller chooses what happens to symlinks and junctions ( |
|
WSL detection (Linux-only, False elsewhere) |
|
Cached pywin32 availability probe (for rich Windows metadata features) |
|
NTFS ctime restoration via pywin32 |
|
Metadata diff with 2s timestamp tolerance |
|
JSON-safe projection of a metadata dict |
|
Public submodule: |
Rule: Signatures may be enriched with additional keyword-only arguments
(def f(existing_arg, *, new_kwarg=default)), but positional parameters and
existing keyword names must not be removed or repurposed.
Locked submodule imports¶
dazzle_filekit.paths¶
Symbol |
Callers |
|---|---|
|
canonical entry point ( |
|
v0.3.0, renamed from |
|
v0.3.0 (#15 Phase A); distinct from |
normalize_path/normalize_path_no_resolvewere removed in 0.3.0 (clean break, no shims) – see the v0.3.0 breaking-changes table near the top.
dazzle_filekit.utils.disk¶
Symbol |
Callers |
|---|---|
|
dazzlecmd |
|
dazzlecmd |
|
dazzlecmd |
dazzle_filekit.utils.compat¶
Symbol |
Callers |
|---|---|
|
dazzlecmd |
|
v0.2.4 addition; platform detection helper |
|
re-exported from |
|
dazzlecmd fixpath |
dazzle_filekit.metadata (new in v0.2.4)¶
Full rich metadata module ported from preservelib. Public submodule: callers can from dazzle_filekit import metadata or from dazzle_filekit.metadata import ....
Symbol |
Purpose |
|---|---|
|
Rich capture incl. SDDL + xattrs + ctime |
|
Rich apply |
|
NTFS ctime restore |
|
Cached pywin32 probe |
|
Diff helper |
|
JSON-safe projection |
|
Human-friendly summary |
|
Timestamp-only capture |
|
Strategy-based timestamp apply |
dazzle_filekit.operations (primitives added in v0.2.4)¶
Symbol |
Purpose |
|---|---|
|
tmp+rename atomic text write |
|
atomic JSON wrapper |
|
link-aware tree copy ( |
dazzle_filekit.platform.windows (new capabilities in v0.2.4)¶
Symbol |
Purpose |
|---|---|
|
NTFS ADS enumeration via ctypes |
|
True if any non-ignored stream exists |
Module attributes (wildcard imports)¶
preservelib (three copies: C:\code\preserve\preservelib\,
C:\code\dazzlecmd\github\projects\core\safedel\_lib\preservelib\,
C:\code\github-traffic-tracker\local\src\ghtraf\lib\preserve_lib\) uses:
from dazzle_filekit import paths, operations, verification
This means the modules themselves (dazzle_filekit.paths,
dazzle_filekit.operations, dazzle_filekit.verification) must remain
importable and must continue to expose the functions preservelib reaches
for. See tests/test_import_stability.py::test_preservelib_module_shapes
for the concrete list.
Allowed changes (non-breaking)¶
Adding new functions.
Adding new modules.
Adding new keyword-only parameters to existing functions.
Enriching the behavior of existing functions when the external contract (return type, raised exceptions on the happy path, side effects on the target file) stays compatible.
Adding new positional arguments that default to an existing value are not safe if a caller uses keyword-only invocation – prefer keyword- only additions.
Forbidden without a migration plan¶
Renaming any symbol in the Locked tables.
Removing any symbol in the Locked tables.
Changing a function from a module-level function to a method on a class.
Changing the return type in a way that breaks existing callers.
Making a previously optional parameter required.
Migration procedure for a locked symbol¶
If a locked symbol genuinely needs to change:
Add the new function alongside the old one.
Update every downstream caller in the same working-set (grep across
C:\code\to confirm).Mark the old symbol
@deprecatedwith a one-release grace window.Ship.
Remove the old symbol in the release after the grace window.
Do not skip steps 2-4 even if you own all the callers – the session-logger incident on 2026-04-10 is the baseline cautionary tale.