test(workspace-context): pin empty rendered changes
This commit is contained in:
@@ -30,9 +30,11 @@ export interface RenderedWorkspaceContext {
|
||||
|
||||
interface RenderedInstructionContext extends RenderedWorkspaceContext {
|
||||
/**
|
||||
* Original files whose file-specific section text survived rendering. This
|
||||
* is not the complement of `omitted`: a truncated file may be represented
|
||||
* here and in `truncated`, while a notice-only file appears in neither.
|
||||
* Original files semantically represented by rendered section text. This is
|
||||
* not the complement of `omitted`: a truncated file may be represented here
|
||||
* and in `truncated`, while a notice-only file appears in neither. A genuinely
|
||||
* empty file counts when its heading survives because that heading conveys
|
||||
* that the instruction exists and has no content.
|
||||
*/
|
||||
represented: LoadedInstructionFile[]
|
||||
}
|
||||
|
||||
@@ -827,6 +827,24 @@ describe('workspace context rendering', () => {
|
||||
expect(rendered.included).toEqual([file])
|
||||
})
|
||||
|
||||
it('represents a genuinely empty instruction through the framed compact-intro path', () => {
|
||||
const file = {
|
||||
absolutePath: '/repo/pkg/AGENTS.md',
|
||||
displayPath: 'pkg/AGENTS.md',
|
||||
content: '',
|
||||
}
|
||||
|
||||
const rendered = renderWorkspaceInstructionSet([file], { maxBytes: 300 })
|
||||
|
||||
expect(rendered.rendered.text).toContain('<system-reminder>')
|
||||
expect(rendered.rendered.text).toContain('Workspace instructions were omitted or truncated')
|
||||
expect(rendered.rendered.text).toContain('Instructions from: pkg/AGENTS.md')
|
||||
expect(rendered.rendered.truncated).toEqual([
|
||||
{ displayPath: 'pkg/AGENTS.md', originalBytes: 0, includedBytes: 0 },
|
||||
])
|
||||
expect(rendered.included).toEqual([file])
|
||||
})
|
||||
|
||||
it('truncates the compact notice itself when the render budget is smaller than the notice', () => {
|
||||
const rendered = renderWorkspaceContext([
|
||||
{ absolutePath: '/repo/pkg/AGENTS.md', displayPath: 'pkg/AGENTS.md', content: 'x'.repeat(1000) },
|
||||
|
||||
Reference in New Issue
Block a user