Bmesh.ops.bevel shuffles edges and removes faces

When using bmesh.ops.bevel on the edges of a face, I would expect that face to still be there, but apparently it gets replaced with a new face?
The original edges still exist, but they’re now part of another face.
Is this a bug, or am I doing something wrong again?

example:

import bpy
import bmesh

bm = bmesh.new()
bmesh.ops.create_grid(bm, x_segments=10, y_segments=10, size=1)
faces = bm.faces[:]
face=faces[0]
edges=face.edges

#beveling edges of a face removes that face and replaces it with a new one?
newFaces=bmesh.ops.bevel(bm, geom=edges, affect='EDGES',segments=4, offset=.01, clamp_overlap=True, vmesh_method='CUTOFF')

#now face is no longer part of bm:
print(face)

#apparently the edges still exist in bm, but translating them shows that they now belong to another face???
verts=[y for x in [e.verts for e in edges] for y in x]
for vert in verts:
	vert.co.z += .1

me = bpy.data.meshes.new("Mesh")
bm.to_mesh(me)
bm.free()
obj = bpy.data.objects.new("Object", me)
bpy.context.collection.objects.link(obj)
bpy.context.view_layer.objects.active = obj
obj.select_set(True)

Yes, bevel rebuilds faces that have new vertices in them. While it might be possible to modify existing faces, that would be harder to do.

But easier to use :frowning:
So there’s no easy way to keep track of faces when using the bevel op?

Sorry, not really. The newly created beveled edges and corners are selected, and therefore the reconstructed faces are all the ones directly adjacent to selected faces; but not possible to figure out which reconstructed face came from which original face, without some detective work (like, they are in the same plane, and maybe some other geometry test). The custom layer data of the reconstructed faces copied from the original faces, so if this use case is essential to what you want to do, you could create a new custom layer and fill it with something unique per face.

ok.

But I still don’t understand why the original edges are still there, only now connected to a different face?

If one creates an edge between two vertices and that edge already exists (and one sets the “no duplicates” flag), the instead of creating a new edge, it returns the existing one. When the new faces are created it makes edges between a cycle of vertices; some of those edges may be the same as existing edges, so will be new ones (because new vertices are creating when beveling).