Skip to content

Interview edges in default schema + tempyr schema upgrade - #56

Merged
cleak merged 3 commits into
masterfrom
feat/schema-interview-edges
Oct 13, 2026
Merged

cleak merged 3 commits into
masterfrom
feat/schema-interview-edges

Conversation

@cleak

@cleak cleak commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Part of the interview-challenge overhaul (S1-R: schema delta + schema upgrade + gitignore coverage).

Summary

Default schema delta (2026-10-interview-edges), additive only, in schema/default-schema.toml:

  • epic: has_risk -> risk, has_question -> open_question
  • decision: has_risk -> risk
  • risk: risk_for -> epic, risk_for -> decision
  • open_question: question_for -> epic

The reverse pairs (has_risk/risk_for, has_question/question_for) already existed in [edge_types]. tempyr init still embeds the file via include_str!. On epic roots, MissingRisk and UnresolvedQuestion gaps can now come up through the existing classify_edge_gap. No tests broke and gap logic is unchanged.

tempyr schema upgrade [--dry-run | --apply] (new crates/tempyr-cli/src/commands/schema_cmd.rs):

  • Deltas are named, versioned entries defined in code (SCHEMA_DELTAS). Each one lists (node_type, edge_type, target) additions and the [edge_types] reverse entries to add if they are missing.
  • Edits go through toml_edit (now a workspace dep; 0.22 is already in the lockfile through toml), so comments and layout are kept. New entries reuse the indentation of the existing allowed_edges array: inline single-line arrays, multi-line arrays and [[...allowed_edges]] arrays-of-tables all work. CRLF files stay CRLF.
  • Additions are keyed on the triple, so ones already present are skipped. Edges are skipped and reported when the node type, target type or edge type is missing from the user's schema.
  • Applied delta names are recorded in .tempyr/config.toml as [schema] applied_deltas = [...] (also through toml_edit). A delta that is already recorded is never applied again, so an edge the user removes stays removed. The embedding and journal config loaders only read their own sections, and a test checks that the rewritten config still loads through JournalConfig.
  • Without --apply the command is a dry run: it lists the additions and writes nothing. --apply writes the files. --json is supported.
  • After upgrading, the schema is re-parsed with Schema and every added edge is checked with validate_edge.
  • tempyr init records every known delta as applied, because the default schema already contains them.

.gitignore coverage: interview archives may contain raw user answers. .tempyr/sessions/ and .tempyr/spar/ are now added to .gitignore by tempyr init and by tempyr schema upgrade --apply, and tempyr doctor warns when either is missing. There are no duplicate entries: equivalent patterns and parent patterns such as /.tempyr/sessions or .tempyr/ count as covered. The .env.local handling in init now uses the same helper (commands/gitignore.rs).

Existing projects get the new edges with tempyr schema upgrade --apply.

Test plan

  • cargo fmt --check
  • cargo clippy --all-targets (no warnings)
  • cargo test (whole workspace)
  • Unit tests (schema_cmd):
    • adds the edges to a pre-delta schema, and the output is byte-identical to the shipped default
    • running twice changes nothing the second time
    • comments and other config sections are preserved
    • a recorded delta is skipped
    • edges already present are not duplicated
    • missing node types are reported
    • array-of-tables layout works
    • CRLF line endings are preserved
    • the init block records every delta
  • Unit tests (gitignore): appends once, adds only uncovered entries, creates the file, recognises equivalent and parent patterns
  • Integration tests:
    • init writes the ignores and the applied_deltas, and schema upgrade then reports up to date
    • dry run lists the changes and writes nothing; doctor warns
    • --apply writes and leaves a valid schema, validate passes, and the doctor warning goes away
    • a recorded delta is not re-applied after the user removes an edge
    • --apply --dry-run is rejected
  • Also tested every schema_cmd and integration test above against a CRLF copy of default-schema.toml

🤖 Generated with Claude Code

cleak and others added 2 commits October 11, 2026 14:49
Default schema delta (2026-10-interview-edges): epics gain has_risk and
has_question, decisions gain has_risk, risks gain risk_for -> epic and
risk_for -> decision, and open questions gain question_for -> epic.

`tempyr schema upgrade` applies named, versioned deltas to an existing
.tempyr/schema.toml via toml_edit so comments and layout are preserved.
Additions are keyed on the (node_type, edge_type, target) triple, edges
whose node types are missing are reported and skipped, and applied delta
names are recorded under [schema] applied_deltas in .tempyr/config.toml
so a delta is never re-applied. Dry run is the default; --apply writes.
`tempyr init` records every delta as already applied.

init, `schema upgrade --apply`, and doctor (as a warning) now keep
.tempyr/sessions/ and .tempyr/spar/ covered by the project .gitignore,
since interview archives may contain raw user answers.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
toml_edit re-renders edited lines with LF, which would mix line endings
in CRLF checkouts (core.autocrlf=true, no .gitattributes). Edit on
LF-normalized text and restore CRLF afterwards; make the test fixtures
line-ending agnostic.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 11 billable files and costs up to $2.75.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 57 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 73 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: e8b3407a-45be-4742-a014-9f877d158188
📥 Commits

Reviewing files that changed from the base of the PR and between 3c8da7a and 81d0075.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • Cargo.toml
  • README.md
  • crates/tempyr-cli/Cargo.toml
  • crates/tempyr-cli/src/commands/doctor.rs
  • crates/tempyr-cli/src/commands/gitignore.rs
  • crates/tempyr-cli/src/commands/init.rs
  • crates/tempyr-cli/src/commands/mod.rs
  • crates/tempyr-cli/src/commands/schema_cmd.rs
  • crates/tempyr-cli/src/main.rs
  • crates/tempyr-cli/tests/integration.rs
  • schema/default-schema.toml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

- `tempyr schema upgrade`: appending to a multi-line `allowed_edges` array
  without a trailing comma put the comma on its own line after the last
  element. The last element's suffix now moves to the array's trailing
  decor (adding a trailing comma for multi-line arrays), a same-line comment
  stays attached to the element it follows, and comment lines inside an
  empty array survive.
- The "Applied." message lists only the files that actually changed; JSON
  output gains `files_written`.
- `.gitignore` coverage asks `git check-ignore --no-index` inside a work
  tree, so nested .gitignore files, info/exclude, global excludes, `**`
  and `!` negations count. The textual check remains the fallback without
  git, and nothing is appended when git already ignores the path.
- `tempyr doctor` skips the archive-ignore warning outside a git repo.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@cleak
cleak merged commit 2f1af3d into master Oct 13, 2026
5 checks passed
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