Skip to content

CRAF'd delivers into CRAF'd's own Appwrite project, with no fallback to the shelf (#327) - #356

Merged
Polichinel merged 4 commits into
developmentfrom
feat/crafd-audience-isolation-327
Nov 27, 2026
Merged

Polichinel merged 4 commits into
developmentfrom
feat/crafd-audience-isolation-327

Conversation

@Polichinel

Copy link
Copy Markdown
Collaborator

Closes #327.

What this changes

The CRAF'd delivery used one Appwrite project for both halves of its job. Since 2026-11-11 the audience has a project of its own, and views-crafdapi reads only that one. A delivery switched on before this change would have written to a place nothing reads — and reported success.

There are now two connections:

project key direction
shelf the shared one producer read
audience CRAF'd's own publisher write

views_postprocessing/contract/audience.py is the new invariant. It refuses the case an absence check cannot see: both coordinates present, and equal. An absence check passes when the audience project id is set to the shelf's, which is exactly how this would be mis-wired.

Three decisions recorded here rather than in a closed issue:

  • No fallback. A missing, blank or equal audience project is a refusal. Falling back to the shelf would restore the bug the change exists to remove, silently.
  • Primitives only. The invariant takes two strings and a name. No Appwrite environment, no pipeline-core, no manager — so it is testable anywhere, and tests/test_clone_readiness.py lists it as shared machinery because it names no partner. A second audience gets it free.
  • The checked value is returned, not re-read. The caller uses what the invariant verified. A second os.getenv is a second chance to read the wrong name.

No refusal message prints a project id. This repository is public and its CI logs are world-readable (register C-89).

The registry pin, and a mistake worth reading

APPWRITE_CRAFD_PUBLISHER_API_KEY is not invented here. It is minted by the coordinate registry in edition v1.9.1 — views-appwrite#211 → PR #212, promoted to that repository's main in #213 and tagged appwrite-seam-v1.9.1. The spelling this branch was built against was adopted unchanged.

