Skip to content

spec(cli-surface): refusing a write outside its confined root is a fix - #7545

Closed
josephfarina wants to merge 1 commit into
mainfrom
josephfarina/ast017-write-confinement
Closed

josephfarina wants to merge 1 commit into
mainfrom
josephfarina/ast017-write-confinement

Conversation

@josephfarina

@josephfarina josephfarina commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

This follows cixzhang's suggestion on this pull request: the CLI's write-confinement classification lives in the CLI record, architecture:cli-surface, next to INV10, and spec:AST-017 keeps the release process. This change no longer edits spec:AST-017.

Exact decision needed

The owner of architecture:cli-surface (josephfarina) approves one rule, INV10a:

When a current record already confines a CLI operation's writes to a root, a change that makes the operation refuse a write outside that root, before writing anything, is a compatible [fix] and patch-eligible, even when the latest stable release accepted the input and its documentation did not forbid the write.

If approved, a Changeset for such a refusal is [fix], patch, and cites INV10a. If not, the same refusal stays [breaking] and waits for a declared minor.

It lands after #7608, which makes each published surface other than a component define its own compatibility contract in its own current record. Until then, spec:AST-017 FR32 classifies the same case as [breaking].

Existing authority searched

Decision

architecture:cli-surface/DEC-3, decider josephfarina, the record's owner.

  • INV10a (new, beside INV10): when a current record already confines the writes of a CLI operation (a command or its programmatic API) to a root, a change that makes the operation refuse a write outside that root, before writing anything, is a compatible [fix] and patch-eligible under the spec:AST-017 release process.
    • It holds for every route the write takes: a traversal segment, an absolute path, a symlink, or a default location derived from an input outside the root.
    • It holds even when the latest stable release accepted the input and its documentation did not forbid the write. A write outside the confined root is not a supported workflow, so a caller that relied on it is not a released victim.
  • The Changeset cites the confinement rule the released behavior violated, names each input that is now refused and how it fails, and gives the migration.
  • Boundary: inputs whose writes stay inside the root keep working. Refusing one of them, moving outputs instead of refusing, or confining an operation that no current record confines is classified like any other change.
  • DEC-3 records why: a write outside the root can replace files the caller never named as outputs, and agents pass generated paths unattended, so holding the refusal for a minor keeps that exposure open.

Rejected alternatives

  • Keep the rule in spec:AST-017, as this pull request first did. cixzhang prefers that spec:AST-017 own the release process and not hold CLI-specific breaking rules. Its decision number also collided with a decision since merged on main.
  • Ship a warning in a patch and refuse in the next minor. The escape stays open for the whole patch line, and the warning prints after the file is already replaced.
  • Use spec:AST-017 FR35's emergency path. It keeps the change [breaking] and needs a separate record and approval for each case, though these corrections are one recurring class with one shape.
  • Let every current invariant outrank released documentation. That is too broad: any correction could claim the patch tier by citing an invariant.

The record keeps the second and fourth as one Rejected: line in DEC-3.

Claim scope and non-goals

  • It governs only how a refusal of a write outside a root that a current record already confines is classified, for CLI commands and their programmatic API.
  • It does not create a confinement requirement or set any operation's root. INV10 and each command's own records do that.
  • It does not cover reads, writes inside the root, moving outputs, or any other correction.
  • It does not change the spec:AST-017 release process: categories and tiers, the declared-tier gate, the emergency path, and coexistence rules all stay as they are.

Evidence and implementation relationship

There is no implementation in this pull request. A Changeset can cite the rule as architecture:cli-surface/INV10a, matching how existing release notes cite records (for example spec:AST-017/FR45). I checked this on main, which declares 0.7.2, a patch plan: a [fix] patch Changeset that cites INV10a passes pnpm check:changesets and parses as category fix, and the same entry as [breaking] minor is refused.

