Repository navigation
fix(populate): leave an edited CONSTRAINTS section alone (#371) - #378
Merged
Merged
Conversation
adf populate (and so every bootstrap) appended detected stack constraints to CONSTRAINTS whenever it did not find them, so a default the user had deleted kept coming back. Stack constraints are now added only when CONSTRAINTS is missing (created [load-bearing]) or still exactly the template's bullets. Any edit, including deleting a default or one of populate's own earlier bullets, leaves the section alone, and the core.adf result carries a reason naming what was not added (bootstrap warns with it). --force keeps the additive behaviour and now also fills an emptied section. ADD_SECTION text edits write a text-style decoration back with U+FE0F, as the scaffolds do, so the re-parse guard accepts it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e.json (#371) Review round 2 on #378. A section holding the template plus the one bullet populate added is, once that bullet is deleted, the template again, so the plain-Worker rule kept coming back. Populate now keeps .ai/.populate.json (version 1; per file, sorted `added` and `offered` lists, written only when it changes) and never re-adds a recorded constraint. A section is untouched while it is the template's bullets followed only by recorded-added ones; a recorded file whose CONSTRAINTS was deleted is not recreated. A new constraint for an edited section is reported once, as text and as a structured `notAdded` field (populate JSON row, bootstrap details.notAdded), and recorded as offered. Hints no longer suggest --force. A created CONSTRAINTS goes after CONTEXT (else GUIDE, else before METRICS) via an anchored ADD_SECTION whose position the re-parse guard checks. --force semantics unchanged, now recorded. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ies (#371) Review round 3 on #378. - An invalid .ai/.populate.json (bad JSON, version != 1, wrong shape, including an array `constraints` or a string `added`) blocks every stack constraint for the run; CONTEXT/STATE still fill. It is reported once per run and never rewritten. A UTF-8 BOM is stripped first. - Record parsing moves to adf-populate-record.ts: entries in a Map (no prototype keys), keys normalized to the bare module name. - adf init / bootstrap --reset-adf back the record up to .ai/.backup/ and drop each replaced module's entry, so its stack rules are filled again. - A created CONSTRAINTS goes after the later of GUIDE and CONTEXT. - No core.adf row suggests --force; the record row is status "recorded" and not counted as populated; no doubled "left as is"; docs paragraph moved back. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…traints # Conflicts: # CHANGELOG.md
Review round 4 on #378. - dropRecordEntries catches backup and write failures and returns a warning: the reset still registers modules, writes .adf.lock, carries the VENDORS record over and reports losses; the exit code is unchanged. - A read-only record is probed up front: populate adds no stack constraints that run (it could not record them), warns on the record row and never throws. The final write is caught too. - A reset drops the entry of every module it leaves at the template: replaced, created, or already the template. - While the record is invalid or unwritable, the core.adf row carries constraintsSkipped instead of "CONTEXT already customized" alone. - A reset with an invalid record leaves it untouched and warns. - Record keys with no file name are invalid; empty-list entries count as not recorded; parse errors are reported on one line; unknown fields are documented as dropped on rewrite. Co-Authored-By: Claude Opus 5.5 <[email protected]>
stackbilt-admin
pushed a commit
that referenced
this pull request
Oct 18, 2026
Keeps both the #366 and #371 CHANGELOG entries. Co-Authored-By: Claude Opus 5.5 <[email protected]>
stackbilt-admin
added a commit
that referenced
this pull request
Oct 18, 2026
parseAdf drops the U+FE0F variation selector from section decorations, and formatAdf emitted the parsed form. As a result, adf fmt --write rewrote the standard decorations (CONSTRAINTS, FILES, TOOLS) to their text-style glyphs, and adf fmt --check flagged correctly decorated files. - New canonicalDecoration(key, decoration) in @stackbilt/adf returns STANDARD_DECORATIONS[key] when the parsed decoration equals it apart from U+FE0F, and otherwise returns the decoration unchanged. formatAdf applies it to every explicit decoration. - The text patcher's U+FE0F workaround (#378) uses the same helper, so headers that populate adds are byte-identical to adf fmt output. Other decorations no longer gain a U+FE0F that fmt would strip. - This repo's .ai/*.adf CONSTRAINTS headers are rewritten to canonical form, and .adf.lock is refreshed (adf sync hashes raw bytes). adf fmt --write output changes for affected files. Closes #351 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #371
Problem
charter adf populate(bootstrap phase 6) appended every detected stack constraint it did not find tocore.adfCONSTRAINTS, so a bullet the user deleted came back on every bootstrap.Fix (three commits)
71d050b: stack constraints go only into a CONSTRAINTS that is missing or still exactly the template's; any edit leaves it alone, with a
reason.e2e860e (review round 2): populate now remembers what it did, in
.ai/.populate.json:{ "version": 1, "constraints": { "core.adf": { "added": [...], "offered": [...] } } }. The text is normalized, lists are sorted and de-duplicated, the JSON uses a two-space indent and a trailing newline, and the file is written only when it changes (not on a no-op run, not on--dry-run). It is meant to be committed: bootstrap lists it under "Created", and itsgit add .charter .ai ...next step already covers it.added.notAdded(section,why:edited|not-a-list|removed,constraints) on theadf populate --format jsonrow and inbootstrap --format jsonsteps[populate].details.notAdded. It is then recorded asoffered, so later runs stay quiet.--force. The new text: "CONSTRAINTS has been edited, so populate did not add the stack constraint: X. Add it by hand if you want it." The not-a-list branch has the same wording.status: "refused", and nothing is recorded that run.--force(and populate's own--yes) keeps its semantics: it appends any detected constraint not present, and now records it too. It also fills an emptied section, which was skipped silently before. Bootstrap never runs populate in force mode.ADD_SECTIONinadf-text-patch.ts. The re-parse guard is kept: the expected document is built one op at a time with the section moved to the same anchor, and the comparison is still exact. The header is written as⚠️ CONSTRAINTS [load-bearing]:; the parser drops U+FE0F, so the text edit restores it.aa6241d (review round 3):
versionother than 1, or the wrong shape (an arrayconstraints, a non-object entry, a non-list or non-stringadded/offered) means no stack constraints are added for any file that run. CONTEXT/STATE filling is unaffected. The record is never rewritten, and its row reportsstatus: "refused"once per run.adf-populate-record.ts. Entries are kept in aMap, so a__proto__key stays an ordinary key. Keys are normalized to the bare module name (.ai/core.adfis read ascore.adf).--reset-adf(bothadf initandbootstrap, viawriteAdfScaffolds): the record is backed up to.ai/.backup/.populate.json.<stamp>, the entry of each replaced module is dropped, and a line in the run's warnings says so. I chose a backup plus a warning line over adding entries to the loss report. A reset Worker repo gets its rule again.bootstrap.tsis not changed in this round.core.adfrow saysCONTEXT already customized; no stack constraints to addand never suggests--force.status: "recorded", so it is not counted indetails.populated.adf populate.Checked that a dotfile in
.ai/is ignored: tidy, serve, bootstrap and vendor all filter*.adf. doctor's LOC and security walks skip.ai. bundle and migrate read manifest and vendor files only..adf.lock(itself a dotfile there) hashes only core/state. A scratch bootstrap followed bydoctor,adf evidence --auto-measure,adf tidy --dry-run,adf bundle,adf sync --check,adf migrate --dry-runandscoreprinted nothing about it, and the evidence gate passed.Known, left as is (review finding 7): only bullets are compared. Changing just the CONSTRAINTS header's weight (
[advisory]) or removing its decoration does not count as an edit.bootstrap.ts: one added line in
runPopulatePhase(details.notAdded).Tests
adf-populate.test.ts:--force--forcepinned, including the recorded-but-deleted case--dry-run, unreadable record refusedintegration/bootstrap-reset-cli.test.ts(built CLI):--force;Created .ai/.populate.jsonis printeddetails.notAddedappears once, then is empty--yes, and--force --yes__proto__, reset throughadf initandbootstrap, placement through populate, the skip text, the record status and count, and the single "left as is".Docs: CHANGELOG Unreleased/Fixed (2.1.0 history untouched);
docs/cli-reference.mdsections foradf populate(including what.ai/.populate.jsonis and that it should be committed) and bootstrap phase 6.🤖 Generated with Claude Code