An intermediate state of this branch pinned v1.9.1 against commit 34261d1, read from a views-appwrite working tree rather than from the file at the commit being named. 34261d1 declares v1.9.0 and mints no such slot, so the pair contradicted itself — the same class of error the pinning rule (#196) exists to prevent.

It was not caught by the two tests that catch it. Both need tomllib, which is Python 3.11; the shell in use was 3.10.14, which is below this project's own declared floor (pyproject.toml:12 requires >=3.11,<3.15). One guard skipped with a message indistinguishable from an ordinary missing-fixture skip; the other aborted collection. The run said passed.

That is registered as C-125 under the existing cluster "A guard that cannot fail", whose thesis it restates from the outside: every earlier member could not fire for a reason inside the code; this one fires correctly and was removed by the environment. The entry proposes two small fixes, both deriving the floor from pyproject.toml rather than adding a declaration that can itself go stale.

Dependency floor — read this before merging

views-pipeline-core moves to >=3.6.0, for its TablesDB metadata writes. Without them a key issued after Appwrite's 1.8 rename uploads the files and then fails on the metadata row, leaving an orphan behind an exit-0 run (ADR-047).

This changes what the next FAO run installs. The shared environment holds pipeline-core 3.3.5, which no longer satisfies the floor, so the launcher will upgrade it — and 3.6.0 requires views-frames >=3.0.0, where 2.0.0 is installed. So FAO's next delivery is the first on two new major versions, not one. The operator accepted that on 2026-11-27.

The lock change itself is four lines, pipeline-core 3.4.0 → 3.6.0 only. pyarrow 16.1.0, views-frames 3.0.0, numpy 1.26.4 and pandas 1.5.3 are untouched in the lock, so the delivered bytes are unaffected by this diff.

Verification

Run on the Python 3.11.15 environment the launcher installs into, not the 3.10 shell default:

  • 574 passed, 3 skipped, 41 xfailed, 1 failed.
  • The one failure is test_the_installed_runtime_dependencies_match_the_lockfile, reporting that the environment holds pipeline-core 3.3.5 and views-frames 2.0.0 against a lock saying 3.6.0 and 3.0.0. That guard is telling the truth: the environment has not been reinstalled since the floor moved. It is the proof of the paragraph above, not a defect in it.
  • tests/test_audience_isolation.py adds 9 tests. Four mutations of audience.py each turned them red and were reverted.
  • The pin guard was mutation-tested: restoring SEAM_CONTRACT_COMMIT = "34261d1" turns two tests red; a251cb8 turns them green.

One judgement call

tests/test_doc_accuracy.py's partner-package line budget was raised 700 → 732 in this branch, once, to a measured number — the package stood at 697 of 700 before it. When later comments pushed it one line over again, the comments were shortened instead of the budget raised a second time; prose that duplicated the register was cut and replaced with pointers to it. Raising a threshold to make a guard pass is the habit epic #344 exists to stop.

Not in scope

The first CRAF'd delivery has not run. The publisher key's write scopes are a console reading, not proven by a request; the registry names that first delivery as the proof, and a write probe was deliberately not added because it would leave a row in a table that currently holds zero. views-models' pin of this package still points at 1.4.0 and moves only after a release tag — the operator's call.

This branch also carries one earlier commit, 879630d, a register curation pass made directly on development and never pushed. It is unrelated to #327 and is included so it does not sit unpushed; it can be reviewed independently of the commit above it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ANY1CCy9Xo7zjMY4XJ69v9

Polichinel and others added 3 commits November 25, 2026 06:29
…elves, and a settled disagreement sat open for 16 weeks

All 12 existing integrity checks passed, so every finding here is in the half the
guard does not cover: the Causal Clusters prose, and entry bodies.

Corrected, each a false statement the register made about itself:

- Cluster M was titled "Six open concerns" and has held exactly one (C-72) since
  2026-08-03 — which its own Entries line already said. Renamed, with the note
  that it closes when C-72 closes: a one-member cluster has no shared root cause.
- Cluster H's Fix-strategy line said "this cluster is discharged" while the
  Resolution-scope line directly below it recorded C-30 as open at Tier 2. The
  cluster is live and its only live purpose is being C-30's home — no other
  cluster covers upstream regression on a views-datafactory region definition.
- D-11 carried "SETTLED 2026-07-31" and "CONDITION MET 2026-08-01" and stated
  outright that no live tension remained, while filed under ## Disagreements.
  Moved to Resolved Disagreements.

Owner added to the nine open entries without one (C-15, C-24, C-26, C-28, C-30,
C-40, C-72, C-98, C-100 — four of them Tier 2). Every value is derived from what
the entry or its cluster already states, not assigned: C-26/C-28 from Cluster G's
"genuinely upstream-owned", C-24 from its own "the repo that owns the fix",
C-72 from "where the exposure actually sits: views-faoapi". Owner is not in the
guard's required set and the nine were the oldest entries, which is why they
drifted; the required set is left alone deliberately, since backfilling a field
is cheaper than failing CI on history.

C-109's trigger fired and is discharged: 19 Location references across the 11
entries filed since 2026-11-12, 0 unresolvable. The entry now records what that
does NOT prove — a line can be in range and point at unrelated code — and that
the trigger is perpetual by construction and kept that way on purpose, because
the subject is decay and the only honest trigger for decay is the clock.

New guard, test_no_settled_entry_sits_under_an_open_section, widening the
existing check twice: it scans ## Disagreements as well as ## Open Concerns, and
reads bodies rather than only headings. Both gaps were needed to hide D-11.

The pattern is anchored (bold, line-initial) because a looser one reported eight
false positives, every one a legitimate partial discharge ("RESIDUAL DISCHARGED
2026-07-27") or a cross-reference to another closed entry. Measured when written:
0 matches under Open Concerns, 1 under Disagreements, 34 under Resolved Concerns.

Mutation-tested rather than assumed, since a guard that cannot fail is this
register's own Cluster O: a settled marker injected under Open Concerns and again
under Disagreements each turned it red, and both were reverted. The existing
fence guard also caught a real error in this change — the C-109 note was first
written past the entry's closing rule, stranding C-112.

Not done, and recommend-only per the skill: three blind spots need register-risk,
the sharpest being that nothing covers a zero-filled upstream tail meeting an
observed-range clip documented to degrade open (C-26 + C-103), which is live
against the artifact published 2026-11-22.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ANY1CCy9Xo7zjMY4XJ69v9
…back to the shelf (#327)

The CRAF'd delivery read and wrote one project. Since 2026-11-11 the audience has
its own, and views-crafdapi reads only that one — so a delivery switched on today
would have landed where nothing reads it.

Two connections now, not one:
  - the SHELF (shared project, producer key) is READ
  - the AUDIENCE (CRAF'd's own project, publisher key) is WRITTEN

`contract/audience.py` refuses the case an absence check cannot see: both
coordinates present and equal. It takes primitives only, so it is testable with no
Appwrite environment and no pipeline-core, and it names no partner, so a clone gets
it free. There is no fallback — a missing, blank or equal audience project is a
refusal, never a write to the shelf — and no refusal message prints a project id,
because this repository is public and its CI logs are world-readable (C-89).

The publisher key's env-var name is minted by the coordinate registry in edition
v1.9.1 (views-appwrite#211 -> PR #212, promoted to main in #213, tagged
appwrite-seam-v1.9.1). The pin moves to that commit.

Raises the views-pipeline-core floor to >=3.6.0 for its TablesDB metadata writes,
without which a key issued after Appwrite's 1.8 rename uploads files and then
401s on the metadata row, leaving an orphan with an exit-0 run (ADR-047). This
changes what the next FAO run installs: pipeline-core 3.3.5 -> 3.6.0 and, because
3.6.0 requires it, views-frames 2.0.0 -> 3.0.0. Accepted by the operator 2026-11-27.

Registers C-125, found while completing the pin: both guards on it were being run
on Python 3.10, below this project's declared floor of 3.11, where one skipped
quietly and the other aborted collection. The suite reported `passed` with the
guards subtracted, and a pin that contradicted itself survived that run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ANY1CCy9Xo7zjMY4XJ69v9
…ect, and fix twelve more review findings (#327)

The #327 guarantee was not guarded. `/code-review max` on #356 found, and I reproduced,
that the whole `assert_audience_is_not_the_shelf` call could be DELETED from
`_partner_appwrite_config`, its two project ids transposed, or `project_id=` repointed at
the shared project — and the suite stayed green in all three. Nine tests exercised the
rule; none asserted the `AppwriteConfig` the manager actually builds. That is this
repository's own cluster O ("a guard that cannot fail"), in a change that had just
registered C-125 for another instance of it.

Ten mutations now fail the suite, each applied and run, each reverted:
delete the call; transpose its project ids; repoint project_id; drop the shelf tuple from
the environment assertion; return the unstripped value; drop the ERROR log; never compare
credentials; pass on a blank shelf id; drop the publisher key from KEY_EXPIRY; drop the
two new coordinates from the class map.

The rule itself, six findings:
  - every parameter keyword-only — four same-typed strings from four similar coordinates
    transpose, and a SYMMETRIC equality check passes when they do;
  - the credential is compared too, never printed. A key authenticates against exactly one
    project, so audience-project-plus-shelf-key is as broken as the collision and fails as
    a 401 inside the delivery instead of as a refusal;
  - a blank or non-str shelf id is now a REFUSAL, not a pass. It previously skipped the
    comparison and then logged "two distinct projects" having compared nothing — the
    polarity C-113 was closed to fix, reintroduced;
  - the returned value is stripped, so the client gets the value that was checked;
  - every refusal is logged at ERROR as well as raised (ADR-008). Failure was the quieter
    outcome: nothing logged on refusal, an INFO line on success;
  - `APPWRITE_DATASTORE_PROJECT_ID` is declared on this path. It was the check's second
    operand while being asserted only in a different function on a different path.

One connection resolution per delivery, shared by the upload and the C-94 read-back. Two
independent `os.getenv` sweeps minutes apart meant the read-back could verify a different
project than the write.

Two pyproject justifications were wrong and are corrected. The claimed mechanism — files
uploaded, metadata 401ing, orphans, exit 0 — does not exist: at pipeline-core 3.4.0
`upload_file_with_metadata` calls `check_file_exists_by_hash` BEFORE storage and returns
failure, and `store_port.py` raises so the run exits non-zero. The cited "ADR-047" names no
document here. And the views-frames paragraph still said pipeline-core capped frames below
3.0.0; 3.6.0 requires `>=3.0.0`, so TWO majors move on FAO's next run, not one.

`publisher-2026-11` added to the expiry tripwire with a role map, because its message said
both delivery paths authenticate with the earliest key — which would have sent the operator
to rotate a key that had not expired.

Docs: vpp_018 records the standing rule (CLAUDE.md requires an ADR, and there was none).
README gained both connections; it listed neither new coordinate, so the only operator
reference could not say where either value comes from. CLONING.md and the CIC both said the
two managers "change no behaviour" — measured 31/53 lines and they now do.

Budgets raised with measurements rather than squeezed: package 732 -> 760, manager
450 -> 475, both with ~20 lines of headroom because zero turns the next unrelated comment
into a red build. The review's own remedy — moving the byte-identical 111-line store port
into `contract/` — is NOT taken: that duplication is C-33, re-affirmed with reasons, and a
line budget is not its stated trigger.

Registers C-126 (none of this code has executed, and views-models does not export the two
coordinates — cross-repo) and C-127 (six container coordinates now addressed against two
projects, their registry rows carrying no project scope). C-125's control measurement
corrected: it quoted a recalled 573/2 in the entry about trusting an unwatched run.

587 passed, 1 failed on Python 3.11.15 — the failure being the environment-drift guard
reporting this prefix has not been reinstalled since the floor moved. ruff clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ANY1CCy9Xo7zjMY4XJ69v9
@Polichinel

Copy link
Copy Markdown
Collaborator Author

Update 2026-11-27 — after /code-review max, and it found a real defect

The review's headline is correct and I reproduced it before changing anything: the guarantee this pull request exists to make was not guarded. The whole isolation call could be deleted from _partner_appwrite_config, its two project ids transposed, or project_id= repointed at the shared project, and the suite stayed green in all three cases. Nine tests exercised the rule; none asserted the AppwriteConfig the manager actually builds. That is this repository's own cluster O — a guard that cannot fail — inside the change that had just registered C-125 for a different instance of it.

Ten mutations now fail the suite. Each was applied to the real files, run, and reverted:

# mutation result
1 delete the isolation call 3 failed
2 transpose its two project ids 2 failed
3 repoint project_id= at the shared project 2 failed
4 drop the shelf tuple from the environment assertion 1 failed
5 return the unstripped value 2 failed
6 drop the ERROR log from refusals 1 failed
7 never compare the credentials 8 failed
8 pass on a blank shelf id (the old polarity) 6 failed
9 drop the publisher key from KEY_EXPIRY 1 failed
10 drop the two new coordinates from the class map 1 failed

What else changed

Six more findings landed on the rule itself: keyword-only parameters (four same-typed strings transpose, and a symmetric equality check passes when they do); the credential is compared as well as the project, never printed; a blank or wrongly-typed shelf id is a refusal rather than a pass that logged "two distinct projects" having compared nothing — the polarity C-113 was closed to fix; the returned value is stripped, so the client gets the value that was checked; refusals are logged at ERROR as well as raised (ADR-008 — failure was previously the quieter outcome); and the shared project's id is declared on the path that reads it.

One connection resolution per delivery is now shared by the upload and the read-back that verifies it. Two independent sweeps of the environment minutes apart could verify a different project than the one written to.

Two justifications in pyproject.toml were wrong and are corrected. The mechanism I claimed — files uploaded, metadata failing, orphans left behind, run exiting 0 — does not exist: at pipeline-core 3.4.0 the metadata check runs before storage and returns failure, and this repository raises so the run exits non-zero. The cited ADR-047 names no document here. The views-frames paragraph still said pipeline-core capped frames below 3.0.0, so anyone reading it to judge the FAO upgrade's blast radius was told one major version moves when the answer is two.

publisher-2026-11 is now in the expiry tripwire with a role map: its message asserted that both delivery paths authenticate with the earliest key, which would have sent the operator to rotate a key that had not expired.

Docs: vpp_018 records the standing rule, which CLAUDE.md required and this change had not written. The README listed neither new coordinate, so the only operator reference in the repository could not say where either value comes from. CLONING.md and the class contract both said the two managers "change no behaviour" — measured 31 lines against 53, and they now do.

Two things I did not do, and why

The budgets were raised with measurements, not squeezed. Package 732 → 760, manager 450 → 475, each with roughly twenty lines of headroom, because zero headroom turns the next unrelated comment into a red build on someone else's pull request. Everything added since the first raise is a review fix; shrinking under the old number would have meant reverting them.

The review's own remedy for the budget is declined with a reason. Moving the byte-identical 111-line store port into contract/ would free 111 lines from both partner packages and put this back under 700 — but that duplication is C-33, a recorded decision re-affirmed with reasons on 2026-08-14, whose extraction trigger is a third partner package or a bug hand-patched in both copies. A line budget is not that trigger, and overturning a documented decision to make a number fit is the same suppression in a tidier shirt. The measurement is recorded in both places so whoever hits the trigger has it.

Registered rather than fixed

  • C-126 — none of this code has executed in any run, because the upload interlock is closed, and there is no mode that validates the audience connection without arming a real delivery. Searched: no script in views-models mentions APPWRITE_CRAFD_PUBLISHER_API_KEY, so the launcher does not yet export the coordinates this delivery now requires. That half is cross-repo and the operator's to sequence.
  • C-127 — six container coordinates are now addressed against two Appwrite projects while their registry rows carry no project scope. The containers themselves are not a gap: registry edition v1.9.1 records the operator measuring file_metadata with the table crafd, all thirteen columns and three indexes, in CRAF'd's own project on 2026-11-25.
  • C-125's control measurement quoted a recalled 573 passed, 2 failed — in the entry about trusting a run nobody watched. Re-measured and corrected.

Verification

CI on this head: 586 passed, 5 skipped, 41 xfailed, 0 failed, lint clean, all four checks green. Locally on Python 3.11.15: 587 passed, 1 failed — that one being the environment-drift guard reporting this machine's prefix has not been reinstalled since the dependency floor moved, which is the guard telling the truth.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ANY1CCy9Xo7zjMY4XJ69v9

…oints at views-models#755

Read in views-models rather than inferred from a grep: `platform_env.sh` exports
coordinates generically from the registry, so `APPWRITE_CRAFD_PROJECT_ID` resolves there
with no change at all. Only the SECRET is single-slotted — `PLATFORM_ENV_SECRET_NAME` at
`:68`, with one `.env` lookup, one export and one presence check behind it — so the
publisher key is the whole of what has nowhere to live.

The entry said "the two coordinates", which overstated the change that repository has to
make. It also failed to cite views-models#755, which has tracked exactly this since
2026-11-25 and deliberately leaves the direction open because it touches their
single-writer rule.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ANY1CCy9Xo7zjMY4XJ69v9
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