Writing rubric results

  • R1 narration: none. INV10a and DEC-3 are in the present tense.
  • R2 research in the record: none.
  • R3 evidence naming a change: none. No evidence or verification cell is added.
  • R4 rejected alternatives over one line or outside a decision: two alternatives, kept as one Rejected: line inside DEC-3.
  • R5 pull request or issue references remaining: none added (I searched the diff for # followed by digits, /pull/ and /issues/).
  • R6 ruled open questions still listing options: none. OQ1 is unrelated and unchanged.

Scope

  • This PR contains specification records only.
  • It records observable behavior and preserves equivalent internal implementations.
  • Any named internal mechanism is intentionally public, names its dependent caller/system, and explains why an equivalent implementation would not satisfy the contract.
  • Verification states the evidence layer and failure signal without prescribing CI job/workflow topology.
  • It records one intentional durable decision, not a rescue for a separable tagalong.
  • The canonical knowledge owner, affected current claims, and overlapping open work are named; any ownership collision is resolved or called out for human decision.
  • Adjacent API, visual, accessibility, composition, and implementation facts remain outside scope unless this exact decision depends on them.
  • Public text and artifacts contain no internal Meta context.

Validation

  • pnpm check:knowledge: passes ("Knowledge templates and records are aligned."). scripts/check-knowledge.test.mjs: 121 passed.
  • Prettier: the added lines are Prettier-clean. Prettier formats main's file and the changed file identically, apart from those lines. prettier --check on docs/architecture/cli-surface.md already fails on main, because its Verification table needs re-padding. This change leaves that table alone, so it doesn't conflict with the open pull requests that edit it.
  • git diff --check: clean.

@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 15, 2026 10:52pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 14, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Oct 14, 2026
@astracat-bot

astracat-bot Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
📝 Draft — not reviewed automatically (for maintainers only) Oct 16, 2026, 3:41 PM UTC

@cixzhang

Copy link
Copy Markdown
Contributor

Hey Joey, I'd rather AST-017 not hold CLI-specific breaking rules. Could you put the write-confinement classification in the CLI record (architecture:cli-surface, next to INV10), so you own what "breaking" means for the CLI? AST-017 will just own the release process and point to each surface's own record for the breaking definition. That also avoids the DEC-21 clash with #7445.

@josephfarina
josephfarina force-pushed the josephfarina/ast017-write-confinement branch from 30134ac to 50a994a Compare October 15, 2026 22:46
@josephfarina josephfarina changed the title spec(AST-017): write-confinement corrections are not breaking spec(cli-surface): refusing a write outside its confined root is a fix Oct 15, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 50a994a

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Oct 15, 2026
cixzhang added a commit that referenced this pull request Oct 15, 2026
…7 owns the release process (#7608)

## Exact decision needed

Who decides what counts as breaking for a published surface that is not a component, such as the CLI?

Today `spec:AST-017` holds every surface's breaking rules, so a CLI owner who wants to say "this CLI correction is a `[fix]`, not breaking" has to change AST-017. This PR makes each non-component surface define its own compatibility contract in its own current record, and keeps AST-017 as the owner of the release process that applies the result. Components keep their rules in AST-017.

## Existing authority searched

- `spec:AST-017` (current, owners `cixzhang`, `josephfarina`): FR1–FR6 define breaking for every surface; FR3, FR9–FR13 and FR45 carry CLI-specific classification; FR32–FR34 classify corrections with a released victim; the Authority relationships section says `architecture:cli-surface` and `spec:AST-042` own CLI structure, admission and parity, while AST-017 owns "compatibility and release transition". Nothing lets a surface record decide its own breaking rules.
- `architecture:cli-surface` (current, owner `josephfarina`, approved by `cixzhang`): INV3 (error codes are append-only) and INV10 (every write is confined) already state CLI contract facts, but the record does not say how a correction to them is classified, because AST-017 claims that.
- Open work on the same record: `#7545` (draft) adds a CLI write-confinement rule as FR54 and DEC-21. DEC-21 is already used on main (successor plan, merged in `#7445`). This PR takes the next free IDs on main, FR54 and DEC-22, so `#7545` collides on FR54. Under this PR its content belongs in `architecture:cli-surface` (next to INV10) instead of AST-017; if it stays in AST-017 it must renumber.

## Decision

`spec:AST-017/DEC-22`, decider `cixzhang`.

- **FR54 (new):** each published surface other than a component takes its compatibility contract from its own current record. For the CLI that record is `architecture:cli-surface`. The contract states which consumer scenarios are valid and supported, what counts as a released victim, and which corrections are `[fix]` vs `[breaking]`. The surface record's owners decide it through that record's normal approval.
  - Where the surface record states a rule for a case, that rule decides it. Where it is silent, FR1–FR6 and AST-017's existing rules for that surface apply, so nothing is left unclassified.
  - A surface rule turns on the change and its contract, never on risk or adoption (FR6), and covers only released, published surfaces (FR2).
  - AST-017's release process applies to the result unchanged: Changeset categories and bump tiers, migration evidence, experimental isolation, patch/minor/emergency paths, deprecation and coexistence, release gates.
  - A surface record defines only whether a change is breaking, never how it ships. Anything any surface record classifies as `[breaking]` lands only in a declared minor (FR31) or through the emergency path (FR35), never in a patch release; no surface record can make it patch-eligible by redefining a release rule.
  - Components keep AST-017's rules, including FR3 and FR53.
- **Pointers:** Intent, FR1, FR32, Authority relationships, and Current-state impact point to FR54. FR54 and DEC-22 join the `compatibility` review trigger. The verification table gains an FR54 row.
- **Not in this PR:** any CLI breaking rule itself, including write confinement. That is the CLI record owner's to add in `architecture:cli-surface`.

## Rejected alternatives

- Keep every surface's breaking rules in AST-017. This makes AST-017's owners decide contracts for surfaces they do not own, and every CLI classification change waits on a global record.
- Move AST-017's existing CLI rules (FR9–FR13, FR45) into `architecture:cli-surface` in the same PR. That is a larger, separate change for the CLI owner; FR54's "silent means AST-017 applies" keeps them working until the CLI record replaces them.

## Claim scope and non-goals

- Governs only who defines the compatibility contract for non-component surfaces, and that AST-017's process applies to the result.
- Does not change any classification today: no surface record states its own rule yet, so every current outcome is unchanged.
- Does not change component classification, accessibility fixes (FR53), the tier gate, or release mechanics.

## Evidence and implementation relationship

No implementation. `pnpm check:changesets` and release tooling are unaffected: they check categories and tiers, which stay in AST-017.

## Writing rubric results

- R1 narration: none; FR54 and DEC-22 are present tense. The DEC-22 rationale states the ownership fact, not the history of the change.
- R2 research in the record: none.
- R3 evidence naming a change: none; the FR54 verification row names the review and representative cases.
- R4 rejected alternatives over one line or outside a decision: one, inside DEC-22, one line.
- R5 pull request or issue references remaining: none added (searched the diff for `#` followed by digits, `/pull/`, `/issues/`).
- R6 ruled open questions still listing options: none; Open questions stays "None".

## Scope

- [x] This PR contains specification records only.
- [x] It records observable behavior and preserves equivalent internal implementations.
- [x] Any named internal mechanism is intentionally public, names its dependent caller/system, and explains why an equivalent implementation would not satisfy the contract.
- [x] Verification states the evidence layer and failure signal without prescribing CI job/workflow topology.
- [x] It records one intentional durable decision, not a rescue for a separable tagalong.
- [x] The canonical knowledge owner, affected current claims, and overlapping open work are named; any ownership collision is resolved or called out for human decision.
- [x] Adjacent API, visual, accessibility, composition, and implementation facts remain outside scope unless this exact decision depends on them.
- [x] Public text and artifacts contain no internal Meta context.

## Validation

- `pnpm check:knowledge`
- Prettier
- `git diff --check`
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

Preview availability: Storybook and Sandbox are not both ready on the exact-head Vercel preview.

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

38 of 474 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 754,077
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,188
Chat Full AI Chat probe light 238,087
Chat Full AI Chat probe dark 237,060
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
Chat Default neutral dark 33,205
Chat Default neutral light 32,876
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232
ProgressBar With Target Mark probe dark 7,895
ProgressBar With Target Mark probe light 7,895
TableRowExpansion Detail Panel neutral dark 5,150
TableRowExpansion Detail Panel neutral light 4,068
SideNav Resizable in AppShell probe dark 3,846
SideNav Resizable in AppShell probe light 3,846

and 18 more.


Generated by PR Enrichment workflow | View full report

@github-actions
github-actions Bot deleted the josephfarina/ast017-write-confinement branch October 17, 2026 06:20

This branch was successfully deployed

1 active deployment
Preview — 50a994a5 Deployed Oct 15, 2026 by vercel[bot]
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.

2 participants